EnvironmentSnapshot
class EnvironmentSnapshot
| internal |
The environment variables as the process received them, before the application boots.
Booting loads the environment file into $_SERVER, $_ENV and putenv(). PHPStan compares cached values in the main process before anything boots, and records new ones in workers after they boot, so both must read the variables as they were before booting.
Properties
| static protected null|array{server: array<array-key, mixed>, env: array<array-key, mixed>, process: array<string, string>} | $captured | The variables captured before boot, as each default environment adapter reads them. |
Methods
Capture the variables before the application boots.
Get the value of a variable as the environment repository reads it, or null when it is not set.
Get a digest of the named variables and of every variable matching one of the patterns.
Flush all static state.
Get the captured variables, or the current ones before anything has booted.
Read a variable from a superglobal as dotenv's constant adapters do.
Details
at line 40
static void
capture()
Capture the variables before the application boots.
at line 48
static string|null
get(string $name)
Get the value of a variable as the environment repository reads it, or null when it is not set.
at line 65
static string
digest(array $names, array $patterns)
Get a digest of the named variables and of every variable matching one of the patterns.
Each variable is digested as each default adapter reads it (ServerConstAdapter, EnvConstAdapter, PutenvAdapter), keeping an unset variable distinct from an empty one, so the digest changes whichever adapters the application enables.
at line 112
static void
flushState()
Flush all static state.
at line 122
static protected array
variables()
Get the captured variables, or the current ones before anything has booted.
at line 136
static protected string|null
scalar(array $variables, string $name)
Read a variable from a superglobal as dotenv's constant adapters do.