Problem/Motivation

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

Steps to reproduce

grep -P "Function [a-zA-Z0-9_]+_update_\\d+\\\\\\\\\(\\\\\\\\\) has no return type specified" core/.phpstan-baseline.php

Proposed resolution

Add return type to the 20 functions listed in steps to reproduce. Many of these are void, some are string, some may be MarkupInterface or TranslatableMarkup.

Add return type to hook_update_N example in module.api.php

Update phpstan baseline

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

Issue fork drupal-3490954

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.

nexusnovaz’s picture

Ill take a look at this one

nexusnovaz’s picture

Status: Active » Needs review

Running the grep command, there was only 20 functions. I've updated those and pushed my changed. Please can you review MR !10445

mstrelan’s picture

Issue summary: View changes
Status: Needs review » Reviewed & tested by the community

Checked again and there are only 20, not 44, ever since #3490638: Add return types to update_test_* hooks. Have updated the IS to reflect that.

MR looks good, pipeline is green, 120 lines removed from baseline checks out (20 x 6 = 120). RTBC from me.

  • quietone committed 4e64f397 on 11.1.x
    Issue #3490954 by nexusnovaz, mstrelan: Add return types to...

  • quietone committed 671996fd on 11.x
    Issue #3490954 by nexusnovaz, mstrelan: Add return types to...
quietone’s picture

Version: 11.x-dev » 11.1.x-dev
Status: Reviewed & tested by the community » Fixed

That equivalent_update_test_update_100201 returns TranslatableMarkup is unusual but it is part of the testing.

Committed to 11.x and cherry-picked to 11.1.x

Thanks

Status: Fixed » Closed (fixed)

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