Skip to content

Commit 0a2c6e7

Browse files
committed
qa: apply coding standard
Signed-off-by: Maximilian Bösing <[email protected]>
1 parent 02f64f7 commit 0a2c6e7

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

phpcs.xml.dist

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,7 @@
3232
<exclude name="SlevomatCodingStandard.Commenting.RequireOneLineDocComment.MultiLineDocComment"/>
3333
<!-- Can be removed with dropping support for PHP 7.4 -->
3434
<exclude name="SlevomatCodingStandard.ControlStructures.RequireNullCoalesceEqualOperator.RequiredNullCoalesceEqualOperator"/>
35+
<!-- Static callables are deprecated as of PHP 8.2 -->
36+
<exclude name="SlevomatCodingStandard.Functions.StaticClosure.ClosureNotStatic"/>
3537
</rule>
3638
</ruleset>

tests/GenericMapTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1104,7 +1104,7 @@ public function testWillJoinValuesWithSeperator(): void
11041104
*/
11051105
public function testWillExchangeKeys(array $initial, callable $keyGenerator, array $expected): void
11061106
{
1107-
$map = new GenericMap($initial);
1107+
$map = new GenericMap($initial);
11081108
$exchanged = $map->keyExchange($keyGenerator);
11091109
self::assertEquals($expected, $exchanged->toNativeArray());
11101110
}

tests/GenericOrderedListTest.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1322,7 +1322,7 @@ public function testForAllPromiseWillSuppressErrors(): void
13221322
{
13231323
$map = new GenericOrderedList(['bar']);
13241324

1325-
$callback = static function (): void {
1325+
$callback = function (): void {
13261326
throw new RuntimeException();
13271327
};
13281328
$map->forAll($callback)->suppressErrors();
@@ -1334,15 +1334,15 @@ public function testForAllPromiseWillSuppressErrors(): void
13341334
public function testForAllPromiseWillExecuteFinallyMethodBeforeThrowingException(): void
13351335
{
13361336
$callbackInvoked = false;
1337-
$callback = static function () use (&$callbackInvoked): void {
1337+
$callback = function () use (&$callbackInvoked): void {
13381338
$callbackInvoked = true;
13391339
};
13401340

13411341
$map = new GenericOrderedList(['bar']);
13421342

13431343
$runtimeExceptionCaught = false;
13441344
try {
1345-
$map->forAll(static function (): void {
1345+
$map->forAll(function (): void {
13461346
throw new RuntimeException();
13471347
})->finally($callback);
13481348
} catch (RuntimeException $exception) {
@@ -1419,7 +1419,7 @@ public function testWillFindIndexOfFirstMatchingItem(): void
14191419
]);
14201420

14211421
/** @psalm-suppress TypeDoesNotContainType Might be a psalm bug */
1422-
self::assertSame(1, $list->findFirstMatchingIndex(static fn (int $value) => $value % 10 === 0));
1422+
self::assertSame(1, $list->findFirstMatchingIndex(fn (int $value) => $value % 10 === 0));
14231423
}
14241424

14251425
public function testWillReturnNullWhenNoItemMatchesFilter(): void
@@ -1431,7 +1431,7 @@ public function testWillReturnNullWhenNoItemMatchesFilter(): void
14311431
8,
14321432
]);
14331433

1434-
self::assertNull($list->findFirstMatchingIndex(static fn (int $value) => $value % 2 !== 0));
1434+
self::assertNull($list->findFirstMatchingIndex(fn (int $value) => $value % 2 !== 0));
14351435
}
14361436

14371437
public function testWillPrependValueToTheList(): void
@@ -1458,12 +1458,12 @@ public function testWillReduceOrderedList(): void
14581458

14591459
self::assertSame(
14601460
15,
1461-
$list->reduce(static fn (int $carry, int $value) => $value + $carry, 0),
1461+
$list->reduce(fn (int $carry, int $value) => $value + $carry, 0),
14621462
'A sum of all values were expected.',
14631463
);
14641464
self::assertSame(
14651465
120,
1466-
$list->reduce(static fn (int $carry, int $value) => $carry === 0 ? $value : $value * $carry, 0),
1466+
$list->reduce(fn (int $carry, int $value) => $carry === 0 ? $value : $value * $carry, 0),
14671467
'Expected that all values are being multiplied with each other',
14681468
);
14691469
}

0 commit comments

Comments
 (0)