From 3bd9c292494ed9e86be6be0b2bb11c46162f2684 Mon Sep 17 00:00:00 2001 From: tedbow <tedbow@240860.no-reply.drupal.org> Date: Tue, 17 Aug 2021 14:12:04 +0000 Subject: [PATCH] Issue #3228392 by tedbow: Fix various nits --- automatic_updates.services.yml | 20 +++++++++---------- src/BatchProcessor.php | 2 +- src/Form/UpdateReady.php | 2 +- src/Form/UpdaterForm.php | 4 ++-- src/Updater.php | 2 +- .../src/MetadataController.php | 2 +- tests/src/Build/AttendedUpdateTestBase.php | 2 +- tests/src/Traits/JsonTrait.php | 2 +- tests/src/Traits/LocalPackagesTrait.php | 4 ++-- .../src/Unit/StagedProjectsValidationTest.php | 2 +- 10 files changed, 21 insertions(+), 21 deletions(-) diff --git a/automatic_updates.services.yml b/automatic_updates.services.yml index 45652a55de..c5638b40d3 100644 --- a/automatic_updates.services.yml +++ b/automatic_updates.services.yml @@ -4,32 +4,32 @@ services: arguments: ['@keyvalue.expirable', '@datetime.time', 24] automatic_updates.updater: class: Drupal\automatic_updates\Updater - arguments: [ '@state', '@string_translation','@automatic_updates.beginner', '@automatic_updates.stager', '@automatic_updates.cleaner', '@automatic_updates.committer' , '@file_system', '@event_dispatcher'] + arguments: ['@state', '@string_translation','@automatic_updates.beginner', '@automatic_updates.stager', '@automatic_updates.cleaner', '@automatic_updates.committer' , '@file_system', '@event_dispatcher'] automatic_updates.staged_package_validator: class: Drupal\automatic_updates\Validation\StagedProjectsValidation - arguments: [ '@string_translation', '@automatic_updates.updater' ] + arguments: ['@string_translation', '@automatic_updates.updater' ] tags: - { name: event_subscriber } automatic_updates.beginner: class: Drupal\automatic_updates\ComposerStager\Beginner arguments: - [ '@automatic_updates.file_copier', '@automatic_updates.file_system' ] + ['@automatic_updates.file_copier', '@automatic_updates.file_system' ] automatic_updates.stager: class: PhpTuf\ComposerStager\Domain\Stager arguments: - [ '@automatic_updates.composer_runner', '@automatic_updates.file_system' ] + ['@automatic_updates.composer_runner', '@automatic_updates.file_system' ] automatic_updates.cleaner: class: PhpTuf\ComposerStager\Domain\Cleaner arguments: - [ '@automatic_updates.file_system' ] + ['@automatic_updates.file_system' ] automatic_updates.committer: class: PhpTuf\ComposerStager\Domain\Committer arguments: - [ '@automatic_updates.file_copier', '@automatic_updates.file_system' ] + ['@automatic_updates.file_copier', '@automatic_updates.file_system' ] automatic_updates.composer_runner: class: PhpTuf\ComposerStager\Infrastructure\Process\Runner\ComposerRunner arguments: - [ '@automatic_updates.exec_finder', '@automatic_updates.process_factory' ] + ['@automatic_updates.exec_finder', '@automatic_updates.process_factory' ] automatic_updates.file_copier.factory: class: PhpTuf\ComposerStager\Infrastructure\Process\FileCopier\FileCopierFactory arguments: @@ -55,7 +55,7 @@ services: automatic_updates.file_system: class: PhpTuf\ComposerStager\Infrastructure\Filesystem\Filesystem arguments: - [ '@automatic_updates.symfony_file_system' ] + ['@automatic_updates.symfony_file_system' ] automatic_updates.symfony_file_system: class: Symfony\Component\Filesystem\Filesystem automatic_updates.symfony_exec_finder: @@ -63,10 +63,10 @@ services: automatic_updates.rsync: class: PhpTuf\ComposerStager\Infrastructure\Process\Runner\RsyncRunner arguments: - [ '@automatic_updates.exec_finder', '@automatic_updates.process_factory' ] + ['@automatic_updates.exec_finder', '@automatic_updates.process_factory' ] automatic_updates.exec_finder: class: PhpTuf\ComposerStager\Infrastructure\Process\ExecutableFinder arguments: - [ '@automatic_updates.symfony_exec_finder' ] + ['@automatic_updates.symfony_exec_finder' ] automatic_updates.process_factory: class: Drupal\automatic_updates\ComposerStager\ProcessFactory diff --git a/src/BatchProcessor.php b/src/BatchProcessor.php index 4086d2a7e1..940418929d 100644 --- a/src/BatchProcessor.php +++ b/src/BatchProcessor.php @@ -12,7 +12,7 @@ use Symfony\Component\HttpFoundation\RedirectResponse; class BatchProcessor { /** - * Get the updater service. + * Gets the updater service. * * @return \Drupal\automatic_updates\Updater * The updater service. diff --git a/src/Form/UpdateReady.php b/src/Form/UpdateReady.php index 619d0dd1ea..cb978f7d20 100644 --- a/src/Form/UpdateReady.php +++ b/src/Form/UpdateReady.php @@ -102,7 +102,7 @@ class UpdateReady extends UpdateFormBase { $session = $this->getRequest()->getSession(); // Store maintenance_mode setting so we can restore it when done. $session->set('maintenance_mode', $this->state->get('system.maintenance_mode')); - if ($form_state->getValue('maintenance_mode') == TRUE) { + if ($form_state->getValue('maintenance_mode') === TRUE) { $this->state->set('system.maintenance_mode', TRUE); // @todo unset after updater. After db update? } diff --git a/src/Form/UpdaterForm.php b/src/Form/UpdaterForm.php index 6dce8d146f..599c7257e0 100644 --- a/src/Form/UpdaterForm.php +++ b/src/Form/UpdaterForm.php @@ -99,7 +99,7 @@ class UpdaterForm extends UpdateFormBase { $project = $project_data['drupal']; // If we're already up-to-date, there's nothing else we need to do. - if ($project['status'] == UpdateManagerInterface::CURRENT) { + if ($project['status'] === UpdateManagerInterface::CURRENT) { $this->messenger()->addMessage('No update available'); return $form; } @@ -190,7 +190,7 @@ class UpdaterForm extends UpdateFormBase { /** * Builds the form actions. * - * @return array + * @return mixed[][] * The form's actions elements. */ protected function actions(): array { diff --git a/src/Updater.php b/src/Updater.php index 6e4b9f55c2..b5751a48c2 100644 --- a/src/Updater.php +++ b/src/Updater.php @@ -80,7 +80,7 @@ class Updater { protected $eventDispatcher; /** - * Updater constructor. + * Constructs an Updater object. * * @param \Drupal\Core\State\StateInterface $state * The state service. diff --git a/tests/modules/automatic_updates_test/src/MetadataController.php b/tests/modules/automatic_updates_test/src/MetadataController.php index 8c8e480b05..c00cce391a 100644 --- a/tests/modules/automatic_updates_test/src/MetadataController.php +++ b/tests/modules/automatic_updates_test/src/MetadataController.php @@ -16,7 +16,7 @@ class MetadataController extends ControllerBase { * testing automatic updates. This was done in order to use a different * directory of mock XML files. */ - public function updateTest($project_name = 'drupal', $version = NULL) { + public function updateTest($project_name = 'drupal', $version = NULL): Response { if ($project_name !== 'drupal') { return new Response(); } diff --git a/tests/src/Build/AttendedUpdateTestBase.php b/tests/src/Build/AttendedUpdateTestBase.php index 1de9ad105c..9d2f2ef93a 100644 --- a/tests/src/Build/AttendedUpdateTestBase.php +++ b/tests/src/Build/AttendedUpdateTestBase.php @@ -118,7 +118,7 @@ END; /** * Returns the data to write to the test site's composer.json. * - * @return array + * @return mixed[] * The data that should be written to the test site's composer.json. */ protected function getComposerConfiguration(): array { diff --git a/tests/src/Traits/JsonTrait.php b/tests/src/Traits/JsonTrait.php index 3299ea439f..2c216306b2 100644 --- a/tests/src/Traits/JsonTrait.php +++ b/tests/src/Traits/JsonTrait.php @@ -16,7 +16,7 @@ trait JsonTrait { * @param string $path * The path of the file to read. * - * @return array + * @return mixed[] * The parsed data in the file. */ protected function readJson(string $path): array { diff --git a/tests/src/Traits/LocalPackagesTrait.php b/tests/src/Traits/LocalPackagesTrait.php index 938ca0a268..f99b7e061c 100644 --- a/tests/src/Traits/LocalPackagesTrait.php +++ b/tests/src/Traits/LocalPackagesTrait.php @@ -30,7 +30,7 @@ trait LocalPackagesTrait { * @param string $dir * The directory which contains composer.lock. * - * @return array[] + * @return mixed[][] * The local path repositories' configuration, for inclusion in a * composer.json file. */ @@ -67,7 +67,7 @@ trait LocalPackagesTrait { * @param string $dir * The directory which contains the lock file. * - * @return array[] + * @return mixed[][] * All package information (including dev packages) from the lock file. */ private function getPackagesFromLockFile(string $dir): array { diff --git a/tests/src/Unit/StagedProjectsValidationTest.php b/tests/src/Unit/StagedProjectsValidationTest.php index c3b256bfa7..a746e6708f 100644 --- a/tests/src/Unit/StagedProjectsValidationTest.php +++ b/tests/src/Unit/StagedProjectsValidationTest.php @@ -119,7 +119,7 @@ class StagedProjectsValidationTest extends UnitTestCase { * * @covers ::validateStagedProjects */ - public function testNoErrors() { + public function testNoErrors(): void { $fixtures_dir = realpath(__DIR__ . '/../../fixtures/project_staged_validation/no_errors'); $updater = $this->prophesize(Updater::class); $updater->getActiveDirectory()->willReturn("$fixtures_dir/active"); -- GitLab