From 5071e3287a66648023d875c4f450388f73676591 Mon Sep 17 00:00:00 2001 From: "Alexander M. Turek" Date: Mon, 13 Nov 2023 09:45:59 +0100 Subject: [PATCH] Drop support for Symfony 3 and 4 (#513) --- DependencyInjection/Configuration.php | 8 +------- .../DoctrineMigrationsExtensionTest.php | 5 +---- composer.json | 7 ++++--- phpstan.neon.dist | 4 ++-- 4 files changed, 8 insertions(+), 16 deletions(-) diff --git a/DependencyInjection/Configuration.php b/DependencyInjection/Configuration.php index f36893e..c2fa1fd 100644 --- a/DependencyInjection/Configuration.php +++ b/DependencyInjection/Configuration.php @@ -14,7 +14,6 @@ use function count; use function in_array; use function is_string; -use function method_exists; use function strlen; use function strpos; use function strtoupper; @@ -34,12 +33,7 @@ public function getConfigTreeBuilder(): TreeBuilder { $treeBuilder = new TreeBuilder('doctrine_migrations'); - if (method_exists($treeBuilder, 'getRootNode')) { - $rootNode = $treeBuilder->getRootNode(); - } else { - // BC layer for symfony/config 4.1 and older - $rootNode = $treeBuilder->root('doctrine_migrations', 'array'); - } + $rootNode = $treeBuilder->getRootNode(); $organizeMigrationModes = $this->getOrganizeMigrationsModes(); diff --git a/Tests/DependencyInjection/DoctrineMigrationsExtensionTest.php b/Tests/DependencyInjection/DoctrineMigrationsExtensionTest.php index 33d64b6..07350b6 100644 --- a/Tests/DependencyInjection/DoctrineMigrationsExtensionTest.php +++ b/Tests/DependencyInjection/DoctrineMigrationsExtensionTest.php @@ -32,7 +32,6 @@ use Symfony\Component\DependencyInjection\Reference; use function assert; -use function class_exists; use function sys_get_temp_dir; class DoctrineMigrationsExtensionTest extends TestCase @@ -451,9 +450,7 @@ private function getContainer(array $config, ?array $dbalConfig = null, ?array $ $container->getDefinition('doctrine.migrations.dependency_factory')->setPublic(true); $container->getDefinition('doctrine.migrations.configuration')->setPublic(true); - if (class_exists(CacheCompatibilityPass::class)) { - $container->addCompilerPass(new CacheCompatibilityPass()); - } + $container->addCompilerPass(new CacheCompatibilityPass()); return $container; } diff --git a/composer.json b/composer.json index 6cc5ba7..030062f 100644 --- a/composer.json +++ b/composer.json @@ -21,8 +21,8 @@ ], "require": { "php": "^7.2|^8.0", - "symfony/framework-bundle": "~3.4|~4.0|~5.0|~6.0|~7.0", - "doctrine/doctrine-bundle": "~1.0|~2.0", + "symfony/framework-bundle": "^5.4 || ^6.0 || ^7.0", + "doctrine/doctrine-bundle": "^2.4", "doctrine/migrations": "^3.2" }, "require-dev": { @@ -32,8 +32,9 @@ "phpstan/phpstan-deprecation-rules": "^1", "phpstan/phpstan-phpunit": "^1", "phpstan/phpstan-strict-rules": "^1.1", + "phpstan/phpstan-symfony": "^1.3", "doctrine/orm": "^2.6", - "doctrine/persistence": "^1.3||^2.0", + "doctrine/persistence": "^2.0 || ^3 ", "vimeo/psalm": "^4.22" }, "autoload": { diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 46bda50..254e7cb 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -6,11 +6,11 @@ parameters: - %currentWorkingDirectory%/Tests ignoreErrors: - - '~.*TreeBuilder.*getRootNode.*~' - - '~.*TreeBuilder::root.*~' - '~Parameter \#1 \$configs.*DoctrineMigrationsExtension::load.*~' includes: - vendor/phpstan/phpstan-strict-rules/rules.neon - vendor/phpstan/phpstan-phpunit/extension.neon - vendor/phpstan/phpstan-phpunit/rules.neon + - vendor/phpstan/phpstan-symfony/extension.neon + - vendor/phpstan/phpstan-symfony/rules.neon