| Conditions | 2 |
| Paths | 1 |
| Total Lines | 14 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 2 |
| Changes | 0 | ||
| 1 | <?php |
||
| 39 | 78 | private function makeReaction(callable $responder): \Closure |
|
| 40 | { |
||
| 41 | 78 | $beforeResponse = $this->methodsToCall(); |
|
| 42 | |||
| 43 | 78 | $cb = $this->chain->predicate; |
|
| 44 | 78 | $this->chain->reset(); |
|
| 45 | |||
| 46 | return function (...$f) use ($responder, $cb, $beforeResponse) { |
||
| 47 | 60 | if ($cb($f)) { |
|
| 48 | 11 | return true; |
|
| 49 | } |
||
| 50 | |||
| 51 | 49 | $beforeResponse(); |
|
| 52 | 48 | $responder(); |
|
| 53 | 78 | }; |
|
| 72 |
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.