-
Notifications
You must be signed in to change notification settings - Fork 542
Fix extract signature #3512
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
Fix extract signature #3512
Conversation
Params names are coming from https://www.php.net/manual/en/function.extract.php I added some tests to check Is something more needed for this PR ? @ondrejmirtes |
The param names should be the ones from php7. Reflection takes care of the correct names for 8.x. |
Was the param names different in php 7 ? |
See https://3v4l.org/kMrVd . The current parameter names aren’t exactly those of PHP 7 either… |
Since named parameter is only a PHP 8 feature, isn't it better to use them in stubs ? |
assertVariableCertainty(TrinaryLogic::createYes(), $foo); | ||
assertType('42', $foo); | ||
|
||
$foo = ['foo' => 42]; |
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.
Would make more sense to test this separately in a different function.
Also: please search for |
resources/functionMap.php
Outdated
'array_merge' => ['array', 'arr1'=>'array', '...args='=>'array'], | ||
'array_merge_recursive' => ['array', 'arr1'=>'array', '...args='=>'array'], | ||
'array_multisort' => ['bool', '&rw_array1'=>'array', 'array1_sort_order='=>'array|int', 'array1_sort_flags='=>'array|int', '...args='=>'array|int'], | ||
'array_multisort' => ['bool', 'rw_array1'=>'array', 'array1_sort_order='=>'array|int', 'array1_sort_flags='=>'array|int', '...args='=>'array|int'], |
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.
The name of the parameter is array1
, not rw_array1
.
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 saw many other param with a wrong name, like
- array_pop => rw_stack
- array_push => rw_stack
- array_shift => rw_stack
- array_splice => rw_input
- array_unsplice => rw_stack
- ...
There is at least 63 occurences of &rw_
param which might need to be checked...
Do you want me to open another PR with such param renaming ?
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.
These aren't part of the name when there's &
in front of them. There's an explanation at the top of functionMap.php
Thank you. |
Closes phpstan/phpstan#11759