3

I have a Drupal 8 site set up with Acquia Dev Desktop on my localhost. I am using PHP 7.0.14; everything is working fine, and the site works perfectly.

I installed Drush 8. When I try to run drush cr all, I get this error message.

PHP Fatal error: Declaration of Drush\Command\DrushInputAdapter::hasParameterOption($values) must be compatible with Symfony\Component\Console\Input\InputInterface::hasParameterOption($values, $onlyParams = false) in /Applications/DevDesktop/tools/vendor/drush/drush/lib/Drush/Command/DrushInputAdapter.php on line 27

The lines causing the error are the following ones.

class DrushInputAdapter implements InputInterface {
    protected $arguments;
    protected $options;
    protected $interactive;

    public function __construct($arguments, $options, $command = false, $interactive = true)
    {
        $this->arguments = $arguments;
        $this->options = $options;

        // If a command name is provided as a parameter, then push
        // it onto the front of the arguments list as a service
        if ($command) {
            $this->arguments = array_merge(
                [ 'command' => $command ],
                $this->arguments
            );
        }
        // Is it interactive, or is it not interactive?
        // Call drush_get_option() here if value not passed in?
        $this->interactive = $interactive;
    }

With Drupal Console, I get something similar.

PHP Fatal error: Declaration of Drupal\Component\DependencyInjection\Container::set($id, $service) must be compatible with Symfony\Component\DependencyInjection\ContainerInterface::set($id, $service, $scope = self::SCOPE_CONTAINER) in /Users/josue/WebDevelop/drupal-8.4.0/core/lib/Drupal/Component/DependencyInjection/Container.php on line 47

1
  • a faster solution is to update to drush 9: composer require drush/drush:9.*
    – ValRob
    Nov 1, 2017 at 12:12

2 Answers 2

3

Updating to Drush 9, as suggested in the comment by user3346970, is certainly one solution to this problem. If you wish to stick with Drush 8, upgrade to version 8.1.15 or later. The problem you report above was fixed somewhere around version 8.1.12.

I'm not certain about the exact versions of Drupal Console to use with each version of Drupal, but I believe that you will probably also discover that updating to the latest version should resolve things as well. The error you are seeing indicates you are crossing Symfony version 2 (e.g. in an old version of Drush or Drupal Console) with Symfony version 3 (e.g. in Drupal 8.4.0 and later).

1

I have updated my drush version from 8.1.10 => 8.1.15 using below command and working fine.

composer global update drush/drush

2
  • 1
    yeah. Also, today, Acquia have a new version and comes with drush 8.1.15.
    – ValRob
    Jun 12, 2018 at 9:04
  • Please do not install Drush -- or any other PHP commandline tool -- using composer global require. Please use cgr instead. See Fixing the Composer Global command. Sep 6, 2018 at 23:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.