Skip to content

Commit f14b223

Browse files
committed
Add PHP 8.4 (alpha build) tests support
1 parent 8961be8 commit f14b223

File tree

6 files changed

+8
-18
lines changed

6 files changed

+8
-18
lines changed

src/ArrayBuffer.php

-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ public function __construct(iterable $stream)
3333

3434
/**
3535
* @param iterable<int<0, max>, TokenInterface> $tokens
36-
*
3736
* @return array<int<0, max>, TokenInterface>
3837
*/
3938
private function iterableToArray(iterable $tokens): array

src/Buffer.php

-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ public function seek($offset): void
6060

6161
/**
6262
* @param array<TokenInterface> $data
63-
*
6463
* @psalm-suppress PossiblyNullArrayOffset
6564
*/
6665
protected function currentFrom(array $data): TokenInterface

src/BufferInterface.php

-6
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ interface BufferInterface extends \SeekableIterator
1515
* Rewind the BufferInterface to the target token element.
1616
*
1717
* @link https://php.net/manual/en/seekableiterator.seek.php
18-
*
1918
* @see \SeekableIterator::seek()
2019
*
2120
* @param int<0, max> $offset
@@ -26,7 +25,6 @@ public function seek($offset): void;
2625
* Return the current token.
2726
*
2827
* @link https://php.net/manual/en/iterator.current.php
29-
*
3028
* @see \Iterator::current()
3129
*/
3230
public function current(): TokenInterface;
@@ -35,7 +33,6 @@ public function current(): TokenInterface;
3533
* Return the ordinal id of the current token element.
3634
*
3735
* @link https://php.net/manual/en/iterator.key.php
38-
*
3936
* @see \Iterator::key()
4037
*
4138
* @return int<0, max>
@@ -46,7 +43,6 @@ public function key(): int;
4643
* Checks if current position is valid and iterator not completed.
4744
*
4845
* @link https://php.net/manual/en/iterator.valid.php
49-
*
5046
* @see \Iterator::valid()
5147
*/
5248
public function valid(): bool;
@@ -55,7 +51,6 @@ public function valid(): bool;
5551
* Rewind the BufferInterface to the first token element.
5652
*
5753
* @link https://php.net/manual/en/iterator.rewind.php
58-
*
5954
* @see \Iterator::rewind()
6055
*/
6156
public function rewind(): void;
@@ -64,7 +59,6 @@ public function rewind(): void;
6459
* Move forward to next token element.
6560
*
6661
* @link https://php.net/manual/en/iterator.next.php
67-
*
6862
* @see \Iterator::next()
6963
*/
7064
public function next(): void;

src/Factory.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
final class Factory implements FactoryInterface
88
{
9-
public function create(iterable $tokens, ?int $size = null): BufferInterface
9+
public function create(iterable $tokens, int $size = null): BufferInterface
1010
{
1111
if ($size === null) {
1212
return new ArrayBuffer($tokens);

src/LazyBuffer.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ public function __construct(iterable $stream)
3838

3939
/**
4040
* @param iterable<TokenInterface> $stream
41-
*
4241
* @return \Generator<mixed, TokenInterface, mixed, mixed>
4342
*/
4443
private function toGenerator(iterable $stream): \Generator
@@ -114,6 +113,7 @@ protected function nextValid(): bool
114113
}
115114

116115
/**
116+
* {@inheritDoc}
117117
* @psalm-suppress MixedReturnTypeCoercion
118118
*/
119119
public function key(): int

tests/Unit/TestCase.php

+6-8
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,21 @@ public static function buffersDataProvider(): array
1717
{
1818
return [
1919
'Generator' => [
20-
static::create(self::createTokens(static::$bufferSize)),
20+
static::create(self::createTokens((static::$bufferSize))),
2121
],
2222
'array' => [
2323
static::create([
24-
...self::createTokens(static::$bufferSize),
24+
...self::createTokens((static::$bufferSize)),
2525
]),
2626
],
2727
'IteratorIterator' => [
2828
static::create(new \IteratorIterator(
29-
self::createTokens(static::$bufferSize),
29+
self::createTokens((static::$bufferSize)),
3030
)),
3131
],
3232
'ArrayIterator' => [
3333
static::create(new \ArrayIterator([
34-
...self::createTokens(static::$bufferSize),
34+
...self::createTokens((static::$bufferSize)),
3535
])),
3636
],
3737
];
@@ -95,8 +95,7 @@ public function testRewindable(BufferInterface $buffer): void
9595
$needle = $buffer->current();
9696

9797
// Iterate
98-
foreach ($buffer as $token) {
99-
}
98+
foreach ($buffer as $token);
10099

101100
$this->assertNotSame($needle, $buffer->current());
102101
$buffer->rewind();
@@ -114,8 +113,7 @@ public function testSeekAhead(BufferInterface $buffer): void
114113

115114
$buffer->rewind();
116115

117-
foreach ($buffer as $item) {
118-
}
116+
foreach ($buffer as $item);
119117

120118
$this->assertSame($buffer->current(), $needle);
121119
}

0 commit comments

Comments
 (0)