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
The dumped type should be a union of Block and *ERROR*. It may be an stdClass or it may not be iterable at all.
In addition, an error should be reported on line 18, because neither *ERROR* nor Block has a method called getPos() (definite crash).
Additional notes
I consider this a serious problem because it's an obvious bug that otherwise won't get detected until reaching level 8. This means that reaching level 6 provides a false sense of security while missing problems like this.
Did PHPStan help you today? Did it make you happy in any way?
It's greatly assisted me while updating an old project to a newer API.
The text was updated successfully, but these errors were encountered:
@@ @@
10: Property HelloWorld::$nullableGenerator is never written, only read.
13: Property HelloWorld::$regularGenerator is never written, only read.
-17: Dumped type: *ERROR*+17: Dumped type: Block+18: Call to an undefined method Block::getPos().
22: Dumped type: Block
23: Call to an undefined method Block::getPos().
Full report
Line
Error
10
Property HelloWorld::$nullableGenerator is never written, only read.
13
Property HelloWorld::$regularGenerator is never written, only read.
Bug report
I know that iterating on Generator|null is a bug, but it's not reported until level 7.
When up to level 6, PHPStan does not report a problem and should be able to understand what the iterable type will be in the case where it's not null.
Code snippet that reproduces the problem
https://phpstan.org/r/c9fc2ca5-501f-4fbe-bdcc-cf14a9f12ea9
Expected output
The dumped type should be a union of
Block
and*ERROR*
. It may be anstdClass
or it may not be iterable at all.In addition, an error should be reported on line 18, because neither
*ERROR*
norBlock
has a method calledgetPos()
(definite crash).Additional notes
I consider this a serious problem because it's an obvious bug that otherwise won't get detected until reaching level 8. This means that reaching level 6 provides a false sense of security while missing problems like this.
Did PHPStan help you today? Did it make you happy in any way?
It's greatly assisted me while updating an old project to a newer API.
The text was updated successfully, but these errors were encountered: