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
Yeah I know, it's a bug I want to fix before release.
This should be decided in MethodCallHandler, StaticCallHandler, FuncCallHandler, NewHandler.
I'd be fine if ExpressionHandler continued to invoke NoopExpressionNode for all nodes that aren't the ones handled by the handlers listed above.
And the handlers above could decide whether they want to invoke NoopExpressionNode based on whether the explicit throw point is about new ObjectType(Error::class) or not.
@@ @@-PHP 8.0 – 8.6 (1 error)-==========--12: Expression "throw new \ValueError('cannot extract a prefix from a string that has no prefix')" on a separate line does not do anything.--PHP 7.2 – 7.4 (3 errors)-==========--12: Instantiated class ValueError not found.-12: Possibly impure instantiation of unknown class in pure function extract_prefix().-12: Throwing object of an unknown class ValueError.+12: Expression "throw new \ValueError('cannot extract a prefix from a string that has no prefix')" on a separate line does not do anything.
Full report
Line
Error
12
Expression "throw new \ValueError('cannot extract a prefix from a string that has no prefix')" on a separate line does not do anything.
Activity
ondrejmirtes commentedon Sep 17, 2026
Yeah I know, it's a bug I want to fix before release.
This should be decided in MethodCallHandler, StaticCallHandler, FuncCallHandler, NewHandler.
I'd be fine if ExpressionHandler continued to invoke
NoopExpressionNodefor all nodes that aren't the ones handled by the handlers listed above.And the handlers above could decide whether they want to invoke NoopExpressionNode based on whether the explicit throw point is about
new ObjectType(Error::class)or not.phpstan-bot commentedon Sep 17, 2026
@claudepache After the latest push in 2.3.x, PHPStan now reports different result with your code snippet:
Full report
Expression "throw new \ValueError('cannot extract a prefix from a string that has no prefix')" on a separate line does not do anything.phpstan-bot commentedon Sep 18, 2026
Closed via merging phpstan/phpstan-src#6471
github-actions commentedon Oct 20, 2026
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.