1 | <?php |
||
37 | class PropertyAccessor extends RawPropertyAccessor |
||
38 | { |
||
39 | /** |
||
40 | * Reflection information about the composite being accessed |
||
41 | * |
||
42 | * @var ReflectionComposite |
||
43 | */ |
||
44 | protected $reflect; |
||
45 | |||
46 | /** |
||
47 | * Creates the PropertyAccessor for the given object, using the |
||
48 | * given reflection information |
||
49 | * |
||
50 | * @param object $object The object to access |
||
51 | * @param ReflectionComposite $reflect Reflection information about |
||
52 | * the composite |
||
53 | */ |
||
54 | 23 | public function __construct($object, ReflectionComposite $reflect) |
|
60 | |||
61 | /** |
||
62 | * Initializes the given object with the given parameters, enforcing |
||
63 | * the constructor requirements and auto building any left overs |
||
64 | */ |
||
65 | 6 | public function constructObject(...$args) |
|
111 | |||
112 | /** |
||
113 | * Builds a property automatically |
||
114 | * |
||
115 | * @param ReflectionProperty $property The property to build |
||
116 | */ |
||
117 | 4 | protected function buildProperty(ReflectionProperty $property) |
|
129 | |||
130 | /** |
||
131 | * Returns the value of the property |
||
132 | * |
||
133 | * @param string $property The name of the property to get |
||
134 | * @return mixed The value of the property |
||
135 | */ |
||
136 | 6 | public function getValue(string $property) |
|
140 | |||
141 | /** |
||
142 | * Sets the value of a property, enforcing datatype requirements |
||
143 | * |
||
144 | * @param string $property The name of the property to set |
||
145 | * @param mixed $value The value to set |
||
146 | */ |
||
147 | 9 | public function setValue(string $property, $value) |
|
163 | |||
164 | /** |
||
165 | * Sets the value of a property, enforcing datatype requirements |
||
166 | * |
||
167 | * @param ReflectionProperty $property The property to set |
||
168 | * @param mixed $value The value to set |
||
169 | */ |
||
170 | 10 | protected function setAnyValue(ReflectionProperty $property, $value) |
|
189 | |||
190 | /** |
||
191 | * Attempts to set a property which expects a scalar value |
||
192 | * |
||
193 | * @param ReflectionProperty $property The property to set |
||
194 | * @param ScalarType $valueType The scalar type |
||
195 | * @param mixed $value The value to set |
||
196 | */ |
||
197 | 4 | private function setScalarValue |
|
228 | |||
229 | /** |
||
230 | * Throws an IlleglPropertyTypeException |
||
231 | * |
||
232 | * @param ReflectionProperty $property The property being set |
||
233 | * @param AbstractType $valueType The value being set |
||
234 | */ |
||
235 | 1 | private function throwError |
|
249 | } |
||
250 |
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: