Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incompatible declaration of Psysh\Shell::hasCommand #4916

Closed
felmab opened this issue Dec 9, 2021 · 8 comments
Closed

Incompatible declaration of Psysh\Shell::hasCommand #4916

felmab opened this issue Dec 9, 2021 · 8 comments

Comments

@felmab
Copy link

felmab commented Dec 9, 2021

I had to upgrade Drush from version 9 to version 10 (10.6.1) in order to upgrade a site from Drupal 8 to Drupal 9. I noticed this error when trying to launch the core:cli command:

PHP Fatal error: Declaration of Drush\Psysh\Shell::hasCommand($input) must be compatible with Psy\Shell::hasCommand(string $input): bool in /var/www/html/vendor/drush/drush/src/Psysh/Shell.php on line 37

On another site using the same version of Drush, there is no such issue. The difference appears to be that the former uses psy/psysh:0.11.0 while the latter uses psy/psysh:0.10.9 (with different method signatures indeed). Provided I did nothing wrong while updating, there might be a constraint missing somewhere in order to avoid newer versions of psy/psysh.

@weitzman
Copy link
Member

weitzman commented Dec 9, 2021

Looks like it. We can just require the newer psysh in Drush 11. PRs welcome.

@felmab
Copy link
Author

felmab commented Dec 9, 2021

Tests fail in #4918 but errors look unrelated.

@MatthieuScarset
Copy link

MatthieuScarset commented Dec 15, 2021

Same issue since today for me.

This is a blocker because it prevents developers from using drush php comand.

Using Drush Commandline Tool 10.6.0

Trying to run drush php does not work:

Fatal error: Declaration of Drush\Psysh\Shell::hasCommand($input) must be compatible with Psy\Shell::hasCommand(string $input): bool in /app/src/vendor/drush/drush/src/Psysh/Shell.php on line 37
 [warning] Drush command terminated abnormally.

@felmab
Copy link
Author

felmab commented Dec 15, 2021

@MatthieuScarset while waiting for a new release you can manually adapt the signature of Shell::hasCommand like this (or maybe force a dev version).

@alexpott
Copy link
Contributor

It might be handy to add a =< 0.10 constraint to Drush 10 so people can run composer update and composer can do the correct thing.

@weitzman
Copy link
Member

Sure I'd merge that PR if anyone gets inspired.

@felmab
Copy link
Author

felmab commented Dec 15, 2021

It might be handy to add a =< 0.10 constraint to Drush 10 so people can run composer update and composer can do the correct thing.

I think that's essentially what was done in #4917, only that it hasn't been released yet.

@weitzman
Copy link
Member

Thanks for clarifying. Released at https://github.com/drush-ops/drush/releases/tag/10.6.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants