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
LanguageLevelTypeAware From phpstorm-stubs #7760
Comments
Please false-positive/false-negative this would solve on phpstan.org/try. |
For the above issue it would be, no error on line 10/11 for php 8.2+ We can achieve this also with existing signature mechanics though |
It's already correct here https://github.com/phpstan/php-8-stubs/blob/main/stubs/ext/spl/iterator_to_array.php, it just needs a fix in https://github.com/phpstan/phpstan-src/blob/1.8.x/src/Reflection/SignatureMap/Php8SignatureMapProvider.php I guess. |
Are there any plans to fix this problem? |
If it's tagged as a bug then it is considered to be a bug and will be worked on at some point. |
This is open-source - anyone can contribute a bugfix.
Honestly - if you really want this fixed then it's your job to fix it :) |
Good suggestion, I'll try to make a fix this week |
@staabm After the latest push in 1.11.x, PHPStan now reports different result with your code snippet: @@ @@
+PHP 8.2 (3 errors)
+==========
+
+ 8: Method HelloWorld::sayHello() has parameter $arr with no value type specified in iterable type array.
+ 8: Method HelloWorld::sayHello() has parameter $itOrArr with no value type specified in iterable type array.
+ 8: Method HelloWorld::sayHello() has parameter $itOrArr with no value type specified in iterable type array|Iterator.
+
+PHP 7.1 – 8.1 (5 errors)
+==========
+
8: Method HelloWorld::sayHello() has parameter $arr with no value type specified in iterable type array.
8: Method HelloWorld::sayHello() has parameter $itOrArr with no value type specified in iterable type array.
8: Method HelloWorld::sayHello() has parameter $itOrArr with no value type specified in iterable type array|Iterator.
10: Parameter #1 $iterator of function iterator_to_array expects Traversable, array given.
11: Parameter #1 $iterator of function iterator_to_array expects Traversable, array|Iterator given. Full reportPHP 8.2 (3 errors)
PHP 7.1 – 8.1 (5 errors)
|
Fixed phpstan/phpstan-src#2625 I don't see any other function this would solve a problem for. |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Feature request
Could/should we take
#LanguageLevelTypeAware
from phpstorm stubs into account?see e.g. https://github.com/DmitryTronin/phpstorm-stubs/blob/8bcaf58b0672ab9c3e835159c6944dc9181df94a/SPL/SPL_f.php#L150
The text was updated successfully, but these errors were encountered: