ValidatorIncompleteRuleRule
API reference › PHPStan › rules › ValidatorIncompleteRuleRule
Reports validation rules returned by Model::rules() that Model::createValidators() rejects because the
rule has no non-null attribute names at key 0 or validator type at key 1.
Only rules() returns of non-anonymous Model subclasses that inherit createValidators() and
getValidators() from Model are analysed. Each rule must be one constant array that native types prove; rules
whose key 0 or 1 may be null, unions, dynamic lists, Validator instances and non-array
rules stand aside.
Methods
Section titled “Methods”| Method | Description | Defined by |
|---|---|---|
getNodeType() | Returns the node class this rule analyses. | ValidatorIncompleteRuleRule |
processNode() | Returns one error per returned rule that lacks a non-null key 0 or 1. | ValidatorIncompleteRuleRule |
Method details
Section titled “Method details”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 returned rule that lacks a non-null key 0 or 1.
Records the declaration dependency of the owner, also when its overrides make the rule stand aside.
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 list item, else at the return line.