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
False positive with when using in_array with literals (or constants) #5496
Comments
let me share my current observations: phpstan runs into this this effectively means the way to solve this issue is to make sure we actually |
@faizanakram99 After the latest commit in dev-master, PHPStan now reports different result with your code snippet: @@ @@
-18: Call to function in_array() with arguments 'auto', array<string, 'auto'|'copy'> and true will always evaluate to true.
+-1: Internal error: PHPStan\Rules\Methods\WrongCaseOfInheritedMethodRule::findMethod(): Argument #2 ($classReflection) must be of type PHPStan\Reflection\ClassReflection, null given, called in /var/task/vendor/phpstan/phpstan-strict-rules/src/Rules/Methods/WrongCaseOfInheritedMethodRule.php on line 40
+Run PHPStan with --debug option and post the stack trace to:
+https://github.com/phpstan/phpstan/issues/new?template=Bug_report.md Full report
|
@faizanakram99 After the latest commit in dev-master, PHPStan now reports different result with your code snippet: @@ @@
-18: Call to function in_array() with arguments 'auto', array<string, 'auto'|'copy'> and true will always evaluate to true.
+No errors |
Fixed: phpstan/phpstan-src@4321374 |
Closes phpstan/phpstan#5759 Closes phpstan/phpstan#5668 Closes phpstan/phpstan#5496 Closes phpstan/phpstan#4666 Closes phpstan/phpstan#3892 Closes phpstan/phpstan#3314 Closes phpstan/phpstan#2870 Closes phpstan/phpstan#5354
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. |
Bug report
latest version (reproduced at phpstan.org)
See line 22 of attached snippet, the
array
is missing'auto'
value yet phpstan reports that\in_array('auto', $propagation, true)
will always return true (at line 18)Code snippet that reproduces the problem
https://phpstan.org/r/00e38865-bbc2-4373-8655-e2f1a3c6c14a
Expected output
No errors
Did PHPStan help you today? Did it make you happy in any way?
Indeed. Thanks for the great tool.
The text was updated successfully, but these errors were encountered: