phpstan-src icon indicating copy to clipboard operation
phpstan-src copied to clipboard

Fix extract signature

Open VincentLanglet opened this issue 1 year ago • 3 comments

Closes https://github.com/phpstan/phpstan/issues/11759

VincentLanglet avatar Sep 28 '24 06:09 VincentLanglet

Params names are coming from https://www.php.net/manual/en/function.extract.php They are also here: https://github.com/php/php-src/blob/7e45e57d8f85f8d1fa2521028f394da30268187d/ext/standard/basic_functions.stub.php#L1643-L1644

I added some tests to check & does not break the extract inference.

Is something more needed for this PR ? @ondrejmirtes

VincentLanglet avatar Oct 12 '24 15:10 VincentLanglet

The param names should be the ones from php7. Reflection takes care of the correct names for 8.x.

thg2k avatar Oct 12 '24 21:10 thg2k

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 ?

VincentLanglet avatar Oct 13 '24 15:10 VincentLanglet

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…

claudepache avatar Nov 12 '24 23:11 claudepache

Since named parameter is only a PHP 8 feature, isn't it better to use them in stubs ? I'm not sure what's the best for PHPStan

VincentLanglet avatar Nov 12 '24 23:11 VincentLanglet

Also: please search for @prefer-ref in vendor/phpstan/php-8-stubs and update all the functions you find too.

ondrejmirtes avatar Nov 13 '24 12:11 ondrejmirtes

Would make more sense to test this separately in a different function.

Done in https://github.com/phpstan/phpstan-src/pull/3512/commits/f9fa213fc39e2b9b4f9817dba28e030fa51cfb5c

Also: please search for @prefer-ref in vendor/phpstan/php-8-stubs and update all the functions you find too.

Done in https://github.com/phpstan/phpstan-src/pull/3512/commits/b5e5de50331a0e6eb8f7af1440d04bba619d9232 if I understood correctly

VincentLanglet avatar Nov 13 '24 12:11 VincentLanglet

Thank you.

ondrejmirtes avatar Nov 13 '24 13:11 ondrejmirtes