Return type void in EntityTypeBehaviorInterface view method

Created on 1 February 2022, about 3 years ago
Updated 25 May 2023, almost 2 years ago

Problem/Motivation

The view method docblock on EntityTypeBehaviorInterface specifies to return an array. https://git.drupalcode.org/project/entity_type_behaviors/-/blob/2.0.x/sr...

This array is never used, and the function is meant to alter the build array. However the docblock causes tools like PHPStan to complain if your implementation does not return anything. Adding a return [] can be done in your implementations, but this is off course a bit silly.

Proposed resolution

Alter the docblock declaration. A return type void could also be added, but the latter is actually a BC break, thus should be done in a v3 version.

API changes

🐛 Bug report
Status

Fixed

Version

2.0

Component

Documentation

Created by

🇧🇪Belgium mallezie Loenhout

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024