Skip to content

Commit 8961be8

Browse files
committed
Add PHP 8.4 tests support
1 parent f15f0c7 commit 8961be8

File tree

7 files changed

+19
-9
lines changed

7 files changed

+19
-9
lines changed

.github/workflows/main.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
strategy:
1717
fail-fast: false
1818
matrix:
19-
php: [ '7.4', '8.0', '8.1', '8.2', '8.3' ]
19+
php: [ '7.4', '8.0', '8.1', '8.2', '8.3', '8.4' ]
2020
os: [ ubuntu-latest, macos-latest, windows-latest ]
2121
stability: [ prefer-lowest, prefer-stable ]
2222
steps:

src/ArrayBuffer.php

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

3434
/**
3535
* @param iterable<int<0, max>, TokenInterface> $tokens
36+
*
3637
* @return array<int<0, max>, TokenInterface>
3738
*/
3839
private function iterableToArray(iterable $tokens): array

src/Buffer.php

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

6161
/**
6262
* @param array<TokenInterface> $data
63+
*
6364
* @psalm-suppress PossiblyNullArrayOffset
6465
*/
6566
protected function currentFrom(array $data): TokenInterface

src/BufferInterface.php

+6
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ 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+
*
1819
* @see \SeekableIterator::seek()
1920
*
2021
* @param int<0, max> $offset
@@ -25,6 +26,7 @@ public function seek($offset): void;
2526
* Return the current token.
2627
*
2728
* @link https://php.net/manual/en/iterator.current.php
29+
*
2830
* @see \Iterator::current()
2931
*/
3032
public function current(): TokenInterface;
@@ -33,6 +35,7 @@ public function current(): TokenInterface;
3335
* Return the ordinal id of the current token element.
3436
*
3537
* @link https://php.net/manual/en/iterator.key.php
38+
*
3639
* @see \Iterator::key()
3740
*
3841
* @return int<0, max>
@@ -43,6 +46,7 @@ public function key(): int;
4346
* Checks if current position is valid and iterator not completed.
4447
*
4548
* @link https://php.net/manual/en/iterator.valid.php
49+
*
4650
* @see \Iterator::valid()
4751
*/
4852
public function valid(): bool;
@@ -51,6 +55,7 @@ public function valid(): bool;
5155
* Rewind the BufferInterface to the first token element.
5256
*
5357
* @link https://php.net/manual/en/iterator.rewind.php
58+
*
5459
* @see \Iterator::rewind()
5560
*/
5661
public function rewind(): void;
@@ -59,6 +64,7 @@ public function rewind(): void;
5964
* Move forward to next token element.
6065
*
6166
* @link https://php.net/manual/en/iterator.next.php
67+
*
6268
* @see \Iterator::next()
6369
*/
6470
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,6 +38,7 @@ public function __construct(iterable $stream)
3838

3939
/**
4040
* @param iterable<TokenInterface> $stream
41+
*
4142
* @return \Generator<mixed, TokenInterface, mixed, mixed>
4243
*/
4344
private function toGenerator(iterable $stream): \Generator
@@ -113,7 +114,6 @@ protected function nextValid(): bool
113114
}
114115

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

tests/Unit/TestCase.php

+8-6
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,7 +95,8 @@ public function testRewindable(BufferInterface $buffer): void
9595
$needle = $buffer->current();
9696

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

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

114115
$buffer->rewind();
115116

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

118120
$this->assertSame($buffer->current(), $needle);
119121
}

0 commit comments

Comments
 (0)