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
16 changes: 16 additions & 0 deletions packages/upgrade/config/sets/level/up-to-tempest-310.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

declare(strict_types=1);

use Rector\Config\RectorConfig;
use Tempest\Upgrade\Set\TempestSetList;

return static function (RectorConfig $config): void {
$config->sets([
TempestSetList::TEMPEST_20,
TempestSetList::TEMPEST_28,
TempestSetList::TEMPEST_30,
TempestSetList::TEMPEST_34,
TempestSetList::TEMPEST_310,
]);
};
13 changes: 13 additions & 0 deletions packages/upgrade/config/sets/tempest310.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

use Rector\Config\RectorConfig;
use Rector\Configuration\Option;
use Rector\Configuration\Parameter\SimpleParameterProvider;
use Tempest\Upgrade\Tempest310\UpdatePriorityImportsRector;

return static function (RectorConfig $config): void {
SimpleParameterProvider::setParameter(Option::AUTO_IMPORT_NAMES, value: true);
SimpleParameterProvider::setParameter(Option::IMPORT_SHORT_CLASSES, value: true);

$config->rule(UpdatePriorityImportsRector::class);
};
2 changes: 0 additions & 2 deletions packages/upgrade/config/sets/tempest34.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,11 @@
use Rector\Configuration\Parameter\SimpleParameterProvider;
use Tempest\Upgrade\Tempest34\UpdateDiscoveryImportsRector;
use Tempest\Upgrade\Tempest34\UpdateKernelDiscoveryPropertiesRector;
use Tempest\Upgrade\Tempest34\UpdatePriorityImportsRector;

return static function (RectorConfig $config): void {
SimpleParameterProvider::setParameter(Option::AUTO_IMPORT_NAMES, value: true);
SimpleParameterProvider::setParameter(Option::IMPORT_SHORT_CLASSES, value: true);

$config->rule(UpdateDiscoveryImportsRector::class);
$config->rule(UpdateKernelDiscoveryPropertiesRector::class);
$config->rule(UpdatePriorityImportsRector::class);
};
2 changes: 2 additions & 0 deletions packages/upgrade/src/Set/TempestLevelSetList.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,6 @@ final class TempestLevelSetList
public const string UP_TO_TEMPEST_30 = __DIR__ . '/../../config/sets/level/up-to-tempest-30.php';

public const string UP_TO_TEMPEST_34 = __DIR__ . '/../../config/sets/level/up-to-tempest-34.php';

public const string UP_TO_TEMPEST_310 = __DIR__ . '/../../config/sets/level/up-to-tempest-310.php';
}
2 changes: 2 additions & 0 deletions packages/upgrade/src/Set/TempestSetList.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,6 @@ final class TempestSetList
public const string TEMPEST_30 = __DIR__ . '/../../config/sets/tempest30.php';

public const string TEMPEST_34 = __DIR__ . '/../../config/sets/tempest34.php';

public const string TEMPEST_310 = __DIR__ . '/../../config/sets/tempest310.php';
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Tempest\Upgrade\Tempest34;
namespace Tempest\Upgrade\Tempest310;

use PhpParser\Node;
use PhpParser\Node\Name;
Expand Down
31 changes: 31 additions & 0 deletions packages/upgrade/tests/Tempest310/Tempest310RectorTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

namespace Tempest\Upgrade\Tests\Tempest310;

use PHPUnit\Framework\Attributes\RunTestsInSeparateProcesses;
use PHPUnit\Framework\TestCase;
use Tempest\Upgrade\Tests\RectorTester;

#[RunTestsInSeparateProcesses]
final class Tempest310RectorTest extends TestCase
{
private RectorTester $rector {
get => new RectorTester(__DIR__ . '/tempest310_rector.php');
}

public function test_priority_namespace_change(): void
{
$this->rector
->runFixture(__DIR__ . '/Fixtures/PriorityNamespaceChange.input.php')
->assertContains('use Tempest\Support\Priority;')
->assertNotContains('use Tempest\Core\Priority;');
}

public function test_fully_qualified_priority(): void
{
$this->rector
->runFixture(__DIR__ . '/Fixtures/FullyQualifiedPriority.input.php')
->assertContains('Tempest\Support\Priority')
->assertNotContains('Tempest\Core\Priority');
}
}
9 changes: 9 additions & 0 deletions packages/upgrade/tests/Tempest310/tempest310_rector.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

declare(strict_types=1);

use Rector\Config\RectorConfig;
use Tempest\Upgrade\Set\TempestSetList;

return RectorConfig::configure()
->withSets([TempestSetList::TEMPEST_310]);
16 changes: 0 additions & 16 deletions packages/upgrade/tests/Tempest34/Tempest34RectorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,22 +77,6 @@ public function test_fully_qualified_discovery_cache(): void
->assertNotContains('Tempest\Core\DiscoveryCache');
}

public function test_priority_namespace_change(): void
{
$this->rector
->runFixture(__DIR__ . '/Fixtures/PriorityNamespaceChange.input.php')
->assertContains('use Tempest\Support\Priority;')
->assertNotContains('use Tempest\Core\Priority;');
}

public function test_fully_qualified_priority(): void
{
$this->rector
->runFixture(__DIR__ . '/Fixtures/FullyQualifiedPriority.input.php')
->assertContains('Tempest\Support\Priority')
->assertNotContains('Tempest\Core\Priority');
}

public function test_kernel_discovery_locations_refactored(): void
{
$this->rector
Expand Down
Loading