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
7 changes: 4 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,15 @@ jobs:
# Test active version
- php-version: '8.3'
phpunit-version: 9
symfony-version: '^7'
- php-version: '8.4'
phpunit-version: 9
symfony-version: '^7'
- php-version: '8.5'
phpunit-version: 9
symfony-version: '^8'
# Test latest unreleased versions
- php-version: '8.5'
phpunit-version: 9
symfony-version: '^7'
symfony-version: '^8'
stability: 'dev'
name: PHP ${{ matrix.php-version }} Test on Symfony ${{ matrix.symfony-version }} ${{ matrix.dependencies}} ${{ matrix.stability }} ${{ matrix.composer-flag }}
steps:
Expand Down
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
"require": {
"ext-json": "*",
"php": "^7.4|^8.0",
"symfony/console": "^5.0|^6.0|^7.0",
"symfony/yaml": "^5.0|^6.0|^7.0",
"symfony/process": "^5.0|^6.0|^7.0",
"symfony/console": "^5.0|^6.0|^7.0|^8.0",
"symfony/yaml": "^5.0|^6.0|^7.0|^8.0",
"symfony/process": "^5.0|^6.0|^7.0|^8.0",
"composer/semver": "^3.4"
},
"autoload": {
Expand All @@ -41,7 +41,7 @@
},
"extra": {
"branch-alias": {
"dev-master": "1.3-dev"
"dev-main": "1.8-dev"
}
}
}
34 changes: 29 additions & 5 deletions src/Liip/RMT/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
use Liip\RMT\Command\ConfigCommand;
use Liip\RMT\Command\InitCommand;
use Liip\RMT\Output\Output;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Application as BaseApplication;
Expand Down Expand Up @@ -47,13 +48,13 @@ public function __construct()
// Add all command, in a controlled way and render exception if any
try {
// Add the default command
$this->add(new InitCommand());
$this->bcAddCommand(new InitCommand());
// Add command that require the config file
if (file_exists($this->getConfigFilePath())) {
$this->add(new ReleaseCommand());
$this->add(new CurrentCommand());
$this->add(new ChangesCommand());
$this->add(new ConfigCommand());
$this->bcAddCommand(new ReleaseCommand());
$this->bcAddCommand(new CurrentCommand());
$this->bcAddCommand(new ChangesCommand());
$this->bcAddCommand(new ConfigCommand());
}
} catch (\Exception $e) {
$output = new Output();
Expand Down Expand Up @@ -183,4 +184,27 @@ public function asText($namespace = null, $raw = false)

return implode(PHP_EOL, $messages);
}

/**
* Can be removed when we remove support for Symfony console < 7.4.
*
* When removing, change the calls to bcAddCommand to addCommand.
*
* @param callable|Command $command
*/
private function bcAddCommand($command): void
{
/* @phpstan-ignore function.alreadyNarrowedType */
if (method_exists($this, 'addCommand')) {
$this->addCommand($command);

return;
}

if (!$command instanceof Command) {
throw new \InvalidArgumentException('Until we remove support for symfony console < 7.4, all commands must extend the base class');
}

$this->add($command);
}
}