Throwing an Error does not do anything?
Author: claudepacheCreated Sep 17, 2026Updated Sep 17, 2026
Labelsbug
Bug report
Most probably an unwanted side-effect of https://github.com/phpstan/phpstan-src/commit/c7301f67e23484ee6576d9549dc31dc61487f837. The following defensive code:
throw new \ValueError('You provided a nonsensical value');makes now PHPStan complain:
Expression "throw new \ValueError('You provided a nonsensical value')" on a separate line does not do anything.
Code snippet that reproduces the problem
https://phpstan.org/r/597818aa-a7f9-4183-9278-1e87a1055698
Expected output
No error on line 12.
Did PHPStan help you today? Did it make you happy in any way?
No response
Source: phpstan/phpstan