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
Conditional type in @param - Call to method Xxx::xxx() with true will always evaluate to true. #10337
Conditional type in @param can have always true condition, but such tautology in it is completely expected and phpstan error must not emit any error for it.
@@ @@
24: Result of method App::callExit() (void) is used.
28: Call to method App::callExit() with true will always evaluate to true.
28: Result of method App::callExit() (void) is used.
-37: Call to method class@anonymous/tmp.php:30::callExit() with true will always evaluate to true.-37: Result of method class@anonymous/tmp.php:30::callExit() (void) is used.+37: Call to method App@anonymous/tmp.php:30::callExit() with true will always evaluate to true.+37: Result of method App@anonymous/tmp.php:30::callExit() (void) is used.
Full report
Line
Error
20
Call to method App::callExit() with true will always evaluate to true.
24
Call to method App::callExit() with true will always evaluate to true.
24
Result of method App::callExit() (void) is used.
28
Call to method App::callExit() with true will always evaluate to true.
28
Result of method App::callExit() (void) is used.
37
Call to method App@anonymous/tmp.php:30::callExit() with true will always evaluate to true.
37
Result of method App@anonymous/tmp.php:30::callExit() (void) is used.
@@ @@
20: Call to method App::callExit() with true will always evaluate to true.
-24: Call to method App::callExit() with true will always evaluate to true.-24: Result of method App::callExit() (void) is used.-28: Call to method App::callExit() with true will always evaluate to true.-28: Result of method App::callExit() (void) is used.-37: Call to method App@anonymous/tmp.php:30::callExit() with true will always evaluate to true.-37: Result of method App@anonymous/tmp.php:30::callExit() (void) is used.+24: Unreachable statement - code above always terminates.
Full report
Line
Error
20
Call to method App::callExit() with true will always evaluate to true.
Thank you. I see you are correct, I was reading the "Unreachable statement - code above always terminates." error to be for a line 20, but it is for line 24 (thanks to line 23). This is expected. I will update my repro.
Activity
phpstan-bot commentedon Sep 19, 2024
@mvorisek After the latest push in 2.0.x, PHPStan now reports different result with your code snippet:
Full report
Call to method App::callExit() with true will always evaluate to true.Call to method App::callExit() with true will always evaluate to true.Result of method App::callExit() (void) is used.Call to method App::callExit() with true will always evaluate to true.Result of method App::callExit() (void) is used.Call to method App@anonymous/tmp.php:30::callExit() with true will always evaluate to true.Result of method App@anonymous/tmp.php:30::callExit() (void) is used.phpstan-bot commentedon Jul 21, 2025
@mvorisek After the latest push in 2.1.x, PHPStan now reports different result with your code snippet:
Full report
Call to method App::callExit() with true will always evaluate to true.Unreachable statement - code above always terminates.mvorisek commentedon Jul 21, 2025
@staabm phpstan/phpstan-src#4090 has broken this repro. It seems conditional
neveris wrongly assumed as always instead of maybe.staabm commentedon Jul 21, 2025
I am not sure what you mean with broken...?
It looks like after the first call which we know will never return everything is unreachable (which I think is expected).
The initial error/bug you reported on line 20 is still there.
IMO its now more correct than before (with the same bug in line20)
mvorisek commentedon Jul 21, 2025
Thank you. I see you are correct, I was reading the "Unreachable statement - code above always terminates." error to be for a line 20, but it is for line 24 (thanks to line 23). This is expected. I will update my repro.
phpstan-bot commentedon Mar 3, 2026
Closed via merging phpstan/phpstan-src#5121
github-actions commentedon Apr 4, 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.