@@ -110,12 +110,8 @@ public function assertCookieExpiryMirrorsExpiry(int $expiry, ResponseInterface $
110
110
{
111
111
$ setCookie = $ response ->getHeaderLine ('Set-Cookie ' );
112
112
$ parts = explode ('; ' , $ setCookie );
113
- $ parts = array_map (function ($ value ) {
114
- return trim ($ value );
115
- }, $ parts );
116
- $ parts = array_filter ($ parts , function (string $ value ) {
117
- return (bool ) preg_match ('/^Expires=/ ' , $ value );
118
- });
113
+ $ parts = array_map (static fn ($ value ) => trim ($ value ), $ parts );
114
+ $ parts = array_filter ($ parts , static fn (string $ value ) => (bool ) preg_match ('/^Expires=/ ' , $ value ));
119
115
120
116
$ this ->assertSame (1 , count ($ parts ), 'No Expires directive found in cookie: ' . $ setCookie );
121
117
@@ -136,12 +132,8 @@ public function assertCookieHasNoExpiryDirective(ResponseInterface $response): v
136
132
{
137
133
$ setCookie = $ response ->getHeaderLine ('Set-Cookie ' );
138
134
$ parts = explode ('; ' , $ setCookie );
139
- $ parts = array_map (function ($ value ) {
140
- return trim ($ value );
141
- }, $ parts );
142
- $ parts = array_filter ($ parts , function (string $ value ) {
143
- return (bool ) preg_match ('/^Expires=/ ' , $ value );
144
- });
135
+ $ parts = array_map (static fn ($ value ) => trim ($ value ), $ parts );
136
+ $ parts = array_filter ($ parts , static fn (string $ value ) => (bool ) preg_match ('/^Expires=/ ' , $ value ));
145
137
146
138
$ this ->assertSame (
147
139
0 ,
@@ -561,10 +553,8 @@ public function testPersistSessionRequestingRegenerationPersistsDataAndSetsHeade
561
553
562
554
$ this ->cachePool
563
555
->method ('getItem ' )
564
- ->with ($ this ->callback (function (string $ value ) {
565
- return $ value !== 'identifier '
566
- && preg_match ('/^[a-f0-9]{32}$/ ' , $ value );
567
- }))
556
+ ->with ($ this ->callback (static fn (string $ value ) => $ value !== 'identifier '
557
+ && preg_match ('/^[a-f0-9]{32}$/ ' , $ value )))
568
558
->willReturn ($ cacheItem );
569
559
$ this ->cachePool ->expects ($ this ->atLeastOnce ())->method ('save ' )->with ($ cacheItem );
570
560
@@ -603,10 +593,8 @@ public function testPersistSessionRequestingRegenerationRemovesPreviousSession(s
603
593
604
594
$ this ->cachePool
605
595
->method ('getItem ' )
606
- ->with ($ this ->callback (function (string $ value ) {
607
- return $ value !== 'identifier '
608
- && preg_match ('/^[a-f0-9]{32}$/ ' , $ value );
609
- }))
596
+ ->with ($ this ->callback (static fn (string $ value ) => $ value !== 'identifier '
597
+ && preg_match ('/^[a-f0-9]{32}$/ ' , $ value )))
610
598
->willReturn ($ cacheItem );
611
599
$ this ->cachePool ->expects ($ this ->atLeastOnce ())->method ('save ' )->with ($ cacheItem );
612
600
@@ -644,10 +632,8 @@ public function testPersistSessionWithIdentifierAndChangedDataPersistsDataAndSet
644
632
645
633
$ this ->cachePool
646
634
->method ('getItem ' )
647
- ->with ($ this ->callback (function (string $ value ) {
648
- return $ value !== 'identifier '
649
- && preg_match ('/^[a-f0-9]{32}$/ ' , $ value );
650
- }))
635
+ ->with ($ this ->callback (static fn (string $ value ) => $ value !== 'identifier '
636
+ && preg_match ('/^[a-f0-9]{32}$/ ' , $ value )))
651
637
->willReturn ($ cacheItem );
652
638
$ this ->cachePool ->expects ($ this ->atLeastOnce ())->method ('save ' )->with ($ cacheItem );
653
639
@@ -685,10 +671,8 @@ public function testPersistSessionDeletesPreviousSessionIfItExists(string $cache
685
671
686
672
$ this ->cachePool
687
673
->method ('getItem ' )
688
- ->with ($ this ->callback (function (string $ value ) {
689
- return $ value !== 'identifier '
690
- && preg_match ('/^[a-f0-9]{32}$/ ' , $ value );
691
- }))
674
+ ->with ($ this ->callback (static fn (string $ value ) => $ value !== 'identifier '
675
+ && preg_match ('/^[a-f0-9]{32}$/ ' , $ value )))
692
676
->willReturn ($ cacheItem );
693
677
$ this ->cachePool ->expects ($ this ->atLeastOnce ())->method ('save ' )->with ($ cacheItem );
694
678
@@ -782,12 +766,10 @@ public function testPersistenceDurationSpecifiedInSessionUsedWhenPresentEvenWhen
782
766
$ cacheItem
783
767
->expects ($ this ->atLeastOnce ())
784
768
->method ('set ' )
785
- ->with ($ this ->callback (function (array $ value ) {
786
- return array_key_exists ('foo ' , $ value )
787
- && $ value ['foo ' ] === 'bar '
788
- && array_key_exists (SessionCookiePersistenceInterface::SESSION_LIFETIME_KEY , $ value )
789
- && $ value [SessionCookiePersistenceInterface::SESSION_LIFETIME_KEY ] === 1200 ;
790
- }));
769
+ ->with ($ this ->callback (static fn (array $ value ) => array_key_exists ('foo ' , $ value )
770
+ && $ value ['foo ' ] === 'bar '
771
+ && array_key_exists (SessionCookiePersistenceInterface::SESSION_LIFETIME_KEY , $ value )
772
+ && $ value [SessionCookiePersistenceInterface::SESSION_LIFETIME_KEY ] === 1200 ));
791
773
$ cacheItem ->expects ($ this ->atLeastOnce ())->method ('expiresAfter ' )->with ($ this ->isType ('int ' ));
792
774
$ this ->cachePool ->method ('hasItem ' )->with ('identifier ' )->willReturn (false );
793
775
$ this ->cachePool
@@ -821,12 +803,10 @@ public function testPersistenceDurationSpecifiedInSessionOverridesExpiryWhenSess
821
803
$ cacheItem
822
804
->expects ($ this ->atLeastOnce ())
823
805
->method ('set ' )
824
- ->with ($ this ->callback (function (array $ value ) {
825
- return array_key_exists ('foo ' , $ value )
826
- && $ value ['foo ' ] === 'bar '
827
- && array_key_exists (SessionCookiePersistenceInterface::SESSION_LIFETIME_KEY , $ value )
828
- && $ value [SessionCookiePersistenceInterface::SESSION_LIFETIME_KEY ] === 1200 ;
829
- }));
806
+ ->with ($ this ->callback (static fn (array $ value ) => array_key_exists ('foo ' , $ value )
807
+ && $ value ['foo ' ] === 'bar '
808
+ && array_key_exists (SessionCookiePersistenceInterface::SESSION_LIFETIME_KEY , $ value )
809
+ && $ value [SessionCookiePersistenceInterface::SESSION_LIFETIME_KEY ] === 1200 ));
830
810
$ cacheItem ->expects ($ this ->atLeastOnce ())->method ('expiresAfter ' )->with ($ this ->isType ('int ' ));
831
811
$ this ->cachePool ->method ('hasItem ' )->with ('identifier ' )->willReturn (false );
832
812
$ this ->cachePool
@@ -858,12 +838,10 @@ public function testPersistenceDurationOfZeroSpecifiedInSessionDisablesPersisten
858
838
$ cacheItem
859
839
->expects ($ this ->atLeastOnce ())
860
840
->method ('set ' )
861
- ->with ($ this ->callback (function (array $ value ) {
862
- return array_key_exists ('foo ' , $ value )
863
- && $ value ['foo ' ] === 'bar '
864
- && array_key_exists (SessionCookiePersistenceInterface::SESSION_LIFETIME_KEY , $ value )
865
- && $ value [SessionCookiePersistenceInterface::SESSION_LIFETIME_KEY ] === 0 ;
866
- }));
841
+ ->with ($ this ->callback (static fn (array $ value ) => array_key_exists ('foo ' , $ value )
842
+ && $ value ['foo ' ] === 'bar '
843
+ && array_key_exists (SessionCookiePersistenceInterface::SESSION_LIFETIME_KEY , $ value )
844
+ && $ value [SessionCookiePersistenceInterface::SESSION_LIFETIME_KEY ] === 0 ));
867
845
$ cacheItem ->expects ($ this ->atLeastOnce ())->method ('expiresAfter ' )->with ($ this ->isType ('int ' ));
868
846
$ this ->cachePool ->method ('hasItem ' )->with ('identifier ' )->willReturn (false );
869
847
$ this ->cachePool
@@ -900,11 +878,9 @@ public function testPersistenceDurationOfZeroWithoutSessionLifetimeKeyInDataResu
900
878
$ cacheItem
901
879
->expects ($ this ->atLeastOnce ())
902
880
->method ('set ' )
903
- ->with ($ this ->callback (function (array $ value ) {
904
- return array_key_exists ('foo ' , $ value )
905
- && $ value ['foo ' ] === 'bar '
906
- && ! array_key_exists (SessionCookiePersistenceInterface::SESSION_LIFETIME_KEY , $ value );
907
- }));
881
+ ->with ($ this ->callback (static fn (array $ value ) => array_key_exists ('foo ' , $ value )
882
+ && $ value ['foo ' ] === 'bar '
883
+ && ! array_key_exists (SessionCookiePersistenceInterface::SESSION_LIFETIME_KEY , $ value )));
908
884
$ cacheItem ->expects ($ this ->atLeastOnce ())->method ('expiresAfter ' )->with ($ this ->isType ('int ' ));
909
885
$ this ->cachePool ->method ('hasItem ' )->with ('identifier ' )->willReturn (false );
910
886
$ this ->cachePool ->method ('getItem ' )->with ('identifier ' )->willReturn ($ cacheItem );
@@ -937,12 +913,10 @@ public function testPersistenceDurationOfZeroIgnoresGlobalPersistenceExpiry(): v
937
913
$ cacheItem
938
914
->expects ($ this ->atLeastOnce ())
939
915
->method ('set ' )
940
- ->with ($ this ->callback (function (array $ value ) {
941
- return array_key_exists ('foo ' , $ value )
942
- && $ value ['foo ' ] === 'bar '
943
- && array_key_exists (SessionCookiePersistenceInterface::SESSION_LIFETIME_KEY , $ value )
944
- && $ value [SessionCookiePersistenceInterface::SESSION_LIFETIME_KEY ] === 0 ;
945
- }));
916
+ ->with ($ this ->callback (static fn (array $ value ) => array_key_exists ('foo ' , $ value )
917
+ && $ value ['foo ' ] === 'bar '
918
+ && array_key_exists (SessionCookiePersistenceInterface::SESSION_LIFETIME_KEY , $ value )
919
+ && $ value [SessionCookiePersistenceInterface::SESSION_LIFETIME_KEY ] === 0 ));
946
920
$ cacheItem ->expects ($ this ->atLeastOnce ())->method ('expiresAfter ' )->with ($ this ->isType ('int ' ));
947
921
$ this ->cachePool ->method ('hasItem ' )->with ('identifier ' )->willReturn (false );
948
922
$ this ->cachePool
@@ -981,12 +955,10 @@ public function testPersistenceDurationInSessionDataWithValueOfZeroIgnoresGlobal
981
955
$ cacheItem
982
956
->expects ($ this ->atLeastOnce ())
983
957
->method ('set ' )
984
- ->with ($ this ->callback (function (array $ value ) {
985
- return array_key_exists ('foo ' , $ value )
986
- && $ value ['foo ' ] === 'baz '
987
- && array_key_exists (SessionCookiePersistenceInterface::SESSION_LIFETIME_KEY , $ value )
988
- && $ value [SessionCookiePersistenceInterface::SESSION_LIFETIME_KEY ] === 0 ;
989
- }));
958
+ ->with ($ this ->callback (static fn (array $ value ) => array_key_exists ('foo ' , $ value )
959
+ && $ value ['foo ' ] === 'baz '
960
+ && array_key_exists (SessionCookiePersistenceInterface::SESSION_LIFETIME_KEY , $ value )
961
+ && $ value [SessionCookiePersistenceInterface::SESSION_LIFETIME_KEY ] === 0 ));
990
962
$ cacheItem ->expects ($ this ->atLeastOnce ())->method ('expiresAfter ' )->with ($ this ->isType ('int ' ));
991
963
$ this ->cachePool ->method ('hasItem ' )->with ('identifier ' )->willReturn (false );
992
964
$ this ->cachePool
0 commit comments