ExternalActionUnknownOptionRule
API reference › PHPStan › rules › ExternalActionUnknownOptionRule
Reports options of external action definitions returned by Controller::actions() that Yii can’t assign to the
created action.
on ... and as ... options are never reported, and other options only when no behavior can receive them.
ExternalActionConfigurationResolver for the definitions the rule analyses.
ObjectOptionAssignment for the assignment semantics.
Methods
Section titled “Methods”| Method | Description | Defined by |
|---|---|---|
__construct() | Initializes the rule with class reflection and the analysis configuration. | ExternalActionUnknownOptionRule |
getNodeType() | Returns the node class this rule analyses. | ExternalActionUnknownOptionRule |
processNode() | Returns one error per distinct option that the created action can’t assign. | ExternalActionUnknownOptionRule |
Method details
Section titled “Method details”__construct()
Section titled “__construct() ”public function __construct(PHPStan\Reflection\ReflectionProvider $reflectionProvider, yii2\extensions\phpstan\ServiceMap $serviceMap)Initializes the rule with class reflection and the analysis configuration.
Parameters
| Parameter | Type | Description |
|---|---|---|
$reflectionProvider | PHPStan\ | Provides class reflection for the created actions. |
$serviceMap | yii2\ | Service and component map for Yii Application static analysis. |
getNodeType()
Section titled “getNodeType() ”public function getNodeType(): class-string<PhpParser\Node\Stmt\Return_>Returns the node class this rule analyses.
Returns
class-string<PhpParser\Node\Stmt\Return_>
processNode()
Section titled “processNode() ”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 that the created action can’t assign.
Parameters
| Parameter | Type | Description |
|---|---|---|
$node | PhpParser\ | Return statement to inspect. |
$scope | PHPStan\ | Current 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.