Skip to content

Commit 4902e4b

Browse files
committed
Recognize @phpstan-pure-unless-callable-is-impure as a known tag
InvalidPHPStanDocTagRule matches @phpstan-* tags by name against a hardcoded list, so native phpdoc-parser recognition does not exempt them. @phpstan-pure-unless-callable-is-impure was never added to that list and is currently reported as an unknown tag; add it alongside @phpstan-pure-unless-parameter-passed and drop the stale TODO.
1 parent 02f5a45 commit 4902e4b

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

src/Rules/PhpDoc/InvalidPHPStanDocTagRule.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,7 @@ final class InvalidPHPStanDocTagRule implements Rule
6464
'@phpstan-param-immediately-invoked-callable',
6565
'@phpstan-param-later-invoked-callable',
6666
'@phpstan-param-closure-this',
67-
// TODO: drop this once phpstan/phpdoc-parser#259 is merged and the parser
68-
// recognizes the tag natively (like @phpstan-pure-unless-callable-is-impure).
67+
'@phpstan-pure-unless-callable-is-impure',
6968
'@phpstan-pure-unless-parameter-passed',
7069
'@phpstan-all-methods-pure',
7170
'@phpstan-all-methods-impure',

tests/PHPStan/Rules/PhpDoc/data/invalid-phpstan-doc.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,3 +58,12 @@ public function doFoo(): string
5858
}
5959

6060
}
61+
62+
/**
63+
* @param-out int $count
64+
* @phpstan-pure-unless-callable-is-impure $callback
65+
* @phpstan-pure-unless-parameter-passed $count
66+
*/
67+
function withPurityTags(callable $callback, int &$count = 0): void
68+
{
69+
}

0 commit comments

Comments
 (0)