-
Notifications
You must be signed in to change notification settings - Fork 9
Description
When using a command like compile, compile:list or compile:watch with Drupal 11, Composer fails with a fatal error due to an incompatible method signature.
Error message:
PHP Fatal error: Declaration of Civi\CompilePlugin\Command\CompileCommand::execute(Symfony\Component\Console\Input\InputInterface $input, Symfony\Component\Console\Output\OutputInterface $output) must be compatible with Symfony\Component\Console\Command\Command::execute(Symfony\Component\Console\Input\InputInterface $input, Symfony\Component\Console\Output\OutputInterface $output): int in /var/www/[...]/vendor/civicrm/composer-compile-plugin/src/Command/CompileCommand.php on line 54
This happens because Drupal 11 is using symfony/console in version 7.x, which requires the execute() method in console commands to declare a return type (: int), but the plugin currently doesn’t.
Steps to reproduce:
- Install CiviCRM with drupal/core >= 11.2 including symfony/console >= 7.0
- Include civicrm/composer-compile-plugin (latest release, e.g. v0.21).
- Run any Composer command that triggers the plugin command.
Suggested fix:
Update Civi\CompilePlugin\Command\CompileCommand::execute() to:
protected function execute(InputInterface $input, OutputInterface $output): int
{
// existing code ...
return Command::SUCCESS;
}