@@ -46,7 +46,7 @@ public function exchangeKeys(): Generator
4646 'bar ' => 'baz ' ,
4747 'qoo ' => 'ooq ' ,
4848 ],
49- static function (string $ key ): string {
49+ function (string $ key ): string {
5050 switch ($ key ) {
5151 case 'foo ' :
5252 return 'bar ' ;
@@ -73,7 +73,7 @@ static function (string $key): string {
7373 'bar ' => 'baz ' ,
7474 'qoo ' => 'ooq ' ,
7575 ],
76- static function (string $ key ): string {
76+ function (string $ key ): string {
7777 switch ($ key ) {
7878 case 'foo ' :
7979 return 'fooo ' ;
@@ -100,7 +100,7 @@ static function (string $key): string {
100100 'bar ' => 'baz ' ,
101101 'qoo ' => 'ooq ' ,
102102 ],
103- static function (string $ key ): string {
103+ function (string $ key ): string {
104104 switch ($ key ) {
105105 case 'bar ' :
106106 case 'foo ' :
@@ -143,7 +143,7 @@ public function testWillMerge(
143143
144144 /** @psalm-var list<MapInterface<string,mixed>> $stackOfMaps */
145145 $ stackOfMaps = array_map (
146- static function (array $ map ): MapInterface {
146+ function (array $ map ): MapInterface {
147147 return new GenericMap ($ map );
148148 },
149149 $ stack ,
@@ -224,7 +224,7 @@ public function sorting(): Generator
224224 'bar ' => 'baz ' ,
225225 'baz ' => 'qoo ' ,
226226 ],
227- static function (string $ a , string $ b ): int {
227+ function (string $ a , string $ b ): int {
228228 return strnatcmp ($ b , $ a );
229229 },
230230 [
@@ -300,7 +300,7 @@ public function testWillMapValues(): void
300300 'second ' => $ object2 ,
301301 ]);
302302
303- $ mapped = $ map ->map (static function (GenericObject $ object ): int {
303+ $ mapped = $ map ->map (function (GenericObject $ object ): int {
304304 return $ object ->id ;
305305 });
306306
@@ -349,7 +349,7 @@ public function orderedLists(): Generator
349349 1 ,
350350 2 ,
351351 ],
352- static function (int $ a , int $ b ): int {
352+ function (int $ a , int $ b ): int {
353353 return $ a <=> $ b ;
354354 },
355355 ];
@@ -406,7 +406,7 @@ public function testAssocIntersectionReturnExpectedValuesWhenCustomComparatorWas
406406 'ooq ' => 'qoo ' ,
407407 ]);
408408
409- self ::assertEquals (['foo ' => 'bar ' ], $ map1 ->intersectAssoc ($ map2 , static function (string $ a , string $ b ): int {
409+ self ::assertEquals (['foo ' => 'bar ' ], $ map1 ->intersectAssoc ($ map2 , function (string $ a , string $ b ): int {
410410 return trim ($ a ) <=> trim ($ b );
411411 })->toNativeArray ());
412412 }
@@ -447,7 +447,7 @@ public function testIntersectionWithKeysReturnExpectedValuesWhenCustomComparator
447447 self ::assertEquals ([
448448 'foo ' => 'bar ' ,
449449 'bar ' => 'baz ' ,
450- ], $ map1 ->intersectUsingKeys ($ map2 , static function (string $ a , string $ b ): int {
450+ ], $ map1 ->intersectUsingKeys ($ map2 , function (string $ a , string $ b ): int {
451451 return strlen ($ a ) <=> strlen ($ b );
452452 })->toNativeArray ());
453453 }
@@ -553,19 +553,19 @@ public function diffs(): Generator
553553 ],
554554 ['object2 ' => $ object2 ],
555555 ['object1 ' => $ object1 ],
556- static function (object $ a , object $ b ): int {
556+ function (object $ a , object $ b ): int {
557557 return $ a ->id <=> $ b ->id ;
558558 },
559559 ];
560560 }
561561
562562 public function testCanIntersectWithUserFunctions (): void
563563 {
564- $ keyComparator = static function (string $ a , string $ b ): int {
564+ $ keyComparator = function (string $ a , string $ b ): int {
565565 return $ a <=> $ b ;
566566 };
567567
568- $ valueComparator = static function (string $ a , string $ b ): int {
568+ $ valueComparator = function (string $ a , string $ b ): int {
569569 return $ a <=> $ b ;
570570 };
571571
@@ -651,7 +651,7 @@ public function partitions(): Generator
651651 'bar ' => 'baz ' ,
652652 'qoo ' => 'ooq ' ,
653653 ],
654- static function (): bool {
654+ function (): bool {
655655 return true ;
656656 },
657657 [
@@ -668,7 +668,7 @@ static function (): bool {
668668 'bar ' => 'baz ' ,
669669 'qoo ' => 'ooq ' ,
670670 ],
671- static function (): bool {
671+ function (): bool {
672672 return false ;
673673 },
674674 [],
@@ -685,7 +685,7 @@ static function (): bool {
685685 'bar ' => 'baz ' ,
686686 'qoo ' => 'ooq ' ,
687687 ],
688- static function (string $ value ): bool {
688+ function (string $ value ): bool {
689689 return in_array ($ value , ['baz ' , 'ooq ' ], true );
690690 },
691691 [
@@ -704,7 +704,7 @@ public function testWillFilter(): void
704704 ]);
705705
706706 $ filtered = $ map ->filter (
707- static function (string $ value ): bool {
707+ function (string $ value ): bool {
708708 return $ value === 'bar ' ;
709709 },
710710 );
@@ -722,7 +722,7 @@ public function testWillGroupValuesToNewInstancesOfInitialInstance(): void
722722 'bar ' => $ object2 = new GenericObject (2 ),
723723 ]);
724724
725- $ grouped = $ map ->group (static function (GenericObject $ object ): string {
725+ $ grouped = $ map ->group (function (GenericObject $ object ): string {
726726 return $ object ->id % 2 ? 'a ' : 'b ' ;
727727 });
728728
@@ -753,15 +753,15 @@ public function testElementsWontSatisfyCallback(): void
753753 {
754754 $ map = new GenericMap (['foo ' => 'bar ' ]);
755755
756- self ::assertFalse ($ map ->allSatisfy (static function (): bool {
756+ self ::assertFalse ($ map ->allSatisfy (function (): bool {
757757 return false ;
758758 }));
759759 }
760760
761761 public function testEmptyMapWillSatisfyCallback (): void
762762 {
763763 $ map = new GenericMap ([]);
764- self ::assertTrue ($ map ->allSatisfy (static function (): bool {
764+ self ::assertTrue ($ map ->allSatisfy (function (): bool {
765765 return false ;
766766 }));
767767 }
@@ -776,7 +776,7 @@ public function satisfactions(): Generator
776776 'one ' => 1 ,
777777 'another one ' => 1 ,
778778 ],
779- static function (int $ value ): bool {
779+ function (int $ value ): bool {
780780 return $ value === 1 ;
781781 },
782782 ];
@@ -786,7 +786,7 @@ static function (int $value): bool {
786786 'foo ' => 'foo ' ,
787787 'bar ' => 'foo ' ,
788788 ],
789- static function (string $ value ): bool {
789+ function (string $ value ): bool {
790790 return strlen ($ value ) === 3 ;
791791 },
792792 ];
@@ -808,7 +808,7 @@ public function testWillFindExistenceOfEntry(array $data, callable $callback, bo
808808 public function testEmptyMapWontFindExistence (): void
809809 {
810810 $ map = new GenericMap ();
811- self ::assertFalse ($ map ->exists (static function (): bool {
811+ self ::assertFalse ($ map ->exists (function (): bool {
812812 return true ;
813813 }));
814814 }
@@ -824,7 +824,7 @@ public function existenceTests(): Generator
824824 'two ' => 2 ,
825825 'another one ' => 1 ,
826826 ],
827- static function (int $ value ): bool {
827+ function (int $ value ): bool {
828828 return $ value === 2 ;
829829 },
830830 true ,
@@ -836,7 +836,7 @@ static function (int $value): bool {
836836 'two ' => 2 ,
837837 'three ' => 3 ,
838838 ],
839- static function (int $ value ): bool {
839+ function (int $ value ): bool {
840840 // @codingStandardsIgnoreStart
841841 return $ value == '2 ' ;
842842 // @codingStandardsIgnoreEnd
@@ -850,7 +850,7 @@ static function (int $value): bool {
850850 'bar ' => 'bar ' ,
851851 'baz ' => 'baz ' ,
852852 ],
853- static function (string $ value ): bool {
853+ function (string $ value ): bool {
854854 return $ value === 'qoo ' ;
855855 },
856856 false ,
@@ -912,7 +912,7 @@ public function testForAllIsExecutedForAllEntries(): void
912912 ]);
913913
914914 $ callable = new CallableObject (['bar ' , 'foo ' ], ['baz ' , 'bar ' ], ['ooq ' , 'qoo ' ]);
915- $ map ->forAll (static fn ($ value , $ key ) => $ callable ($ value , $ key ))->execute ();
915+ $ map ->forAll (fn ($ value , $ key ) => $ callable ($ value , $ key ))->execute ();
916916 }
917917
918918 public function testWillGenerateErrorCollectionWhileExecutingForAll (): void
@@ -979,7 +979,7 @@ public function testForAllPromiseWillSuppressErrors(): void
979979 {
980980 $ map = new GenericMap (['foo ' => 'bar ' ]);
981981
982- $ callback = static function (): void {
982+ $ callback = function (): void {
983983 throw new RuntimeException ();
984984 };
985985 $ map ->forAll ($ callback )->suppressErrors ();
@@ -991,15 +991,15 @@ public function testForAllPromiseWillSuppressErrors(): void
991991 public function testForAllPromiseWillExecuteFinallyMethodBeforeThrowingException (): void
992992 {
993993 $ callbackInvoked = false ;
994- $ callback = static function () use (&$ callbackInvoked ): void {
994+ $ callback = function () use (&$ callbackInvoked ): void {
995995 $ callbackInvoked = true ;
996996 };
997997
998998 $ map = new GenericMap (['foo ' => 'bar ' ]);
999999
10001000 $ runtimeExceptionCaught = false ;
10011001 try {
1002- $ map ->forAll (static function (): void {
1002+ $ map ->forAll (function (): void {
10031003 throw new RuntimeException ();
10041004 })->finally ($ callback );
10051005 } catch (RuntimeException $ exception ) {
@@ -1036,7 +1036,7 @@ public function testWillSortKeysByProvidedCustomSorter(): void
10361036
10371037 $ map = new GenericMap ($ data );
10381038
1039- $ sorter = static function (string $ a , string $ b ): int {
1039+ $ sorter = function (string $ a , string $ b ): int {
10401040 return ord ($ b ) <=> ord ($ a );
10411041 };
10421042
@@ -1114,7 +1114,7 @@ public function testWillDetectDuplicatedKeys(): void
11141114 $ map = new GenericMap (['foo ' => 'bar ' , 'bar ' => 'baz ' ]);
11151115 $ this ->expectException (RuntimeException::class);
11161116 $ this ->expectExceptionMessage ('Provided key generator generates the same key "foo" multiple times. ' );
1117- $ map ->keyExchange (static function (): string {
1117+ $ map ->keyExchange (function (): string {
11181118 return 'foo ' ;
11191119 });
11201120 }
@@ -1131,19 +1131,19 @@ public function testWillReduceMap(): void
11311131
11321132 self ::assertSame (
11331133 15 ,
1134- $ list ->reduce (static fn (int $ carry , int $ value ) => $ value + $ carry , 0 ),
1134+ $ list ->reduce (fn (int $ carry , int $ value ) => $ value + $ carry , 0 ),
11351135 'A sum of all values were expected. ' ,
11361136 );
11371137 self ::assertSame (
11381138 120 ,
1139- $ list ->reduce (static fn (int $ carry , int $ value ) => $ carry === 0 ? $ value : $ value * $ carry , 0 ),
1139+ $ list ->reduce (fn (int $ carry , int $ value ) => $ carry === 0 ? $ value : $ value * $ carry , 0 ),
11401140 'Expected that all values are being multiplied with each other ' ,
11411141 );
11421142 }
11431143
11441144 public function testReduceWillReturnInitialValueOnEmptyList (): void
11451145 {
11461146 $ list = new GenericMap ([]);
1147- self ::assertSame (PHP_INT_MAX , $ list ->reduce (static fn () => 1 , PHP_INT_MAX ));
1147+ self ::assertSame (PHP_INT_MAX , $ list ->reduce (fn () => 1 , PHP_INT_MAX ));
11481148 }
11491149}
0 commit comments