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
When a method's return type is covariant with its grandparent class but not its parent class, PHPStan doesn't detect this problem even though it triggers a fatal error in PHP at runtime.
@@ @@-No errors+PHP 7.4 – 8.2 (1 error)+==========++19: Return type mixed of method three::foo() is not covariant with return type array of method two::foo().++PHP 7.1 – 7.3 (1 error)+==========++19: Return type mixed of method three::foo() is not compatible with return type array of method two::foo().
Full report
PHP 7.4 – 8.2 (1 error)
Line
Error
19
Return type mixed of method three::foo() is not covariant with return type array of method two::foo().
PHP 7.1 – 7.3 (1 error)
Line
Error
19
Return type mixed of method three::foo() is not compatible with return type array of method two::foo().
Bug report
When a method's return type is covariant with its grandparent class but not its parent class, PHPStan doesn't detect this problem even though it triggers a fatal error in PHP at runtime.
Code snippet that reproduces the problem
Expected output
I expect this to trigger an error
Did PHPStan help you today? Did it make you happy in any way?
The levels system in PHPStan is a great feature, it's allowing me to gradually refactor a large project level by level. Cheers!
The text was updated successfully, but these errors were encountered: