Skip to content

Update Error Docs#14934

Merged
ondrejmirtes merged 1 commit into
phpstan:2.2.xfrom
phpstan-bot:create-pull-request/patch-stp9kqr
Jul 7, 2026
Merged

Update Error Docs#14934
ondrejmirtes merged 1 commit into
phpstan:2.2.xfrom
phpstan-bot:create-pull-request/patch-stp9kqr

Conversation

@phpstan-bot

Copy link
Copy Markdown
Contributor

The latest website/src/errorsIdentifiers.json update introduced three new error identifiers, all related to the @pure-unless-callable-is-impure PHPDoc tag. This PR documents them.

New documentation pages

  • pureFunction.redundantUnlessCallable — a function is marked @pure-unless-callable-is-impure for a parameter, but that parameter is already typed as a pure-callable, so the tag has no effect and @phpstan-pure should be used instead.
  • pureMethod.redundantUnlessCallable — the same situation for a method.
  • method.impureOverridePureUnlessCallable — an @phpstan-impure method overrides a parent method marked @pure-unless-callable-is-impure, breaking the inherited conditional-purity contract.

Each page includes a minimal code example derived from the phpstan-src test fixtures (FunctionPurityCheck and MethodSignatureRule), an explanation of the @pure-unless-callable-is-impure semantics, and fixes covering both correcting the annotation and adjusting the parameter/purity contract.

- Added `pureFunction.redundantUnlessCallable` and `pureMethod.redundantUnlessCallable`
  for functions/methods marked @pure-unless-callable-is-impure on a parameter that is
  already typed as a pure callable, where @phpstan-pure should be used instead.
- Added `method.impureOverridePureUnlessCallable` for impure methods overriding a parent
  method marked @pure-unless-callable-is-impure.
@ondrejmirtes
ondrejmirtes merged commit e93e3e6 into phpstan:2.2.x Jul 7, 2026
11 checks passed
@ondrejmirtes
ondrejmirtes deleted the create-pull-request/patch-stp9kqr branch July 7, 2026 16:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants