1 | <?php |
||
16 | class ArgumentHelper |
||
17 | { |
||
18 | /** |
||
19 | * Extracts all of the valid arguments for a provided Closure. |
||
20 | * |
||
21 | * @param $transformer |
||
22 | * @param array $params |
||
23 | * @return array |
||
24 | */ |
||
25 | public static function closure(\Closure $transformer, array $params): array |
||
42 | |||
43 | /** |
||
44 | * Extracts all of the valid arguments for a provided callable. |
||
45 | * |
||
46 | * @param callable $transformer |
||
47 | * @param array $params |
||
48 | * @param string $method |
||
49 | * @return array |
||
50 | */ |
||
51 | public static function callable(callable $transformer, array $params, string $method = 'transform'): array |
||
72 | |||
73 | /** |
||
74 | * Merges an indexed array of arguments values with their name. Note, the orders MUST match. |
||
75 | * |
||
76 | * @param callable $transformer |
||
77 | * @param array $params |
||
78 | * @param string $method |
||
79 | * @return array |
||
80 | * @throws \ReflectionException |
||
81 | */ |
||
82 | public static function mergeCallable(callable $transformer, array $params, string $method = 'transform'): array |
||
93 | |||
94 | /** |
||
95 | * Merges an indexed array of arguments values with their name. Note, the orders MUST match. |
||
96 | * |
||
97 | * @param callable $transformer |
||
98 | * @param array $params |
||
99 | * @return array |
||
100 | * @throws \ReflectionException |
||
101 | */ |
||
102 | public static function mergeClosure(callable $transformer, array $params): array |
||
109 | |||
110 | |||
111 | /** |
||
112 | * @param \ReflectionFunctionAbstract $function |
||
113 | * @param array $params |
||
114 | * @return array |
||
115 | */ |
||
116 | private static function mergeParameters(\ReflectionFunctionAbstract $function, array $params): array |
||
127 | |||
128 | /** |
||
129 | * @param \ReflectionFunctionAbstract $function |
||
130 | * @param array $params |
||
131 | * @return array |
||
132 | * @throws \InvalidArgumentException |
||
133 | */ |
||
134 | private static function interpretFunction(\ReflectionFunctionAbstract $function, array $params): array |
||
166 | |||
167 | /** |
||
168 | * @param \ReflectionParameter $param |
||
169 | * @param $value |
||
170 | * @return mixed |
||
171 | */ |
||
172 | private static function argType( |
||
197 | } |
||
198 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: