PHP Fatal error: Declaration of Robo\Common\ConfigAwareTrait::getConfig() must be compatible with Drush\Commands\DrushCommands::getConfig(): Drush\Config\DrushConfig in /var/www/html/vendor/consolidation/robo/src/Common/ConfigAwareTrait.php on line 34
Describe the bug
On a new Drupal 11 project, doing drush si produces this error:
PHP Fatal error: Declaration of Robo\Common\ConfigAwareTrait::getConfig() must be compatible with Drush\Commands\DrushCommands::getConfig(): Drush\Config\DrushConfig in /var/www/html/vendor/consolidation/robo/src/Common/ConfigAwareTrait.php on line 34
To Reproduce
Installed Drupal on PHP 8.3, with the version of Drush that Composer installs by default.
Workaround
None other than hacking the file vendor/drush/drush/src/Config/ConfigAwareTrait.php by hand to remove the return type from getConfig().
System Configuration
| Q | A |
|---|---|
| Drush version? | 13.6.0 |
| Drupal version? | 11.1.7 |
| PHP version | 8.3.19 |
| OS? | Mac, using ddev |
Additional information Add any other context about the problem here.
Seems like you have an odd version of consolidation/robo in your vendor. Maybe try to update that.
Should Drush then declare a minimum version of consolidation/robo to prevent this?
AFAIK, we do already. If we dont its a bug.
Well this was a clean D11 install, and Composer installed that version of robo.
Also, I've just cloned 5.x of robo, and it has in Robo\Common\ConfigAwareTrait:
public function getConfig()
I'm having the same problem.