Skip to content

Allow forwarding a @pure-unless-callable-is-impure callback - #6224

Open
zonuexe wants to merge 2 commits into
phpstan:2.2.xfrom
zonuexe:forward-pure-unless-callable-callback
Open

Allow forwarding a @pure-unless-callable-is-impure callback#6224
zonuexe wants to merge 2 commits into
phpstan:2.2.xfrom
zonuexe:forward-pure-unless-callable-callback

Conversation

@zonuexe

@zonuexe zonuexe commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Fixes phpstan/phpstan#15075

A @pure-unless-callable-is-impure function is pure as long as its flagged callback is pure. Forwarding that callback to another @pure-unless-callable-is-impure function was still reported as impure; such forwarded calls are now exempted.

A @pure-unless-callable-is-impure function is pure as long as its flagged
callback is pure. Forwarding that callback to another
@pure-unless-callable-is-impure function was still reported as impure; such
forwarded calls are now exempted.
Reading the per-parameter TrinaryLogic flag was an equivalent mutation
here: a Maybe flag only comes from combining several acceptors, which
cannot happen for the resolved function of a plain function call. Use the
function-level map with array_key_exists instead, like the check above.
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.

Calling a @pure-unless-callable-is-impure from @pure-unless-callable-is-impure context

1 participant