Skip to content
PHP Ecosystem
Explore

ExternalActionInvalidOptionTypeRule

API reference › PHPStan › rules › ExternalActionInvalidOptionTypeRule

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

Reports option values of external action definitions returned by Controller::actions() that the property or setter Yii assigns them to never accepts, even with PHP’s weak type coercion.

ExternalActionConfigurationResolver for the definitions the rule analyses. CreateObjectConfigurationResolver::rejectedOptions() for the type semantics.

MethodDescriptionDefined by
__construct()Initializes the rule with class reflection and the analysis configuration.ExternalActionInvalidOptionTypeRule
getNodeType()Returns the node class this rule analyses.ExternalActionInvalidOptionTypeRule
processNode()Returns one error per distinct option whose value the created action never accepts.ExternalActionInvalidOptionTypeRule
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 the created actions.
$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 distinct option whose value the created action 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 first key of each option, else at the definition line, else at the return line.