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

Issue fork drupal-3490579

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

mstrelan created an issue. See original summary.

harivansh made their first commit to this issue’s fork.

harivansh’s picture

Status: Active » Needs review
mstrelan’s picture

Status: Needs review » Needs work

Need to regenerate the baseline

shalini_jha made their first commit to this issue’s fork.

shalini_jha’s picture

Status: Needs work » Needs review

I 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.

mstrelan’s picture

Status: Needs review » Needs work

Added a couple comments on the MR

shalini_jha’s picture

Assigned: Unassigned » shalini_jha

Thanks for the review , working on the feedback.

shalini_jha’s picture

Assigned: shalini_jha » Unassigned
Status: Needs work » Needs review

I 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

ankitv18’s picture

Status: Needs review » Reviewed & tested by the community

Looks good to be merge ~~ Changing to RTBC.

  • larowlan committed 283d4162 on 11.x
    Issue #3490579 by shalini_jha, mstrelan: Add void return to all views...
larowlan’s picture

Status: Reviewed & tested by the community » Fixed

Committed to 11.x - thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.