1 | <?php |
||
16 | class SettingActionEvent extends Event |
||
17 | { |
||
18 | /** |
||
19 | * @var string |
||
20 | */ |
||
21 | private $name; |
||
22 | |||
23 | /** |
||
24 | * @var array |
||
25 | */ |
||
26 | private $data; |
||
27 | |||
28 | /** |
||
29 | * @var |
||
30 | */ |
||
31 | private $setting; |
||
32 | |||
33 | public function __construct($name, array $data = null, $setting = null) |
||
39 | |||
40 | /** |
||
41 | * @return string |
||
42 | */ |
||
43 | public function getName() |
||
47 | |||
48 | /** |
||
49 | * @param string $name |
||
50 | */ |
||
51 | public function setName($name) |
||
55 | |||
56 | /** |
||
57 | * @return array |
||
58 | */ |
||
59 | public function getData() |
||
63 | |||
64 | /** |
||
65 | * @param array $data |
||
66 | */ |
||
67 | public function setData($data) |
||
71 | |||
72 | /** |
||
73 | * @return mixed |
||
74 | */ |
||
75 | public function getSetting() |
||
79 | |||
80 | /** |
||
81 | * @param mixed $setting |
||
82 | */ |
||
83 | public function setSetting($setting) |
||
87 | } |
Our type inference engine has found an assignment of a scalar value (like a string, an integer or null) to a property which is an array.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property.
To type hint that a parameter can be either an array or null, you can set a type hint of array and a default value of null. The PHP interpreter will then accept both an array or null for that parameter.
The function can be called with either null or an array for the parameter
$needle
but will only accept an array as$haystack
.