allow Doctrine migrations to be used with Symfony 8 components (#1546)

This commit is contained in:
Christian Flothmann
2025-11-20 11:48:26 +01:00
committed by GitHub
parent aa4fcb0b9b
commit ed6d91c38c
3 changed files with 17 additions and 7 deletions

View File

@@ -30,9 +30,9 @@
"doctrine/deprecations": "^0.5.3 || ^1",
"doctrine/event-manager": "^1.2 || ^2.0",
"psr/log": "^1.1.3 || ^2 || ^3",
"symfony/console": "^5.4 || ^6.0 || ^7.0",
"symfony/stopwatch": "^5.4 || ^6.0 || ^7.0",
"symfony/var-exporter": "^6.2 || ^7.0"
"symfony/console": "^5.4 || ^6.0 || ^7.0 || ^8.0",
"symfony/stopwatch": "^5.4 || ^6.0 || ^7.0 || ^8.0",
"symfony/var-exporter": "^6.2 || ^7.0 || ^8.0"
},
"require-dev": {
"ext-pdo_sqlite": "*",
@@ -47,9 +47,9 @@
"phpstan/phpstan-strict-rules": "^2",
"phpstan/phpstan-symfony": "^2",
"phpunit/phpunit": "^10.3 || ^11.0 || ^12.0",
"symfony/cache": "^5.4 || ^6.0 || ^7.0",
"symfony/process": "^5.4 || ^6.0 || ^7.0",
"symfony/yaml": "^5.4 || ^6.0 || ^7.0"
"symfony/cache": "^5.4 || ^6.0 || ^7.0 || ^8.0",
"symfony/process": "^5.4 || ^6.0 || ^7.0 || ^8.0",
"symfony/yaml": "^5.4 || ^6.0 || ^7.0 || ^8.0"
},
"conflict": {
"doctrine/orm": "<2.12 || >=4"

View File

@@ -60,6 +60,11 @@ parameters:
message: '~^Parameter #1 \$array \(list<string>\) of array_values is already a list, call has no effect\.$~'
path: tests/Generator/DiffGeneratorTest.php
# Symfony 8 forward compatibility
-
message: '~^Call to an undefined method Symfony\\Component\\Console\\Application\:\:addCommand\(\)\.$~'
path: src/Tools/Console/ConsoleRunner.php
symfony:
consoleApplicationLoader: tests/doctrine-migrations-phpstan-app.php
includes:

View File

@@ -31,6 +31,7 @@ use function assert;
use function file_exists;
use function getcwd;
use function is_readable;
use function method_exists;
use function sprintf;
use const DIRECTORY_SEPARATOR;
@@ -129,7 +130,11 @@ class ConsoleRunner
return;
}
$cli->add(new DiffCommand($dependencyFactory));
if (method_exists(Application::class, 'addCommand')) {
$cli->addCommand(new DiffCommand($dependencyFactory));
} else {
$cli->add(new DiffCommand($dependencyFactory));
}
}
private static function checkLegacyConfiguration(mixed $dependencyFactory, string $configurationFile): mixed