From 70b9b866050a930bd13470eebcf6e20a1c9e07e6 Mon Sep 17 00:00:00 2001 From: azjezz Date: Sun, 29 Dec 2024 22:30:05 +0100 Subject: [PATCH] chore: apply mago fix -p Signed-off-by: azjezz --- tests/static-analysis/Fun/pipe.php | 26 ++--- tests/static-analysis/Option/zip.php | 2 +- tests/static-analysis/Type/intersection.php | 6 +- tests/static-analysis/Type/union.php | 4 +- 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/DateTime/DurationTest.php | 117 +++++++++---------- tests/unit/DateTime/MonthTest.php | 10 +- tests/unit/DateTime/SecondsStyleTest.php | 2 +- tests/unit/DateTime/TimestampTest.php | 32 ++--- 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 | 5 +- tests/unit/Result/SuccessTest.php | 5 +- tests/unit/TCP/ServerOptionsTest.php | 2 +- tests/unit/Type/ConvertedTypeTest.php | 4 +- tests/unit/Type/ShapeTypeTest.php | 2 +- 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 +- 29 files changed, 164 insertions(+), 171 deletions(-) diff --git a/tests/static-analysis/Fun/pipe.php b/tests/static-analysis/Fun/pipe.php index ec0d40d7..beb6457a 100644 --- a/tests/static-analysis/Fun/pipe.php +++ b/tests/static-analysis/Fun/pipe.php @@ -14,20 +14,17 @@ function test_too_few_argument_dont_matter(): int } /** - * @psalm-suppress InvalidArgument, UnusedClosureParam + * @psalm-suppress InvalidArgument */ 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'); } -/** - * @psalm-suppress UnusedClosureParam - */ 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); } @@ -55,40 +52,37 @@ function test_invalid_arguments(): void } /** - * @psalm-suppress InvalidScalarArgument, UnusedClosureParam + * @psalm-suppress InvalidScalarArgument */ 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'); } /** - * @psalm-suppress UnusedClosureParam, InvalidArgument + * @psalm-suppress InvalidArgument */ 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); } /** * @throws InvariantViolationException * - * @psalm-suppress UnusedClosureParam, RedundantCondition + * @psalm-suppress RedundantCondition */ 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')), 'Expected output of int'); } -/** - * @psalm-suppress UnusedClosureParam - */ 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..1391c645 100644 --- a/tests/static-analysis/Type/intersection.php +++ b/tests/static-analysis/Type/intersection.php @@ -8,11 +8,9 @@ use Psl\Type; /** - * @psalm-suppress UnusedParam - * - * @param Map&ResultInterface&stdClass&Vector $value + * @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..3fca082d 100644 --- a/tests/static-analysis/Type/union.php +++ b/tests/static-analysis/Type/union.php @@ -5,11 +5,9 @@ use Psl\Type; /** - * @psalm-suppress UnusedParam - * * @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 1b283fbe..10f2800b 100644 --- a/tests/unit/Async/AwaitableTest.php +++ b/tests/unit/Async/AwaitableTest.php @@ -186,13 +186,13 @@ public function testThenOnSuccess(): void }); $awaitable = $awaitable - ->then(static fn(string $result) => Str\reverse($result), static fn(Throwable $exception) => exit(0)) + ->then(static fn(string $result) => Str\reverse($result), 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 553cea0f..6d95aa57 100644 --- a/tests/unit/Collection/AbstractMapTest.php +++ b/tests/unit/Collection/AbstractMapTest.php @@ -181,7 +181,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); @@ -261,14 +261,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); @@ -423,19 +423,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); @@ -481,25 +481,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 fe8abc8d..408f89e5 100644 --- a/tests/unit/Collection/AbstractSetTest.php +++ b/tests/unit/Collection/AbstractSetTest.php @@ -348,19 +348,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); @@ -406,25 +406,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 0febc26f..c3fbb35f 100644 --- a/tests/unit/Collection/AbstractVectorTest.php +++ b/tests/unit/Collection/AbstractVectorTest.php @@ -157,7 +157,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); @@ -237,14 +237,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); @@ -392,19 +392,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); @@ -450,25 +450,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/DateTime/DurationTest.php b/tests/unit/DateTime/DurationTest.php index 61d4232a..a78b355a 100644 --- a/tests/unit/DateTime/DurationTest.php +++ b/tests/unit/DateTime/DurationTest.php @@ -20,11 +20,11 @@ public function testGetters(): void { $t = DateTime\Duration::fromParts(1, 2, 3, 4); - static::assertEquals(1, $t->getHours()); - static::assertEquals(2, $t->getMinutes()); - static::assertEquals(3, $t->getSeconds()); - static::assertEquals(4, $t->getNanoseconds()); - static::assertEquals([1, 2, 3, 4], $t->getParts()); + static::assertSame(1, $t->getHours()); + static::assertSame(2, $t->getMinutes()); + static::assertSame(3, $t->getSeconds()); + static::assertSame(4, $t->getNanoseconds()); + static::assertSame([1, 2, 3, 4], $t->getParts()); } public function testNamedConstructors() @@ -65,7 +65,7 @@ public function testGetTotalHours( float $expectedHours, ): void { $time = DateTime\Duration::fromParts($hours, $minutes, $seconds, $nanoseconds); - static::assertEquals($expectedHours, $time->getTotalHours()); + static::assertSame($expectedHours, $time->getTotalHours()); } public function provideGetTotalMinutes(): array @@ -93,7 +93,7 @@ public function testGetTotalMinutes( float $expectedMinutes, ): void { $time = DateTime\Duration::fromParts($hours, $minutes, $seconds, $nanoseconds); - static::assertEquals($expectedMinutes, $time->getTotalMinutes()); + static::assertSame($expectedMinutes, $time->getTotalMinutes()); } public function provideGetTotalSeconds(): array @@ -121,7 +121,7 @@ public function testGetTotalSeconds( float $expectedSeconds, ): void { $time = DateTime\Duration::fromParts($hours, $minutes, $seconds, $nanoseconds); - static::assertEquals($expectedSeconds, $time->getTotalSeconds()); + static::assertSame($expectedSeconds, $time->getTotalSeconds()); } public function provideGetTotalMilliseconds(): array @@ -149,7 +149,7 @@ public function testGetTotalMilliseconds( float $expectedMilliseconds, ): void { $time = DateTime\Duration::fromParts($hours, $minutes, $seconds, $nanoseconds); - static::assertEquals($expectedMilliseconds, $time->getTotalMilliseconds()); + static::assertSame($expectedMilliseconds, $time->getTotalMilliseconds()); } public function provideGetTotalMicroseconds(): array @@ -177,34 +177,34 @@ public function testGetTotalMicroseconds( float $expectedMicroseconds, ): void { $time = DateTime\Duration::fromParts($hours, $minutes, $seconds, $nanoseconds); - static::assertEquals($expectedMicroseconds, $time->getTotalMicroseconds()); + static::assertSame($expectedMicroseconds, $time->getTotalMicroseconds()); } public function testSetters(): void { $t = DateTime\Duration::fromParts(1, 2, 3, 4); - static::assertEquals([42, 2, 3, 4], $t->withHours(42)->getParts()); - static::assertEquals([1, 42, 3, 4], $t->withMinutes(42)->getParts()); - static::assertEquals([1, 2, 42, 4], $t->withSeconds(42)->getParts()); - static::assertEquals([1, 2, 3, 42], $t->withNanoseconds(42)->getParts()); - static::assertEquals([2, 3, 3, 4], $t->withMinutes(63)->getParts()); - static::assertEquals([1, 3, 3, 4], $t->withSeconds(63)->getParts()); - static::assertEquals([1, 2, 4, 42], $t->withNanoseconds(DateTime\NANOSECONDS_PER_SECOND + 42)->getParts()); - static::assertEquals([1, 2, 3, 4], $t->getParts()); + static::assertSame([42, 2, 3, 4], $t->withHours(42)->getParts()); + static::assertSame([1, 42, 3, 4], $t->withMinutes(42)->getParts()); + static::assertSame([1, 2, 42, 4], $t->withSeconds(42)->getParts()); + static::assertSame([1, 2, 3, 42], $t->withNanoseconds(42)->getParts()); + static::assertSame([2, 3, 3, 4], $t->withMinutes(63)->getParts()); + static::assertSame([1, 3, 3, 4], $t->withSeconds(63)->getParts()); + static::assertSame([1, 2, 4, 42], $t->withNanoseconds(DateTime\NANOSECONDS_PER_SECOND + 42)->getParts()); + static::assertSame([1, 2, 3, 4], $t->getParts()); } public function testFractionsOfSecond(): void { - static::assertEquals([0, 0, 0, 0], DateTime\Duration::zero()->getParts()); - static::assertEquals([0, 0, 0, 42], DateTime\Duration::nanoseconds(42)->getParts()); - static::assertEquals( + static::assertSame([0, 0, 0, 0], DateTime\Duration::zero()->getParts()); + static::assertSame([0, 0, 0, 42], DateTime\Duration::nanoseconds(42)->getParts()); + static::assertSame( [0, 0, 1, 42], DateTime\Duration::nanoseconds(DateTime\NANOSECONDS_PER_SECOND + 42)->getParts(), ); - static::assertEquals([0, 0, 0, 42000], DateTime\Duration::microseconds(42)->getParts()); - static::assertEquals([0, 0, 1, 42000], DateTime\Duration::microseconds(1000042)->getParts()); - static::assertEquals([0, 0, 0, 42000000], DateTime\Duration::milliseconds(42)->getParts()); - static::assertEquals([0, 0, 1, 42000000], DateTime\Duration::milliseconds(1042)->getParts()); + static::assertSame([0, 0, 0, 42000], DateTime\Duration::microseconds(42)->getParts()); + static::assertSame([0, 0, 1, 42000], DateTime\Duration::microseconds(1000042)->getParts()); + static::assertSame([0, 0, 0, 42000000], DateTime\Duration::milliseconds(42)->getParts()); + static::assertSame([0, 0, 1, 42000000], DateTime\Duration::milliseconds(1042)->getParts()); } /** @@ -231,7 +231,7 @@ public static function provideNormalized(): array */ public function testNormalized(int $input_s, int $input_ns, int $normalized_s, int $normalized_ns): void { - static::assertEquals( + static::assertSame( [0, 0, $normalized_s, $normalized_ns], DateTime\Duration::fromParts(0, 0, $input_s, $input_ns)->getParts(), ); @@ -239,19 +239,16 @@ public function testNormalized(int $input_s, int $input_ns, int $normalized_s, i public function testNormalizedHMS(): void { - static::assertEquals([3, 5, 4, 0], DateTime\Duration::fromParts(2, 63, 124)->getParts()); - static::assertEquals([0, 59, 4, 0], DateTime\Duration::fromParts(2, -63, 124)->getParts()); - static::assertEquals( + static::assertSame([3, 5, 4, 0], DateTime\Duration::fromParts(2, 63, 124)->getParts()); + static::assertSame([0, 59, 4, 0], DateTime\Duration::fromParts(2, -63, 124)->getParts()); + static::assertSame( [-1, 0, -55, -(DateTime\NANOSECONDS_PER_SECOND - 42)], DateTime\Duration::fromParts(0, -63, 124, 42)->getParts(), ); - static::assertEquals([42, 0, 0, 0], DateTime\Duration::hours(42)->getParts()); - static::assertEquals([1, 3, 0, 0], DateTime\Duration::minutes(63)->getParts()); - static::assertEquals([0, -1, -3, 0], DateTime\Duration::seconds(-63)->getParts()); - static::assertEquals( - [0, 0, -1, 0], - DateTime\Duration::nanoseconds(-DateTime\NANOSECONDS_PER_SECOND)->getParts(), - ); + static::assertSame([42, 0, 0, 0], DateTime\Duration::hours(42)->getParts()); + static::assertSame([1, 3, 0, 0], DateTime\Duration::minutes(63)->getParts()); + static::assertSame([0, -1, -3, 0], DateTime\Duration::seconds(-63)->getParts()); + static::assertSame([0, 0, -1, 0], DateTime\Duration::nanoseconds(-DateTime\NANOSECONDS_PER_SECOND)->getParts()); } /** @@ -273,9 +270,9 @@ public static function providePositiveNegative(): array public function testPositiveNegative(int $h, int $m, int $s, int $ns, int $expected_sign): void { $t = DateTime\Duration::fromParts($h, $m, $s, $ns); - static::assertEquals($expected_sign === 0, $t->isZero()); - static::assertEquals($expected_sign === 1, $t->isPositive()); - static::assertEquals($expected_sign === -1, $t->isNegative()); + static::assertSame($expected_sign === 0, $t->isZero()); + static::assertSame($expected_sign === 1, $t->isPositive()); + static::assertSame($expected_sign === -1, $t->isNegative()); } /** @@ -299,13 +296,13 @@ public function testCompare(DateTime\Duration $a, DateTime\Duration $b, Order $e { $opposite = Order::from(-$expected->value); - static::assertEquals($expected, $a->compare($b)); - static::assertEquals($opposite, $b->compare($a)); - static::assertEquals($expected === Order::Equal, $a->equals($b)); - static::assertEquals($expected === Order::Less, $a->shorter($b)); - static::assertEquals($expected !== Order::Greater, $a->shorterOrEqual($b)); - static::assertEquals($expected === Order::Greater, $a->longer($b)); - static::assertEquals($expected !== Order::Less, $a->longerOrEqual($b)); + static::assertSame($expected, $a->compare($b)); + static::assertSame($opposite, $b->compare($a)); + static::assertSame($expected === Order::Equal, $a->equals($b)); + static::assertSame($expected === Order::Less, $a->shorter($b)); + static::assertSame($expected !== Order::Greater, $a->shorterOrEqual($b)); + static::assertSame($expected === Order::Greater, $a->longer($b)); + static::assertSame($expected !== Order::Less, $a->longerOrEqual($b)); static::assertFalse($a->betweenExclusive($a, $a)); static::assertFalse($a->betweenExclusive($a, $b)); static::assertFalse($a->betweenExclusive($b, $a)); @@ -313,7 +310,7 @@ public function testCompare(DateTime\Duration $a, DateTime\Duration $b, Order $e static::assertTrue($a->betweenInclusive($a, $a)); static::assertTrue($a->betweenInclusive($a, $b)); static::assertTrue($a->betweenInclusive($b, $a)); - static::assertEquals($expected === Order::Equal, $a->betweenInclusive($b, $b)); + static::assertSame($expected === Order::Equal, $a->betweenInclusive($b, $b)); } public function testIsBetween(): void @@ -336,18 +333,18 @@ public function testOperations(): void $z = DateTime\Duration::zero(); $a = DateTime\Duration::fromParts(0, 2, 25); $b = DateTime\Duration::fromParts(0, 0, -63, 42); - static::assertEquals([0, 0, 0, 0], $z->invert()->getParts()); - static::assertEquals([0, -2, -25, 0], $a->invert()->getParts()); - static::assertEquals([0, 1, 2, DateTime\NANOSECONDS_PER_SECOND - 42], $b->invert()->getParts()); - static::assertEquals($a->getParts(), $z->plus($a)->getParts()); - static::assertEquals($b->getParts(), $b->plus($z)->getParts()); - static::assertEquals($b->invert()->getParts(), $z->minus($b)->getParts()); - static::assertEquals($a->getParts(), $a->minus($z)->getParts()); - static::assertEquals([0, 1, 22, 42], $a->plus($b)->getParts()); - static::assertEquals([0, 1, 22, 42], $b->plus($a)->getParts()); - static::assertEquals([0, 3, 27, DateTime\NANOSECONDS_PER_SECOND - 42], $a->minus($b)->getParts()); - static::assertEquals([0, -3, -27, -(DateTime\NANOSECONDS_PER_SECOND - 42)], $b->minus($a)->getParts()); - static::assertEquals($b->invert()->plus($a)->getParts(), $a->minus($b)->getParts()); + static::assertSame([0, 0, 0, 0], $z->invert()->getParts()); + static::assertSame([0, -2, -25, 0], $a->invert()->getParts()); + static::assertSame([0, 1, 2, DateTime\NANOSECONDS_PER_SECOND - 42], $b->invert()->getParts()); + static::assertSame($a->getParts(), $z->plus($a)->getParts()); + static::assertSame($b->getParts(), $b->plus($z)->getParts()); + static::assertSame($b->invert()->getParts(), $z->minus($b)->getParts()); + static::assertSame($a->getParts(), $a->minus($z)->getParts()); + static::assertSame([0, 1, 22, 42], $a->plus($b)->getParts()); + static::assertSame([0, 1, 22, 42], $b->plus($a)->getParts()); + static::assertSame([0, 3, 27, DateTime\NANOSECONDS_PER_SECOND - 42], $a->minus($b)->getParts()); + static::assertSame([0, -3, -27, -(DateTime\NANOSECONDS_PER_SECOND - 42)], $b->minus($a)->getParts()); + static::assertSame($b->invert()->plus($a)->getParts(), $a->minus($b)->getParts()); } /** @@ -380,7 +377,7 @@ public static function provideToString(): array */ public function testToString(int $h, int $m, int $s, int $ns, string $expected): void { - static::assertEquals($expected, DateTime\Duration::fromParts($h, $m, $s, $ns)->toString()); + static::assertSame($expected, DateTime\Duration::fromParts($h, $m, $s, $ns)->toString()); } public function testSerialization(): void diff --git a/tests/unit/DateTime/MonthTest.php b/tests/unit/DateTime/MonthTest.php index 3d52a0c1..1cecf763 100644 --- a/tests/unit/DateTime/MonthTest.php +++ b/tests/unit/DateTime/MonthTest.php @@ -16,7 +16,7 @@ final class MonthTest extends TestCase */ public function testGetPrevious(Month $month, Month $expected): void { - static::assertEquals($expected, $month->getPrevious()); + static::assertSame($expected, $month->getPrevious()); } /** @@ -24,7 +24,7 @@ public function testGetPrevious(Month $month, Month $expected): void */ public function testGetNext(Month $month, Month $expected): void { - static::assertEquals($expected, $month->getNext()); + static::assertSame($expected, $month->getNext()); } /** @@ -32,8 +32,8 @@ public function testGetNext(Month $month, Month $expected): void */ public function testGetDays(Month $month, int $expectedForLeapYear, int $expectedForNonLeapYear): void { - static::assertEquals($expectedForLeapYear, $month->getLeapYearDays()); - static::assertEquals($expectedForNonLeapYear, $month->getNonLeapYearDays()); + static::assertSame($expectedForLeapYear, $month->getLeapYearDays()); + static::assertSame($expectedForNonLeapYear, $month->getNonLeapYearDays()); } /** @@ -41,7 +41,7 @@ public function testGetDays(Month $month, int $expectedForLeapYear, int $expecte */ public function testGetDaysForYear(Month $month, int $year, int $expected): void { - static::assertEquals($expected, $month->getDaysForYear($year)); + static::assertSame($expected, $month->getDaysForYear($year)); } /** diff --git a/tests/unit/DateTime/SecondsStyleTest.php b/tests/unit/DateTime/SecondsStyleTest.php index 7a9cc80e..be6e396e 100644 --- a/tests/unit/DateTime/SecondsStyleTest.php +++ b/tests/unit/DateTime/SecondsStyleTest.php @@ -17,7 +17,7 @@ final class SecondsStyleTest extends TestCase */ public function testFromTimestamp(SecondsStyle $expectedSecondsStyle, Timestamp $timestamp): void { - static::assertEquals($expectedSecondsStyle, SecondsStyle::fromTimestamp($timestamp)); + static::assertSame($expectedSecondsStyle, SecondsStyle::fromTimestamp($timestamp)); } /** diff --git a/tests/unit/DateTime/TimestampTest.php b/tests/unit/DateTime/TimestampTest.php index cc630ff1..431804b2 100644 --- a/tests/unit/DateTime/TimestampTest.php +++ b/tests/unit/DateTime/TimestampTest.php @@ -85,23 +85,23 @@ public function testFromRowSimplifiesNanoseconds(): void { $timestamp = Timestamp::fromParts(0, NANOSECONDS_PER_SECOND * 20); - static::assertEquals(20, $timestamp->getSeconds()); - static::assertEquals(0, $timestamp->getNanoseconds()); + static::assertSame(20, $timestamp->getSeconds()); + static::assertSame(0, $timestamp->getNanoseconds()); $timestamp = Timestamp::fromParts(0, 100 + (NANOSECONDS_PER_SECOND * 20)); - static::assertEquals(20, $timestamp->getSeconds()); - static::assertEquals(100, $timestamp->getNanoseconds()); + static::assertSame(20, $timestamp->getSeconds()); + static::assertSame(100, $timestamp->getNanoseconds()); $timestamp = Timestamp::fromParts(30, -NANOSECONDS_PER_SECOND * 20); - static::assertEquals(10, $timestamp->getSeconds()); - static::assertEquals(0, $timestamp->getNanoseconds()); + static::assertSame(10, $timestamp->getSeconds()); + static::assertSame(0, $timestamp->getNanoseconds()); $timestamp = Timestamp::fromParts(10, 100 + (-NANOSECONDS_PER_SECOND * 20)); - static::assertEquals(-10, $timestamp->getSeconds()); - static::assertEquals(100, $timestamp->getNanoseconds()); + static::assertSame(-10, $timestamp->getSeconds()); + static::assertSame(100, $timestamp->getNanoseconds()); } public function testParsingFromPattern(): void @@ -258,13 +258,13 @@ public function testCompare(Timestamp $a, Timestamp $b, Order $expected): void { $opposite = Order::from(-$expected->value); - static::assertEquals($expected, $a->compare($b)); - static::assertEquals($opposite, $b->compare($a)); - static::assertEquals($expected === Order::Equal, $a->equals($b)); - static::assertEquals($expected === Order::Less, $a->before($b)); - static::assertEquals($expected !== Order::Greater, $a->beforeOrAtTheSameTime($b)); - static::assertEquals($expected === Order::Greater, $a->after($b)); - static::assertEquals($expected !== Order::Less, $a->afterOrAtTheSameTime($b)); + static::assertSame($expected, $a->compare($b)); + static::assertSame($opposite, $b->compare($a)); + static::assertSame($expected === Order::Equal, $a->equals($b)); + static::assertSame($expected === Order::Less, $a->before($b)); + static::assertSame($expected !== Order::Greater, $a->beforeOrAtTheSameTime($b)); + static::assertSame($expected === Order::Greater, $a->after($b)); + static::assertSame($expected !== Order::Less, $a->afterOrAtTheSameTime($b)); static::assertFalse($a->betweenTimeExclusive($a, $a)); static::assertFalse($a->betweenTimeExclusive($a, $b)); static::assertFalse($a->betweenTimeExclusive($b, $a)); @@ -272,7 +272,7 @@ public function testCompare(Timestamp $a, Timestamp $b, Order $expected): void static::assertTrue($a->betweenTimeInclusive($a, $a)); static::assertTrue($a->betweenTimeInclusive($a, $b)); static::assertTrue($a->betweenTimeInclusive($b, $a)); - static::assertEquals($expected === Order::Equal, $a->betweenTimeInclusive($b, $b)); + static::assertSame($expected === Order::Equal, $a->betweenTimeInclusive($b, $b)); } public function testNanosecondsModifications(): void 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 d48f2fd2..b220da88 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, Iter\to_iterator([1, 2, 3]), static fn($accumulator, $k) => $accumulator + $k, 0]; } diff --git a/tests/unit/Iter/ReduceTest.php b/tests/unit/Iter/ReduceTest.php index a600e84c..2b318681 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, Iter\to_iterator([1, 2, 3]), static fn($accumulator, $v) => $accumulator + $v, 0]; } diff --git a/tests/unit/Iter/ReduceWithKeysTest.php b/tests/unit/Iter/ReduceWithKeysTest.php index 463e38d1..0a883cb3 100644 --- a/tests/unit/Iter/ReduceWithKeysTest.php +++ b/tests/unit/Iter/ReduceWithKeysTest.php @@ -19,8 +19,8 @@ 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 [6, Iter\to_iterator([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, 0]; } } diff --git a/tests/unit/Result/FailureTest.php b/tests/unit/Result/FailureTest.php index 3ce0b2f9..51fef31c 100644 --- a/tests/unit/Result/FailureTest.php +++ b/tests/unit/Result/FailureTest.php @@ -53,7 +53,10 @@ 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..8860c9b8 100644 --- a/tests/unit/Result/SuccessTest.php +++ b/tests/unit/Result/SuccessTest.php @@ -52,7 +52,10 @@ 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/TCP/ServerOptionsTest.php b/tests/unit/TCP/ServerOptionsTest.php index 8347bc8b..0c8a8f1f 100644 --- a/tests/unit/TCP/ServerOptionsTest.php +++ b/tests/unit/TCP/ServerOptionsTest.php @@ -15,7 +15,7 @@ public function testDefaultOptions(): void $options = ServerOptions::default(); static::assertFalse($options->noDelay); - static::assertEquals(ServerOptions::DEFAULT_IDLE_CONNECTIONS, $options->idleConnections); + static::assertSame(ServerOptions::DEFAULT_IDLE_CONNECTIONS, $options->idleConnections); static::assertEquals(SocketOptions::default(), $options->socketOptions); } public function testNoDelay(): void diff --git a/tests/unit/Type/ConvertedTypeTest.php b/tests/unit/Type/ConvertedTypeTest.php index c7df8b20..b850f7f5 100644 --- a/tests/unit/Type/ConvertedTypeTest.php +++ b/tests/unit/Type/ConvertedTypeTest.php @@ -79,7 +79,7 @@ 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.', @@ -88,7 +88,7 @@ public static function provideCoerceExceptionExpectations(): iterable Type\converted( Type\int(), Type\string(), - static fn(int $i): object => new class() { + static fn(int $_i): object => new class() { }, ), 1, diff --git a/tests/unit/Type/ShapeTypeTest.php b/tests/unit/Type/ShapeTypeTest.php index 680ce28c..e344d7ce 100644 --- a/tests/unit/Type/ShapeTypeTest.php +++ b/tests/unit/Type/ShapeTypeTest.php @@ -34,7 +34,7 @@ public function getType(): Type\TypeInterface public function testWillConsiderUnknownIterableFieldsWhenCoercing(): void { - static::assertEquals( + static::assertSame( [ 'defined_key' => 'value', 'additional_key' => 'value', diff --git a/tests/unit/Vec/FilterKeysTest.php b/tests/unit/Vec/FilterKeysTest.php index 0cfdf394..039c9e39 100644 --- a/tests/unit/Vec/FilterKeysTest.php +++ b/tests/unit/Vec/FilterKeysTest.php @@ -27,8 +27,8 @@ public function provideData(): iterable yield [['a'], ['a', 'b'], static fn(int $k): bool => $k !== 1]; yield [['b'], ['a', 'b'], static fn(int $k): bool => $k !== 0]; yield [['b'], Collection\Vector::fromArray(['a', 'b']), static fn(int $k): bool => $k !== 0]; - yield [[], Collection\Vector::fromArray(['a', 'b']), static fn(int $k): bool => false]; - yield [[], Collection\Vector::fromArray([]), static fn(int $k): bool => false]; + yield [[], Collection\Vector::fromArray(['a', 'b']), static fn(int $_k): bool => false]; + yield [[], Collection\Vector::fromArray([]), 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 d42770dd..c4699918 100644 --- a/tests/unit/Vec/FilterWithKeyTest.php +++ b/tests/unit/Vec/FilterWithKeyTest.php @@ -30,7 +30,7 @@ public function provideData(): iterable yield [['a', 'b'], Collection\Vector::fromArray(['a', 'b'])]; yield [[], Collection\Vector::fromArray(['a', 'b']), static fn(int $_k, string $_v) => false]; yield [['a', 'b'], 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, ]; }