Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test on PHP 8.2 #102

Merged
merged 8 commits into from
Sep 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,18 @@ jobs:

strategy:
matrix:
php-version: ['7.2', '7.3', '7.4', 'latest']
php-version:
- '7.2'
- '7.3'
- '7.4'
- '8.0'
- '8.1'
- '8.2'
- 'latest'
coverage: ['pcov']
dependencies: ['']
include:
- { php-version: '7.1', coverage: 'xdebug', dependencies: '' }
- { php-version: '8.0', coverage: 'pcov', dependencies: '' }
- { php-version: '8.1', coverage: 'pcov', dependencies: '' }

steps:
- name: Checkout code
Expand Down Expand Up @@ -68,7 +73,7 @@ jobs:

env:
PHP_VERSION: 8.0
PHP_CS_FIXER_VERSION: v3.2.1
PHP_CS_FIXER_VERSION: v3.11.0

steps:
- name: Checkout
Expand Down
2 changes: 2 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@
'php_unit_test_case_static_method_calls' => false,
'yoda_style' => true,
'random_api_migration' => false,
'blank_line_between_import_groups' => false,
'blank_line_before_statement' => ['statements' => ['break', 'continue', 'declare', 'return', 'throw', 'try']],
])
->setFinder(
PhpCsFixer\Finder::create()
Expand Down
5 changes: 3 additions & 2 deletions psalm.xml.dist
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?xml version="1.0"?>
<psalm
totallyTyped="true"
errorLevel="3"
errorLevel="2"
resolveFromConfigFile="true"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
Expand All @@ -21,5 +20,7 @@
<file name="example.php" />
</errorLevel>
</ForbiddenCode>
<MissingClosureParamType errorLevel="suppress" />
<MissingClosureReturnType errorLevel="suppress" />
</issueHandlers>
</psalm>
3 changes: 3 additions & 0 deletions src/Standard.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ public function __construct(iterable $input = null)
* An extra variant of `map` which unpacks arrays into arguments. Flattens inputs if no callback provided.
*
* @param ?callable $func
*
* @psalm-suppress InvalidArgument
*
* @return $this
Expand Down Expand Up @@ -627,6 +628,7 @@ private static function drainValues(Generator $input): Generator
* Simple and slow algorithm, commonly known as Algorithm R.
*
* @see https://en.wikipedia.org/wiki/Reservoir_sampling#Simple_algorithm
*
* @psalm-param positive-int $size
*/
private static function reservoirRandom(Generator $input, int $size): Generator
Expand Down Expand Up @@ -659,6 +661,7 @@ private static function reservoirRandom(Generator $input, int $size): Generator
* Weighted random sampling.
*
* @see https://en.wikipedia.org/wiki/Reservoir_sampling#Algorithm_A-Chao
*
* @psalm-param positive-int $size
*/
private static function reservoirWeighted(Generator $input, int $size, callable $weightFunc): Generator
Expand Down
1 change: 1 addition & 0 deletions tests/Benchmarks/BenchTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
* @covers \Pipeline\Standard
*
* @internal
*
* @long
*/
final class BenchTest extends TestCase
Expand Down
2 changes: 1 addition & 1 deletion tests/ErrorsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public function testUnpackNonIterable(): void
$this->expectException(TypeError::class);
// Older PHPUnit on 7.1 does not have this method
if (is_callable([$this, 'expectExceptionMessageMatches'])) {
$this->expectExceptionMessageMatches('/must .* iterable/');
$this->expectExceptionMessageMatches('/must .* (iterable|Traversable)/');
}
$pipeline->toArray();
}
Expand Down
2 changes: 2 additions & 0 deletions tests/SliceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ public static function specimens(): iterable

/**
* @dataProvider specimens
*
* @covers \Pipeline\Standard::slice()
*/
public function testSliceWithArrays(array $expected, array $input, int $offset, ?int $length = null, bool $useKeys = false): void
Expand All @@ -281,6 +282,7 @@ public function testSliceWithArrays(array $expected, array $input, int $offset,

/**
* @dataProvider specimens
*
* @covers \Pipeline\Standard::slice()
*/
public function testSliceWithIterables(array $expected, array $input, int $offset, ?int $length = null, bool $useKeys = false): void
Expand Down
2 changes: 1 addition & 1 deletion tests/StandardTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ public function testReduceFloat(): void

$result = $pipeline->reduce();

$this->assertSame(55 * 1.05, $result);
$this->assertEqualsWithDelta(55 * 1.05, $result, 0.0001);
}

public function testReduceArrays(): void
Expand Down