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 using Generator::throw() feature, calling yield will actually throw that exception. Surrounding yield with a try...catch-block makes PHPStan with bleeding edge enabled incorrectly report a dead catch.
If you add (new HelloWorld())->consumeGenerator(); to this example, and run it with PHP, you'll see that the exception message actually is echoed, which proves that this not a dead catch.
Expected output
No error.
The text was updated successfully, but these errors were encountered:
Bug report
When using
Generator::throw()
feature, callingyield
will actually throw that exception. Surroundingyield
with atry
...catch
-block makes PHPStan with bleeding edge enabled incorrectly report a dead catch.Code snippet that reproduces the problem
https://phpstan.org/r/f9c59ed6-949c-47bf-ae2d-69d3f3290842
If you add
(new HelloWorld())->consumeGenerator();
to this example, and run it with PHP, you'll see that the exception message actually is echoed, which proves that this not a dead catch.Expected output
No error.
The text was updated successfully, but these errors were encountered: