diff --git a/core/.phpstan-baseline.php b/core/.phpstan-baseline.php index 06f0c6b5dd7c1b405fca5d174efe17cda351f35b..47ea172423bb4cea5194ce453559c61d7f80a440 100644 --- a/core/.phpstan-baseline.php +++ b/core/.phpstan-baseline.php @@ -15724,12 +15724,6 @@ 'count' => 1, 'path' => __DIR__ . '/modules/content_moderation/src/Hook/ContentModerationHooks.php', ]; -$ignoreErrors[] = [ - // identifier: missingType.return - 'message' => '#^Method Drupal\\\\content_moderation\\\\Hook\\\\ContentModerationHooks\\:\\:viewsPostExecute\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/modules/content_moderation/src/Hook/ContentModerationHooks.php', -]; $ignoreErrors[] = [ // identifier: missingType.return 'message' => '#^Method Drupal\\\\content_moderation\\\\Hook\\\\ContentModerationHooks\\:\\:workflowInsert\\(\\) has no return type specified\\.$#', @@ -17242,12 +17236,6 @@ 'count' => 1, 'path' => __DIR__ . '/modules/dblog/src/Hook/DblogHooks.php', ]; -$ignoreErrors[] = [ - // identifier: missingType.return - 'message' => '#^Method Drupal\\\\dblog\\\\Hook\\\\DblogHooks\\:\\:viewsPreRender\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/modules/dblog/src/Hook/DblogHooks.php', -]; $ignoreErrors[] = [ // identifier: isset.variable 'message' => '#^Variable \\$view in isset\\(\\) always exists and is not nullable\\.$#', @@ -26764,18 +26752,6 @@ 'count' => 1, 'path' => __DIR__ . '/modules/media_library/src/Hook/MediaLibraryHooks.php', ]; -$ignoreErrors[] = [ - // identifier: missingType.return - 'message' => '#^Method Drupal\\\\media_library\\\\Hook\\\\MediaLibraryHooks\\:\\:viewsPostRender\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/modules/media_library/src/Hook/MediaLibraryHooks.php', -]; -$ignoreErrors[] = [ - // identifier: missingType.return - 'message' => '#^Method Drupal\\\\media_library\\\\Hook\\\\MediaLibraryHooks\\:\\:viewsPreRender\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/modules/media_library/src/Hook/MediaLibraryHooks.php', -]; $ignoreErrors[] = [ // identifier: missingType.return 'message' => '#^Method Drupal\\\\media_library\\\\MediaLibraryServiceProvider\\:\\:register\\(\\) has no return type specified\\.$#', @@ -32442,12 +32418,6 @@ 'count' => 1, 'path' => __DIR__ . '/modules/rest/tests/modules/rest_test/src/Hook/RestTestHooks.php', ]; -$ignoreErrors[] = [ - // identifier: missingType.return - 'message' => '#^Method Drupal\\\\rest_test_views\\\\Hook\\\\RestTestViewsHooks\\:\\:viewsPostExecute\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/modules/rest/tests/modules/rest_test_views/src/Hook/RestTestViewsHooks.php', -]; $ignoreErrors[] = [ // identifier: missingType.return 'message' => '#^Method Drupal\\\\Tests\\\\rest\\\\Functional\\\\EntityResource\\\\EntityResourceTestBase\\:\\:assert406Response\\(\\) has no return type specified\\.$#', @@ -44817,12 +44787,6 @@ 'count' => 1, 'path' => __DIR__ . '/modules/views/src/Hook/ViewsHooks.php', ]; -$ignoreErrors[] = [ - // identifier: missingType.return - 'message' => '#^Method Drupal\\\\views\\\\Hook\\\\ViewsHooks\\:\\:viewsPreRender\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/modules/views/src/Hook/ViewsHooks.php', -]; $ignoreErrors[] = [ // identifier: missingType.return 'message' => '#^Method Drupal\\\\views\\\\Hook\\\\ViewsTokensHooks\\:\\:tokenInfo\\(\\) has no return type specified\\.$#', @@ -50889,12 +50853,6 @@ 'count' => 1, 'path' => __DIR__ . '/modules/views/tests/modules/views_test_config/src/Hook/ViewsTestConfigHooks.php', ]; -$ignoreErrors[] = [ - // identifier: missingType.return - 'message' => '#^Method Drupal\\\\views_test_config\\\\Hook\\\\ViewsTestConfigHooks\\:\\:viewsPostRender\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/modules/views/tests/modules/views_test_config/src/Hook/ViewsTestConfigHooks.php', -]; $ignoreErrors[] = [ // identifier: missingType.return 'message' => '#^Method Drupal\\\\views_test_data\\\\Controller\\\\ViewsTestDataController\\:\\:errorFormPage\\(\\) has no return type specified\\.$#', @@ -50949,48 +50907,6 @@ 'count' => 1, 'path' => __DIR__ . '/modules/views/tests/modules/views_test_data/src/Hook/ViewsTestDataViewsExecutionHooks.php', ]; -$ignoreErrors[] = [ - // identifier: missingType.return - 'message' => '#^Method Drupal\\\\views_test_data\\\\Hook\\\\ViewsTestDataViewsExecutionHooks\\:\\:viewsPostBuild\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/modules/views/tests/modules/views_test_data/src/Hook/ViewsTestDataViewsExecutionHooks.php', -]; -$ignoreErrors[] = [ - // identifier: missingType.return - 'message' => '#^Method Drupal\\\\views_test_data\\\\Hook\\\\ViewsTestDataViewsExecutionHooks\\:\\:viewsPostExecute\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/modules/views/tests/modules/views_test_data/src/Hook/ViewsTestDataViewsExecutionHooks.php', -]; -$ignoreErrors[] = [ - // identifier: missingType.return - 'message' => '#^Method Drupal\\\\views_test_data\\\\Hook\\\\ViewsTestDataViewsExecutionHooks\\:\\:viewsPostRender\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/modules/views/tests/modules/views_test_data/src/Hook/ViewsTestDataViewsExecutionHooks.php', -]; -$ignoreErrors[] = [ - // identifier: missingType.return - 'message' => '#^Method Drupal\\\\views_test_data\\\\Hook\\\\ViewsTestDataViewsExecutionHooks\\:\\:viewsPreBuild\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/modules/views/tests/modules/views_test_data/src/Hook/ViewsTestDataViewsExecutionHooks.php', -]; -$ignoreErrors[] = [ - // identifier: missingType.return - 'message' => '#^Method Drupal\\\\views_test_data\\\\Hook\\\\ViewsTestDataViewsExecutionHooks\\:\\:viewsPreExecute\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/modules/views/tests/modules/views_test_data/src/Hook/ViewsTestDataViewsExecutionHooks.php', -]; -$ignoreErrors[] = [ - // identifier: missingType.return - 'message' => '#^Method Drupal\\\\views_test_data\\\\Hook\\\\ViewsTestDataViewsExecutionHooks\\:\\:viewsPreRender\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/modules/views/tests/modules/views_test_data/src/Hook/ViewsTestDataViewsExecutionHooks.php', -]; -$ignoreErrors[] = [ - // identifier: missingType.return - 'message' => '#^Method Drupal\\\\views_test_data\\\\Hook\\\\ViewsTestDataViewsExecutionHooks\\:\\:viewsPreView\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/modules/views/tests/modules/views_test_data/src/Hook/ViewsTestDataViewsExecutionHooks.php', -]; $ignoreErrors[] = [ // identifier: missingType.return 'message' => '#^Method Drupal\\\\views_test_data\\\\Hook\\\\ViewsTestDataViewsExecutionHooks\\:\\:viewsQuerySubstitutions\\(\\) has no return type specified\\.$#', diff --git a/core/modules/content_moderation/src/Hook/ContentModerationHooks.php b/core/modules/content_moderation/src/Hook/ContentModerationHooks.php index daa836846419835a350ff129d821e7201eefa550..cd0ffba64c8975f865da04696cece39b7e9dba72 100644 --- a/core/modules/content_moderation/src/Hook/ContentModerationHooks.php +++ b/core/modules/content_moderation/src/Hook/ContentModerationHooks.php @@ -360,7 +360,7 @@ public function workflowUpdate(WorkflowInterface $entity) { * Implements hook_views_post_execute(). */ #[Hook('views_post_execute')] - public function viewsPostExecute(ViewExecutable $view) { + public function viewsPostExecute(ViewExecutable $view): void { // @todo Remove this once broken handlers in views configuration result in // a view no longer returning results. https://www.drupal.org/node/2907954. foreach ($view->filter as $id => $filter) { diff --git a/core/modules/dblog/src/Hook/DblogHooks.php b/core/modules/dblog/src/Hook/DblogHooks.php index accfc02ec970e86abee9bb8a251dbd17e32a51cb..ff99bd670d7bca287c24c6c8bf0ba00d88c36872 100644 --- a/core/modules/dblog/src/Hook/DblogHooks.php +++ b/core/modules/dblog/src/Hook/DblogHooks.php @@ -100,7 +100,7 @@ public function formSystemLoggingSettingsAlter(&$form, FormStateInterface $form_ * Implements hook_views_pre_render(). */ #[Hook('views_pre_render')] - public function viewsPreRender(ViewExecutable $view) { + public function viewsPreRender(ViewExecutable $view): void { if (isset($view) && $view->storage->get('base_table') == 'watchdog') { $view->element['#attached']['library'][] = 'dblog/drupal.dblog'; } diff --git a/core/modules/media_library/src/Hook/MediaLibraryHooks.php b/core/modules/media_library/src/Hook/MediaLibraryHooks.php index 32ee7b4dfb3efa2a9199dfa1d8559d33a72ef3ec..a8da48121dfb6a10991bdaefe561e1936ae0b908 100644 --- a/core/modules/media_library/src/Hook/MediaLibraryHooks.php +++ b/core/modules/media_library/src/Hook/MediaLibraryHooks.php @@ -117,7 +117,7 @@ public function theme() : array { * Implements hook_views_pre_render(). */ #[Hook('views_pre_render')] - public function viewsPreRender(ViewExecutable $view) { + public function viewsPreRender(ViewExecutable $view): void { $add_classes = function (&$option, array $classes_to_add) { $classes = $option ? preg_split('/\s+/', trim($option)) : []; $classes = array_filter($classes); @@ -151,7 +151,7 @@ public function viewsPreRender(ViewExecutable $view) { * Implements hook_views_post_render(). */ #[Hook('views_post_render')] - public function viewsPostRender(ViewExecutable $view, &$output, CachePluginBase $cache) { + public function viewsPostRender(ViewExecutable $view, &$output, CachePluginBase $cache): void { if ($view->id() === 'media_library') { $output['#attached']['library'][] = 'media_library/view'; if (str_starts_with($view->current_display, 'widget')) { diff --git a/core/modules/rest/tests/modules/rest_test_views/src/Hook/RestTestViewsHooks.php b/core/modules/rest/tests/modules/rest_test_views/src/Hook/RestTestViewsHooks.php index d7bc69f05e36c8676aaf335db86fd6d78d271e30..dccd4433a6d41437f9963170aa04f4556001112f 100644 --- a/core/modules/rest/tests/modules/rest_test_views/src/Hook/RestTestViewsHooks.php +++ b/core/modules/rest/tests/modules/rest_test_views/src/Hook/RestTestViewsHooks.php @@ -16,7 +16,7 @@ class RestTestViewsHooks { * Implements hook_views_post_execute(). */ #[Hook('views_post_execute')] - public function viewsPostExecute(ViewExecutable $view) { + public function viewsPostExecute(ViewExecutable $view): void { // Attach a custom header to the test_data_export view. if ($view->id() === 'test_serializer_display_entity') { if ($value = \Drupal::state()->get('rest_test_views_set_header', FALSE)) { diff --git a/core/modules/views/src/Hook/ViewsHooks.php b/core/modules/views/src/Hook/ViewsHooks.php index f26b51ef05d1c6d3813a06472568861b1f85ed85..192fc1cd139c9eb66fc26cefbff22cddbddc55b0 100644 --- a/core/modules/views/src/Hook/ViewsHooks.php +++ b/core/modules/views/src/Hook/ViewsHooks.php @@ -57,7 +57,7 @@ public function help($route_name, RouteMatchInterface $route_match) { * Implements hook_views_pre_render(). */ #[Hook('views_pre_render')] - public function viewsPreRender($view) { + public function viewsPreRender($view): void { // If using AJAX, send identifying data about this view. if ($view->ajaxEnabled() && empty($view->is_attachment) && empty($view->live_preview)) { $view->element['#attached']['drupalSettings']['views'] = [ @@ -78,7 +78,6 @@ public function viewsPreRender($view) { ]; $view->element['#attached']['library'][] = 'views/views.ajax'; } - return $view; } /** diff --git a/core/modules/views/tests/modules/views_test_config/src/Hook/ViewsTestConfigHooks.php b/core/modules/views/tests/modules/views_test_config/src/Hook/ViewsTestConfigHooks.php index ae21dd62c260b12260dbf298cb7746610d0a6fa1..bb9cfad5b1b6baa44b94fbaf181f2c3dbb26e15f 100644 --- a/core/modules/views/tests/modules/views_test_config/src/Hook/ViewsTestConfigHooks.php +++ b/core/modules/views/tests/modules/views_test_config/src/Hook/ViewsTestConfigHooks.php @@ -31,7 +31,7 @@ public function viewLoad(array $views) { * Implements hook_views_post_render(). */ #[Hook('views_post_render')] - public function viewsPostRender(ViewExecutable $view, &$output, CachePluginBase $cache) { + public function viewsPostRender(ViewExecutable $view, &$output, CachePluginBase $cache): void { if (\Drupal::state()->get('views_test_config.views_post_render_cache_tag')) { \Drupal::state()->set('views_test_config.views_post_render_called', TRUE); // Set a cache key on output to ensure ViewsSelection::stripAdminAndAnchorTagsFromResults diff --git a/core/modules/views/tests/modules/views_test_data/src/Hook/ViewsTestDataViewsExecutionHooks.php b/core/modules/views/tests/modules/views_test_data/src/Hook/ViewsTestDataViewsExecutionHooks.php index 85ec17616f615f1282c094a759d1014b3cf08cad..781ae9f4c4ea328690a66d496492f82f3aee0e1d 100644 --- a/core/modules/views/tests/modules/views_test_data/src/Hook/ViewsTestDataViewsExecutionHooks.php +++ b/core/modules/views/tests/modules/views_test_data/src/Hook/ViewsTestDataViewsExecutionHooks.php @@ -59,7 +59,7 @@ public function fieldViewsDataAlter(&$data, FieldStorageConfigInterface $field_s * @see \Drupal\views\Tests\Plugin\RenderTest */ #[Hook('views_pre_render')] - public function viewsPreRender(ViewExecutable $view) { + public function viewsPreRender(ViewExecutable $view): void { \Drupal::state()->set('views_hook_test_views_pre_render', TRUE); if (isset($view) && $view->storage->id() == 'test_cache_header_storage') { $view->element['#attached']['library'][] = 'views_test_data/test'; @@ -79,7 +79,7 @@ public function viewsPreRender(ViewExecutable $view) { * Implements hook_views_post_render(). */ #[Hook('views_post_render')] - public function viewsPostRender(ViewExecutable $view, &$output, CachePluginBase $cache) { + public function viewsPostRender(ViewExecutable $view, &$output, CachePluginBase $cache): void { \Drupal::state()->set('views_hook_test_views_post_render', TRUE); if ($view->storage->id() === 'test_page_display' && $view->current_display === 'empty_row') { for ($i = 0; $i < 5; $i++) { @@ -92,7 +92,7 @@ public function viewsPostRender(ViewExecutable $view, &$output, CachePluginBase * Implements hook_views_pre_build(). */ #[Hook('views_pre_build')] - public function viewsPreBuild(ViewExecutable $view) { + public function viewsPreBuild(ViewExecutable $view): void { \Drupal::state()->set('views_hook_test_views_pre_build', TRUE); } @@ -100,7 +100,7 @@ public function viewsPreBuild(ViewExecutable $view) { * Implements hook_views_post_build(). */ #[Hook('views_post_build')] - public function viewsPostBuild(ViewExecutable $view) { + public function viewsPostBuild(ViewExecutable $view): void { \Drupal::state()->set('views_hook_test_views_post_build', TRUE); if (isset($view) && $view->storage->id() == 'test_page_display') { if ($view->current_display == 'page_1') { @@ -116,7 +116,7 @@ public function viewsPostBuild(ViewExecutable $view) { * Implements hook_views_pre_view(). */ #[Hook('views_pre_view')] - public function viewsPreView(ViewExecutable $view) { + public function viewsPreView(ViewExecutable $view): void { \Drupal::state()->set('views_hook_test_views_pre_view', TRUE); } @@ -124,7 +124,7 @@ public function viewsPreView(ViewExecutable $view) { * Implements hook_views_pre_execute(). */ #[Hook('views_pre_execute')] - public function viewsPreExecute(ViewExecutable $view) { + public function viewsPreExecute(ViewExecutable $view): void { \Drupal::state()->set('views_hook_test_views_pre_execute', TRUE); } @@ -132,7 +132,7 @@ public function viewsPreExecute(ViewExecutable $view) { * Implements hook_views_post_execute(). */ #[Hook('views_post_execute')] - public function viewsPostExecute(ViewExecutable $view) { + public function viewsPostExecute(ViewExecutable $view): void { \Drupal::state()->set('views_hook_test_views_post_execute', TRUE); }