Problem/Motivation
When project_browser is enabled on the Drupal 10 site & any drush operation is executed apart from drush cr, a fatal error is thrown & the command gets terminated abnormally.
PHP Fatal error: Type of Drupal\project_browser\Commands\UpdateFixtureCommands::$logger must be ?Psr\Log\LoggerInterface (as in class Drush\Commands\DrushCommands) in /var/www/html/modules/contrib/project_browser/src/Commands/UpdateFixtureCommands.php on line 25
Steps to reproduce
Once vanilla Drupal 10 is installed, execute the following commands:
composer require 'drupal/project_browser:1.0.x-dev@dev'
composer require drush/drush
By this time, drush works normally, such as drush uli, drush cst
Now enable the project_browser module and try executing drush uli, it would throw the following error:
PHP Fatal error: Type of Drupal\project_browser\Commands\UpdateFixtureCommands::$logger must be ?Psr\Log\LoggerInterface (as in class Drush\Commands\DrushCommands) in /var/www/html/modules/contrib/project_browser/src/Commands/UpdateFixtureCommands.php on line 25
Proposed resolution
The issue is happening due to the signature of the \Drush\Commands\DrushCommands::logger, which was updated last year in Dec, please see bd0cfe46c309383028b7fd994d2590cdbaaadcba
Remaining tasks
Create MR
- ✅ File an issue about this project
- ☐ Manual Testing
- ☐ Code Review
- ☐ Accessibility Review
- ☐ Automated tests needed/written?


| Comment | File | Size | Author |
|---|---|---|---|
| #8 | screenshot-drush-success-3292395.png | 10.38 KB | capysara |
Issue fork project_browser-3292395
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
rishi.kulshreshthaComment #4
narendrarGreat catch, but I think this change will not work for Drupal 9. We need a solution which works for both.
Comment #5
rishi.kulshreshthaSo my initial thought was to provide a fix for D10 & then backport it to D9, but while revamping the code, I found that it isn't required. The code is now updated to replace the
\Drupal\project_browser\Commands\UpdateFixtureCommands::$loggerwith inherited\Drush\Commands\DrushCommands::loggerComment #6
narendrarLooks good, except that build is failing due to Unused use statement
use Psr\Log\LoggerInterface;Comment #7
rishi.kulshreshtha🤦 , now back to review.
Comment #8
capysara commentedI tested this manually with:
Drupal 10.0.0-dev
PHP 8.1.3
Using local environment ddev v1.19.0
I tried a few different drush commands (uli, help, coder, cim) and I can confirm that applying the patch in MR172 in comment #6 allows drush commands without throwing errors.
Comment #9
narendrarComment #12
bnjmnmThanks for catching @ fixing this @Rishi Kulshreshtha, merged!