You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+10-12Lines changed: 10 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,21 +1,21 @@
1
-
# Namespace helper - use Namespace\Keywords;
2
-
3
-
This package can parse PHP scripts to extract the names of PHPs internal Classes, Functions and Constants used within a Class. The parsed Names can then be used to define `use Namespace\Keywords;` in namespaced Classes.
This package can parse PHP scripts to extract the names of Classes, Functions and Constants used within the script. The parsed names will then be used to generate a list of `use Namespace;` statements for the parsed script. It can parse any script, but only namespaced Classes allows the use of the generated statements.
5
4
6
5
__VSCode Screenshot__
7
6
8
7
It's pretty hard to talk about this Topic, because it's just called "Namespace" ...
9
8
10
9

11
10
12
-
The `use`keyword can be used within Classes to tell PHP, which Classes, Functions and Constants to use internally for Functions used in your Class. It also can boost your scripts by pointing PHP to the right Namespace to use. For example, if you call `json_encode()` within a Class, PHP searches in the calling Class for a Function with the name `json_encode()` first, before searching it in the global Namespace (if at all). You can speed up the process with a Backslash before the function name, like: `\json_encode()`, but IDK, it looks awful. An alternate is to define any used Function, Class and Constant at the very top of your Class with the 'use'-keyword. And that's for what this Package is meant to be.
11
+
The `use`statement can be used in Classes to tell PHP, which Function to use internally for Functions used in the Class. It also can boost scripts by pointing PHP to the right Namespace to use. For example, if you call `json_encode()` within a Class, PHP searches in the calling Class for a Function with the name `json_encode()`, before searching it in the global Namespace (if at all). You can speed up the process with a Backslash before the function name, like: `\json_encode()`, but it looks awful. An alternate is to define any used Function, Class and Constant at the very top of the Class with the 'use' statement. This Package is made to simplify the process.
13
12
14
-
The `use`keyword also allows you to Alias and change your scripts quick and easy.
13
+
The `use`statement also allows quick Aliasing of Functions in namespaced Classes.
0 commit comments