Skip to content
PHP Ecosystem
Explore

CreateObjectBehaviorUnknownOptionRule

API reference › PHPStan › rules › CreateObjectBehaviorUnknownOptionRule

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

Reports options of behavior configurations in the as options of BaseYii::createObject() configurations that the created Behavior can’t assign.

BehaviorDefinitionResolver for the configurations the rule reads and those it stands aside on. ObjectOptionAssignment for the assignment semantics.

MethodDescriptionDefined by
__construct()Initializes the rule with class reflection and the analysis configuration.CreateObjectBehaviorUnknownOptionRule
getNodeType()Returns the node class this rule analyses.CreateObjectBehaviorUnknownOptionRule
processNode()Returns one error per behavior option that Yii can’t assign.CreateObjectBehaviorUnknownOptionRule
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\Expr\StaticCall>

Returns the node class this rule analyses.

Returns

class-string<PhpParser\Node\Expr\StaticCall>

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

Returns one error per behavior option that Yii can’t assign.

Parameters

ParameterTypeDescription
$nodePhpParser\Node\Expr\StaticCallStatic call 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 as option or the call line.