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
{{ message }}
Repository navigation
Phpstan doesn't see code throwing Exception if couter go after his limit @var int<0, 20> #7783
I think the issue is not related to the counter. It feels like it can not find that methods are throwing exceptions. It seems to neither work inlined or as doc-block comment. Here an example: https://phpstan.org/r/d7399c17-547b-4203-866f-90149148e33b
Throwing the exception directly works and PHPStan is happy.
PHPStan was helpful today, yes. Because if this is behaviour, it currently does not make me happy (; But in general it does.
Edit: Seems to be working if return type never is used. Thanks to @Mooeeezzzz!
Activity
Neila142 commentedon Aug 15, 2022
For an additonal note, this code show no errors:
https://phpstan.org/r/50d56438-1877-4e12-b073-74a29e4a447f
Which is the same, just a little different placement of variables increments.
It work but I found it less readable
ezintz commentedon Aug 22, 2022
I think the issue is not related to the counter. It feels like it can not find that methods are throwing exceptions. It seems to neither work inlined or as doc-block comment. Here an example: https://phpstan.org/r/d7399c17-547b-4203-866f-90149148e33b
Throwing the exception directly works and PHPStan is happy.
PHPStan was helpful today, yes. Because if this is behaviour, it currently does not make me happy (; But in general it does.
Edit: Seems to be working if return type
neveris used. Thanks to @Mooeeezzzz!ondrejmirtes commentedon Aug 22, 2022
Yes, see this: https://phpstan.org/user-guide/troubleshooting-types#what-phpstan-doesn%E2%80%99t-do
This feature might help you in the future once it's released: phpstan/phpstan-src#1317
nevermarks a function that ALWAYS throws the exception.github-actions commentedon Sep 23, 2022
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.