Skip to content

Commit

Permalink
Add error message for missing docblock
Browse files Browse the repository at this point in the history
  • Loading branch information
Khadreal committed Nov 22, 2024
1 parent a7bfc41 commit 3ac6b68
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,19 @@ public function processNode(Node $node, Scope $scope): array
$this->currentScope = $scope;
$this->errors = [];

if (! ($node->name instanceof Name)) {
return [];
}

if (! in_array($node->name->toString(), self::SUPPORTED_FUNCTIONS, true)) {
if (! ($node->name instanceof Name)

Check failure on line 61 in tests/phpstan/Rules/ApplyFiltersTypedDynamicFunctionReturnTypeExtension.php

View workflow job for this annotation

GitHub Actions / WPRocket lint with PHP Stan. PHP 8.2 on ubuntu-latest.

Access to an undefined property PhpParser\Node::$name.
|| ! in_array($node->name->toString(), self::SUPPORTED_FUNCTIONS, true)
) {
return [];
}

$resolvedPhpDoc = $this->hookDocBlock->getNullableHookDocBlock($node, $scope);

if ($resolvedPhpDoc === null) {
$this->errors[] = RuleErrorBuilder::message(
'Missing docblock for wpm_apply_filters_typed call.'
)->identifier('docblock.missing')->build();

return [];
}

Expand Down

0 comments on commit 3ac6b68

Please sign in to comment.