ConfigSourceResolver
class ConfigSourceResolver
| internal |
Finds what a booted application loads into its configuration besides its own config files: the framework defaults, the package files providers merge, and the keys that providers and bootstrappers write. ConfigParser composes these into config types.
Provider sources are read from their syntax trees and the booted providers' metadata. No provider or configuration code runs.
Traits
Constants
| CONFIG_FILE_PATTERN |
The names of the files a config directory loads, as a directory dependency pattern. |
| private MERGE_METHODS |
Whether each merge method replaces recursively, keyed by lowercase name. |
| private WRITE_METHODS |
The repository methods that write a key, keyed by lowercase name, with the name of the
parameter holding the key. |
| private READ_METHODS |
The repository methods that only read. |
Properties
| protected Container|null | $container | from HasContainer | |
| bool | $returns |
Methods
Create a new resolver instance.
Get the application's config directories, highest priority first.
Get the config directories the booted application loaded, highest priority first.
Get the paths whose contents can change a config key's loaded value, each mapped to whether it is a directory of config files.
Get the paths whose contents can change any loaded config value, each mapped to whether it is a directory of config files: the config directories, the framework's config directory and the package files merged into the configuration.
Determine whether the framework's config files are merged beneath the application's.
Get the named-entry options LoadConfiguration merges for a framework config file.
Get the package config files providers merge, in registration order.
Get the config keys that providers and bootstrappers write.
Determine whether a provider writes config keys that cannot be found statically.
Determine whether the analyzed file is a config file.
Determine whether the file is a package config file: one that a provider merges, or one that a provider publishes into the config directory.
No description
Details
in
HasContainer at line 19
void
setContainer(Container $container)
Set the container used for resolution.
in
HasContainer at line 27
Container
getContainer()
Return the current container.
in
HasContainer at line 35
mixed
resolve(string $abstract)
Resolve the given type from the container.
at line 165
__construct(FileHelper $fileHelper, Parser $parser, ReflectionProvider $reflectionProvider, array $configuredDirectories, string|null $singleReflectionFile = null, string|null $singleReflectionInsteadOfFile = null)
Create a new resolver instance.
The single reflection files are PHPStan's normalized --tmp-file and
--instead-of paths, which are set in editor mode.
at line 187
array
getConfigDirectories()
Get the application's config directories, highest priority first.
Configured directories replace the booted config path. Testbench's workbench config directory overlays the booted path when its config discovery is on.
at line 206
array
getBootedConfigDirectories()
Get the config directories the booted application loaded, highest priority first.
Testbench's workbench config directory overlays the config path when its config discovery is on.
at line 237
array
getKeySources(string $key, array $directories)
Get the paths whose contents can change a config key's loaded value, each mapped to whether it is a directory of config files.
In each config directory, these are the file of every prefix of the key, existing or not, and the directory below the key, whose files make its value a merged one. Then the framework's file for the key and the package files merged into an overlapping key.
at line 271
array
getAllSources(array $directories)
Get the paths whose contents can change any loaded config value, each mapped to whether it is a directory of config files: the config directories, the framework's config directory and the package files merged into the configuration.
at line 291
bool
shouldMergeFrameworkConfiguration()
Determine whether the framework's config files are merged beneath the application's.
at line 301
array
getMergeableOptions(string $name)
Get the named-entry options LoadConfiguration merges for a framework config file.
at line 316
array
getMerges()
Get the package config files providers merge, in registration order.
A merge is definite when every boot runs it; other merges may or may not run. The options are the provider's named-entry options for the key.
at line 326
array
getWrittenKeys()
Get the config keys that providers and bootstrappers write.
at line 334
bool
hasUnknownWrites()
Determine whether a provider writes config keys that cannot be found statically.
at line 347
bool
isConfigFile(string $file)
Determine whether the analyzed file is a config file.
Besides the application's config directories, the framework's config and config:publish stub directories and package config files are config files: those providers merge, and those they publish into the config directory. In editor mode PHPStan analyzes a temporary file, which stands in for the edited one.
at line 375
bool
isPackageConfigFile(string $path)
Determine whether the file is a package config file: one that a provider merges, or one that a provider publishes into the config directory.
at line 1073
int|null
enterNode(Node $node)
No description