-
Notifications
You must be signed in to change notification settings - Fork 515
Improve return type of array map #4068
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
base: 2.1.x
Are you sure you want to change the base?
Conversation
2e49201
to
1e133b3
Compare
This pull request has been marked as ready for review. |
src/Analyser/MutatingScope.php
Outdated
$node->name instanceof FuncCall | ||
&& $node->name->isFirstClassCallable() | ||
&& $node->name->getAttribute('phpstan_cache_printer') !== null | ||
&& preg_match('/\A(?<name>\\\\?[^()]+)\(...\)\z/', $node->name->getAttribute('phpstan_cache_printer'), $m) === 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why the original code with:
return ParametersAcceptorSelector::selectFromArgs(
$this,
$node->getArgs(),
$calledOnType->getCallableParametersAcceptors($this),
null,
)->getReturnType();
does not work here? That should be addressed instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I took the code from the previous PR but it might be improved indeed so I re-tried.
I tried to simplify/rewrite the code in order to show what was missing in the original code.
Now it should be more clear with https://github.com/phpstan/phpstan-src/pull/4068/files
There is nothing wrong with
ParametersAcceptorSelector::selectFromArgs(
$this,
$node->getArgs(),
$calledOnType->getCallableParametersAcceptors($this),
null,
)
but the issue was the early getReturnType
and the fact the DynamicReturnTypeExtension was not used in this case.
Is it better ?
fbbcdeb
to
218705b
Compare
218705b
to
1721508
Compare
1721508
to
0852680
Compare
From #3156
Closes phpstan/phpstan#11180
Closes #3156