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
thrownewNoSuchIndexException(sprintf('Cannot read index "%s" while trying to traverse path "%s". Available indices are "%s".', $property, (string) $propertyPath, print_r(array_keys($zval[self::VALUE]), true)));
317
+
thrownewNoSuchIndexException(\sprintf('Cannot read index "%s" while trying to traverse path "%s". Available indices are "%s".', $property, (string) $propertyPath, print_r(array_keys($zval[self::VALUE]), true)));
318
318
}
319
319
320
320
if ($i + 1 < $propertyPath->getLength()) {
@@ -366,7 +366,7 @@ private function readPropertiesUntil(array $zval, PropertyPathInterface $propert
if (!$zval[self::VALUE] instanceof \ArrayAccess && !\is_array($zval[self::VALUE])) {
369
-
thrownewNoSuchIndexException(sprintf('Cannot read index "%s" from object of type "%s" because it doesn\'t implement \ArrayAccess.', $index, get_debug_type($zval[self::VALUE])));
369
+
thrownewNoSuchIndexException(\sprintf('Cannot read index "%s" from object of type "%s" because it doesn\'t implement \ArrayAccess.', $index, get_debug_type($zval[self::VALUE])));
thrownewNoSuchPropertyException(sprintf('Cannot read property "%s" from an array. Maybe you intended to write the property path as "[%1$s]" instead.', $property));
397
+
thrownewNoSuchPropertyException(\sprintf('Cannot read property "%s" from an array. Maybe you intended to write the property path as "[%1$s]" instead.', $property));
&& preg_match('/Return value (?:of .*::\w+\(\) )?must be of (?:the )?type (\w+), null returned$/', $e->getMessage(), $matches)
421
421
) {
422
-
thrownewUninitializedPropertyException(sprintf('The method "%s::%s()" returned "null", but expected type "%3$s". Did you forget to initialize a property or to make the return type nullable using "?%3$s"?', get_debug_type($object), $name, $matches[1]), 0, $e);
422
+
thrownewUninitializedPropertyException(\sprintf('The method "%s::%s()" returned "null", but expected type "%3$s". Did you forget to initialize a property or to make the return type nullable using "?%3$s"?', get_debug_type($object), $name, $matches[1]), 0, $e);
thrownewUninitializedPropertyException(sprintf('The property "%s::$%s" is not readable because it is typed "%s". You should initialize it or declare a default value instead.', $matches[1], $r->getName(), $type), 0, $e);
454
+
thrownewUninitializedPropertyException(\sprintf('The property "%s::$%s" is not readable because it is typed "%s". You should initialize it or declare a default value instead.', $matches[1], $r->getName(), $type), 0, $e);
if (!$zval[self::VALUE] instanceof \ArrayAccess && !\is_array($zval[self::VALUE])) {
517
-
thrownewNoSuchIndexException(sprintf('Cannot modify index "%s" in object of type "%s" because it doesn\'t implement \ArrayAccess.', $index, get_debug_type($zval[self::VALUE])));
517
+
thrownewNoSuchIndexException(\sprintf('Cannot modify index "%s" in object of type "%s" because it doesn\'t implement \ArrayAccess.', $index, get_debug_type($zval[self::VALUE])));
thrownewNoSuchPropertyException(sprintf('Cannot write property "%s" to an array. Maybe you should write the property path as "[%1$s]" instead?', $property));
531
+
thrownewNoSuchPropertyException(\sprintf('Cannot write property "%s" to an array. Maybe you should write the property path as "[%1$s]" instead?', $property));
Copy file name to clipboardExpand all lines: PropertyPath.php
+5-5Lines changed: 5 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -122,7 +122,7 @@ public function __construct(self|string $propertyPath)
122
122
}
123
123
124
124
if ('' !== $remaining) {
125
-
thrownewInvalidPropertyPathException(sprintf('Could not parse property path "%s". Unexpected token "%s" at position %d.', $propertyPath, $remaining[0], $position));
125
+
thrownewInvalidPropertyPathException(\sprintf('Could not parse property path "%s". Unexpected token "%s" at position %d.', $propertyPath, $remaining[0], $position));
126
126
}
127
127
128
128
$this->length = \count($this->elements);
@@ -171,7 +171,7 @@ public function getElements(): array
171
171
publicfunctiongetElement(int$index): string
172
172
{
173
173
if (!isset($this->elements[$index])) {
174
-
thrownewOutOfBoundsException(sprintf('The index "%s" is not within the property path.', $index));
174
+
thrownewOutOfBoundsException(\sprintf('The index "%s" is not within the property path.', $index));
175
175
}
176
176
177
177
return$this->elements[$index];
@@ -180,7 +180,7 @@ public function getElement(int $index): string
180
180
publicfunctionisProperty(int$index): bool
181
181
{
182
182
if (!isset($this->isIndex[$index])) {
183
-
thrownewOutOfBoundsException(sprintf('The index "%s" is not within the property path.', $index));
183
+
thrownewOutOfBoundsException(\sprintf('The index "%s" is not within the property path.', $index));
184
184
}
185
185
186
186
return !$this->isIndex[$index];
@@ -189,7 +189,7 @@ public function isProperty(int $index): bool
189
189
publicfunctionisIndex(int$index): bool
190
190
{
191
191
if (!isset($this->isIndex[$index])) {
192
-
thrownewOutOfBoundsException(sprintf('The index "%s" is not within the property path.', $index));
192
+
thrownewOutOfBoundsException(\sprintf('The index "%s" is not within the property path.', $index));
193
193
}
194
194
195
195
return$this->isIndex[$index];
@@ -198,7 +198,7 @@ public function isIndex(int $index): bool
198
198
publicfunctionisNullSafe(int$index): bool
199
199
{
200
200
if (!isset($this->isNullSafe[$index])) {
201
-
thrownewOutOfBoundsException(sprintf('The index "%s" is not within the property path.', $index));
201
+
thrownewOutOfBoundsException(\sprintf('The index "%s" is not within the property path.', $index));
$this->expectExceptionMessage('The method "class@anonymous::getUninitialized()" returned "null", but expected type "array". Did you forget to initialize a property or to make the return type nullable using "?array"?');
151
151
152
-
$object = newclass() {
152
+
$object = newclass {
153
153
private$uninitialized;
154
154
155
155
publicfunctiongetUninitialized(): array
@@ -166,7 +166,7 @@ public function testGetValueThrowsExceptionIfUninitializedNotNullablePropertyWit
$this->expectExceptionMessage('The property "class@anonymous::$uninitialized" is not readable because it is typed "string". You should initialize it or declare a default value instead.');
168
168
169
-
$object = newclass() {
169
+
$object = newclass {
170
170
privatestring$uninitialized;
171
171
172
172
publicfunctiongetUninitialized(): string
@@ -183,7 +183,7 @@ public function testGetValueThrowsExceptionIfUninitializedPropertyOfAnonymousCla
$this->expectExceptionMessage('The property "class@anonymous::$uninitialized" is not readable because it is typed "string". You should initialize it or declare a default value instead.');
185
185
186
-
$object = newclass() {
186
+
$object = newclass {
187
187
publicstring$uninitialized;
188
188
};
189
189
@@ -211,7 +211,7 @@ public function testGetValueThrowsExceptionIfUninitializedPropertyWithGetterOfAn
$this->expectExceptionMessage('The method "stdClass@anonymous::getUninitialized()" returned "null", but expected type "array". Did you forget to initialize a property or to make the return type nullable using "?array"?');
213
213
214
-
$object = newclass()extends \stdClass {
214
+
$object = newclassextends \stdClass {
215
215
private$uninitialized;
216
216
217
217
publicfunctiongetUninitialized(): array
@@ -228,7 +228,7 @@ public function testGetValueThrowsExceptionIfUninitializedPropertyWithGetterOfAn
$this->expectExceptionMessage('The method "Symfony\Component\PropertyAccess\Tests\Fixtures\UninitializedPrivateProperty@anonymous::getUninitialized()" returned "null", but expected type "array". Did you forget to initialize a property or to make the return type nullable using "?array"?');
0 commit comments