Fix incompatibility between webprofiler module and migrate:setup command #3018
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When the devel's webprofiler submodule is activated, the migre:setup command fails with the following exception:
TypeError: Argument 1 passed to Drupal\Console\Command\Migrate\SetupCommand::__construct() must be an instance of Drupal\Core\State\State, instance of Drupal\webprofiler\State\StateWrapper given in /srv/www/drupal/src/vendor/drupal/console/src/Command/Migrate/SetupCommand.php on line 44 #0 [internal function]: Drupal\Console\Command\Migrate\SetupCommand->__construct(Object(Drupal\webprofiler\State\StateWrapper), Object(Drupal\migrate\Plugin\MigrationPluginManager))
#1 /srv/www/drupal/src/vendor/symfony/dependency-injection/ContainerBuilder.php(928): ReflectionClass->newInstanceArgs(Array)
#2 /srv/www/drupal/src/vendor/symfony/dependency-injection/ContainerBuilder.php(468): Symfony\Component\DependencyInjection\ContainerBuilder->createService(Object(Symfony\Component\DependencyInjection\Definition), 'migrate_setup')
#3 /srv/www/drupal/src/vendor/drupal/console/src/Application.php(143): Symfony\Component\DependencyInjection\ContainerBuilder->get('migrate_setup')
#4 /srv/www/drupal/src/vendor/drupal/console/src/Application.php(38): Drupal\Console\Application->registerCommands()
#5 /srv/www/drupal/src/vendor/symfony/console/Application.php(124): Drupal\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#6 /srv/www/drupal/src/vendor/drupal/console/bin/drupal.php(70): Symfony\Component\Console\Application->run()
#7 /srv/www/drupal/src/vendor/drupal/console/bin/drupal(4): require('/srv/www/drupal...')
#8 {main}
TypeError: Argument 1 passed to Drupal\Console\Command\Migrate\SetupCommand::__construct() must be an instance of Drupal\Core\State\State, instance of Drupal\webprofiler\State\StateWrapper given in Drupal\Console\Command\Migrate\SetupCommand->__construct() (line 44 of /srv/www/drupal/src/vendor/drupal/console/src/Command/Migrate/SetupCommand.php).
This pull request offer a fix by using Drupal\Core\State\StateInterface instead of Drupal\Core\State\State as type for the first constructor argument of this command, to make it compatible with any implementation of state service.