1 | <?php |
||
18 | trait ExtendedArrayTrait |
||
19 | { |
||
20 | use StringTrait; |
||
21 | |||
22 | /** |
||
23 | * @param array $array |
||
24 | * @param Integer $spaces |
||
25 | * @return string |
||
26 | */ |
||
27 | 12 | public function arrayToCommaString(array $array, $spaces) |
|
31 | |||
32 | /** |
||
33 | * @param array $array |
||
34 | * @return string |
||
35 | */ |
||
36 | 1 | public function arrayToPairString(array $array) |
|
37 | { |
||
38 | return implode(',', array_map(function($key, $value) { |
||
39 | 1 | return $key.'='.$value; |
|
40 | 1 | }, array_keys($array), $array)); |
|
41 | } |
||
42 | |||
43 | /** |
||
44 | * @param array $array |
||
45 | * @return string |
||
46 | */ |
||
47 | public function arrayToAttributeArray(array $array) |
||
48 | { |
||
49 | return implode(' ', array_map(function($key, $value) { |
||
50 | return is_null($value) ? $key : $key.'="'.$value.'"'; |
||
51 | }, array_keys($array), $array)); |
||
52 | } |
||
53 | |||
54 | /** |
||
55 | * @param $json |
||
56 | * @return array |
||
57 | */ |
||
58 | 3 | public static function getArrayUsingJsonNotation($json) |
|
62 | |||
63 | /** |
||
64 | * Get an item from an array using "dot" notation. |
||
65 | * |
||
66 | * @param array $array |
||
67 | * @param string $key |
||
68 | * @param mixed $default |
||
69 | * |
||
70 | * @return mixed |
||
71 | */ |
||
72 | 2 | public static function getFromArrayUsingJsonNotation( |
|
94 | |||
95 | /** |
||
96 | * @param array $array |
||
97 | * @param bool|false $key |
||
98 | * @return null |
||
99 | */ |
||
100 | public static function nullIfNotSet(array $array, $key = false) |
||
104 | |||
105 | /** |
||
106 | * @param array $array |
||
107 | * @param bool|false $key |
||
108 | * @return bool |
||
109 | */ |
||
110 | public static function falseIfNotSet(array $array, $key = false) |
||
114 | } |
||
115 |
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: