diff --git a/core/modules/auto_updates/src/Controller/ReadinessCheckerController.php b/core/modules/auto_updates/src/Controller/ReadinessCheckerController.php index c2bb521490..bd3aac3fb8 100644 --- a/core/modules/auto_updates/src/Controller/ReadinessCheckerController.php +++ b/core/modules/auto_updates/src/Controller/ReadinessCheckerController.php @@ -4,6 +4,7 @@ use Drupal\auto_updates\ReadinessChecker\ReadinessCheckerManagerInterface; use Drupal\Core\Access\AccessResult; +use Drupal\Core\Access\AccessResultInterface; use Drupal\Core\Controller\ControllerBase; use Drupal\Core\StringTranslation\TranslationInterface; use Symfony\Component\DependencyInjection\ContainerInterface; @@ -67,7 +68,7 @@ public function run() { * @return \Drupal\Core\Access\AccessResultInterface * The access result. */ - public function access() { + public function access(): AccessResultInterface { return AccessResult::allowedIf($this->checkerManager->isEnabled()); } diff --git a/core/modules/auto_updates/src/ReadinessChecker/DiskSpace.php b/core/modules/auto_updates/src/ReadinessChecker/DiskSpace.php index b97695900e..2cc5684d4a 100644 --- a/core/modules/auto_updates/src/ReadinessChecker/DiskSpace.php +++ b/core/modules/auto_updates/src/ReadinessChecker/DiskSpace.php @@ -2,8 +2,6 @@ namespace Drupal\auto_updates\ReadinessChecker; -use Drupal\Component\FileSystem\FileSystem as FileSystemComponent; - /** * A readiness checker that ensures there is enough disk space for updates. */ diff --git a/core/modules/auto_updates/src/ReadinessChecker/ReadinessCheckerManager.php b/core/modules/auto_updates/src/ReadinessChecker/ReadinessCheckerManager.php index f77076a6af..2d855d3190 100644 --- a/core/modules/auto_updates/src/ReadinessChecker/ReadinessCheckerManager.php +++ b/core/modules/auto_updates/src/ReadinessChecker/ReadinessCheckerManager.php @@ -106,7 +106,7 @@ public function run(): array { /** * {@inheritdoc} */ - public function getResults($category): array { + public function getResults(string $category): array { if ($this->isEnabled()) { $results = $this->keyValue->get('readiness_check_results', []); $all_messages = $results['messages'] ?? []; diff --git a/core/modules/auto_updates/src/ReadinessChecker/ReadinessCheckerManagerInterface.php b/core/modules/auto_updates/src/ReadinessChecker/ReadinessCheckerManagerInterface.php index 0280b6663e..51923de26e 100644 --- a/core/modules/auto_updates/src/ReadinessChecker/ReadinessCheckerManagerInterface.php +++ b/core/modules/auto_updates/src/ReadinessChecker/ReadinessCheckerManagerInterface.php @@ -23,7 +23,7 @@ interface ReadinessCheckerManagerInterface { * @param \Drupal\auto_updates\ReadinessChecker\ReadinessCheckerInterface $checker * The checker interface to be appended to the checker chain. * @param string $category - * (optional) The category of check. Defaults to 'warning' + * (optional) The category of check. Defaults to 'warning'. * @param int $priority * (optional) The priority of the checker being added. Defaults to 0. * Readiness checkers with larger priorities will run first within a @@ -53,7 +53,7 @@ public function run(): array; * An array of translatable messages if any checks fail, otherwise an empty * array. */ - public function getResults($category): array; + public function getResults(string $category): array; /** * Gets the timestamp of the most recent run. diff --git a/core/modules/auto_updates/tests/modules/auto_updates_test/src/Datetime/TestTime.php b/core/modules/auto_updates/tests/modules/auto_updates_test/src/Datetime/TestTime.php index 3bbc9d606a..3b86be5058 100644 --- a/core/modules/auto_updates/tests/modules/auto_updates_test/src/Datetime/TestTime.php +++ b/core/modules/auto_updates/tests/modules/auto_updates_test/src/Datetime/TestTime.php @@ -9,16 +9,22 @@ */ class TestTime extends Time { + /** + * The time format to for setting the test time. + */ const TIME_FORMAT = 'U'; + /** + * The state key for setting and getting the test time. + */ const STATE_KEY = 'auto_updates_test.mock_date_time'; /** * {@inheritdoc} */ public function getRequestTime() { - if ($mock_date = \Drupal::state()->get(TestTime::STATE_KEY, NULL)) { - return \DateTime::createFromFormat(self::TIME_FORMAT, $mock_date)->getTimestamp(); + if ($faked_date = \Drupal::state()->get(TestTime::STATE_KEY)) { + return \DateTime::createFromFormat(self::TIME_FORMAT, $faked_date)->getTimestamp(); } return parent::getRequestTime(); } diff --git a/core/modules/auto_updates/tests/modules/auto_updates_test/src/ReadinessChecker/TestChecker.php b/core/modules/auto_updates/tests/modules/auto_updates_test/src/ReadinessChecker/TestChecker.php index 1641cd468f..eed3815139 100644 --- a/core/modules/auto_updates/tests/modules/auto_updates_test/src/ReadinessChecker/TestChecker.php +++ b/core/modules/auto_updates/tests/modules/auto_updates_test/src/ReadinessChecker/TestChecker.php @@ -6,19 +6,22 @@ use Drupal\Core\StringTranslation\StringTranslationTrait; /** - * The disk space readiness checker. + * A test readiness checker. */ class TestChecker implements ReadinessCheckerInterface { use StringTranslationTrait; + /** + * The state key for setting and getting checker message. + */ const STATE_KEY = 'auto_updates_test.check_error'; /** * {@inheritDoc} */ public function run(): array { - if ($message = \Drupal::state()->get(static::STATE_KEY, NULL)) { + if ($message = \Drupal::state()->get(static::STATE_KEY)) { return [$message]; } return [];