Add return type to functions in global namespace

Created on 17 March 2025, about 2 months ago

Problem/Motivation

Following on from 📌 [META] Add return types to hook implementations Active there are thousands of functions without return types. The next bunch of low hanging fruit here is procedural functions in the global namespace. These should be simple because there is no BC concern, i.e. they don't belong to an interface or class and therefore can't be extended.

Steps to reproduce

grep -oP 'Function \K[^D].*(?=\\\\\(\\\\\) has no return type specified)' core/.phpstan-baseline.php

That lists 255 functions with no return type.

Proposed resolution

Determine how to split this issue, then add return type to each function.

Possibly we can split by prefix, then review the remaining 118 functions:

  • locale (34)
  • install (22)
  • update (22)
  • views (19)
  • simpletest (16)
  • user (14)
  • batch (10)
  • filter (10)

Or we can just do it all in one go.

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

📌 Task
Status

Active

Version

11.0 🔥

Component

other

Created by

🇦🇺Australia mstrelan

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024