Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,34 @@
null,
'lax'
),

new ReplaceArgumentDefaultValue(
'Symfony\Component\HttpFoundation\Cookie',
'__construct',
8,
'none',
'Symfony\Component\HttpFoundation\Cookie::SAMESITE_NONE'
),
new ReplaceArgumentDefaultValue(
'Symfony\Component\HttpFoundation\Cookie',
'create',
8,
'none',
'Symfony\Component\HttpFoundation\Cookie::SAMESITE_NONE'
),
new ReplaceArgumentDefaultValue(
'Symfony\Component\HttpFoundation\Cookie',
'create',
8,
'lax',
'Symfony\Component\HttpFoundation\Cookie::SAMESITE_LAX'
),
new ReplaceArgumentDefaultValue(
'Symfony\Component\HttpFoundation\Cookie',
'create',
8,
'strict',
'Symfony\Component\HttpFoundation\Cookie::SAMESITE_STRICT'
),
]);
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

namespace Rector\Symfony\Tests\Set\Symfony42\Fixture;

use Symfony\Component\HttpFoundation\Cookie;

class ReplaceNewCookieAndCreateParameterValue
{
public function run()
{
$cookie = Cookie::create('name', 'value', 0, '/', null, false, true, false, 'none');

return new Cookie('name', 'value', 0, '/', null, false, true, false, 'none');
}
}

?>

-----
<?php

namespace Rector\Symfony\Tests\Set\Symfony42\Fixture;

use Symfony\Component\HttpFoundation\Cookie;

class ReplaceNewCookieAndCreateParameterValue
{
public function run()
{
$cookie = Cookie::create('name', 'value', 0, '/', null, false, true, false, \Symfony\Component\HttpFoundation\Cookie::SAMESITE_NONE);

return \Symfony\Component\HttpFoundation\Cookie::create('name', 'value', 0, '/', null, false, true, false, \Symfony\Component\HttpFoundation\Cookie::SAMESITE_NONE);
}
}

?>
28 changes: 28 additions & 0 deletions tests/Set/Symfony42/Symfony42Test.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

declare(strict_types=1);

namespace Rector\Symfony\Tests\Set\Symfony42;

use Iterator;
use PHPUnit\Framework\Attributes\DataProvider;
use Rector\Testing\PHPUnit\AbstractRectorTestCase;

final class Symfony42Test extends AbstractRectorTestCase
{
#[DataProvider('provideData')]
public function test(string $filePath): void
{
$this->doTestFile($filePath);
}

public static function provideData(): Iterator
{
return self::yieldFilesFromDirectory(__DIR__ . '/Fixture');
}

public function provideConfigFilePath(): string
{
return __DIR__ . '/config/symfony42.php';
}
}
10 changes: 10 additions & 0 deletions tests/Set/Symfony42/config/symfony42.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

declare(strict_types=1);

use Rector\Config\RectorConfig;
use Rector\Symfony\Set\SymfonySetList;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->sets([SymfonySetList::SYMFONY_42]);
};