Problem/Motivation
See #3483037: [META] Add return types to hook implementations
Steps to reproduce
grep -P 'Drupal\\\\.*\\\\Hook\\\\.*:\\\\:views(Pre|Post)(View|Build|Execute|Render)\\\\\(\\\\\) has no return type specified' core/.phpstan-baseline.php
Proposed resolution
Add : void to the following hooks in views.api.php:
hook_views_pre_view
hook_views_pre_build
hook_views_post_build
hook_views_pre_execute
hook_views_post_execute
hook_views_pre_render
hook_views_post_render
Add : void to each of these:
Drupal\content_moderation\Hook\ContentModerationHooks::viewsPostExecute()
Drupal\dblog\Hook\DblogHooks::viewsPreRender()
Drupal\media_library\Hook\MediaLibraryHooks::viewsPostRender()
Drupal\media_library\Hook\MediaLibraryHooks::viewsPreRender()
Drupal\rest_test_views\Hook\RestTestViewsHooks::viewsPostExecute()
Drupal\views\Hook\ViewsHooks::viewsPreRender()
Drupal\views_test_config\Hook\ViewsTestConfigHooks::viewsPostRender()
Drupal\views_test_data\Hook\ViewsTestDataViewsExecutionHooks::viewsPostBuild()
Drupal\views_test_data\Hook\ViewsTestDataViewsExecutionHooks::viewsPostExecute()
Drupal\views_test_data\Hook\ViewsTestDataViewsExecutionHooks::viewsPostRender()
Drupal\views_test_data\Hook\ViewsTestDataViewsExecutionHooks::viewsPreBuild()
Drupal\views_test_data\Hook\ViewsTestDataViewsExecutionHooks::viewsPreExecute()
Drupal\views_test_data\Hook\ViewsTestDataViewsExecutionHooks::viewsPreRender()
Drupal\views_test_data\Hook\ViewsTestDataViewsExecutionHooks::viewsPreView()
Update phpstan baseline
./vendor/bin/phpstan --configuration=core/phpstan.neon --generate-baseline=core/.phpstan-baseline.php
Remaining tasks
User interface changes
Introduced terminology
API changes
Data model changes
Release notes snippet
Comments
Comment #4
harivansh commentedComment #5
mstrelan commentedNeed to regenerate the baseline
Comment #7
shalini_jha commentedI checked the pipeline failure issue and added return type hint & regenerated the Baseline as mentioned in issue summary. so pipeline is green now.
grep -P 'Drupal\\\\.*\\\\Hook\\\\.*:\\\\:views(Pre|Post)(View|Build|Execute|Render)\\\\\(\\\\\) has no return type specified' core/.phpstan-baseline.php -> not listed any issue.
Moving this to NR, Kindly review.
Comment #8
mstrelan commentedAdded a couple comments on the MR
Comment #9
shalini_jha commentedThanks for the review , working on the feedback.
Comment #10
shalini_jha commentedI missed noticing the spacing issues in the initial work of this MR. I have now addressed all comments on the MR. The pipeline is green, so moving this back to 'Needs Review.' Kindly review
Comment #11
ankitv18 commentedLooks good to be merge ~~ Changing to RTBC.
Comment #14
larowlanCommitted to 11.x - thanks!