From bf335e0d48b26933791b56923ec8fbe24951d33c Mon Sep 17 00:00:00 2001 From: azjezz Date: Mon, 9 Dec 2024 01:04:06 +0100 Subject: [PATCH] chore: apply `mago fix --potentially-unsafe` Signed-off-by: azjezz --- tests/static-analysis/Fun/pipe.php | 12 ++++++------ tests/static-analysis/Option/zip.php | 2 +- tests/static-analysis/Type/intersection.php | 2 +- tests/static-analysis/Type/union.php | 2 +- tests/unit/Async/AwaitableTest.php | 8 ++++---- tests/unit/Collection/AbstractMapTest.php | 20 ++++++++++---------- tests/unit/Collection/AbstractSetTest.php | 14 +++++++------- tests/unit/Collection/AbstractVectorTest.php | 20 ++++++++++---------- tests/unit/Dict/PartitionTest.php | 4 ++-- tests/unit/Dict/PartitionWithKeyTest.php | 12 ++++++------ tests/unit/Iter/AllTest.php | 6 +++--- tests/unit/Iter/AnyTest.php | 6 +++--- tests/unit/Iter/ReduceKeysTest.php | 2 +- tests/unit/Iter/ReduceTest.php | 2 +- tests/unit/Iter/ReduceWithKeysTest.php | 6 +++--- tests/unit/Result/FailureTest.php | 2 +- tests/unit/Result/SuccessTest.php | 2 +- tests/unit/Type/ConvertedTypeTest.php | 4 ++-- tests/unit/Vec/FilterKeysTest.php | 4 ++-- tests/unit/Vec/FilterWithKeyTest.php | 2 +- tests/unit/Vec/FlatMapTest.php | 4 ++-- tests/unit/Vec/MapWithKeyTest.php | 2 +- tests/unit/Vec/ReductionsTest.php | 6 +++--- 23 files changed, 72 insertions(+), 72 deletions(-) diff --git a/tests/static-analysis/Fun/pipe.php b/tests/static-analysis/Fun/pipe.php index 84a3a860..8eb3d439 100644 --- a/tests/static-analysis/Fun/pipe.php +++ b/tests/static-analysis/Fun/pipe.php @@ -18,7 +18,7 @@ function test_too_few_argument_dont_matter(): int */ function test_too_many_argument_count_issues(): int { - $stages = pipe(static fn(string $x, string $y): int => 2); + $stages = pipe(static fn(string $_x, string $_y): int => 2); return $stages('hello'); } @@ -27,7 +27,7 @@ function test_too_many_argument_count_issues(): int */ function test_variadic_and_default_params(): int { - $stages = pipe(static fn(int $y, string $x = 'hello'): float => 1.2, static fn(float ...$items): int => 23); + $stages = pipe(static fn(int $_y, string $_x = 'hello'): float => 1.2, static fn(float ...$_items): int => 23); return $stages(123); } @@ -59,7 +59,7 @@ function test_invalid_arguments(): void */ function test_invalid_return_to_input_type(): float { - $stages = pipe(static fn(string $x): int => 2, static fn(string $y): float => 1.2); + $stages = pipe(static fn(string $_x): int => 2, static fn(string $_y): float => 1.2); return $stages('hello'); } @@ -68,7 +68,7 @@ function test_invalid_return_to_input_type(): float */ function test_invalid_input_type(): float { - $stages = pipe(static fn(string $x): int => 2, static fn(int $y): float => 1.2); + $stages = pipe(static fn(string $_x): int => 2, static fn(int $_y): float => 1.2); return $stages(143); } @@ -79,7 +79,7 @@ function test_invalid_input_type(): float */ function test_output_type_is_known(): void { - $stages = pipe(static fn(string $x): int => 2); + $stages = pipe(static fn(string $_x): int => 2); Psl\invariant( is_int($stages('hello')), @@ -92,6 +92,6 @@ function test_output_type_is_known(): void */ function test_first_class_callables(): int { - $stages = pipe($assignment = static fn(string $x): int => 2, static fn(): int => 2(...)); + $stages = pipe($assignment = static fn(string $_x): int => 2, static fn(): int => 2(...)); return $stages('hello'); } diff --git a/tests/static-analysis/Option/zip.php b/tests/static-analysis/Option/zip.php index 1caf944e..41f03ba8 100644 --- a/tests/static-analysis/Option/zip.php +++ b/tests/static-analysis/Option/zip.php @@ -72,5 +72,5 @@ function test_some_zip_with() */ function test_some_zip_with_2() { - return Option\some(1)->zipWith(Option\some('2'), static fn($a, $b) => $b); + return Option\some(1)->zipWith(Option\some('2'), static fn($_a, $b) => $b); } diff --git a/tests/static-analysis/Type/intersection.php b/tests/static-analysis/Type/intersection.php index 87ab1083..b1663b2f 100644 --- a/tests/static-analysis/Type/intersection.php +++ b/tests/static-analysis/Type/intersection.php @@ -12,7 +12,7 @@ * * @param Map&ResultInterface&stdClass&Vector $value */ -function takes_valid_intersection($value): void +function takes_valid_intersection($_value): void { } diff --git a/tests/static-analysis/Type/union.php b/tests/static-analysis/Type/union.php index 3ff57df6..82c5bd20 100644 --- a/tests/static-analysis/Type/union.php +++ b/tests/static-analysis/Type/union.php @@ -9,7 +9,7 @@ * * @param 'PENDING'|'PROCESSING'|'COMPLETED'|'ERROR' $state */ -function takes_valid_state(string $state): void +function takes_valid_state(string $_state): void { } diff --git a/tests/unit/Async/AwaitableTest.php b/tests/unit/Async/AwaitableTest.php index b67b8023..0d492c20 100644 --- a/tests/unit/Async/AwaitableTest.php +++ b/tests/unit/Async/AwaitableTest.php @@ -187,14 +187,14 @@ public function testThenOnSuccess(): void $awaitable = $awaitable->then( static fn(string $result) => Str\reverse($result), - static fn(Throwable $exception) => exit(0), + static fn(Throwable $_exception) => exit(0), ) ->then( static fn(string $result) => throw new InvariantViolationException($result), - static fn(Throwable $exception) => exit(0), + static fn(Throwable $_exception) => exit(0), ) - ->then(static fn($result) => exit(0), static fn(Throwable $exception) => throw $exception) - ->then(static fn($result) => exit(0), static fn(Throwable $exception) => $exception->getMessage()); + ->then(static fn($_result) => exit(0), static fn(Throwable $exception) => throw $exception) + ->then(static fn($_result) => exit(0), static fn(Throwable $exception) => $exception->getMessage()); static::assertSame('olleh', $awaitable->await()); } diff --git a/tests/unit/Collection/AbstractMapTest.php b/tests/unit/Collection/AbstractMapTest.php index cb2f4ae8..3fa267ff 100644 --- a/tests/unit/Collection/AbstractMapTest.php +++ b/tests/unit/Collection/AbstractMapTest.php @@ -187,7 +187,7 @@ public function testFilterWithKey(): void 3 => 'qux', ]); - $filtered = $map->filterWithKey(static fn(int $k, string $v) => 4 === $k); + $filtered = $map->filterWithKey(static fn(int $k, string $_v) => 4 === $k); static::assertInstanceOf($this->mapClass, $filtered); static::assertNotContains('bar', $filtered); @@ -267,14 +267,14 @@ public function testMapWithKey(): void 3 => 'qux', ]); - $mapped = $map->mapWithKey(static fn(int $k, string $v) => $k); + $mapped = $map->mapWithKey(static fn(int $k, string $_v) => $k); static::assertInstanceOf($this->mapClass, $mapped); static::assertNotSame($map, $mapped); static::assertSame($map->keys()->toArray(), $mapped->toArray()); static::assertCount(4, $mapped); - $mapped = $map->mapWithKey(static fn(int $k, string $v) => $v); + $mapped = $map->mapWithKey(static fn(int $_k, string $v) => $v); static::assertInstanceOf($this->mapClass, $mapped); static::assertNotSame($map, $mapped); @@ -429,19 +429,19 @@ public function testTake(): void public function testTakeWhile(): void { $map = $this->create([]); - $rest = $map->takeWhile(static fn($v) => false); + $rest = $map->takeWhile(static fn($_v) => false); static::assertInstanceOf($this->mapClass, $rest); static::assertNotSame($map, $rest); static::assertCount(0, $rest); $map = $this->create([]); - $rest = $map->takeWhile(static fn($v) => true); + $rest = $map->takeWhile(static fn($_v) => true); static::assertInstanceOf($this->mapClass, $rest); static::assertNotSame($map, $rest); static::assertCount(0, $rest); $map = $this->create(['foo' => 'bar', 'baz' => 'qux']); - $rest = $map->takeWhile(static fn($v) => true); + $rest = $map->takeWhile(static fn($_v) => true); static::assertInstanceOf($this->mapClass, $rest); static::assertNotSame($map, $rest); static::assertCount(2, $rest); @@ -487,25 +487,25 @@ public function testDrop(): void public function testDropWhile(): void { $map = $this->create([]); - $rest = $map->dropWhile(static fn($v) => true); + $rest = $map->dropWhile(static fn($_v) => true); static::assertInstanceOf($this->mapClass, $rest); static::assertNotSame($map, $rest); static::assertCount(0, $rest); $map = $this->create([]); - $rest = $map->dropWhile(static fn($v) => false); + $rest = $map->dropWhile(static fn($_v) => false); static::assertInstanceOf($this->mapClass, $rest); static::assertNotSame($map, $rest); static::assertCount(0, $rest); $map = $this->create(['foo' => 'bar', 'baz' => 'qux']); - $rest = $map->dropWhile(static fn($v) => true); + $rest = $map->dropWhile(static fn($_v) => true); static::assertInstanceOf($this->mapClass, $rest); static::assertNotSame($map, $rest); static::assertCount(0, $rest); $map = $this->create(['foo' => 'bar', 'baz' => 'qux']); - $rest = $map->dropWhile(static fn($v) => false); + $rest = $map->dropWhile(static fn($_v) => false); static::assertInstanceOf($this->mapClass, $rest); static::assertNotSame($map, $rest); static::assertCount(2, $rest); diff --git a/tests/unit/Collection/AbstractSetTest.php b/tests/unit/Collection/AbstractSetTest.php index ed5ad1f7..135d7470 100644 --- a/tests/unit/Collection/AbstractSetTest.php +++ b/tests/unit/Collection/AbstractSetTest.php @@ -354,19 +354,19 @@ public function testTake(): void public function testTakeWhile(): void { $set = $this->default(); - $rest = $set->takeWhile(static fn($v) => false); + $rest = $set->takeWhile(static fn($_v) => false); static::assertInstanceOf($this->setClass, $rest); static::assertNotSame($set, $rest); static::assertCount(0, $rest); $set = $this->default(); - $rest = $set->takeWhile(static fn($v) => true); + $rest = $set->takeWhile(static fn($_v) => true); static::assertInstanceOf($this->setClass, $rest); static::assertNotSame($set, $rest); static::assertCount(0, $rest); $set = $this->createFromList(['bar', 'qux']); - $rest = $set->takeWhile(static fn($v) => true); + $rest = $set->takeWhile(static fn($_v) => true); static::assertInstanceOf($this->setClass, $rest); static::assertNotSame($set, $rest); static::assertCount(2, $rest); @@ -412,25 +412,25 @@ public function testDrop(): void public function testDropWhile(): void { $set = $this->default(); - $rest = $set->dropWhile(static fn($v) => true); + $rest = $set->dropWhile(static fn($_v) => true); static::assertInstanceOf($this->setClass, $rest); static::assertNotSame($set, $rest); static::assertCount(0, $rest); $set = $this->default(); - $rest = $set->dropWhile(static fn($v) => false); + $rest = $set->dropWhile(static fn($_v) => false); static::assertInstanceOf($this->setClass, $rest); static::assertNotSame($set, $rest); static::assertCount(0, $rest); $set = $this->createFromList(['bar', 'qux']); - $rest = $set->dropWhile(static fn($v) => true); + $rest = $set->dropWhile(static fn($_v) => true); static::assertInstanceOf($this->setClass, $rest); static::assertNotSame($set, $rest); static::assertCount(0, $rest); $set = $this->createFromList(['bar', 'qux']); - $rest = $set->dropWhile(static fn($v) => false); + $rest = $set->dropWhile(static fn($_v) => false); static::assertInstanceOf($this->setClass, $rest); static::assertNotSame($set, $rest); static::assertCount(2, $rest); diff --git a/tests/unit/Collection/AbstractVectorTest.php b/tests/unit/Collection/AbstractVectorTest.php index 765759a0..77b1c9da 100644 --- a/tests/unit/Collection/AbstractVectorTest.php +++ b/tests/unit/Collection/AbstractVectorTest.php @@ -163,7 +163,7 @@ public function testFilterWithKey(): void 'qux', ]); - $filtered = $vector->filterWithKey(static fn(int $k, string $v) => 4 === $k); + $filtered = $vector->filterWithKey(static fn(int $k, string $_v) => 4 === $k); static::assertInstanceOf($this->vectorClass, $filtered); static::assertNotContains('bar', $filtered); @@ -243,14 +243,14 @@ public function testMapWithKey(): void 'qux', ]); - $mapped = $vector->mapWithKey(static fn(int $k, string $v) => $k); + $mapped = $vector->mapWithKey(static fn(int $k, string $_v) => $k); static::assertInstanceOf($this->vectorClass, $mapped); static::assertNotSame($vector, $mapped); static::assertSame($vector->keys()->toArray(), $mapped->toArray()); static::assertCount(4, $mapped); - $mapped = $vector->mapWithKey(static fn(int $k, string $v) => $v); + $mapped = $vector->mapWithKey(static fn(int $_k, string $v) => $v); static::assertInstanceOf($this->vectorClass, $mapped); static::assertNotSame($vector, $mapped); @@ -398,19 +398,19 @@ public function testTake(): void public function testTakeWhile(): void { $vector = $this->create([]); - $rest = $vector->takeWhile(static fn($v) => false); + $rest = $vector->takeWhile(static fn($_v) => false); static::assertInstanceOf($this->vectorClass, $rest); static::assertNotSame($vector, $rest); static::assertCount(0, $rest); $vector = $this->create([]); - $rest = $vector->takeWhile(static fn($v) => true); + $rest = $vector->takeWhile(static fn($_v) => true); static::assertInstanceOf($this->vectorClass, $rest); static::assertNotSame($vector, $rest); static::assertCount(0, $rest); $vector = $this->create(['bar', 'qux']); - $rest = $vector->takeWhile(static fn($v) => true); + $rest = $vector->takeWhile(static fn($_v) => true); static::assertInstanceOf($this->vectorClass, $rest); static::assertNotSame($vector, $rest); static::assertCount(2, $rest); @@ -456,25 +456,25 @@ public function testDrop(): void public function testDropWhile(): void { $vector = $this->create([]); - $rest = $vector->dropWhile(static fn($v) => true); + $rest = $vector->dropWhile(static fn($_v) => true); static::assertInstanceOf($this->vectorClass, $rest); static::assertNotSame($vector, $rest); static::assertCount(0, $rest); $vector = $this->create([]); - $rest = $vector->dropWhile(static fn($v) => false); + $rest = $vector->dropWhile(static fn($_v) => false); static::assertInstanceOf($this->vectorClass, $rest); static::assertNotSame($vector, $rest); static::assertCount(0, $rest); $vector = $this->create(['bar', 'qux']); - $rest = $vector->dropWhile(static fn($v) => true); + $rest = $vector->dropWhile(static fn($_v) => true); static::assertInstanceOf($this->vectorClass, $rest); static::assertNotSame($vector, $rest); static::assertCount(0, $rest); $vector = $this->create(['bar', 'qux']); - $rest = $vector->dropWhile(static fn($v) => false); + $rest = $vector->dropWhile(static fn($_v) => false); static::assertInstanceOf($this->vectorClass, $rest); static::assertNotSame($vector, $rest); static::assertCount(2, $rest); diff --git a/tests/unit/Dict/PartitionTest.php b/tests/unit/Dict/PartitionTest.php index 692623ee..d3639244 100644 --- a/tests/unit/Dict/PartitionTest.php +++ b/tests/unit/Dict/PartitionTest.php @@ -39,12 +39,12 @@ public function provideData(): array [ [[], ['foo', 'bar', 'baz', 'qux']], ['foo', 'bar', 'baz', 'qux'], - static fn(string $str) => false, + static fn(string $_str) => false, ], [ [['foo', 'bar', 'baz', 'qux'], []], ['foo', 'bar', 'baz', 'qux'], - static fn(string $str) => true, + static fn(string $_str) => true, ], ]; } diff --git a/tests/unit/Dict/PartitionWithKeyTest.php b/tests/unit/Dict/PartitionWithKeyTest.php index 675cc4cc..a3cdf9bc 100644 --- a/tests/unit/Dict/PartitionWithKeyTest.php +++ b/tests/unit/Dict/PartitionWithKeyTest.php @@ -24,12 +24,12 @@ public function provideData(): array [ [[1 => 'bar', 2 => 'baz'], [0 => 'foo', 3 => 'qux']], ['foo', 'bar', 'baz', 'qux'], - static fn(int $k, string $str) => Str\starts_with($str, 'b'), + static fn(int $_k, string $str) => Str\starts_with($str, 'b'), ], [ [[0 => 'foo', 3 => 'qux'], [1 => 'bar', 2 => 'baz']], ['foo', 'bar', 'baz', 'qux'], - static fn(int $k, string $str) => !Str\starts_with($str, 'b'), + static fn(int $_k, string $str) => !Str\starts_with($str, 'b'), ], [ [[], []], @@ -39,22 +39,22 @@ public function provideData(): array [ [[], ['foo', 'bar', 'baz', 'qux']], ['foo', 'bar', 'baz', 'qux'], - static fn(int $k, string $str) => false, + static fn(int $_k, string $_str) => false, ], [ [['foo', 'bar', 'baz', 'qux'], []], ['foo', 'bar', 'baz', 'qux'], - static fn(int $k, string $str) => true, + static fn(int $_k, string $_str) => true, ], [ [[1 => 'bar', 2 => 'baz', 3 => 'qux'], ['foo']], ['foo', 'bar', 'baz', 'qux'], - static fn(int $k, string $str) => (bool) $k, + static fn(int $k, string $_str) => (bool) $k, ], [ [['foo'], [1 => 'bar', 2 => 'baz', 3 => 'qux']], ['foo', 'bar', 'baz', 'qux'], - static fn(int $k, string $str) => !((bool) $k), + static fn(int $k, string $_str) => !((bool) $k), ], ]; } diff --git a/tests/unit/Iter/AllTest.php b/tests/unit/Iter/AllTest.php index 8c067d9c..65cf51fb 100644 --- a/tests/unit/Iter/AllTest.php +++ b/tests/unit/Iter/AllTest.php @@ -25,11 +25,11 @@ public function provideData(): iterable yield [false, [true, true, true], static fn(bool $value): bool => !$value]; yield [false, [false, false, false], static fn(bool $value): bool => $value]; yield [true, [false, false, false], static fn(bool $value): bool => !$value]; - yield [true, [false, false, false], static fn(bool $value): bool => true]; - yield [false, [false, false, false], static fn(bool $value): bool => false]; + yield [true, [false, false, false], static fn(bool $_value): bool => true]; + yield [false, [false, false, false], static fn(bool $_value): bool => false]; yield [false, [1, 2, 3], static fn(int $i): bool => $i > 3]; yield [true, [4, 5, 6], static fn(int $i): bool => $i > 3]; yield [false, [1, 2, 3, 4, 5, 6], static fn(int $i): bool => $i > 3]; - yield [true, [], static fn(bool $value): bool => false]; + yield [true, [], static fn(bool $_value): bool => false]; } } diff --git a/tests/unit/Iter/AnyTest.php b/tests/unit/Iter/AnyTest.php index 68fc0bf6..2546852d 100644 --- a/tests/unit/Iter/AnyTest.php +++ b/tests/unit/Iter/AnyTest.php @@ -25,11 +25,11 @@ public function provideData(): iterable yield [false, [true, true, true], static fn(bool $value): bool => !$value]; yield [false, [false, false, false], static fn(bool $value): bool => $value]; yield [true, [false, false, false], static fn(bool $value): bool => !$value]; - yield [true, [false, false, false], static fn(bool $value): bool => true]; - yield [false, [false, false, false], static fn(bool $value): bool => false]; + yield [true, [false, false, false], static fn(bool $_value): bool => true]; + yield [false, [false, false, false], static fn(bool $_value): bool => false]; yield [false, [1, 2, 3], static fn(int $i): bool => $i > 3]; yield [true, [4, 5, 6], static fn(int $i): bool => $i > 3]; yield [true, [1, 2, 3, 4, 5, 6], static fn(int $i): bool => $i > 3]; - yield [false, [], static fn(bool $value): bool => false]; + yield [false, [], static fn(bool $_value): bool => false]; } } diff --git a/tests/unit/Iter/ReduceKeysTest.php b/tests/unit/Iter/ReduceKeysTest.php index f677175a..80746768 100644 --- a/tests/unit/Iter/ReduceKeysTest.php +++ b/tests/unit/Iter/ReduceKeysTest.php @@ -19,7 +19,7 @@ public function testReduceKeys($expected, iterable $iterable, callable $function public function provideData(): iterable { - yield [null, [], static fn($accumulator, $k) => $accumulator, null]; + yield [null, [], static fn($accumulator, $_k) => $accumulator, null]; yield [3, [1, 2, 3], static fn($accumulator, $k) => $accumulator + $k, 0]; yield [ 3, diff --git a/tests/unit/Iter/ReduceTest.php b/tests/unit/Iter/ReduceTest.php index 1e3374b7..1fd8b658 100644 --- a/tests/unit/Iter/ReduceTest.php +++ b/tests/unit/Iter/ReduceTest.php @@ -19,7 +19,7 @@ public function testReduce($expected, iterable $iterable, callable $function, $i public function provideData(): iterable { - yield [null, [], static fn($accumulator, $v) => $accumulator, null]; + yield [null, [], static fn($accumulator, $_v) => $accumulator, null]; yield [6, [1, 2, 3], static fn($accumulator, $v) => $accumulator + $v, 0]; yield [ 6, diff --git a/tests/unit/Iter/ReduceWithKeysTest.php b/tests/unit/Iter/ReduceWithKeysTest.php index 775f5c12..03c6832d 100644 --- a/tests/unit/Iter/ReduceWithKeysTest.php +++ b/tests/unit/Iter/ReduceWithKeysTest.php @@ -19,12 +19,12 @@ public function testReduceWithKeys($expected, iterable $iterable, callable $func public function provideData(): iterable { - yield [null, [], static fn($accumulator, $k, $v) => $accumulator, null]; - yield [6, [1, 2, 3], static fn($accumulator, $k, $v) => $accumulator + $v, 0]; + yield [null, [], static fn($accumulator, $_k, $_v) => $accumulator, null]; + yield [6, [1, 2, 3], static fn($accumulator, $_k, $v) => $accumulator + $v, 0]; yield [ 6, Iter\to_iterator([1, 2, 3]), - static fn($accumulator, $k, $v) => $accumulator + $v, + static fn($accumulator, $_k, $v) => $accumulator + $v, 0, ]; } diff --git a/tests/unit/Result/FailureTest.php b/tests/unit/Result/FailureTest.php index 3ce0b2f9..9116dad1 100644 --- a/tests/unit/Result/FailureTest.php +++ b/tests/unit/Result/FailureTest.php @@ -53,7 +53,7 @@ public function testProceed(): void { $exception = new Exception('bar'); $wrapper = new Failure($exception); - $actual = $wrapper->proceed(static fn(string $result): int => 200, static fn(Exception $exception): int => 404); + $actual = $wrapper->proceed(static fn(string $_result): int => 200, static fn(Exception $_exception): int => 404); static::assertSame(404, $actual); } diff --git a/tests/unit/Result/SuccessTest.php b/tests/unit/Result/SuccessTest.php index 2701ba50..a5448630 100644 --- a/tests/unit/Result/SuccessTest.php +++ b/tests/unit/Result/SuccessTest.php @@ -52,7 +52,7 @@ public function testGetException(): void public function testProceed(): void { $wrapper = new Success('hello'); - $actual = $wrapper->proceed(static fn(string $result): int => 200, static fn(Exception $exception): int => 404); + $actual = $wrapper->proceed(static fn(string $_result): int => 200, static fn(Exception $_exception): int => 404); static::assertSame(200, $actual); } diff --git a/tests/unit/Type/ConvertedTypeTest.php b/tests/unit/Type/ConvertedTypeTest.php index 0823f7a6..3e76b33e 100644 --- a/tests/unit/Type/ConvertedTypeTest.php +++ b/tests/unit/Type/ConvertedTypeTest.php @@ -80,13 +80,13 @@ public static function provideCoerceExceptionExpectations(): iterable Type\converted( Type\int(), Type\string(), - static fn(int $i): string => throw new RuntimeException('not possible'), + static fn(int $_i): string => throw new RuntimeException('not possible'), ), 1, 'Could not coerce "int" to type "string" at path "convert(int): string": not possible.', ]; yield 'Coerce output error' => [ - Type\converted(Type\int(), Type\string(), static fn(int $i): object => new class() { + Type\converted(Type\int(), Type\string(), static fn(int $_i): object => new class() { }), 1, 'Could not coerce "class@anonymous" to type "string" at path "coerce_output(class@anonymous): string".', diff --git a/tests/unit/Vec/FilterKeysTest.php b/tests/unit/Vec/FilterKeysTest.php index be4804b0..87fefb1b 100644 --- a/tests/unit/Vec/FilterKeysTest.php +++ b/tests/unit/Vec/FilterKeysTest.php @@ -34,12 +34,12 @@ public function provideData(): iterable yield [ [], Collection\Vector::fromArray(['a', 'b']), - static fn(int $k): bool => false, + static fn(int $_k): bool => false, ]; yield [ [], Collection\Vector::fromArray([]), - static fn(int $k): bool => false, + static fn(int $_k): bool => false, ]; yield [[], ['a', 'b'], static fn(int $_) => false]; yield [['a', 'b'], ['a', 'b'], static fn(int $_): bool => true]; diff --git a/tests/unit/Vec/FilterWithKeyTest.php b/tests/unit/Vec/FilterWithKeyTest.php index 96748347..35e2598f 100644 --- a/tests/unit/Vec/FilterWithKeyTest.php +++ b/tests/unit/Vec/FilterWithKeyTest.php @@ -44,7 +44,7 @@ public function provideData(): iterable Collection\Vector::fromArray(['a', 'b']), static fn(int $_k, string $_v): bool => true, ]; - yield [['a'], ['a', 'b'], static fn(int $k, string $v): bool => 'b' !== $v]; + yield [['a'], ['a', 'b'], static fn(int $_k, string $v): bool => 'b' !== $v]; yield [[], ['a', 'b'], static fn(int $k, string $v): bool => 'b' !== $v && 0 !== $k]; yield [['a'], ['a', 'b'], static fn(int $k, string $v): bool => 'b' !== $v && 1 !== $k]; yield [[], ['a', 'b'], static fn(int $k, string $v): bool => 'a' !== $v && 1 !== $k]; diff --git a/tests/unit/Vec/FlatMapTest.php b/tests/unit/Vec/FlatMapTest.php index 1774864d..8a5e67c6 100644 --- a/tests/unit/Vec/FlatMapTest.php +++ b/tests/unit/Vec/FlatMapTest.php @@ -24,9 +24,9 @@ public function provideData(): iterable { yield [[1, 2, 3], [1, 2, 3], static fn(int $v): array => [$v]]; yield [[1, 2, 2, 4, 3, 6], [1, 2, 3], static fn(int $v): array => [$v, $v * 2]]; - yield [[], [1, 2], static fn(int $k): array => []]; + yield [[], [1, 2], static fn(int $_k): array => []]; yield [[[1], [2]], [1, 2], static fn(int $v): array => [[$v]]]; - yield [[], [], static fn(int $k): array => []]; + yield [[], [], static fn(int $_k): array => []]; yield [ ['The', 'quick', 'brown', 'fox', 'jumps', 'over', 'the', 'lazy', 'dog', ''], ['The quick brown', 'fox', 'jumps over', 'the lazy dog', ''], diff --git a/tests/unit/Vec/MapWithKeyTest.php b/tests/unit/Vec/MapWithKeyTest.php index d5d9a585..ed0fa16b 100644 --- a/tests/unit/Vec/MapWithKeyTest.php +++ b/tests/unit/Vec/MapWithKeyTest.php @@ -21,7 +21,7 @@ public function testMapWithKey(array $expected, array $array, callable $function public function provideData(): iterable { - yield [[1, 2, 3], ['a' => 1, 'b' => 2, 'c' => 3], static fn(string $k, int $v): int => $v]; + yield [[1, 2, 3], ['a' => 1, 'b' => 2, 'c' => 3], static fn(string $_k, int $v): int => $v]; yield [[1, 3, 5], [1, 2, 3], static fn(int $k, int $v): int => $k + $v]; yield [[0, 4, 16], [1, 2, 3], static fn(int $k, int $v): int => $k * (2 ** $v)]; yield [['1', '3', '5'], [1, 2, 3], static fn(int $k, int $v): string => (string) ($k + $v)]; diff --git a/tests/unit/Vec/ReductionsTest.php b/tests/unit/Vec/ReductionsTest.php index b26e419b..2b0820f9 100644 --- a/tests/unit/Vec/ReductionsTest.php +++ b/tests/unit/Vec/ReductionsTest.php @@ -34,21 +34,21 @@ public function provideData(): iterable yield [ [], [], - static fn(int $accumulator, int $k, int $v): int => $accumulator, + static fn(int $accumulator, int $_k, int $_v): int => $accumulator, 0, ]; yield [ [1, 3, 6], [1, 2, 3], - static fn(int $accumulator, int $k, int $v): int => $accumulator + $v, + static fn(int $accumulator, int $_k, int $v): int => $accumulator + $v, 0, ]; yield [ [1, 3, 6], Iter\to_iterator([1, 2, 3]), - static fn(int $accumulator, int $k, int $v): int => $accumulator + $v, + static fn(int $accumulator, int $_k, int $v): int => $accumulator + $v, 0, ]; }