diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 74234da..6034cfb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,7 +13,7 @@ jobs: fail-fast: false matrix: php: ['8.4'] - symfony_version: ['8.0.*'] + symfony_version: ['6.4.*', '7.0.*', '7.4.*', '8.0.*'] name: PHP ${{ matrix.php }} Symfony ${{ matrix.symfony_version }} diff --git a/.gitignore b/.gitignore index b34e165..d099c2a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +*.sh .phpunit.cache composer.lock config/reference.php diff --git a/composer.json b/composer.json index 559d209..ef2c9bc 100644 --- a/composer.json +++ b/composer.json @@ -26,8 +26,8 @@ "phpunit/phpunit": "^12.1", "psalm/plugin-phpunit": "^0.19.5", "psalm/plugin-symfony": "^5.2", - "symfony/framework-bundle": "^8.0", - "symfony/phpunit-bridge": "^8.0", + "symfony/framework-bundle": "^6.4 || ^7.0 || ^7.4 || ^8.0", + "symfony/phpunit-bridge": "^6.4 || ^7.0 || ^7.4 || ^8.0", "vimeo/psalm": "^6" }, "autoload": { diff --git a/src/Command/Doctrine/ContextRunner.php b/src/Command/Doctrine/ContextRunner.php index f316b6e..257841a 100644 --- a/src/Command/Doctrine/ContextRunner.php +++ b/src/Command/Doctrine/ContextRunner.php @@ -29,6 +29,7 @@ use function explode; use function implode; use function ksort; +use function method_exists; use function sprintf; use function trim; @@ -53,6 +54,14 @@ public function getConfiguration(): Configuration public function configure(Command $wrapper, Command $innerCommand): void { + if (method_exists($wrapper, 'getCode') && $wrapper->getCode() !== null) { + throw new InvalidArgumentException(sprintf('The CLI command "%s" is not expected to use custom execution code', $wrapper::class)); + } + + if (method_exists($innerCommand, 'getCode') && $innerCommand->getCode() !== null) { + throw new InvalidArgumentException(sprintf('The CLI command "%s" is not expected to use custom execution code', $innerCommand::class)); + } + $name = $wrapper->getName() ?? $innerCommand->getName(); if ($name !== null) { $wrapper->setName($name); diff --git a/src/Command/Doctrine/Database/CreateDatabaseCommand.php b/src/Command/Doctrine/Database/CreateDatabaseCommand.php index 432f8ec..578af1a 100644 --- a/src/Command/Doctrine/Database/CreateDatabaseCommand.php +++ b/src/Command/Doctrine/Database/CreateDatabaseCommand.php @@ -17,7 +17,7 @@ public function __construct( private readonly CreateDatabaseDoctrineCommand $command, private readonly ContextRunner $contextRunner, ) { - parent::__construct($this->command->getName(), $this->command->getCode()); + parent::__construct($this->command->getName()); } #[Override] diff --git a/src/Command/Doctrine/Mapping/InfoCommand.php b/src/Command/Doctrine/Mapping/InfoCommand.php index d3842c2..7f7be3b 100644 --- a/src/Command/Doctrine/Mapping/InfoCommand.php +++ b/src/Command/Doctrine/Mapping/InfoCommand.php @@ -16,7 +16,7 @@ public function __construct( private readonly \Doctrine\ORM\Tools\Console\Command\InfoCommand $command, private readonly ContextRunner $contextRunner, ) { - parent::__construct($this->command->getName(), $this->command->getCode()); + parent::__construct($this->command->getName()); } #[Override] diff --git a/src/Command/Doctrine/Migrations/CurrentCommand.php b/src/Command/Doctrine/Migrations/CurrentCommand.php index a00be76..6ee12bd 100644 --- a/src/Command/Doctrine/Migrations/CurrentCommand.php +++ b/src/Command/Doctrine/Migrations/CurrentCommand.php @@ -16,7 +16,7 @@ public function __construct( private readonly \Doctrine\Migrations\Tools\Console\Command\CurrentCommand $command, private readonly ContextRunner $contextRunner, ) { - parent::__construct($this->command->getName(), $this->command->getCode()); + parent::__construct($this->command->getName()); } #[Override] diff --git a/src/Command/Doctrine/Migrations/DiffCommand.php b/src/Command/Doctrine/Migrations/DiffCommand.php index 3f0f8ac..b5d8fa7 100644 --- a/src/Command/Doctrine/Migrations/DiffCommand.php +++ b/src/Command/Doctrine/Migrations/DiffCommand.php @@ -16,7 +16,7 @@ public function __construct( private readonly \Doctrine\Migrations\Tools\Console\Command\DiffCommand $command, private readonly ContextRunner $contextRunner, ) { - parent::__construct($this->command->getName(), $this->command->getCode()); + parent::__construct($this->command->getName()); } #[Override] diff --git a/src/Command/Doctrine/Migrations/DumpSchemaCommand.php b/src/Command/Doctrine/Migrations/DumpSchemaCommand.php index aaddc83..06314cd 100644 --- a/src/Command/Doctrine/Migrations/DumpSchemaCommand.php +++ b/src/Command/Doctrine/Migrations/DumpSchemaCommand.php @@ -16,7 +16,7 @@ public function __construct( private readonly \Doctrine\Migrations\Tools\Console\Command\DumpSchemaCommand $command, private readonly ContextRunner $contextRunner, ) { - parent::__construct($this->command->getName(), $this->command->getCode()); + parent::__construct($this->command->getName()); } #[Override] diff --git a/src/Command/Doctrine/Migrations/ExecuteCommand.php b/src/Command/Doctrine/Migrations/ExecuteCommand.php index 3a2a57e..f211485 100644 --- a/src/Command/Doctrine/Migrations/ExecuteCommand.php +++ b/src/Command/Doctrine/Migrations/ExecuteCommand.php @@ -16,7 +16,7 @@ public function __construct( private readonly \Doctrine\Migrations\Tools\Console\Command\ExecuteCommand $command, private readonly ContextRunner $contextRunner, ) { - parent::__construct($this->command->getName(), $this->command->getCode()); + parent::__construct($this->command->getName()); } #[Override] diff --git a/src/Command/Doctrine/Migrations/GenerateCommand.php b/src/Command/Doctrine/Migrations/GenerateCommand.php index a68fc9a..34e0b6a 100644 --- a/src/Command/Doctrine/Migrations/GenerateCommand.php +++ b/src/Command/Doctrine/Migrations/GenerateCommand.php @@ -16,7 +16,7 @@ public function __construct( private readonly \Doctrine\Migrations\Tools\Console\Command\GenerateCommand $command, private readonly ContextRunner $contextRunner, ) { - parent::__construct($this->command->getName(), $this->command->getCode()); + parent::__construct($this->command->getName()); } #[Override] diff --git a/src/Command/Doctrine/Migrations/LatestCommand.php b/src/Command/Doctrine/Migrations/LatestCommand.php index 6c11c2e..8ccaaac 100644 --- a/src/Command/Doctrine/Migrations/LatestCommand.php +++ b/src/Command/Doctrine/Migrations/LatestCommand.php @@ -16,7 +16,7 @@ public function __construct( private readonly \Doctrine\Migrations\Tools\Console\Command\LatestCommand $command, private readonly ContextRunner $contextRunner, ) { - parent::__construct($this->command->getName(), $this->command->getCode()); + parent::__construct($this->command->getName()); } #[Override] diff --git a/src/Command/Doctrine/Migrations/ListCommand.php b/src/Command/Doctrine/Migrations/ListCommand.php index 1a1936e..fd64d9e 100644 --- a/src/Command/Doctrine/Migrations/ListCommand.php +++ b/src/Command/Doctrine/Migrations/ListCommand.php @@ -16,7 +16,7 @@ public function __construct( private readonly \Doctrine\Migrations\Tools\Console\Command\ListCommand $command, private readonly ContextRunner $contextRunner, ) { - parent::__construct($this->command->getName(), $this->command->getCode()); + parent::__construct($this->command->getName()); } #[Override] diff --git a/src/Command/Doctrine/Migrations/MigrateCommand.php b/src/Command/Doctrine/Migrations/MigrateCommand.php index 5858fbf..d6922ef 100644 --- a/src/Command/Doctrine/Migrations/MigrateCommand.php +++ b/src/Command/Doctrine/Migrations/MigrateCommand.php @@ -16,7 +16,7 @@ public function __construct( private readonly \Doctrine\Migrations\Tools\Console\Command\MigrateCommand $command, private readonly ContextRunner $contextRunner, ) { - parent::__construct($this->command->getName(), $this->command->getCode()); + parent::__construct($this->command->getName()); } #[Override] diff --git a/src/Command/Doctrine/Migrations/RollupCommand.php b/src/Command/Doctrine/Migrations/RollupCommand.php index 82dfe82..145459c 100644 --- a/src/Command/Doctrine/Migrations/RollupCommand.php +++ b/src/Command/Doctrine/Migrations/RollupCommand.php @@ -16,7 +16,7 @@ public function __construct( private readonly \Doctrine\Migrations\Tools\Console\Command\RollupCommand $command, private readonly ContextRunner $contextRunner, ) { - parent::__construct($this->command->getName(), $this->command->getCode()); + parent::__construct($this->command->getName()); } #[Override] diff --git a/src/Command/Doctrine/Migrations/StatusCommand.php b/src/Command/Doctrine/Migrations/StatusCommand.php index c4e99e8..a33d5e8 100644 --- a/src/Command/Doctrine/Migrations/StatusCommand.php +++ b/src/Command/Doctrine/Migrations/StatusCommand.php @@ -16,7 +16,7 @@ public function __construct( private readonly \Doctrine\Migrations\Tools\Console\Command\StatusCommand $command, private readonly ContextRunner $contextRunner, ) { - parent::__construct($this->command->getName(), $this->command->getCode()); + parent::__construct($this->command->getName()); } #[Override] diff --git a/src/Command/Doctrine/Migrations/SyncMetadataCommand.php b/src/Command/Doctrine/Migrations/SyncMetadataCommand.php index 107d6c6..d4ab4f2 100644 --- a/src/Command/Doctrine/Migrations/SyncMetadataCommand.php +++ b/src/Command/Doctrine/Migrations/SyncMetadataCommand.php @@ -16,7 +16,7 @@ public function __construct( private readonly \Doctrine\Migrations\Tools\Console\Command\SyncMetadataCommand $command, private readonly ContextRunner $contextRunner, ) { - parent::__construct($this->command->getName(), $this->command->getCode()); + parent::__construct($this->command->getName()); } #[Override] diff --git a/src/Command/Doctrine/Migrations/UpToDateCommand.php b/src/Command/Doctrine/Migrations/UpToDateCommand.php index 6fa3e5d..c6e1d08 100644 --- a/src/Command/Doctrine/Migrations/UpToDateCommand.php +++ b/src/Command/Doctrine/Migrations/UpToDateCommand.php @@ -16,7 +16,7 @@ public function __construct( private readonly \Doctrine\Migrations\Tools\Console\Command\UpToDateCommand $command, private readonly ContextRunner $contextRunner, ) { - parent::__construct($this->command->getName(), $this->command->getCode()); + parent::__construct($this->command->getName()); } #[Override] diff --git a/src/Command/Doctrine/Migrations/VersionCommand.php b/src/Command/Doctrine/Migrations/VersionCommand.php index c76d59b..9395b13 100644 --- a/src/Command/Doctrine/Migrations/VersionCommand.php +++ b/src/Command/Doctrine/Migrations/VersionCommand.php @@ -16,7 +16,7 @@ public function __construct( private readonly \Doctrine\Migrations\Tools\Console\Command\VersionCommand $command, private readonly ContextRunner $contextRunner, ) { - parent::__construct($this->command->getName(), $this->command->getCode()); + parent::__construct($this->command->getName()); } #[Override] diff --git a/src/Command/Doctrine/Schema/CreateSchemaCommand.php b/src/Command/Doctrine/Schema/CreateSchemaCommand.php index 76750d4..bbc693c 100644 --- a/src/Command/Doctrine/Schema/CreateSchemaCommand.php +++ b/src/Command/Doctrine/Schema/CreateSchemaCommand.php @@ -17,7 +17,7 @@ public function __construct( private readonly CreateCommand $command, private readonly ContextRunner $contextRunner, ) { - parent::__construct($this->command->getName(), $this->command->getCode()); + parent::__construct($this->command->getName()); } #[Override] diff --git a/src/Command/Doctrine/Schema/ValidateSchemaCommand.php b/src/Command/Doctrine/Schema/ValidateSchemaCommand.php index 43aa5da..eeed02d 100644 --- a/src/Command/Doctrine/Schema/ValidateSchemaCommand.php +++ b/src/Command/Doctrine/Schema/ValidateSchemaCommand.php @@ -16,7 +16,7 @@ public function __construct( private readonly \Doctrine\ORM\Tools\Console\Command\ValidateSchemaCommand $command, private readonly ContextRunner $contextRunner, ) { - parent::__construct($this->command->getName(), $this->command->getCode()); + parent::__construct($this->command->getName()); } #[Override]