Skip to content

Fix 13296 #4184

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 28, 2025
Merged

Fix 13296 #4184

merged 2 commits into from
Jul 28, 2025

Conversation

VincentLanglet
Copy link
Contributor

@VincentLanglet VincentLanglet commented Jul 28, 2025

@VincentLanglet VincentLanglet changed the title Try to fix 13296 Fix 13296 Jul 28, 2025
} elseif (
$node->name instanceof FuncCall
&& $node->name->name instanceof Name
&& $node->name->isFirstClassCallable()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like the purpose of this if was to resolve node like
strtoupper(...)($foo)
which is resolved to strtoupper($foo)
but it messed up with foo($bar)($baz)
which was resolved to foo($baz).

*/
public function test($a, $b)
{
assertType('string', current($a)($b));
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without the fix, the type is understood as current($b) which is int.

@VincentLanglet VincentLanglet marked this pull request as ready for review July 28, 2025 18:06
@phpstan-bot
Copy link
Collaborator

This pull request has been marked as ready for review.

@AJenbo
Copy link
Contributor

AJenbo commented Jul 28, 2025

Thanks

@ondrejmirtes
Copy link
Member

Please use more descriptive PR titles than "Fix 13296" next time.

@ondrejmirtes ondrejmirtes merged commit 6b33ea1 into phpstan:2.1.x Jul 28, 2025
414 of 420 checks passed
@ondrejmirtes
Copy link
Member

Thank you!

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.1.18 __invoke return type not recognized depending on how the class is resolved
4 participants