phpstan-src
phpstan-src copied to clipboard
apply parameter closure type extension in FunctionCallParametersCheck
Fixes https://phpstan.org/r/8ff9bc8f-4162-4ccf-bf5c-8b3d2061e68d Partially fixes: https://github.com/phpstan/phpstan/issues/10396 Related to https://github.com/phpstan/phpstan-src/pull/3282#issuecomment-2306883685
I thought about this. I thought I wanted a different solution using virtual nodes but it'd need a lot of refactoring. And maybe it'd still be very hard.
For similar reasons I already added $scope->pushInFunctionCall() in the same Check class.
So feel free to pursue the same direction you started 😊
This pull request has been marked as ready for review.
I've looked at this and here are my thoughts: I don't like that FunctionCallParametersCheck::check() gains full reflection as another parameter. This isn't how I would design this. There are enough things already passed from reflection that this change really feels like it's bolted on to achieve a single goal.
Since the goal is to basically change $parameter from already passed $parametersAcceptor, I feel like we should modify $parametersAcceptor before it's passed to the check() method.
So the rules that call FunctionCallParametersCheck should modify ParametersAcceptor before it's passed there.
Alright, I see this is just an alternative to https://github.com/phpstan/phpstan-src/pull/3282. I will merge that instead. Thank you.