1 | <?php |
||
5 | abstract class ArgumentsResolver |
||
6 | { |
||
7 | /** |
||
8 | * @var \ReflectionFunctionAbstract |
||
9 | */ |
||
10 | protected $reflection; |
||
11 | |||
12 | /** |
||
13 | * @param mixed $function |
||
14 | */ |
||
15 | 16 | public function __construct($function) |
|
21 | |||
22 | /** |
||
23 | * Resolves function arguments. |
||
24 | * |
||
25 | * @param array $parameters |
||
26 | * |
||
27 | * @return array |
||
28 | * |
||
29 | * @throws UnresolvableArgumentException |
||
30 | */ |
||
31 | 16 | public function resolve(array $parameters) |
|
58 | |||
59 | /** |
||
60 | * Returns an array of reflection parameters. |
||
61 | * |
||
62 | * @return \ReflectionParameter[] |
||
63 | */ |
||
64 | 3 | protected function getParameters() |
|
68 | |||
69 | /** |
||
70 | * Returns the [key, value] pair if the parameter is matched or null otherwise. |
||
71 | * |
||
72 | * @param \ReflectionParameter $parameter |
||
73 | * @param array $parameters |
||
74 | * |
||
75 | * @return array|null |
||
76 | */ |
||
77 | abstract protected function match(\ReflectionParameter $parameter, array $parameters); |
||
78 | } |
||
79 |
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.