Bug report
In PHP, for better or worse, visibility is class-wide, not object-wide. So any object A can access any protected property defined in any of ancestors or the A class on any object B that shares those classes in ancestry, even though the objects might be distinct.
In PHPStan 2.1.7 and earlier, PHPStan did not complain about such property access but 2.1.8 started to find them objectionable.
Code snippet that reproduces the problem
https://phpstan.org/r/f26c18dc-3de1-406a-a779-f446d21a0b08
Expected output
No error.
Did PHPStan help you today? Did it make you happy in any way?
No response
Bug report
In PHP, for better or worse, visibility is class-wide, not object-wide. So any object A can access any protected property defined in any of ancestors or the A class on any object B that shares those classes in ancestry, even though the objects might be distinct.
In PHPStan 2.1.7 and earlier, PHPStan did not complain about such property access but 2.1.8 started to find them objectionable.
Code snippet that reproduces the problem
https://phpstan.org/r/f26c18dc-3de1-406a-a779-f446d21a0b08
Expected output
No error.
Did PHPStan help you today? Did it make you happy in any way?
No response