Problem/Motivation

See #3483037: [META] Add return types to hook implementations

Steps to reproduce

grep "_requirements\\\\.* has no return type specified" core/.phpstan-baseline.php

Proposed resolution

Add array return type

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

Issue fork drupal-3498059

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.

mstrelan’s picture

Status: Active » Needs review
hetal.solanki’s picture

Status: Needs review » Reviewed & tested by the community

@mstrelan

MR looks good moving to RTBC.

Thank You!!

hetal.solanki’s picture

quietone’s picture

Status: Reviewed & tested by the community » Needs work

This too needs a rebase

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

shalini_jha’s picture

Rebased this and resolved conflicts. However, after running the command:
grep "_requirements\\\\.* has no return type specified" core/.phpstan-baseline.php

I noticed that two additional entries are still listed:

'message' => '#^Function install_check_requirements\\(\\) has no return type specified\\.$#',
'message' => '#^Function update_check_requirements\\(\\) has no return type specified\\.$#',

I’m unsure if we also need to update these?

nicxvan’s picture

No, those are not hooks, they cannot be updated here.

shalini_jha’s picture

Status: Needs work » Needs review

Thank you for the confirmation. Since everything is addressed, I am moving this to Needs Review.

nicxvan’s picture

Status: Needs review » Reviewed & tested by the community
berdir’s picture

Is it really worth doing this when we are in the middle of changing all hook_requirements() implementations anyway?

nicxvan’s picture

Sure why not, we did it for all of the other hooks, at the minimum it means you don't have to manage phpstan when converting them which is nice.

  • quietone committed a0503e22 on 11.x
    Issue #3498059 by mstrelan, shalini_jha, hetal.solanki: Add array return...
quietone’s picture

Applied the diff and regenerated the baseline. That results in finding 2 instances but they are not hooks.

(11.x)$ grep "_requirements\\\\.* has no return type specified" core/.phpstan-baseline.php
        'message' => '#^Function install_check_requirements\\(\\) has no return type specified\\.$#',
        'message' => '#^Function update_check_requirements\\(\\) has no return type specified\\.$#',
quietone’s picture

Status: Reviewed & tested by the community » Fixed

Committed a0503e2 and pushed to 11.x. Thanks!

Status: Fixed » Closed (fixed)

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