diff --git a/core/.phpstan-baseline.php b/core/.phpstan-baseline.php index 3ccdd046c004ae2c0ef49d6762d713aaa30271c2..03b39093fa7ac8a0316229f3defa9685c91b7c22 100644 --- a/core/.phpstan-baseline.php +++ b/core/.phpstan-baseline.php @@ -11380,12 +11380,6 @@ 'count' => 1, 'path' => __DIR__ . '/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/UniqueFieldValueValidator.php', ]; -$ignoreErrors[] = [ - // identifier: missingType.return - 'message' => '#^Method Drupal\\\\announcements_feed\\\\Hook\\\\AnnouncementsFeedHooks\\:\\:cron\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/modules/announcements_feed/src/Hook/AnnouncementsFeedHooks.php', -]; $ignoreErrors[] = [ // identifier: missingType.return 'message' => '#^Method Drupal\\\\announcements_feed\\\\Hook\\\\AnnouncementsFeedHooks\\:\\:help\\(\\) has no return type specified\\.$#', @@ -13492,12 +13486,6 @@ 'count' => 1, 'path' => __DIR__ . '/modules/comment/src/Form/DeleteForm.php', ]; -$ignoreErrors[] = [ - // identifier: missingType.return - 'message' => '#^Method Drupal\\\\comment\\\\Hook\\\\CommentHooks\\:\\:cron\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/modules/comment/src/Hook/CommentHooks.php', -]; $ignoreErrors[] = [ // identifier: missingType.return 'message' => '#^Method Drupal\\\\comment\\\\Hook\\\\CommentHooks\\:\\:entityExtraFieldInfo\\(\\) has no return type specified\\.$#', @@ -17434,12 +17422,6 @@ 'count' => 1, 'path' => __DIR__ . '/modules/dblog/src/Form/DblogFilterForm.php', ]; -$ignoreErrors[] = [ - // identifier: missingType.return - 'message' => '#^Method Drupal\\\\dblog\\\\Hook\\\\DblogHooks\\:\\:cron\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/modules/dblog/src/Hook/DblogHooks.php', -]; $ignoreErrors[] = [ // identifier: missingType.return 'message' => '#^Method Drupal\\\\dblog\\\\Hook\\\\DblogHooks\\:\\:help\\(\\) has no return type specified\\.$#', @@ -17932,12 +17914,6 @@ 'count' => 1, 'path' => __DIR__ . '/modules/field/src/FieldConfigStorage.php', ]; -$ignoreErrors[] = [ - // identifier: missingType.return - 'message' => '#^Method Drupal\\\\field\\\\Hook\\\\FieldHooks\\:\\:cron\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/modules/field/src/Hook/FieldHooks.php', -]; $ignoreErrors[] = [ // identifier: missingType.return 'message' => '#^Method Drupal\\\\field\\\\Hook\\\\FieldHooks\\:\\:entityBundleDelete\\(\\) has no return type specified\\.$#', @@ -19672,12 +19648,6 @@ 'count' => 1, 'path' => __DIR__ . '/modules/file/src/FileUsage/FileUsageInterface.php', ]; -$ignoreErrors[] = [ - // identifier: missingType.return - 'message' => '#^Method Drupal\\\\file\\\\Hook\\\\FileHooks\\:\\:cron\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/modules/file/src/Hook/FileHooks.php', -]; $ignoreErrors[] = [ // identifier: missingType.return 'message' => '#^Method Drupal\\\\file\\\\Hook\\\\FileHooks\\:\\:fileDownload\\(\\) has no return type specified\\.$#', @@ -21082,12 +21052,6 @@ 'count' => 1, 'path' => __DIR__ . '/modules/history/src/Controller/HistoryController.php', ]; -$ignoreErrors[] = [ - // identifier: missingType.return - 'message' => '#^Method Drupal\\\\history\\\\Hook\\\\HistoryHooks\\:\\:cron\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/modules/history/src/Hook/HistoryHooks.php', -]; $ignoreErrors[] = [ // identifier: missingType.return 'message' => '#^Method Drupal\\\\history\\\\Hook\\\\HistoryHooks\\:\\:help\\(\\) has no return type specified\\.$#', @@ -24118,12 +24082,6 @@ 'count' => 1, 'path' => __DIR__ . '/modules/layout_builder/src/Hook/LayoutBuilderHooks.php', ]; -$ignoreErrors[] = [ - // identifier: missingType.return - 'message' => '#^Method Drupal\\\\layout_builder\\\\Hook\\\\LayoutBuilderHooks\\:\\:cron\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/modules/layout_builder/src/Hook/LayoutBuilderHooks.php', -]; $ignoreErrors[] = [ // identifier: missingType.return 'message' => '#^Method Drupal\\\\layout_builder\\\\Hook\\\\LayoutBuilderHooks\\:\\:entityDelete\\(\\) has no return type specified\\.$#', @@ -25564,12 +25522,6 @@ 'count' => 1, 'path' => __DIR__ . '/modules/locale/src/Hook/LocaleHooks.php', ]; -$ignoreErrors[] = [ - // identifier: missingType.return - 'message' => '#^Method Drupal\\\\locale\\\\Hook\\\\LocaleHooks\\:\\:cron\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/modules/locale/src/Hook/LocaleHooks.php', -]; $ignoreErrors[] = [ // identifier: missingType.return 'message' => '#^Method Drupal\\\\locale\\\\Hook\\\\LocaleHooks\\:\\:help\\(\\) has no return type specified\\.$#', @@ -30516,12 +30468,6 @@ 'count' => 1, 'path' => __DIR__ . '/modules/node/src/Hook/NodeHooks1.php', ]; -$ignoreErrors[] = [ - // identifier: missingType.return - 'message' => '#^Method Drupal\\\\node\\\\Hook\\\\NodeHooks1\\:\\:cron\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/modules/node/src/Hook/NodeHooks1.php', -]; $ignoreErrors[] = [ // identifier: missingType.return 'message' => '#^Method Drupal\\\\node\\\\Hook\\\\NodeHooks1\\:\\:entityExtraFieldInfo\\(\\) has no return type specified\\.$#', @@ -33528,12 +33474,6 @@ 'count' => 1, 'path' => __DIR__ . '/modules/search/src/Hook/SearchHooks.php', ]; -$ignoreErrors[] = [ - // identifier: missingType.return - 'message' => '#^Method Drupal\\\\search\\\\Hook\\\\SearchHooks\\:\\:cron\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/modules/search/src/Hook/SearchHooks.php', -]; $ignoreErrors[] = [ // identifier: missingType.return 'message' => '#^Method Drupal\\\\search\\\\Hook\\\\SearchHooks\\:\\:help\\(\\) has no return type specified\\.$#', @@ -35412,12 +35352,6 @@ 'count' => 1, 'path' => __DIR__ . '/modules/system/src/Form/ThemeSettingsForm.php', ]; -$ignoreErrors[] = [ - // identifier: missingType.return - 'message' => '#^Method Drupal\\\\system\\\\Hook\\\\SystemHooks\\:\\:cron\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/modules/system/src/Hook/SystemHooks.php', -]; $ignoreErrors[] = [ // identifier: missingType.return 'message' => '#^Method Drupal\\\\system\\\\Hook\\\\SystemHooks\\:\\:entityTypeBuild\\(\\) has no return type specified\\.$#', @@ -36384,12 +36318,6 @@ 'count' => 1, 'path' => __DIR__ . '/modules/system/tests/modules/common_test/src/Hook/CommonTestHooks.php', ]; -$ignoreErrors[] = [ - // identifier: missingType.return - 'message' => '#^Method Drupal\\\\common_test\\\\Hook\\\\CommonTestHooks\\:\\:cron\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/modules/system/tests/modules/common_test/src/Hook/CommonTestHooks.php', -]; $ignoreErrors[] = [ // identifier: missingType.return 'message' => '#^Method Drupal\\\\common_test\\\\Hook\\\\CommonTestHooks\\:\\:libraryInfoBuild\\(\\) has no return type specified\\.$#', @@ -36402,12 +36330,6 @@ 'count' => 1, 'path' => __DIR__ . '/modules/system/tests/modules/common_test/src/Hook/CommonTestHooks.php', ]; -$ignoreErrors[] = [ - // identifier: missingType.return - 'message' => '#^Method Drupal\\\\common_test_cron_helper\\\\Hook\\\\CommonTestCronHelperHooks\\:\\:cron\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/modules/system/tests/modules/common_test_cron_helper/src/Hook/CommonTestCronHelperHooks.php', -]; $ignoreErrors[] = [ // identifier: missingType.return 'message' => '#^Method Drupal\\\\condition_test\\\\FormController\\:\\:submitForm\\(\\) has no return type specified\\.$#', @@ -43509,12 +43431,6 @@ 'count' => 1, 'path' => __DIR__ . '/modules/update/src/Form/UpdateReady.php', ]; -$ignoreErrors[] = [ - // identifier: missingType.return - 'message' => '#^Method Drupal\\\\update\\\\Hook\\\\UpdateHooks\\:\\:cron\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/modules/update/src/Hook/UpdateHooks.php', -]; $ignoreErrors[] = [ // identifier: missingType.return 'message' => '#^Method Drupal\\\\update\\\\Hook\\\\UpdateHooks\\:\\:help\\(\\) has no return type specified\\.$#', @@ -55095,12 +55011,6 @@ 'count' => 1, 'path' => __DIR__ . '/modules/workspaces/src/FormOperations.php', ]; -$ignoreErrors[] = [ - // identifier: missingType.return - 'message' => '#^Method Drupal\\\\workspaces\\\\Hook\\\\WorkspacesHooks\\:\\:cron\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/modules/workspaces/src/Hook/WorkspacesHooks.php', -]; $ignoreErrors[] = [ // identifier: missingType.return 'message' => '#^Method Drupal\\\\workspaces\\\\Hook\\\\WorkspacesHooks\\:\\:entityAccess\\(\\) has no return type specified\\.$#', diff --git a/core/modules/announcements_feed/src/Hook/AnnouncementsFeedHooks.php b/core/modules/announcements_feed/src/Hook/AnnouncementsFeedHooks.php index d49535e5c40f5b8beb3592b06831854113614ef2..47245c1f3644318dc0a5ca6ee0317e49c3709b90 100644 --- a/core/modules/announcements_feed/src/Hook/AnnouncementsFeedHooks.php +++ b/core/modules/announcements_feed/src/Hook/AnnouncementsFeedHooks.php @@ -123,7 +123,7 @@ public function theme($existing, $type, $theme, $path) : array { * Implements hook_cron(). */ #[Hook('cron')] - public function cron() { + public function cron(): void { $config = \Drupal::config('announcements_feed.settings'); $interval = $config->get('cron_interval'); $last_check = \Drupal::state()->get('announcements_feed.last_fetch', 0); diff --git a/core/modules/comment/src/Hook/CommentHooks.php b/core/modules/comment/src/Hook/CommentHooks.php index d63f0bc6e17a3b53077ab6bd68246fce5eaea38c..e104fe978c6c7e10609e02b1b79874fe058977bc 100644 --- a/core/modules/comment/src/Hook/CommentHooks.php +++ b/core/modules/comment/src/Hook/CommentHooks.php @@ -382,7 +382,7 @@ public function nodeUpdateIndex(EntityInterface $node) { * Implements hook_cron(). */ #[Hook('cron')] - public function cron() { + public function cron(): void { // Store the maximum possible comments per thread (used for node search // ranking by reply count). \Drupal::state()->set('comment.node_comment_statistics_scale', 1.0 / max(1, \Drupal::service('comment.statistics')->getMaximumCount('node'))); diff --git a/core/modules/dblog/src/Hook/DblogHooks.php b/core/modules/dblog/src/Hook/DblogHooks.php index 7db7b7123d2fb77ce20f02742ef8a4a855deff3b..accfc02ec970e86abee9bb8a251dbd17e32a51cb 100644 --- a/core/modules/dblog/src/Hook/DblogHooks.php +++ b/core/modules/dblog/src/Hook/DblogHooks.php @@ -61,7 +61,7 @@ public function menuLinksDiscoveredAlter(&$links): void { * Controls the size of the log table, paring it to 'dblog_row_limit' messages. */ #[Hook('cron')] - public function cron() { + public function cron(): void { // Cleanup the watchdog table. $row_limit = \Drupal::config('dblog.settings')->get('row_limit'); // For row limit n, get the wid of the nth row in descending wid order. diff --git a/core/modules/field/src/Hook/FieldHooks.php b/core/modules/field/src/Hook/FieldHooks.php index bab9f2aebdb69a7d900691a02f3703145aeaa2cb..546a6e0c95dbe48f72489ab9ba2180682be12fed 100644 --- a/core/modules/field/src/Hook/FieldHooks.php +++ b/core/modules/field/src/Hook/FieldHooks.php @@ -161,7 +161,7 @@ public function help($route_name, RouteMatchInterface $route_match) { * Implements hook_cron(). */ #[Hook('cron')] - public function cron() { + public function cron(): void { // Do a pass of purging on deleted Field API data, if any exists. $limit = \Drupal::config('field.settings')->get('purge_batch_size'); field_purge_batch($limit); diff --git a/core/modules/file/src/Hook/FileHooks.php b/core/modules/file/src/Hook/FileHooks.php index 9553c56196442b3f0dbf4426890e91af1ddb9a17..c3cb60ca529dcdc984c777cac4e14e02aba5e387 100644 --- a/core/modules/file/src/Hook/FileHooks.php +++ b/core/modules/file/src/Hook/FileHooks.php @@ -163,7 +163,7 @@ public function fileDownload($uri) { * Implements hook_cron(). */ #[Hook('cron')] - public function cron() { + public function cron(): void { $age = \Drupal::config('system.file')->get('temporary_maximum_age'); $file_storage = \Drupal::entityTypeManager()->getStorage('file'); /** @var \Drupal\Core\StreamWrapper\StreamWrapperManagerInterface $stream_wrapper_manager */ diff --git a/core/modules/history/src/Hook/HistoryHooks.php b/core/modules/history/src/Hook/HistoryHooks.php index 5fe37506fda4859a9840b1c532292e3d637d7d57..2b95304dfd2d7a86105f0e67c89344e165b7ba7e 100644 --- a/core/modules/history/src/Hook/HistoryHooks.php +++ b/core/modules/history/src/Hook/HistoryHooks.php @@ -36,7 +36,7 @@ public function help($route_name, RouteMatchInterface $route_match) { * Implements hook_cron(). */ #[Hook('cron')] - public function cron() { + public function cron(): void { \Drupal::database()->delete('history')->condition('timestamp', HISTORY_READ_LIMIT, '<')->execute(); } diff --git a/core/modules/layout_builder/src/Hook/LayoutBuilderHooks.php b/core/modules/layout_builder/src/Hook/LayoutBuilderHooks.php index 1ecc0eb960607a0c3d9dd2200cd5e36e033c7eaa..195cb0db3d19f8849e57c2619d90b9568f6b352d 100644 --- a/core/modules/layout_builder/src/Hook/LayoutBuilderHooks.php +++ b/core/modules/layout_builder/src/Hook/LayoutBuilderHooks.php @@ -217,7 +217,7 @@ public function entityDelete(EntityInterface $entity) { * Implements hook_cron(). */ #[Hook('cron')] - public function cron() { + public function cron(): void { if (\Drupal::moduleHandler()->moduleExists('block_content')) { /** @var \Drupal\layout_builder\InlineBlockEntityOperations $entity_operations */ $entity_operations = \Drupal::classResolver(InlineBlockEntityOperations::class); diff --git a/core/modules/locale/src/Hook/LocaleHooks.php b/core/modules/locale/src/Hook/LocaleHooks.php index a526bdb90bcc8397bce235e98c98d9b185f2a3b4..e0afe107c87cba87cc47ffdcb7dcdfbac4127e2f 100644 --- a/core/modules/locale/src/Hook/LocaleHooks.php +++ b/core/modules/locale/src/Hook/LocaleHooks.php @@ -196,7 +196,7 @@ public function themesUninstalled($themes) { * @see \Drupal\locale\Plugin\QueueWorker\LocaleTranslation */ #[Hook('cron')] - public function cron() { + public function cron(): void { // Update translations only when an update frequency was set by the admin // and a translatable language was set. // Update tasks are added to the queue here but processed by Drupal's cron. diff --git a/core/modules/node/src/Hook/NodeHooks1.php b/core/modules/node/src/Hook/NodeHooks1.php index cce417a67ae26d1d708071e853944e186b97c20c..073090e030662a1747cab2943473fdc9941185c7 100644 --- a/core/modules/node/src/Hook/NodeHooks1.php +++ b/core/modules/node/src/Hook/NodeHooks1.php @@ -189,7 +189,7 @@ public function entityExtraFieldInfo() { * Implements hook_cron(). */ #[Hook('cron')] - public function cron() { + public function cron(): void { // Calculate the oldest and newest node created times, for use in search // rankings. (Note that field aliases have to be variables passed by // reference.) diff --git a/core/modules/search/src/Hook/SearchHooks.php b/core/modules/search/src/Hook/SearchHooks.php index dc507ce4504ce9b4e5fa4f9fec61a98a02a16ec0..8e4d95a07185f69b813bf77bc5a6e750086c1a4a 100644 --- a/core/modules/search/src/Hook/SearchHooks.php +++ b/core/modules/search/src/Hook/SearchHooks.php @@ -93,7 +93,7 @@ public function theme() : array { * and cleans up dirty words. */ #[Hook('cron')] - public function cron() { + public function cron(): void { /** @var \Drupal\search\SearchPageRepositoryInterface $search_page_repository */ $search_page_repository = \Drupal::service('search.search_page_repository'); foreach ($search_page_repository->getIndexableSearchPages() as $entity) { diff --git a/core/modules/system/src/Hook/SystemHooks.php b/core/modules/system/src/Hook/SystemHooks.php index d6474e30e7bd30c37755459277e502954fd1bd28..297fd35813e3bc8f4cce5d8713d16ee2018ad5fd 100644 --- a/core/modules/system/src/Hook/SystemHooks.php +++ b/core/modules/system/src/Hook/SystemHooks.php @@ -318,7 +318,7 @@ public function systemInfoAlter(&$info, Extension $file, $type): void { * ensure files directories have .htaccess files. */ #[Hook('cron')] - public function cron() { + public function cron(): void { // Clean up the flood. \Drupal::flood()->garbageCollection(); foreach (Cache::getBins() as $cache_backend) { diff --git a/core/modules/system/tests/modules/common_test/src/Hook/CommonTestHooks.php b/core/modules/system/tests/modules/common_test/src/Hook/CommonTestHooks.php index f3959b67212c11edec88e3ecc5e3cf30a7cdc910..7df7924d82ede79768705bfd5d90817a906c3534 100644 --- a/core/modules/system/tests/modules/common_test/src/Hook/CommonTestHooks.php +++ b/core/modules/system/tests/modules/common_test/src/Hook/CommonTestHooks.php @@ -114,7 +114,7 @@ public function libraryInfoAlter(&$libraries, $module): void { * @see common_test_cron_helper() */ #[Hook('cron')] - public function cron() { + public function cron(): void { throw new \Exception('Uncaught exception'); } diff --git a/core/modules/system/tests/modules/common_test_cron_helper/src/Hook/CommonTestCronHelperHooks.php b/core/modules/system/tests/modules/common_test_cron_helper/src/Hook/CommonTestCronHelperHooks.php index 024669c3da7225c5004087c6082097431b1d19a6..5cec42967d37b207da1491856b70bd56927a9847 100644 --- a/core/modules/system/tests/modules/common_test_cron_helper/src/Hook/CommonTestCronHelperHooks.php +++ b/core/modules/system/tests/modules/common_test_cron_helper/src/Hook/CommonTestCronHelperHooks.php @@ -20,7 +20,7 @@ class CommonTestCronHelperHooks { * @see common_test_cron() */ #[Hook('cron')] - public function cron() { + public function cron(): void { \Drupal::state()->set('common_test.cron', 'success'); } diff --git a/core/modules/update/src/Hook/UpdateHooks.php b/core/modules/update/src/Hook/UpdateHooks.php index 999a4e4d630e2c29eb9165e7786b662ea3ace874..71fc5c6ea7427973f64d571c79f9bccbee0c3f16 100644 --- a/core/modules/update/src/Hook/UpdateHooks.php +++ b/core/modules/update/src/Hook/UpdateHooks.php @@ -165,7 +165,7 @@ public function theme() : array { * Implements hook_cron(). */ #[Hook('cron')] - public function cron() { + public function cron(): void { $update_config = \Drupal::config('update.settings'); $frequency = $update_config->get('check.interval_days'); $interval = 60 * 60 * 24 * $frequency; diff --git a/core/modules/workspaces/src/Hook/WorkspacesHooks.php b/core/modules/workspaces/src/Hook/WorkspacesHooks.php index 6d1ca63d62faac6a58b2b2a85e89eda5dc8f5927..adcb10ffb241f08d791c568dd79c6b5fde6f6296 100644 --- a/core/modules/workspaces/src/Hook/WorkspacesHooks.php +++ b/core/modules/workspaces/src/Hook/WorkspacesHooks.php @@ -228,7 +228,7 @@ public function viewsQueryAlter(ViewExecutable $view, QueryPluginBase $query): v * Implements hook_cron(). */ #[Hook('cron')] - public function cron() { + public function cron(): void { \Drupal::service('workspaces.manager')->purgeDeletedWorkspacesBatch(); }