File tree 1 file changed +4
-8
lines changed
1 file changed +4
-8
lines changed Original file line number Diff line number Diff line change 9
9
class ArrayBuffer extends Buffer
10
10
{
11
11
/**
12
- * @var array<int<0, max>, TokenInterface>
12
+ * @var list< TokenInterface>
13
13
*/
14
14
private array $ buffer = [];
15
15
@@ -25,24 +25,20 @@ public function __construct(iterable $stream)
25
25
{
26
26
$ this ->buffer = $ this ->iterableToArray ($ stream );
27
27
$ this ->size = \count ($ this ->buffer );
28
-
29
- if ($ this ->buffer !== []) {
30
- $ this ->initial = $ this ->current = \array_key_first ($ this ->buffer );
31
- }
32
28
}
33
29
34
30
/**
35
31
* @param iterable<int<0, max>, TokenInterface> $tokens
36
32
*
37
- * @return array<int<0, max>, TokenInterface>
33
+ * @return list< TokenInterface>
38
34
*/
39
35
private function iterableToArray (iterable $ tokens ): array
40
36
{
41
37
if ($ tokens instanceof \Traversable) {
42
- return \iterator_to_array ($ tokens );
38
+ return \iterator_to_array ($ tokens, false );
43
39
}
44
40
45
- return $ tokens ;
41
+ return \array_values ( $ tokens) ;
46
42
}
47
43
48
44
public function seek (int $ offset ): void
You can’t perform that action at this time.
0 commit comments