You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 2aa8657
Browse filesBrowse the repository at this point in the historyBrowse files
Re-price a stored closure result when it is asked about under a different pushInFunctionCall() callable parameter
- ExpressionResult::askScopeVariableStateMatches() used to treat a stored
closure/arrow function result as matching any asking scope, so
Scope::getType() returned the walk-time closure type even when an extension
had pushed its own callable parameter with pushInFunctionCall(). Untyped
closure parameters then stayed `mixed` (phpstan-laravel's keyBy/groupBy
typing, a regression from 2.2.x).
- New ClosureCallContextMatcher::matches() decides whether the call context of
the ask differs. The walk result is kept for identical stacks, for a
shallower stack (the call site), for a parameter of equal type, and for the
callee's own parameter that still references the callee's templates (the
acceptor-selection and argument-check asks in ParametersAcceptorSelector and
FunctionCallParametersCheck). Any other parameter at the same depth sends the
ask on to ClosureTypeResolver::getClosureType(). Comparing the stacks alone,
as the issue suggested, also re-priced PHPStan's own asks and changed
generic inference (array_reduce, Ds\Pair mappers, ...).
- turbo-ext: the ExpressionResult mirror answers identical stacks natively and
calls the PHP helper otherwise (new class ref `closureCallContextMatcher`).
- Tests cover functions, instance methods, closures and arrow functions,
closures nested in an array argument, and a callable parameter typed with a
class template.
0 commit comments