-
-
Notifications
You must be signed in to change notification settings - Fork 929
Closed
phpstan/phpstan-src
#4145Labels
Milestone
Description
Bug report
Since version 2.1.19 , registering signals via pcntl_signal
appears to be treating the provided callback as being executed immediately. In the case mentioned in the code snippet, where the callback calls exit
, this triggers a deadCode.unreachable
error for the line below - although the code actually continues to be executed.
This behavior starts with level 4.
phpstan analyze --level 4 ./pcntl.php
1/1 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%
------ -------------------------------------------------------
Line pcntl.php
------ -------------------------------------------------------
9 Unreachable statement - code above always terminates.
🪪 deadCode.unreachable
------ -------------------------------------------------------
[ERROR] Found 1 error
Code snippet that reproduces the problem
https://phpstan.org/r/1e3bf5cc-97ec-4cb4-95af-82626bb7e217
Expected output
phpstan analyze --level 4 ./pcntl.php
1/1 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%
[OK] No errors
(version 2.1.18)
Did PHPStan help you today? Did it make you happy in any way?
No other tool has done more to make PHP Development feel more professional!
(PhpStorm maybe, but different category :) ).