ApplicationClassResolver
API reference › PHPStan › reflection › ApplicationClassResolver
Validates the configured application type against PHPStan reflection and resolves its class reflection.
The application type is validated where the analysis consumes it, not when the configuration is loaded: PHPStan
executes the configuration before parameters.bootstrapFiles, and only its reflection also discovers classes from
analysed paths and scanned files. A class PHPStan reflection can’t discover, an interface, a trait, an enum, or a class
not extending Application is rejected; Application itself and every subclass are accepted.
Project stub validation reflects stub files only, where Application is usually unknown and the application
hierarchy can’t be established. When Application can’t be reflected, the class is returned unvalidated if it
can be reflected, or null otherwise, as before validation existed.
Methods
Section titled “Methods”| Method | Description | Defined by |
|---|---|---|
resolve() static | Returns the class reflection of the configured application type. | ApplicationClassResolver |
Method details
Section titled “Method details”resolve()
Section titled “resolve() ”public static function resolve(string $applicationType, PHPStan\Reflection\ReflectionProvider $reflectionProvider): PHPStan\Reflection\ClassReflection|nullReturns the class reflection of the configured application type.
Parameters
| Parameter | Type | Description |
|---|---|---|
$applicationType | string | Application type returned by ServiceMap, with or without a leading backslash. |
$reflectionProvider | PHPStan\ | Reflection provider of the running analysis. |
Returns
PHPStan\Reflection\ClassReflection|null: Class reflection of the application type, or null if neither Application nor the application type can be reflected.
Throws
RuntimeException: ifApplicationcan be reflected and the application type doesn’t name it or a class extending it.