ValidatorConfigurationResolver
API reference › PHPStan › rules › ValidatorConfigurationResolver
Resolves the validator class and options that Validator::createValidator() passes to Yii::createObject()
for a Model::rules() entry using a closure, a qualified class name or one of Yii’s declared built-in aliases.
Assumes the declared alias table has not been changed at runtime. Method names, other unqualified names, qualified
names under an overridden hasMethod() and incomplete or uncertain rules stand aside. Container definitions and the
created class follow CreateObjectConfigurationResolver::resolveTypeOptions().
Methods
Section titled “Methods”| Method | Description | Defined by |
|---|---|---|
__construct() | Initializes static class reflection and the analysis service map. | ValidatorConfigurationResolver |
resolve() | Returns the configuration of the validator that Yii creates for the rule, or null when it isn’t proven. | ValidatorConfigurationResolver |
Method details
Section titled “Method details”__construct()
Section titled “__construct() ”public function __construct(PHPStan\Reflection\ReflectionProvider $reflectionProvider, yii2\extensions\phpstan\ServiceMap $serviceMap)Initializes static class reflection and the analysis service map.
Parameters
| Parameter | Type | Description |
|---|---|---|
$reflectionProvider | PHPStan\ | |
$serviceMap | yii2\ |
resolve()
Section titled “resolve() ”public function resolve(PHPStan\Reflection\ClassReflection $owner, PHPStan\Type\Type $rule, int $line, PHPStan\Analyser\DependencyTracker&PHPStan\Analyser\Scope $scope): yii2\extensions\phpstan\rules\ValidatorConfiguration|nullReturns the configuration of the validator that Yii creates for the rule, or null when it isn’t proven.
Records the declaration and source file dependencies of Validator before reading its declared alias table,
and the dependencies of CreateObjectConfigurationResolver::resolveTypeOptions().
Parameters
| Parameter | Type | Description |
|---|---|---|
$owner | PHPStan\ | Model whose rules() returns the rule. |
$rule | PHPStan\ | Native type of the rule. |
$line | int | Line reported for the rule’s options. |
$scope | PHPStan\ | Current PHPStan analysis scope. |
Returns