@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | foreach ($collectors as $collector) { |
| 92 | 92 | $yielded = $collector->processEvent($event); |
| 93 | 93 | if (is_array($yielded)) { |
| 94 | - [ $key, $value ] = $yielded; |
|
| 94 | + [$key, $value] = $yielded; |
|
| 95 | 95 | yield $key => $value; |
| 96 | 96 | } |
| 97 | 97 | } |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | $tokens = $this->tokens(); |
| 111 | 111 | |
| 112 | 112 | // shortcut to event factory |
| 113 | - $createEvent = function (string $eventId, $value = null) use ($stack, &$token): Event { |
|
| 113 | + $createEvent = function(string $eventId, $value = null) use ($stack, &$token): Event { |
|
| 114 | 114 | return $this->createEvent($eventId, $value, $stack, $token->getLineNumber(), $token->getCharNumber()); |
| 115 | 115 | }; |
| 116 | 116 | |
@@ -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 | } |