File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 99class ArrayBuffer extends Buffer
1010{
1111 /**
12- * @var array<int<0, max>, TokenInterface>
12+ * @var list< TokenInterface>
1313 */
1414 private array $ buffer = [];
1515
@@ -25,24 +25,20 @@ public function __construct(iterable $stream)
2525 {
2626 $ this ->buffer = $ this ->iterableToArray ($ stream );
2727 $ this ->size = \count ($ this ->buffer );
28-
29- if ($ this ->buffer !== []) {
30- $ this ->initial = $ this ->current = \array_key_first ($ this ->buffer );
31- }
3228 }
3329
3430 /**
3531 * @param iterable<int<0, max>, TokenInterface> $tokens
3632 *
37- * @return array<int<0, max>, TokenInterface>
33+ * @return list< TokenInterface>
3834 */
3935 private function iterableToArray (iterable $ tokens ): array
4036 {
4137 if ($ tokens instanceof \Traversable) {
42- return \iterator_to_array ($ tokens );
38+ return \iterator_to_array ($ tokens, false );
4339 }
4440
45- return $ tokens ;
41+ return \array_values ( $ tokens) ;
4642 }
4743
4844 public function seek (int $ offset ): void
You can’t perform that action at this time.
0 commit comments