Skip to content
PHP Ecosystem
Explore

ApplicationClassResolver

API reference › PHPStan › reflection › ApplicationClassResolver

final classyii2\extensions\phpstan\reflection\ApplicationClassResolver
Sourcesrc/reflection/ApplicationClassResolver.php

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.

MethodDescriptionDefined by
resolve() staticReturns the class reflection of the configured application type.ApplicationClassResolver
public static function resolve(string $applicationType, PHPStan\Reflection\ReflectionProvider $reflectionProvider): PHPStan\Reflection\ClassReflection|null

Returns the class reflection of the configured application type.

Parameters

ParameterTypeDescription
$applicationTypestringApplication type returned by ServiceMap, with or without a leading backslash.
$reflectionProviderPHPStan\Reflection\ReflectionProviderReflection 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