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.
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.
The name of the parameter is array1, not rw_array1.
There was a problem hiding this comment.
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.
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