You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since upgrading from 1.8.2 to 1.8.5, I've got the following inspection coming up in a test :
Call to static method PHPUnit\Framework\Assert::assertSame() with array{2, 4} and array{1, 2, 3, 4, 5} will always evaluate to false.
I've reproduced it below in the playground without PHPUnit in the mix. It seems like the modulo is too hard for PHPStan to deal with, as replacing the condition by 2 === $value || 4 === $value returns the proper type.
Did PHPStan help you today? Did it make you happy in any way?
❤️ ❤️ ❤️ ❤️ ❤️ ❤️ ❤️ ❤️ ❤️ ❤️ ❤️
The text was updated successfully, but these errors were encountered:
gnutix
changed the title
[>=1.8.3] array_filter does not reduce an array shape's values
[>=1.8.3] array_filter does not reduce an array shape's values with a modulo condition
Sep 12, 2022
gnutix
changed the title
[>=1.8.3] array_filter does not reduce an array shape's values with a modulo condition
[>=1.8.3] array_filter and modulo do not work well together (does not restrict the array's values)
Sep 12, 2022
Bug report
Since upgrading from 1.8.2 to 1.8.5, I've got the following inspection coming up in a test :
I've reproduced it below in the playground without PHPUnit in the mix. It seems like the modulo is too hard for PHPStan to deal with, as replacing the condition by
2 === $value || 4 === $value
returns the proper type.Code snippet that reproduces the problem
https://phpstan.org/r/1c5d7559-1568-4b26-a45b-f56317935ad2
Expected output
The output should be
array{1: 2, 3: 4}
.Did PHPStan help you today? Did it make you happy in any way?
❤️ ❤️ ❤️ ❤️ ❤️ ❤️ ❤️ ❤️ ❤️ ❤️ ❤️
The text was updated successfully, but these errors were encountered: