From cfafc5a779999da6e284daaef6d5cde5c688378a Mon Sep 17 00:00:00 2001 From: "Theresa.Grannum" <theresa.grannum@3688861.no-reply.drupal.org> Date: Wed, 20 Jul 2022 17:37:41 +0000 Subject: [PATCH] Issue #3295791 by Theresa.Grannum, tedbow: Add return types where needed --- .../tests/src/Build/ModuleUpdateTest.php | 4 ++-- .../tests/src/Functional/UpdaterFormTest.php | 4 ++-- .../src/EventSubscriber/TestSubscriber.php | 2 +- src/BatchProcessor.php | 2 +- .../src/StagedDatabaseUpdateValidator.php | 2 +- ...tomaticUpdatesTestDisableValidatorsServiceProvider.php | 2 +- tests/src/Build/CoreUpdateTest.php | 2 +- .../src/Functional/AutomaticUpdatesFunctionalTestBase.php | 4 ++-- tests/src/Functional/UpdaterFormTest.php | 2 +- tests/src/Kernel/ProjectInfoTest.php | 6 +++--- tests/src/Kernel/ReleaseChooserTest.php | 2 +- tests/src/Unit/LegacyVersionUtilityTest.php | 8 ++++---- 12 files changed, 20 insertions(+), 20 deletions(-) diff --git a/automatic_updates_extensions/tests/src/Build/ModuleUpdateTest.php b/automatic_updates_extensions/tests/src/Build/ModuleUpdateTest.php index f5821cb68e..55e122bb50 100644 --- a/automatic_updates_extensions/tests/src/Build/ModuleUpdateTest.php +++ b/automatic_updates_extensions/tests/src/Build/ModuleUpdateTest.php @@ -101,7 +101,7 @@ END; /** * Tests updating a module in a staging area via the UI. */ - public function testUi() { + public function testUi(): void { $this->createTestProject('RecommendedProject'); $mink = $this->getMink(); @@ -154,7 +154,7 @@ END; * @param string $version * The expected version. */ - private function assertModuleVersion(string $module_name, string $version) { + private function assertModuleVersion(string $module_name, string $version): void { $web_root = $this->getWebRoot(); $composer_json = file_get_contents("$web_root/modules/contrib/$module_name/composer.json"); $data = json_decode($composer_json, TRUE); diff --git a/automatic_updates_extensions/tests/src/Functional/UpdaterFormTest.php b/automatic_updates_extensions/tests/src/Functional/UpdaterFormTest.php index 70d5ce61b2..506766d690 100644 --- a/automatic_updates_extensions/tests/src/Functional/UpdaterFormTest.php +++ b/automatic_updates_extensions/tests/src/Functional/UpdaterFormTest.php @@ -47,7 +47,7 @@ class UpdaterFormTest extends AutomaticUpdatesFunctionalTestBase { * @return array[] * The test cases. */ - public function providerSuccessfulUpdate() { + public function providerSuccessfulUpdate(): array { return [ 'maintenance mode on, semver' => [TRUE, 'semver_test', '8.1.0', '8.1.1'], 'maintenance mode off, legacy' => [FALSE, 'aaa_update_test', '8.x-2.0', '8.x-2.1'], @@ -82,7 +82,7 @@ class UpdaterFormTest extends AutomaticUpdatesFunctionalTestBase { * @todo This is copied from core. We need to file a core issue so we do not * have to copy this. */ - protected function setProjectInstalledVersion($project_versions) { + protected function setProjectInstalledVersion($project_versions): void { $this->config('update.settings') ->set('fetch.url', $this->baseUrl . '/test-release-history') ->save(); diff --git a/package_manager/tests/modules/package_manager_test_validation/src/EventSubscriber/TestSubscriber.php b/package_manager/tests/modules/package_manager_test_validation/src/EventSubscriber/TestSubscriber.php index ca317f0f7e..ca31d2d13d 100644 --- a/package_manager/tests/modules/package_manager_test_validation/src/EventSubscriber/TestSubscriber.php +++ b/package_manager/tests/modules/package_manager_test_validation/src/EventSubscriber/TestSubscriber.php @@ -112,7 +112,7 @@ class TestSubscriber implements EventSubscriberInterface { * @return string * The state key under which to store the results for the given event. */ - protected static function getStateKey(string $event) { + protected static function getStateKey(string $event): string { $parts = explode('\\', $event); return static::STATE_KEY . array_pop($parts); } diff --git a/src/BatchProcessor.php b/src/BatchProcessor.php index e37fafce45..935f8c09e6 100644 --- a/src/BatchProcessor.php +++ b/src/BatchProcessor.php @@ -264,7 +264,7 @@ final class BatchProcessor { * @see \Drupal\update\Form\UpdateReady::submitForm() * @see automatic_updates_batch_alter() */ - public static function dbUpdateBatchFinished(bool $success, array $results, array $operations) { + public static function dbUpdateBatchFinished(bool $success, array $results, array $operations): void { DbUpdateController::batchFinished($success, $results, $operations); // Now that the update is done, we can put the site back online if it was // previously not in maintenance mode. diff --git a/tests/modules/automatic_updates_test/src/StagedDatabaseUpdateValidator.php b/tests/modules/automatic_updates_test/src/StagedDatabaseUpdateValidator.php index 34d1b0ca12..e2abcea63e 100644 --- a/tests/modules/automatic_updates_test/src/StagedDatabaseUpdateValidator.php +++ b/tests/modules/automatic_updates_test/src/StagedDatabaseUpdateValidator.php @@ -25,7 +25,7 @@ class StagedDatabaseUpdateValidator extends BaseValidator { * @param \Drupal\Core\State\StateInterface $state * The state service. */ - public function setState(StateInterface $state) { + public function setState(StateInterface $state): void { $this->state = $state; } diff --git a/tests/modules/automatic_updates_test_disable_validators/src/AutomaticUpdatesTestDisableValidatorsServiceProvider.php b/tests/modules/automatic_updates_test_disable_validators/src/AutomaticUpdatesTestDisableValidatorsServiceProvider.php index 1f009782b6..f5da5371fb 100644 --- a/tests/modules/automatic_updates_test_disable_validators/src/AutomaticUpdatesTestDisableValidatorsServiceProvider.php +++ b/tests/modules/automatic_updates_test_disable_validators/src/AutomaticUpdatesTestDisableValidatorsServiceProvider.php @@ -14,7 +14,7 @@ class AutomaticUpdatesTestDisableValidatorsServiceProvider extends ServiceProvid /** * {@inheritdoc} */ - public function alter(ContainerBuilder $container) { + public function alter(ContainerBuilder $container): void { parent::alter($container); $validators = Settings::get('automatic_updates_test_disable_validators', []); diff --git a/tests/src/Build/CoreUpdateTest.php b/tests/src/Build/CoreUpdateTest.php index 61e18bbe85..e5f58b29fa 100644 --- a/tests/src/Build/CoreUpdateTest.php +++ b/tests/src/Build/CoreUpdateTest.php @@ -14,7 +14,7 @@ class CoreUpdateTest extends UpdateTestBase { /** * {@inheritdoc} */ - public function copyCodebase(\Iterator $iterator = NULL, $working_dir = NULL) { + public function copyCodebase(\Iterator $iterator = NULL, $working_dir = NULL): void { parent::copyCodebase($iterator, $working_dir); // Ensure that we will install Drupal 9.8.0 (a fake version that should diff --git a/tests/src/Functional/AutomaticUpdatesFunctionalTestBase.php b/tests/src/Functional/AutomaticUpdatesFunctionalTestBase.php index 7109612ba2..9f056d460b 100644 --- a/tests/src/Functional/AutomaticUpdatesFunctionalTestBase.php +++ b/tests/src/Functional/AutomaticUpdatesFunctionalTestBase.php @@ -41,7 +41,7 @@ abstract class AutomaticUpdatesFunctionalTestBase extends BrowserTestBase { /** * {@inheritdoc} */ - protected function setUp() { + protected function setUp(): void { parent::setUp(); $this->disableValidators($this->disableValidators); @@ -60,7 +60,7 @@ abstract class AutomaticUpdatesFunctionalTestBase extends BrowserTestBase { /** * {@inheritdoc} */ - protected function installModulesFromClassProperty(ContainerInterface $container) { + protected function installModulesFromClassProperty(ContainerInterface $container): void { $container->get('module_installer')->install([ 'automatic_updates_test_release_history', ]); diff --git a/tests/src/Functional/UpdaterFormTest.php b/tests/src/Functional/UpdaterFormTest.php index fbb86029c3..d58e165988 100644 --- a/tests/src/Functional/UpdaterFormTest.php +++ b/tests/src/Functional/UpdaterFormTest.php @@ -427,7 +427,7 @@ class UpdaterFormTest extends AutomaticUpdatesFunctionalTestBase { * @return bool[][] * The test cases. */ - public function providerStagedDatabaseUpdates() { + public function providerStagedDatabaseUpdates(): array { return [ 'maintenance mode on' => [TRUE], 'maintenance mode off' => [FALSE], diff --git a/tests/src/Kernel/ProjectInfoTest.php b/tests/src/Kernel/ProjectInfoTest.php index e2b6c3ed41..e68bf344ce 100644 --- a/tests/src/Kernel/ProjectInfoTest.php +++ b/tests/src/Kernel/ProjectInfoTest.php @@ -23,7 +23,7 @@ class ProjectInfoTest extends AutomaticUpdatesKernelTestBase { * * @dataProvider providerGetInstallableReleases */ - public function testGetInstallableReleases(string $fixture, string $installed_version, array $expected_versions) { + public function testGetInstallableReleases(string $fixture, string $installed_version, array $expected_versions): void { [$project] = explode('.', $fixture); $fixtures_directory = __DIR__ . '/../../fixtures/release-history/'; if ($project === 'drupal') { @@ -60,7 +60,7 @@ class ProjectInfoTest extends AutomaticUpdatesKernelTestBase { * @return array[] * The test cases. */ - public function providerGetInstallableReleases() { + public function providerGetInstallableReleases(): array { return [ 'core, no updates' => [ 'drupal.9.8.2.xml', @@ -122,7 +122,7 @@ class ProjectInfoTest extends AutomaticUpdatesKernelTestBase { * * @covers ::getInstallableReleases() */ - public function testNotPublishedProject() { + public function testNotPublishedProject(): void { $this->setReleaseMetadata(['drupal' => __DIR__ . '/../../fixtures/release-history/drupal.9.8.2_unknown_status.xml']); $project_info = new ProjectInfo('drupal'); $this->expectException('RuntimeException'); diff --git a/tests/src/Kernel/ReleaseChooserTest.php b/tests/src/Kernel/ReleaseChooserTest.php index f158f7da52..b3b2b692a1 100644 --- a/tests/src/Kernel/ReleaseChooserTest.php +++ b/tests/src/Kernel/ReleaseChooserTest.php @@ -159,7 +159,7 @@ class ReleaseChooserTest extends AutomaticUpdatesKernelTestBase { * @param \Drupal\update\ProjectRelease|null $release * The release to check, or NULL if no release is expected. */ - private function assertReleaseVersion(?string $version, ?ProjectRelease $release) { + private function assertReleaseVersion(?string $version, ?ProjectRelease $release): void { if (is_null($version)) { $this->assertNull($release); } diff --git a/tests/src/Unit/LegacyVersionUtilityTest.php b/tests/src/Unit/LegacyVersionUtilityTest.php index 1d3da036bb..cfb4f1f4e7 100644 --- a/tests/src/Unit/LegacyVersionUtilityTest.php +++ b/tests/src/Unit/LegacyVersionUtilityTest.php @@ -22,7 +22,7 @@ class LegacyVersionUtilityTest extends UnitTestCase { * * @dataProvider providerConvertToSemanticVersion */ - public function testConvertToSemanticVersion(string $version_number, string $expected) { + public function testConvertToSemanticVersion(string $version_number, string $expected): void { $this->assertSame($expected, LegacyVersionUtility::convertToSemanticVersion($version_number)); } @@ -32,7 +32,7 @@ class LegacyVersionUtilityTest extends UnitTestCase { * @return string[][] * The test cases. */ - public function providerConvertToSemanticVersion() { + public function providerConvertToSemanticVersion(): array { return [ '8.x-1.2' => ['8.x-1.2', '1.2.0'], '8.x-1.2-alpha1' => ['8.x-1.2-alpha1', '1.2.0-alpha1'], @@ -51,7 +51,7 @@ class LegacyVersionUtilityTest extends UnitTestCase { * * @dataProvider providerConvertToLegacyVersion */ - public function testConvertToLegacyVersion(string $version_number, ?string $expected) { + public function testConvertToLegacyVersion(string $version_number, ?string $expected): void { $this->assertSame($expected, LegacyVersionUtility::convertToLegacyVersion($version_number)); } @@ -61,7 +61,7 @@ class LegacyVersionUtilityTest extends UnitTestCase { * @return array[] * The test cases. */ - public function providerConvertToLegacyVersion() { + public function providerConvertToLegacyVersion(): array { return [ '1.2.0' => ['1.2.0', '8.x-1.2'], '1.2.0-alpha1' => ['1.2.0-alpha1', '8.x-1.2-alpha1'], -- GitLab