From 1f940d342cc59ab853305697c5b73858c14b989c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 4 Dec 2025 13:59:46 +0000 Subject: [PATCH 1/3] Update symfony/console requirement from ^6.0|^7.0 to ^6.0|^7.0|^8.0 --- updated-dependencies: - dependency-name: symfony/console dependency-version: 8.0.0 dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index e76c937eb..7732b5f39 100644 --- a/composer.json +++ b/composer.json @@ -41,7 +41,7 @@ "cakephp/database": "^5.0.2", "psr/container": "^1.1|^2.0", "symfony/config": "^4.0|^5.0|^6.0|^7.0|^8.0", - "symfony/console": "^6.0|^7.0" + "symfony/console": "^6.0|^7.0|^8.0" }, "require-dev": { "ext-json": "*", From 19502528bbc6c5d423ba3368d33017b5ef545764 Mon Sep 17 00:00:00 2001 From: mscherer Date: Thu, 4 Dec 2025 16:01:57 +0100 Subject: [PATCH 2/3] Fix Symfony Console 8.0 compatibility Add backwards compatible add() method that delegates to addCommand() on Symfony 8.x where add() was removed, while still working with Symfony 6.x/7.x where add() exists. --- phpstan-baseline.neon | 6 ++++++ src/Phinx/Console/PhinxApplication.php | 20 ++++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index e94c74dde..0445789fd 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -4,3 +4,9 @@ parameters: message: "#^Expression on left side of \\?\\? is not nullable\\.$#" count: 1 path: src/Phinx/Db/Adapter/MysqlAdapter.php + + - + message: "#^Call to an undefined method Symfony\\\\Component\\\\Console\\\\Application\\:\\:addCommand\\(\\)\\.$#" + count: 1 + path: src/Phinx/Console/PhinxApplication.php + reportUnmatched: false diff --git a/src/Phinx/Console/PhinxApplication.php b/src/Phinx/Console/PhinxApplication.php index a5f523b21..8145fc161 100644 --- a/src/Phinx/Console/PhinxApplication.php +++ b/src/Phinx/Console/PhinxApplication.php @@ -20,6 +20,7 @@ use Phinx\Console\Command\Status; use Phinx\Console\Command\Test; use Symfony\Component\Console\Application; +use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputDefinition; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; @@ -90,6 +91,25 @@ public function doRun(InputInterface $input, OutputInterface $output): int return parent::doRun($input, $output); } + /** + * Adds a command object. + * + * Provides backwards compatibility for Symfony Console 6.x/7.x where + * the add() method exists, and Symfony 8.x where it was removed in + * favor of addCommand(). + * + * @param \Symfony\Component\Console\Command\Command $command A Command object + * @return \Symfony\Component\Console\Command\Command|null + */ + public function add(Command $command): ?Command + { + if (method_exists(Application::class, 'addCommand')) { + return parent::addCommand($command); + } + + return parent::add($command); + } + /** * Get the current application version. * From 80834d8e728b4efdba97b7d86997dcc92523c528 Mon Sep 17 00:00:00 2001 From: Matthew Peveler Date: Thu, 4 Dec 2025 21:13:13 -0700 Subject: [PATCH 3/3] Update error message for undefined method in phpstan --- phpstan-baseline.neon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 0445789fd..d5bdae97f 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -6,7 +6,7 @@ parameters: path: src/Phinx/Db/Adapter/MysqlAdapter.php - - message: "#^Call to an undefined method Symfony\\\\Component\\\\Console\\\\Application\\:\\:addCommand\\(\\)\\.$#" + message: "#^Call to an undefined static method Symfony\\\\Component\\\\Console\\\\Application\\:\\:addCommand\\(\\)\\.$#" count: 1 path: src/Phinx/Console/PhinxApplication.php reportUnmatched: false