Bug report
Hi,
With this code, phpstan report the error Call to function constant() on a separate line has no effect.:
try {
constant('FOO');
} catch (\Error) {
}
But it should not report an error because constant() can throw an exception when the constant is not found, so we can call constant() without assigning it's return to a variable, just to know if the constant exists.
Code snippet that reproduces the problem
https://phpstan.org/r/0ef2088f-142b-404b-9bb2-a1a0bb7ae01e
Expected output
No error
Did PHPStan help you today? Did it make you happy in any way?
No response
Bug report
Hi,
With this code, phpstan report the error
Call to function constant() on a separate line has no effect.:But it should not report an error because
constant()can throw an exception when the constant is not found, so we can callconstant()without assigning it's return to a variable, just to know if the constant exists.Code snippet that reproduces the problem
https://phpstan.org/r/0ef2088f-142b-404b-9bb2-a1a0bb7ae01e
Expected output
No error
Did PHPStan help you today? Did it make you happy in any way?
No response