Bug report
Starting with phpstan 2.1.38, the code snippet example now no longer reports any errors, when it did in <=2.1.37.
Code snippet that reproduces the problem
https://phpstan.org/r/ecea6359-1973-4a20-a1cf-4d1b6c1c1f30
Expected output
1/1 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%
------ ----------------------------------------------------------------------------------------------------------------------------------------------------------
Line Foo.php
------ ----------------------------------------------------------------------------------------------------------------------------------------------------------
34 Parameter #1 $data of class Foo\Foo constructor expects array{foo: int, bar: int}, array{foo: 1} given.
🪪 argument.type
💡 Array does not have offset 'bar'.
------ ----------------------------------------------------------------------------------------------------------------------------------------------------------
[ERROR] Found 1 error
Did PHPStan help you today? Did it make you happy in any way?
It takes away a lot of my stress having more confidence in the correctness of the code, without trying it :)
It actually is great that phpstan also complains when there are no errors to ignore, since we caught this bug because we suddenly got that warning in our tests, which somtimes construct classes, like the one in the example, without all required fields on purpose.
Bug report
Starting with phpstan 2.1.38, the code snippet example now no longer reports any errors, when it did in <=2.1.37.
Code snippet that reproduces the problem
https://phpstan.org/r/ecea6359-1973-4a20-a1cf-4d1b6c1c1f30
Expected output
Did PHPStan help you today? Did it make you happy in any way?
It takes away a lot of my stress having more confidence in the correctness of the code, without trying it :)
It actually is great that phpstan also complains when there are no errors to ignore, since we caught this bug because we suddenly got that warning in our tests, which somtimes construct classes, like the one in the example, without all required fields on purpose.