You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
minor #13754 [PropertyAccess] unify and fix doc (Tobion)
This PR was merged into the 2.6 branch.
Discussion
----------
[PropertyAccess] unify and fix doc
| Q | A
| ------------- | ---
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets |
| License | MIT
| Doc PR | -
Commits
-------
d1c8c5d [PropertyAccess] unify and fix doc
'Cannot read property "%s". Available properties are "%s"',
213
+
'Cannot read index "%s" while trying to traverse path "%s". Available indices are "%s".',
213
214
$property,
215
+
(string) $propertyPath,
214
216
print_r(array_keys($objectOrArray), true)
215
217
));
216
218
}
@@ -250,7 +252,7 @@ private function &readPropertiesUntil(&$objectOrArray, PropertyPathInterface $pr
250
252
privatefunction &readIndex(&$array, $index)
251
253
{
252
254
if (!$arrayinstanceof \ArrayAccess && !is_array($array)) {
253
-
thrownewNoSuchIndexException(sprintf('Index "%s" cannot be read from object of type "%s" because it doesn\'t implement \ArrayAccess', $index, get_class($array)));
255
+
thrownewNoSuchIndexException(sprintf('Cannot read index "%s" from object of type "%s" because it doesn\'t implement \ArrayAccess.', $index, get_class($array)));
254
256
}
255
257
256
258
// Use an array instead of an object since performance is very crucial here
@@ -294,7 +296,7 @@ private function &readProperty(&$object, $property)
294
296
);
295
297
296
298
if (!is_object($object)) {
297
-
thrownewNoSuchPropertyException(sprintf('Cannot read property "%s" from an array. Maybe you should write the property path as "[%s]" instead?', $property, $property));
299
+
thrownewNoSuchPropertyException(sprintf('Cannot read property "%s" from an array. Maybe you intended to write the property path as "[%s]" instead.', $property, $property));
298
300
}
299
301
300
302
$camelized = $this->camelize($property);
@@ -364,7 +366,7 @@ private function &readProperty(&$object, $property)
if (!$arrayinstanceof \ArrayAccess && !is_array($array)) {
367
-
thrownewNoSuchIndexException(sprintf('Index "%s" cannot be modified in object of type "%s" because it doesn\'t implement \ArrayAccess', $index, get_class($array)));
369
+
thrownewNoSuchIndexException(sprintf('Cannot modify index "%s" in object of type "%s" because it doesn\'t implement \ArrayAccess', $index, get_class($array)));
0 commit comments