| 1 | <?php |
||
| 8 | class HttpException extends RuntimeException |
||
| 9 | { |
||
| 10 | /** |
||
| 11 | * @param string $path |
||
| 12 | * |
||
| 13 | * @return static |
||
| 14 | */ |
||
| 15 | 3 | public static function notFound($path) |
|
| 22 | |||
| 23 | /** |
||
| 24 | * @param string $path |
||
| 25 | * @param string $method |
||
| 26 | * @param array $allowed |
||
| 27 | * |
||
| 28 | * @return static |
||
| 29 | */ |
||
| 30 | 3 | public static function methodNotAllowed($path, $method, array $allowed) |
|
| 42 | |||
| 43 | /** |
||
| 44 | * @param string $message |
||
| 45 | * |
||
| 46 | * @return static |
||
| 47 | */ |
||
| 48 | 1 | public static function badRequest($message) |
|
| 55 | |||
| 56 | /** |
||
| 57 | * @var array |
||
| 58 | */ |
||
| 59 | private $allowed = []; |
||
| 60 | |||
| 61 | /** |
||
| 62 | * @param ResponseInterface $response |
||
| 63 | * |
||
| 64 | * @return ResponseInterface |
||
| 65 | */ |
||
| 66 | 3 | public function withResponse(ResponseInterface $response) |
|
| 74 | } |
||
| 75 |
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.