| Conditions | 2 |
| Paths | 2 |
| Total Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 6 |
| CRAP Score | 2 |
| Changes | 0 | ||
| 1 | <?php |
||
| 31 | 4 | public function handle(ServerRequestInterface $req): ResponseInterface |
|
| 32 | {
|
||
| 33 | 4 | if (! $this->stack) |
|
|
|
|||
| 34 | {
|
||
| 35 | 1 | throw new RuntimeException('The pipe is empty');
|
|
| 36 | } |
||
| 37 | |||
| 38 | 3 | $pipe = clone $this; |
|
| 39 | 3 | $middleware = array_shift($pipe->stack); |
|
| 40 | 3 | return $middleware->process($req, $pipe); |
|
| 41 | } |
||
| 42 | |||
| 49 | } |
This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.
Consider making the comparison explicit by using
empty(..)or! empty(...)instead.