diff --git a/package_manager/package_manager.services.yml b/package_manager/package_manager.services.yml index 0aa69ae971103b48fec30fdc48395bbdac8b270d..a5e5e7b8c6d58ada07b03c4b4f89e4820c5e9743 100644 --- a/package_manager/package_manager.services.yml +++ b/package_manager/package_manager.services.yml @@ -1,4 +1,7 @@ services: + _defaults: + autowire: true + # Underlying Symfony utilities for Composer Stager. Symfony\Component\Filesystem\Filesystem: public: false @@ -8,19 +11,10 @@ services: # Basic infrastructure services for Composer Stager, overridden by us to # provide additional functionality. Drupal\package_manager\ProcessFactory: - arguments: - - '@file_system' - - '@config.factory' public: false Drupal\package_manager\ExecutableFinder: - arguments: - $configFactory: '@config.factory' - autowire: true public: false Drupal\package_manager\FileSyncerFactory: - arguments: - $configFactory: '@config.factory' - autowire: true public: false PhpTuf\ComposerStager\Infrastructure\Service\Finder\ExecutableFinderInterface: alias: 'Drupal\package_manager\ExecutableFinder' @@ -32,33 +26,30 @@ services: # Services provided to Drupal by Package Manager. package_manager.beginner: class: PhpTuf\ComposerStager\Domain\Core\Beginner\Beginner - autowire: true package_manager.stager: class: PhpTuf\ComposerStager\Domain\Core\Stager\Stager - autowire: true package_manager.committer: class: PhpTuf\ComposerStager\Domain\Core\Committer\Committer - autowire: true package_manager.path_locator: class: Drupal\package_manager\PathLocator arguments: - - '%app.root%' - - '@config.factory' - - '@file_system' + $appRoot: '%app.root%' + Drupal\package_manager\PathLocator: '@package_manager.path_locator' package_manager.failure_marker: class: Drupal\package_manager\FailureMarker - arguments: - - '@package_manager.path_locator' + Drupal\package_manager\FailureMarker: '@package_manager.failure_marker' package_manager.update_data_subscriber: class: Drupal\package_manager\EventSubscriber\UpdateDataSubscriber arguments: - '@update.manager' + # @todo Autowire this service when https://drupal.org/i/3325557 lands. + autowire: false tags: - { name: event_subscriber } package_manager.composer_inspector: class: Drupal\package_manager\ComposerInspector - autowire: true public: false + Drupal\package_manager\ComposerInspector: '@package_manager.composer_inspector' # Validators. package_manager.validator.environment_support: @@ -67,16 +58,10 @@ services: - { name: event_subscriber } package_manager.validator.composer: class: Drupal\package_manager\Validator\ComposerValidator - arguments: - - '@package_manager.composer_inspector' - - '@package_manager.path_locator' - - '@module_handler' tags: - { name: event_subscriber } package_manager.validator.disk_space: class: Drupal\package_manager\Validator\DiskSpaceValidator - arguments: - - '@package_manager.path_locator' tags: - { name: event_subscriber } package_manager.validator.pending_updates: @@ -84,121 +69,78 @@ services: arguments: - '%app.root%' - '@update.post_update_registry' + # @todo Autowire this service when https://drupal.org/i/3325557 lands. + autowire: false tags: - { name: event_subscriber } package_manager.validator.lock_file: class: Drupal\package_manager\Validator\LockFileValidator - arguments: - - '@state' - - '@package_manager.path_locator' tags: - { name: event_subscriber } package_manager.validator.file_system: class: Drupal\package_manager\Validator\WritableFileSystemValidator - arguments: - - '@package_manager.path_locator' tags: - { name: event_subscriber } package_manager.validator.composer_settings: class: Drupal\package_manager\Validator\ComposerSettingsValidator - arguments: - - '@package_manager.composer_inspector' - - '@package_manager.path_locator' tags: - { name: event_subscriber } package_manger.validator.composer_minimum_stability: class: Drupal\package_manager\Validator\ComposerMinimumStabilityValidator - arguments: - - '@package_manager.path_locator' - - '@package_manager.composer_inspector' tags: - { name: event_subscriber } package_manager.validator.multisite: class: Drupal\package_manager\Validator\MultisiteValidator - arguments: - - '@package_manager.path_locator' tags: - { name: event_subscriber } package_manager.validator.symlink: class: Drupal\package_manager\Validator\SymlinkValidator - arguments: - - '@package_manager.path_locator' - - '@PhpTuf\ComposerStager\Domain\Service\Precondition\CodebaseContainsNoSymlinksInterface' - - '@PhpTuf\ComposerStager\Infrastructure\Factory\Path\PathFactoryInterface' - - '@module_handler' tags: - { name: event_subscriber } package_manager.validator.duplicate_info_file: class: Drupal\package_manager\Validator\DuplicateInfoFileValidator - arguments: - - '@package_manager.path_locator' tags: - { name: event_subscriber } package_manager.validator.overwrite_existing_packages: class: Drupal\package_manager\Validator\OverwriteExistingPackagesValidator - arguments: - - '@package_manager.path_locator' tags: - { name: event_subscriber } package_manager.validator.staged_database_updates: class: Drupal\package_manager\Validator\StagedDBUpdateValidator - arguments: - - '@package_manager.path_locator' - - '@extension.list.module' - - '@extension.list.theme' tags: - { name: event_subscriber } package_manager.test_site_excluder: class: Drupal\package_manager\PathExcluder\TestSiteExcluder - arguments: - - '@package_manager.path_locator' tags: - { name: event_subscriber } package_manager.vendor_hardening_excluder: class: Drupal\package_manager\PathExcluder\VendorHardeningExcluder - arguments: - - '@package_manager.path_locator' tags: - { name: event_subscriber } package_manager.site_files_excluder: class: Drupal\package_manager\PathExcluder\SiteFilesExcluder - arguments: - $path_locator: '@package_manager.path_locator' - $streamWrapperManager: '@stream_wrapper_manager' tags: - { name: event_subscriber } - autowire: true package_manager.sqlite_excluder: class: Drupal\package_manager\PathExcluder\SqliteDatabaseExcluder - arguments: - - '@package_manager.path_locator' - - '@database' tags: - { name: event_subscriber } package_manager.git_excluder: class: Drupal\package_manager\PathExcluder\GitExcluder - arguments: - - '@package_manager.path_locator' - - '@file_system' tags: - { name: event_subscriber } package_manager.unknown_path_excluder: class: Drupal\package_manager\PathExcluder\UnknownPathExcluder - arguments: - - '@package_manager.path_locator' tags: - { name: event_subscriber } package_manager.site_configuration_excluder: class: Drupal\package_manager\PathExcluder\SiteConfigurationExcluder arguments: - - '%site.path%' - - '@package_manager.path_locator' + $sitePath: '%site.path%' tags: - { name: event_subscriber } package_manager.node_modules_excluder: class: Drupal\package_manager\PathExcluder\NodeModulesExcluder - arguments: - - '@package_manager.path_locator' tags: - { name: event_subscriber } package_manager.uninstall_validator: @@ -215,16 +157,10 @@ services: - { name: event_subscriber } package_manager.validator.composer_plugins: class: Drupal\package_manager\Validator\ComposerPluginsValidator - arguments: - - '@config.factory' - - '@package_manager.composer_inspector' - - '@package_manager.path_locator' tags: - { name: event_subscriber } package_manager.validator.patches: class: Drupal\package_manager\Validator\ComposerPatchesValidator - arguments: - - '@module_handler' tags: - { name: event_subscriber } package_manager.validator.supported_releases: @@ -233,8 +169,6 @@ services: - { name: event_subscriber } package_manager.validator.stage_not_in_active: class: Drupal\package_manager\Validator\StageNotInActiveValidator - arguments: - - '@package_manager.path_locator' tags: - { name: event_subscriber } package_manager.validator.xdebug: @@ -243,4 +177,8 @@ services: - { name: event_subscriber } package_manager.update_processor: class: Drupal\package_manager\PackageManagerUpdateProcessor - arguments: [ '@config.factory', '@queue', '@update.fetcher', '@state', '@private_key', '@keyvalue', '@keyvalue.expirable' ] + arguments: + # @todo Autowire $update_fetcher when https://drupal.org/i/3325557 lands. + $update_fetcher: '@update.fetcher' + $key_value_factory: '@keyvalue' + $key_value_expirable_factory: '@keyvalue.expirable' diff --git a/package_manager/tests/modules/package_manager_bypass/src/PackageManagerBypassServiceProvider.php b/package_manager/tests/modules/package_manager_bypass/src/PackageManagerBypassServiceProvider.php index d382af7017ee685e75e5225b410f2f427999f29f..f6ab530a2fd6cf680e36cb5634bd6fd18551032d 100644 --- a/package_manager/tests/modules/package_manager_bypass/src/PackageManagerBypassServiceProvider.php +++ b/package_manager/tests/modules/package_manager_bypass/src/PackageManagerBypassServiceProvider.php @@ -7,6 +7,7 @@ namespace Drupal\package_manager_bypass; use Drupal\Core\DependencyInjection\ContainerBuilder; use Drupal\Core\DependencyInjection\ServiceProviderBase; use Drupal\Core\Site\Settings; +use Symfony\Component\DependencyInjection\Parameter; use Symfony\Component\DependencyInjection\Reference; /** @@ -30,11 +31,15 @@ final class PackageManagerBypassServiceProvider extends ServiceProviderBase { $container->getDefinition('package_manager.stager')->setClass(NoOpStager::class)->setArguments([$state]); } - $definition = $container->getDefinition('package_manager.path_locator') - ->setClass(MockPathLocator::class); - $arguments = $definition->getArguments(); - array_unshift($arguments, $state); - $definition->setArguments($arguments); + $container->getDefinition('package_manager.path_locator') + ->setClass(MockPathLocator::class) + ->setAutowired(FALSE) + ->setArguments([ + $state, + new Parameter('app.root'), + new Reference('config.factory'), + new Reference('file_system'), + ]); } }