| 1 | <?php | ||
| 21 | class Allows implements RuleInterface | ||
| 22 | { | ||
| 23 | /** | ||
| 24 | * | ||
| 25 | * Does the server request method match an allowed route method? | ||
| 26 | * | ||
| 27 | * @param ServerRequestInterface $request The HTTP request. | ||
| 28 | * | ||
| 29 | * @param Route $route The route. | ||
| 30 | * | ||
| 31 | * @return bool True on success, false on failure. | ||
| 32 | * | ||
| 33 | */ | ||
| 34 | 6 | public function __invoke(ServerRequestInterface $request, Route $route) | |
| 43 | } | ||
| 44 | 
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.