EnvironmentVariableScanner
class EnvironmentVariableScanner
| internal |
Find the environment variables a set of PHP files can read.
The scan is syntactic: it recognizes the framework's environment readers called with a constant name. A read whose name it cannot determine could read any variable, so the whole environment is selected, except inside the readers themselves and the framework methods that build their names from known prefixes.
Constants
| private READER_FUNCTIONS |
The global functions that read the variable named by their first argument. |
| private READER_METHODS |
The Env methods that read the variable named by their first argument. |
| private MODELED_READERS |
The framework methods and functions that read variables by computed names, with the names a boot can read through them. Testbench's defined_environment_variables() copies every variable into a subprocess's environment, which no boot-derived fact depends on. |
Methods
Create a new scanner instance.
Get the variable names and name patterns the files can read.
Get the variable a node reads: its name, '' when the name is not constant, or null when it reads none.
Determine whether a computed name in the given function is accounted for.
Details
at line 91
__construct(Parser $parser, ReflectionProvider $reflectionProvider)
Create a new scanner instance.
at line 110
array
scan(array $files, array $classes)
Get the variable names and name patterns the files can read.
The patterns of the modeled framework readers are included whenever their class was loaded at boot, scanned or not. A '*' pattern selects every variable.
at line 163
string|null
readName(Node $node, string|null $class)
Get the variable a node reads: its name, '' when the name is not constant, or null when it reads none.
at line 209
bool
readsComputedNames(string|null $class, string|null $function)
Determine whether a computed name in the given function is accounted for.
The readers pass their caller's name through, and the modeled framework methods read names their patterns cover.