Skip to content

Commit cea9c12

Browse files
dependabot[bot]dereuromarkMasterOdin
authored
Update symfony/console requirement from ^6.0|^7.0 to ^6.0|^7.0|^8.0 (#2396)
Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: mscherer <[email protected]> Co-authored-by: Matthew Peveler <[email protected]>
1 parent ca7985e commit cea9c12

File tree

3 files changed

+27
-1
lines changed

3 files changed

+27
-1
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"cakephp/database": "^5.0.2",
4242
"psr/container": "^1.1|^2.0",
4343
"symfony/config": "^4.0|^5.0|^6.0|^7.0|^8.0",
44-
"symfony/console": "^6.0|^7.0"
44+
"symfony/console": "^6.0|^7.0|^8.0"
4545
},
4646
"require-dev": {
4747
"ext-json": "*",

phpstan-baseline.neon

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,9 @@ parameters:
44
message: "#^Expression on left side of \\?\\? is not nullable\\.$#"
55
count: 1
66
path: src/Phinx/Db/Adapter/MysqlAdapter.php
7+
8+
-
9+
message: "#^Call to an undefined static method Symfony\\\\Component\\\\Console\\\\Application\\:\\:addCommand\\(\\)\\.$#"
10+
count: 1
11+
path: src/Phinx/Console/PhinxApplication.php
12+
reportUnmatched: false

src/Phinx/Console/PhinxApplication.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
use Phinx\Console\Command\Status;
2121
use Phinx\Console\Command\Test;
2222
use Symfony\Component\Console\Application;
23+
use Symfony\Component\Console\Command\Command;
2324
use Symfony\Component\Console\Input\InputDefinition;
2425
use Symfony\Component\Console\Input\InputInterface;
2526
use Symfony\Component\Console\Input\InputOption;
@@ -90,6 +91,25 @@ public function doRun(InputInterface $input, OutputInterface $output): int
9091
return parent::doRun($input, $output);
9192
}
9293

94+
/**
95+
* Adds a command object.
96+
*
97+
* Provides backwards compatibility for Symfony Console 6.x/7.x where
98+
* the add() method exists, and Symfony 8.x where it was removed in
99+
* favor of addCommand().
100+
*
101+
* @param \Symfony\Component\Console\Command\Command $command A Command object
102+
* @return \Symfony\Component\Console\Command\Command|null
103+
*/
104+
public function add(Command $command): ?Command
105+
{
106+
if (method_exists(Application::class, 'addCommand')) {
107+
return parent::addCommand($command);
108+
}
109+
110+
return parent::add($command);
111+
}
112+
93113
/**
94114
* Get the current application version.
95115
*

0 commit comments

Comments
 (0)