RuntimeInputs
class RuntimeInputs
| internal |
The inputs the booted application was built from, declared as one dependency by everything that reads the booted application.
Bindings, macros, drivers, commands and registrations come from code the boot ran, which no analyzed file references, so the files the boot loaded and the environment variables it can read are tracked instead. A Testbench package boots from a disposable runtime copy, so copied paths are tracked through their skeleton source.
Properties
| static protected Application|null | $application | The application the analyzer booted. |
|
| static protected list<string> | $includedFiles | The files loaded once the application had booted. |
|
| static protected array<string, true> | $classes | The lowercased names of the classes, interfaces and traits loaded once the application had booted. |
|
| static protected array<string, true> | $classFiles | The files declaring the classes, interfaces and traits loaded once the application had booted. |
|
| static protected string|null | $environmentFile | The environment file an application boot selects from, or null for a Testbench package, whose application loads no environment file. |
|
| static protected bool | $packageApplication | Whether the analyzer booted a Testbench application for a package rather than an application's own. |
Methods
Create a new runtime inputs instance.
Capture what the boot loaded.
Determine whether the analyzer booted a Testbench application for a package.
Declare that the analysis of the current file, or what a class declares, depends on the booted application.
Declare that the dependent depends on what a class the booted application selected declares.
Declare that the dependent depends on the declarations and code of a class the booted application selected and the analysis runs.
Declare that the dependent depends on which views exist.
Declare that the analysis of the current file depends on the names and contents of the files in directories, as the view finder and translation loader read them.
Get the path to track for a file the analysis reads.
Get the directory to track for files in it the analysis reads, as sourcePath() does for a file.
Details
at line 139
__construct(ReflectionProvider $reflectionProvider, DeclarationDependencyTracker $declarationDependencyTracker, EnvironmentVariableScanner $environmentVariableScanner, ConfigSourceResolver $configSourceResolver, RuntimeInputsResultCacheValueExtension $valueExtension, string $tmpDir)
Create a new runtime inputs instance.
at line 156
static void
captureBoot(Application $app, string|null $environmentFile, bool $packageApplication)
Capture what the boot loaded.
Called by the analyzer's bootstrap file once the application has booted, before analysis loads anything else.
at line 176
bool
isPackageApplication()
Determine whether the analyzer booted a Testbench application for a package.
at line 186
void
track(Scope|ClassReflection $dependent)
Declare that the analysis of the current file, or what a class declares, depends on the booted application.
at line 203
void
trackClass(Scope|ClassReflection $dependent, string $className)
Declare that the dependent depends on what a class the booted application selected declares.
Resolving a binding can load its class after boot, outside the runtime inputs, and a declared type is read without loading its class at all.
at line 221
void
trackSources(Scope|ClassReflection $dependent, string $className, string|null $baseClass)
Declare that the dependent depends on the declarations and code of a class the booted application selected and the analysis runs.
Method bodies and property defaults are not declarations, so the files declaring the class and its parents below the base class, or all of them without one, with their traits and the constants their defaults read, are tracked too.
at line 247
void
trackViews(Scope|ClassReflection $dependent)
Declare that the dependent depends on which views exist.
Only the names of the files in the booted finder's directories matter, so editing a template does not invalidate it. The finder's directories come from the boot.
at line 268
void
trackLinkedDirectories(Scope $scope, array $directories, string $pattern = '*')
Declare that the analysis of the current file depends on the names and contents of the files in directories, as the view finder and translation loader read them.
Both find files through symlinked directories, which PHPStan's directory dependency does not enter.
at line 292
string
sourcePath(string $path)
Get the path to track for a file the analysis reads.
A file in the runtime copy is tracked through its skeleton source while the two are identical. A file the copy changed or added has no known source and keeps its runtime path, which disappears with the copy, so it is analyzed again on every run.
at line 300
string
sourceDirectory(string $directory, string $pattern = '*')
Get the directory to track for files in it the analysis reads, as sourcePath() does for a file.