From 0210506a5afd2a9ccd8efbd130a6426035202f70 Mon Sep 17 00:00:00 2001 From: Jannik Zschiesche Date: Thu, 20 Jun 2024 13:52:19 +0200 Subject: [PATCH 1/2] Remove deprecated implementations --- composer.json | 1 - src/Command/PostBuildTasksCommand.php | 13 +------ src/Command/PostDeploymentTasksCommand.php | 14 +------- src/Hosting/HostingEnvironment.php | 31 ++--------------- src/Tier/HostingTier.php | 12 +------ tests/Hosting/HostingEnvironmentTest.php | 40 ---------------------- 6 files changed, 6 insertions(+), 105 deletions(-) diff --git a/composer.json b/composer.json index f755fd7..ac6b7a6 100644 --- a/composer.json +++ b/composer.json @@ -24,7 +24,6 @@ "symfony/config": "^6.4 || ^7.0", "symfony/console": "^6.4 || ^7.0", "symfony/dependency-injection": "^6.4 || ^7.0", - "symfony/deprecation-contracts": "^3.4", "symfony/event-dispatcher-contracts": "^3.4", "symfony/filesystem": "^6.4 || ^7.0", "symfony/process": "^6.4 || ^7.0" diff --git a/src/Command/PostBuildTasksCommand.php b/src/Command/PostBuildTasksCommand.php index ef36d62..7023832 100644 --- a/src/Command/PostBuildTasksCommand.php +++ b/src/Command/PostBuildTasksCommand.php @@ -9,7 +9,7 @@ use Torr\Hosting\Deployment\TaskCli; use Torr\Hosting\Deployment\TaskRunners; -#[AsCommand("hosting:run-tasks:post-build", aliases: ["hosting:post-build"])] +#[AsCommand("hosting:run-tasks:post-build")] final class PostBuildTasksCommand extends Command { private TaskRunners $runners; @@ -29,17 +29,6 @@ public function __construct(TaskRunners $runners) protected function execute (InputInterface $input, OutputInterface $output) : int { $io = new TaskCli($input, $output); - - // @todo remove in v3 and remove alias above - if ("hosting:run-tasks:post-build" !== $input->getFirstArgument()) - { - trigger_deprecation("21torr/hosting", "2.1.0", "The command name '{$input->getFirstArgument()}' was deprecated. Use 'hosting:run-tasks:post-build' instead."); - $io->caution(sprintf( - "The command name `%s` was deprecated.\nUse `hosting:run-tasks:post-build` instead.", - $input->getFirstArgument(), - )); - } - $io->title("Run Post Build Tasks"); $this->runners->runPostBuild($io); diff --git a/src/Command/PostDeploymentTasksCommand.php b/src/Command/PostDeploymentTasksCommand.php index 79eb183..2b7bff4 100644 --- a/src/Command/PostDeploymentTasksCommand.php +++ b/src/Command/PostDeploymentTasksCommand.php @@ -9,7 +9,7 @@ use Torr\Hosting\Deployment\TaskCli; use Torr\Hosting\Deployment\TaskRunners; -#[AsCommand("hosting:run-tasks:post-deploy", aliases: ["hosting:post-deploy"])] +#[AsCommand("hosting:run-tasks:post-deploy")] final class PostDeploymentTasksCommand extends Command { private TaskRunners $runners; @@ -28,18 +28,6 @@ public function __construct(TaskRunners $runners) */ protected function execute(InputInterface $input, OutputInterface $output) : int { - $io = new TaskCli($input, $output); - - // @todo remove in v3 and remove alias above - if ("hosting:run-tasks:post-deploy" !== $input->getFirstArgument()) - { - trigger_deprecation("21torr/hosting", "2.1.0", "The command name '{$input->getFirstArgument()}' was deprecated. Use 'hosting:run-tasks:post-deploy' instead."); - $io->caution(sprintf( - "The command name `%s` was deprecated.\nUse `hosting:run-tasks:post-deploy` instead.", - $input->getFirstArgument(), - )); - } - $io = new TaskCli($input, $output); $io->title("Run Post Deployment Tasks"); diff --git a/src/Hosting/HostingEnvironment.php b/src/Hosting/HostingEnvironment.php index a454dbe..d19751d 100644 --- a/src/Hosting/HostingEnvironment.php +++ b/src/Hosting/HostingEnvironment.php @@ -19,24 +19,12 @@ public function __construct ( } /** - * @todo refactor in v3 */ private function getHostingTier (string|HostingTier $tier) : HostingTier { - if ($tier instanceof HostingTier) - { - return $tier; - } - - if ("live" === $tier) - { - // @phpstan-ignore-next-line todoBy.sfDeprecation - trigger_deprecation("21torr/hosting", "2.1.0", "The hosting tier 'live' is deprecated. Use 'production' instead."); - - return HostingTier::PRODUCTION; - } - - return HostingTier::from($tier); + return $tier instanceof HostingTier + ? $tier + : HostingTier::from($tier); } /** @@ -53,19 +41,6 @@ public function isStaging () : bool return HostingTier::STAGING === $this->tier; } - /** - * @deprecated use {@see self::isProduction()} instead - * - * @todo remove in v3 - */ - public function isLive () : bool - { - // @phpstan-ignore-next-line todoBy.sfDeprecation - trigger_deprecation("21torr/hosting", "2.1.0", "The hosting tier 'live' is deprecated. Use 'production' instead."); - - return $this->isProduction(); - } - /** */ public function isProduction () : bool diff --git a/src/Tier/HostingTier.php b/src/Tier/HostingTier.php index 7d277ed..39c7d14 100644 --- a/src/Tier/HostingTier.php +++ b/src/Tier/HostingTier.php @@ -6,12 +6,6 @@ */ enum HostingTier : string { - /** - * @deprecated - * - * @todo remove in v3 - */ - case LIVE = "live"; case PRODUCTION = "production"; case STAGING = "staging"; case DEVELOPMENT = "development"; @@ -25,11 +19,7 @@ public static function getAllowedConfigValues () : array foreach (self::cases() as $tier) { - // @phpstan-ignore-next-line classConstant.deprecated - if (self::LIVE !== $tier) - { - $result[] = $tier->value; - } + $result[] = $tier->value; } return $result; diff --git a/tests/Hosting/HostingEnvironmentTest.php b/tests/Hosting/HostingEnvironmentTest.php index bf85304..5bd4e46 100644 --- a/tests/Hosting/HostingEnvironmentTest.php +++ b/tests/Hosting/HostingEnvironmentTest.php @@ -3,9 +3,6 @@ namespace Tests\Torr\Hosting\Hosting; use PHPUnit\Framework\TestCase; -use Symfony\Bridge\PhpUnit\ExpectDeprecationTrait; -use Symfony\Component\Config\Definition\Processor; -use Torr\Hosting\DependencyInjection\HostingBundleConfiguration; use Torr\Hosting\Hosting\HostingEnvironment; use Torr\Hosting\Tier\HostingTier; @@ -14,8 +11,6 @@ */ final class HostingEnvironmentTest extends TestCase { - use ExpectDeprecationTrait; - /** */ public function testInstallationKey () : void @@ -57,39 +52,4 @@ public function testHostingTiers (string|HostingTier $value, HostingTier $expect $environment = new HostingEnvironment($value, "installation"); self::assertSame($expected, $environment->getTier()); } - - /** - * @group legacy - */ - public function testLegacyLiveHostingTier () : void - { - $this->expectDeprecation("Since 21torr/hosting 2.1.0: The hosting tier 'live' is deprecated. Use 'production' instead."); - $environment = new HostingEnvironment("live", "installation"); - self::assertSame(HostingTier::PRODUCTION, $environment->getTier()); - } - - /** - * @group legacy - */ - public function testLegacyLiveHostingTierGetter () : void - { - $this->expectDeprecation("Since 21torr/hosting 2.1.0: The hosting tier 'live' is deprecated. Use 'production' instead."); - $environment = new HostingEnvironment(HostingTier::PRODUCTION, "installation"); - self::assertTrue($environment->isLive()); - } - - /** - * @group legacy - */ - public function testLegacyConfigValues () : void - { - $config = new HostingBundleConfiguration(); - $configProcessor = new Processor(); - $resolved = $configProcessor->processConfiguration($config, [[ - "tier" => "live", - ]]); - - // live is explicitly allowed - self::assertSame("live", $resolved["tier"]); - } } From f804fe8bf5bf4733adb679e2c14ebd7d1c154330 Mon Sep 17 00:00:00 2001 From: Jannik Zschiesche Date: Thu, 20 Jun 2024 13:53:34 +0200 Subject: [PATCH 2/2] Bump deps --- CHANGELOG.md | 7 +++++++ composer.json | 20 ++++++++++---------- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b92d774..75b5a3a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +3.0.0 +===== + +* (bc) Remove deprecated config and code. +* (improvement) Require Symfony 7. + + 2.1.3 ===== diff --git a/composer.json b/composer.json index ac6b7a6..dc05d08 100644 --- a/composer.json +++ b/composer.json @@ -16,17 +16,17 @@ "ext-intl": "*", "ext-json": "*", "ext-mbstring": "*", - "21torr/bundle-helpers": "^2.1", - "21torr/cli": "^1.0.3", + "21torr/bundle-helpers": "^2.2", + "21torr/cli": "^1.2.3", "psr/log": "^3.0", - "symfony/cache-contracts": "^3.4", - "symfony/clock": "^6.4 || ^7.0", - "symfony/config": "^6.4 || ^7.0", - "symfony/console": "^6.4 || ^7.0", - "symfony/dependency-injection": "^6.4 || ^7.0", - "symfony/event-dispatcher-contracts": "^3.4", - "symfony/filesystem": "^6.4 || ^7.0", - "symfony/process": "^6.4 || ^7.0" + "symfony/cache-contracts": "^3.5", + "symfony/clock": "^7.0", + "symfony/config": "^7.0", + "symfony/console": "^7.0", + "symfony/dependency-injection": "^7.0", + "symfony/event-dispatcher-contracts": "^3.5", + "symfony/filesystem": "^7.0", + "symfony/process": "^7.0" }, "require-dev": { "21torr/janus": "^1.3.4",