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
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "*",
Expand Down
6 changes: 6 additions & 0 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -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 static method Symfony\\\\Component\\\\Console\\\\Application\\:\\:addCommand\\(\\)\\.$#"
count: 1
path: src/Phinx/Console/PhinxApplication.php
reportUnmatched: false
20 changes: 20 additions & 0 deletions src/Phinx/Console/PhinxApplication.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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.
*
Expand Down