Update PHPDoc Tags Docs - #14933
Merged
ondrejmirtes merged 1 commit intoJul 7, 2026
Merged
Conversation
- Added a "Conditionally pure functions" section to phpdocs-basics.md - Explains marking a function/method as pure unless the callable passed to the named parameter is impure (mirrors `array_map()` behavior) - Notes the tag is inherited by overriding methods and follows renamed parameters
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Documents the
@pure-unless-callable-is-impurePHPDoc tag, which was not covered anywhere on the website.What was done
I compared the full set of PHPDoc tags PHPStan recognizes (extracted from
PhpDocNodeResolver.phpand thePOSSIBLE_PHPSTAN_TAGSlist inInvalidPHPStanDocTagRule.php) against the existing website documentation. Every base tag was already documented except one:@pure-unless-callable-is-impure(with its@phpstan-prefixed variant) — resolved inPhpDocNodeResolver::resolveParamPureUnlessCallableIsImpure()and consumed inSimpleImpurePoint::resolvePureUnlessCallableIsImpureVerdict().Research
The tag marks a function or method as pure unless the callable passed to the named parameter is impure — the same conditional purity that built-in higher-order functions like
array_map()have. Behavior confirmed from the test data intests/PHPStan/Rules/Pure/data/pure-unless-callable-is-impure.php, which shows:Documentation change
Added a new "Conditionally pure functions" section to
website/src/writing-php-code/phpdocs-basics.md, placed right after the "Impure functions" section. It includes a concise description, amyMap()code example, and a version badge (Available in PHPStan 2.2).All other supported tags were verified to already be documented, so no other changes were made.
🤖 Generated with Claude Code