1 | <?php |
||
13 | class Method |
||
14 | { |
||
15 | public $name; |
||
16 | public $method; |
||
17 | public $context = []; |
||
18 | public $defaultContext = true; |
||
19 | public $inherit = true; |
||
20 | public $options = []; |
||
21 | |||
22 | 1 | public function __construct(array $values) |
|
45 | |||
46 | /** |
||
47 | * @return mixed |
||
48 | */ |
||
49 | public function getName() |
||
53 | |||
54 | /** |
||
55 | * @param mixed $name |
||
56 | */ |
||
57 | 1 | public function setName($name) |
|
61 | |||
62 | /** |
||
63 | * @return mixed |
||
64 | */ |
||
65 | 2 | public function getMethod() |
|
69 | |||
70 | /** |
||
71 | * @param mixed $method |
||
72 | */ |
||
73 | 1 | public function setMethod($method) |
|
77 | |||
78 | /** |
||
79 | * @return array |
||
80 | */ |
||
81 | 2 | public function getContext() |
|
85 | |||
86 | /** |
||
87 | * @param array $context |
||
88 | */ |
||
89 | 1 | public function setContext($context) |
|
93 | |||
94 | /** |
||
95 | * @return boolean |
||
96 | */ |
||
97 | 2 | public function isDefaultContext() |
|
101 | |||
102 | /** |
||
103 | * @param boolean $defaultContext |
||
104 | */ |
||
105 | 1 | public function setDefaultContext($defaultContext) |
|
109 | |||
110 | /** |
||
111 | * @return boolean |
||
112 | */ |
||
113 | 2 | public function isInherit() |
|
117 | |||
118 | /** |
||
119 | * @param boolean $inherit |
||
120 | */ |
||
121 | 1 | public function setInherit($inherit) |
|
125 | |||
126 | /** |
||
127 | * @return array |
||
128 | */ |
||
129 | 2 | public function getOptions() |
|
133 | |||
134 | /** |
||
135 | * @param array $options |
||
136 | */ |
||
137 | public function setOptions(array $options = null) |
||
141 | } |
||
142 |
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
.