Skip to content
PHP Ecosystem
Explore

BehaviorsInvalidOptionTypeRule

API reference › PHPStan › rules › BehaviorsInvalidOptionTypeRule

final classyii2\extensions\phpstan\rules\BehaviorsInvalidOptionTypeRule
ImplementsRule
Sourcesrc/rules/BehaviorsInvalidOptionTypeRule.php

Reports option values of behavior configurations returned by Component::behaviors() that the created Behavior never accepts.

BehaviorDefinitionResolver for the configurations the rule reads and those it stands aside on. ObjectOptionAssignment for the assignment semantics. CreateObjectConfigurationResolver::rejectedOptions() for the type coercion semantics.

MethodDescriptionDefined by
__construct()Initializes the rule with class reflection and the analysis configuration.BehaviorsInvalidOptionTypeRule
getNodeType()Returns the node class this rule analyses.BehaviorsInvalidOptionTypeRule
processNode()Returns one error per behavior option whose value the created behavior never accepts.BehaviorsInvalidOptionTypeRule
public function __construct(PHPStan\Reflection\ReflectionProvider $reflectionProvider, yii2\extensions\phpstan\ServiceMap $serviceMap)

Initializes the rule with class reflection and the analysis configuration.

Parameters

ParameterTypeDescription
$reflectionProviderPHPStan\Reflection\ReflectionProviderProvides class reflection for owners and behavior classes.
$serviceMapyii2\extensions\phpstan\ServiceMapService and component map for Yii Application static analysis.
public function getNodeType(): class-string<PhpParser\Node\Stmt\Return_>

Returns the node class this rule analyses.

Returns

class-string<PhpParser\Node\Stmt\Return_>

public function processNode(PhpParser\Node\Stmt\Return_ $node, PHPStan\Analyser\DependencyTracker&PHPStan\Analyser\Scope $scope): list<PHPStan\Rules\IdentifierRuleError>

Returns one error per behavior option whose value the created behavior never accepts.

Parameters

ParameterTypeDescription
$nodePhpParser\Node\Stmt\Return_Return statement to inspect.
$scopePHPStan\Analyser\DependencyTracker&PHPStan\Analyser\ScopeCurrent PHPStan analysis scope.

Returns

list<PHPStan\Rules\IdentifierRuleError>: Errors reported at the option key, else at the list item or the return line.