File tree Expand file tree Collapse file tree 6 files changed +117
-1
lines changed
config/sets/symfony/symfony5 Expand file tree Collapse file tree 6 files changed +117
-1
lines changed Original file line number Diff line number Diff line change 16
16
$ rectorConfig ->import (__DIR__ . '/symfony51/symfony51-inflector.php ' );
17
17
$ rectorConfig ->import (__DIR__ . '/symfony51/symfony51-notifier.php ' );
18
18
$ rectorConfig ->import (__DIR__ . '/symfony51/symfony51-security-http.php ' );
19
-
19
+ $ rectorConfig -> import ( __DIR__ . ' /symfony51/symfony51-web-link.php ' );
20
20
};
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ declare (strict_types=1 );
4
+
5
+ use Rector \Arguments \Rector \ClassMethod \ReplaceArgumentDefaultValueRector ;
6
+ use Rector \Arguments \ValueObject \ReplaceArgumentDefaultValue ;
7
+ use Rector \Config \RectorConfig ;
8
+
9
+ return static function (RectorConfig $ rectorConfig ): void {
10
+ $ rectorConfig ->ruleWithConfiguration (ReplaceArgumentDefaultValueRector::class, [
11
+ new ReplaceArgumentDefaultValue (
12
+ 'Symfony\Component\HttpFoundation\Cookie ' ,
13
+ 'withSameSite ' ,
14
+ 0 ,
15
+ 'none ' ,
16
+ 'Symfony\Component\HttpFoundation\Cookie::SAMESITE_NONE '
17
+ ),
18
+ new ReplaceArgumentDefaultValue (
19
+ 'Symfony\Component\HttpFoundation\Cookie ' ,
20
+ 'withSameSite ' ,
21
+ 0 ,
22
+ 'lax ' ,
23
+ 'Symfony\Component\HttpFoundation\Cookie::SAMESITE_LAX '
24
+ ),
25
+ new ReplaceArgumentDefaultValue (
26
+ 'Symfony\Component\HttpFoundation\Cookie ' ,
27
+ 'withSameSite ' ,
28
+ 0 ,
29
+ 'strict ' ,
30
+ 'Symfony\Component\HttpFoundation\Cookie::SAMESITE_STRICT '
31
+ ),
32
+ ]);
33
+ };
Original file line number Diff line number Diff line change @@ -125,6 +125,13 @@ public function provide(): array
125
125
__DIR__ . '/../../../config/sets/symfony/symfony5/symfony51/symfony51-security-core.php '
126
126
),
127
127
128
+ new ComposerTriggeredSet (
129
+ SetGroup::SYMFONY ,
130
+ 'symfony/web-link ' ,
131
+ '5.1 ' ,
132
+ __DIR__ . '/../../../config/sets/symfony/symfony5/symfony51/symfony51-web-link.php '
133
+ ),
134
+
128
135
new ComposerTriggeredSet (
129
136
SetGroup::SYMFONY ,
130
137
'symfony/symfony ' ,
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace Rector \Symfony \Tests \Set \Symfony51 \Fixture ;
4
+
5
+ use Symfony \Component \HttpFoundation \Cookie ;
6
+
7
+ class ReplaceCookieWithSameSiteParameterValue
8
+ {
9
+ public function run ()
10
+ {
11
+ $ cookie = Cookie::create ('name ' );
12
+ $ cookie ->withSameSite ('none ' );
13
+
14
+ return $ cookie ;
15
+ }
16
+ }
17
+
18
+ ?>
19
+
20
+ -----
21
+ <?php
22
+
23
+ namespace Rector \Symfony \Tests \Set \Symfony51 \Fixture ;
24
+
25
+ use Symfony \Component \HttpFoundation \Cookie ;
26
+
27
+ class ReplaceCookieWithSameSiteParameterValue
28
+ {
29
+ public function run ()
30
+ {
31
+ $ cookie = Cookie::create ('name ' );
32
+ $ cookie ->withSameSite (\Symfony \Component \HttpFoundation \Cookie::SAMESITE_NONE );
33
+
34
+ return $ cookie ;
35
+ }
36
+ }
37
+
38
+ ?>
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ declare (strict_types=1 );
4
+
5
+ namespace Rector \Symfony \Tests \Set \Symfony51 ;
6
+
7
+ use Iterator ;
8
+ use PHPUnit \Framework \Attributes \DataProvider ;
9
+ use Rector \Testing \PHPUnit \AbstractRectorTestCase ;
10
+
11
+ final class Symfony51Test extends AbstractRectorTestCase
12
+ {
13
+ #[DataProvider('provideData ' )]
14
+ public function test (string $ filePath ): void
15
+ {
16
+ $ this ->doTestFile ($ filePath );
17
+ }
18
+
19
+ public static function provideData (): Iterator
20
+ {
21
+ return self ::yieldFilesFromDirectory (__DIR__ . '/Fixture ' );
22
+ }
23
+
24
+ public function provideConfigFilePath (): string
25
+ {
26
+ return __DIR__ . '/config/symfony51.php ' ;
27
+ }
28
+ }
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ declare (strict_types=1 );
4
+
5
+ use Rector \Config \RectorConfig ;
6
+ use Rector \Symfony \Set \SymfonySetList ;
7
+
8
+ return static function (RectorConfig $ rectorConfig ): void {
9
+ $ rectorConfig ->sets ([SymfonySetList::SYMFONY_51 ]);
10
+ };
You can’t perform that action at this time.
0 commit comments