@@ -50,25 +50,25 @@ discard block |
||
| 50 | 50 | // `[]` |
| 51 | 51 | array_push( |
| 52 | 52 | $selectorStack, |
| 53 | - [ 'type' => 'any' ] |
|
| 53 | + ['type' => 'any'] |
|
| 54 | 54 | ); |
| 55 | 55 | } elseif ($offset == 0 && preg_match('/^([a-z_\$][a-z0-9_\$]*)/i', $part, $matches)) { |
| 56 | 56 | // `foo` but only as a beginning of selector |
| 57 | 57 | array_push( |
| 58 | 58 | $selectorStack, |
| 59 | - [ 'type' => 'key', 'key' => $matches[1] ] |
|
| 59 | + ['type' => 'key', 'key' => $matches[1]] |
|
| 60 | 60 | ); |
| 61 | 61 | } elseif (preg_match('/^\.([a-z_\$][a-z0-9_\$]*)/i', $part, $matches)) { |
| 62 | 62 | // `.foo` |
| 63 | 63 | array_push( |
| 64 | 64 | $selectorStack, |
| 65 | - [ 'type' => 'key', 'key' => $matches[1] ] |
|
| 65 | + ['type' => 'key', 'key' => $matches[1]] |
|
| 66 | 66 | ); |
| 67 | 67 | } elseif (preg_match('/^\[(0|[1-9][0-9]*)]/', $part, $matches)) { |
| 68 | 68 | // `[1]` |
| 69 | 69 | array_push( |
| 70 | 70 | $selectorStack, |
| 71 | - [ 'type' => 'index', 'index' => (int)$matches[1] ] |
|
| 71 | + ['type' => 'index', 'index' => (int)$matches[1]] |
|
| 72 | 72 | ); |
| 73 | 73 | } elseif (preg_match('/^\[(0|[1-9][0-9]*)?:(0|[1-9][0-9]*)?]/', $part, $matches)) { |
| 74 | 74 | // `[1:9]` or `[1:]` or `[:9]` |
@@ -79,13 +79,13 @@ discard block |
||
| 79 | 79 | } |
| 80 | 80 | array_push( |
| 81 | 81 | $selectorStack, |
| 82 | - [ 'type' => 'range', 'start' => $firstIndex, 'end' => $lastIndex ] |
|
| 82 | + ['type' => 'range', 'start' => $firstIndex, 'end' => $lastIndex] |
|
| 83 | 83 | ); |
| 84 | 84 | } elseif (preg_match('/^\["((?:[^"\\\\]+|\\\\.)*)"]/', $part, $matches)) { |
| 85 | 85 | // `["foo"]` and also `["The \"Foo\" key"]` |
| 86 | 86 | array_push( |
| 87 | 87 | $selectorStack, |
| 88 | - [ 'type' => 'key', 'key' => $matches[1] ] |
|
| 88 | + ['type' => 'key', 'key' => $matches[1]] |
|
| 89 | 89 | ); |
| 90 | 90 | } |
| 91 | 91 | |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | |
| 50 | 50 | case Event::VALUE: |
| 51 | 51 | if ($this->current === null) { |
| 52 | - return [ $event->getPath(), $event->getValue() ]; |
|
| 52 | + return [$event->getPath(), $event->getValue()]; |
|
| 53 | 53 | } elseif ($this->key !== null && $this->hasKeyInCurrent($this->key)) { |
| 54 | 54 | throw CollectorException::duplicatedKey($this->key, $event); |
| 55 | 55 | } else { |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | } else { |
| 85 | 85 | $this->current = null; |
| 86 | 86 | $this->key = null; |
| 87 | - return [ $event->getPath(), $finished ]; |
|
| 87 | + return [$event->getPath(), $finished]; |
|
| 88 | 88 | } |
| 89 | 89 | break; |
| 90 | 90 | } |
@@ -70,9 +70,9 @@ discard block |
||
| 70 | 70 | } else if (is_array($selectors)) { |
| 71 | 71 | $selectorsArray = $selectors; |
| 72 | 72 | } else if ($selectors instanceof CollectorInterface) { |
| 73 | - $selectorsArray = [ $selectors ]; |
|
| 73 | + $selectorsArray = [$selectors]; |
|
| 74 | 74 | } else if ($selectors === null) { |
| 75 | - $selectorsArray = [ null ]; |
|
| 75 | + $selectorsArray = [null]; |
|
| 76 | 76 | } else { |
| 77 | 77 | throw new ParserException('Unexpected selectors are provided', ParserException::CODE_INVALID_ARGUMENT); |
| 78 | 78 | } |
@@ -98,14 +98,14 @@ discard block |
||
| 98 | 98 | if (count($yielded) != 2) { |
| 99 | 99 | throw ParserException::unexpectedCollectorReturn($yielded, $event); |
| 100 | 100 | } |
| 101 | - [ $key, $value ] = $yielded; |
|
| 101 | + [$key, $value] = $yielded; |
|
| 102 | 102 | yield $key => $value; |
| 103 | 103 | } else if ($yielded instanceof Generator) { |
| 104 | 104 | foreach ($yielded as $yieldedSingle) { |
| 105 | 105 | if (!is_array($yieldedSingle) || count($yieldedSingle) != 2) { |
| 106 | 106 | throw ParserException::unexpectedCollectorReturn($yielded, $event); |
| 107 | 107 | } |
| 108 | - [ $key, $value ] = $yieldedSingle; |
|
| 108 | + [$key, $value] = $yieldedSingle; |
|
| 109 | 109 | yield $key => $value; |
| 110 | 110 | } |
| 111 | 111 | } else if ($yielded === null) { |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | $tokens = $this->tokens(); |
| 130 | 130 | |
| 131 | 131 | // shortcut to event factory |
| 132 | - $createEvent = function (string $eventId, $value = null) use ($stack, &$token): Event { |
|
| 132 | + $createEvent = function(string $eventId, $value = null) use ($stack, &$token): Event { |
|
| 133 | 133 | return $this->createEvent($eventId, $value, $stack, $token->getLineNumber(), $token->getCharNumber()); |
| 134 | 134 | }; |
| 135 | 135 | |