| Conditions | 3 |
| Paths | 3 |
| Total Lines | 23 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 51 | public function runInBackground() : Process |
||
| 52 | { |
||
| 53 | $processID = pcntl_fork(); |
||
| 54 | |||
| 55 | if ($processID === -1) { |
||
| 56 | throw new Exception( |
||
| 57 | "Failed to fork process." |
||
| 58 | ); |
||
| 59 | } |
||
| 60 | |||
| 61 | // This is the child process. |
||
| 62 | if ($processID === 0) { |
||
| 63 | // @codeCoverageIgnoreStart |
||
| 64 | $this->runInForeground(); |
||
| 65 | |||
| 66 | exit(0); |
||
| 67 | // @codeCoverageIgnoreEnd |
||
| 68 | } |
||
| 69 | |||
| 70 | $process = new Process($processID); |
||
| 71 | |||
| 72 | return $process; |
||
| 73 | } |
||
| 74 | } |
||
| 75 |
It seems like you allow that null is being passed for a parameter, however the function which is called does not seem to accept null.
We recommend to add an additional type check (or disallow null for the parameter):