| @@ -70,9 +70,9 @@ | ||
| 70 | 70 | $this->pathAsString = $propertyPath->pathAsString; |
| 71 | 71 | return; |
| 72 | 72 | } |
| 73 | 73 | if (!\is_string($propertyPath)) { |
| 74 | - throw new InvalidArgumentException(\sprintf('The property path constructor needs a string or an instance of "Symfony\\Component\\PropertyAccess\\PropertyPath". Got: "%s".', \get_debug_type($propertyPath))); | |
| 74 | + throw new InvalidArgumentException(sprintf('The property path constructor needs a string or an instance of "Symfony\Component\PropertyAccess\PropertyPath". Got: "%s".', get_debug_type($propertyPath))); | |
| 75 | 75 | } |
| 76 | 76 | if ('' === $propertyPath) { |
| 77 | 77 | throw new InvalidPropertyPathException('The property path should not be empty.'); |
| 78 | 78 | } |
| @@ -79,10 +79,10 @@ | ||
| 79 | 79 | $this->pathAsString = $propertyPath; |
| 80 | 80 | $position = 0; |
| 81 | 81 | $remaining = $propertyPath; |
| 82 | 82 | // first element is evaluated differently - no leading dot for properties |
| 83 | - $pattern = '/^(([^\\.\\[]++)|\\[([^\\]]++)\\])(.*)/'; | |
| 84 | - while (\preg_match($pattern, $remaining, $matches)) { | |
| 83 | + $pattern = '/^(([^\.\[]++)|\[([^\]]++)\])(.*)/'; | |
| 84 | + while (preg_match($pattern, $remaining, $matches)) { | |
| 85 | 85 | if ('' !== $matches[2]) { |
| 86 | 86 | $element = $matches[2]; |
| 87 | 87 | $this->isIndex[] = \false; |
| 88 | 88 | } else { |
| @@ -91,12 +91,12 @@ | ||
| 91 | 91 | } |
| 92 | 92 | $this->elements[] = $element; |
| 93 | 93 | $position += \strlen($matches[1]); |
| 94 | 94 | $remaining = $matches[4]; |
| 95 | - $pattern = '/^(\\.([^\\.|\\[]++)|\\[([^\\]]++)\\])(.*)/'; | |
| 95 | + $pattern = '/^(\.([^\.|\[]++)|\[([^\]]++)\])(.*)/'; | |
| 96 | 96 | } |
| 97 | 97 | if ('' !== $remaining) { |
| 98 | - throw new InvalidPropertyPathException(\sprintf('Could not parse property path "%s". Unexpected token "%s" at position %d.', $propertyPath, $remaining[0], $position)); | |
| 98 | + throw new InvalidPropertyPathException(sprintf('Could not parse property path "%s". Unexpected token "%s" at position %d.', $propertyPath, $remaining[0], $position)); | |
| 99 | 99 | } |
| 100 | 100 | $this->length = \count($this->elements); |
| 101 | 101 | } |
| 102 | 102 | /** |
| @@ -122,11 +122,11 @@ | ||
| 122 | 122 | return null; |
| 123 | 123 | } |
| 124 | 124 | $parent = clone $this; |
| 125 | 125 | --$parent->length; |
| 126 | - $parent->pathAsString = \substr($parent->pathAsString, 0, \max(\strrpos($parent->pathAsString, '.'), \strrpos($parent->pathAsString, '['))); | |
| 127 | - \array_pop($parent->elements); | |
| 128 | - \array_pop($parent->isIndex); | |
| 126 | + $parent->pathAsString = substr($parent->pathAsString, 0, max(strrpos($parent->pathAsString, '.'), strrpos($parent->pathAsString, '['))); | |
| 127 | + array_pop($parent->elements); | |
| 128 | + array_pop($parent->isIndex); | |
| 129 | 129 | return $parent; |
| 130 | 130 | } |
| 131 | 131 | /** |
| 132 | 132 | * Returns a new iterator for this path. |
| @@ -150,9 +150,9 @@ | ||
| 150 | 150 | */ |
| 151 | 151 | public function getElement(int $index) |
| 152 | 152 | { |
| 153 | 153 | if (!isset($this->elements[$index])) { |
| 154 | - throw new OutOfBoundsException(\sprintf('The index "%s" is not within the property path.', $index)); | |
| 154 | + throw new OutOfBoundsException(sprintf('The index "%s" is not within the property path.', $index)); | |
| 155 | 155 | } |
| 156 | 156 | return $this->elements[$index]; |
| 157 | 157 | } |
| 158 | 158 | /** |
| @@ -160,9 +160,9 @@ | ||
| 160 | 160 | */ |
| 161 | 161 | public function isProperty(int $index) |
| 162 | 162 | { |
| 163 | 163 | if (!isset($this->isIndex[$index])) { |
| 164 | - throw new OutOfBoundsException(\sprintf('The index "%s" is not within the property path.', $index)); | |
| 164 | + throw new OutOfBoundsException(sprintf('The index "%s" is not within the property path.', $index)); | |
| 165 | 165 | } |
| 166 | 166 | return !$this->isIndex[$index]; |
| 167 | 167 | } |
| 168 | 168 | /** |
| @@ -170,9 +170,9 @@ | ||
| 170 | 170 | */ |
| 171 | 171 | public function isIndex(int $index) |
| 172 | 172 | { |
| 173 | 173 | if (!isset($this->isIndex[$index])) { |
| 174 | - throw new OutOfBoundsException(\sprintf('The index "%s" is not within the property path.', $index)); | |
| 174 | + throw new OutOfBoundsException(sprintf('The index "%s" is not within the property path.', $index)); | |
| 175 | 175 | } |
| 176 | 176 | return $this->isIndex[$index]; |
| 177 | 177 | } |
| 178 | 178 | } |