Problem/Motivation

EntityTypeInterface::getFormClass() can return NULL if it is called with an operation for which no form class exists.

It is documented that it always returns a string, however. This is annoying because PHPStan will complain if you (correctly!) perform a type-check or similar on the return value.

Proposed resolution

Fix the documentation.

CommentFileSizeAuthor
#2 3108081-2.patch759 byteststoeckler
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

tstoeckler created an issue. See original summary.

tstoeckler’s picture

Status: Active » Needs review
FileSize
759 bytes

Here's a patch that applies to 8.8.x, 8.9.x and 9.0.x.

longwave’s picture

Status: Needs review » Reviewed & tested by the community

Confirmed that getFormClass() returns NULL if hasHandlerClass() returns FALSE for the provided arguments.

  • catch committed d0d8e87 on 9.0.x
    Issue #3108081 by tstoeckler, longwave: Return type for...

  • catch committed c29a995 on 8.9.x
    Issue #3108081 by tstoeckler, longwave: Return type for...
catch’s picture

Version: 8.8.x-dev » 8.9.x-dev
Status: Reviewed & tested by the community » Fixed

Committed d0d8e87 and pushed to 9.0.x and 8.9.x. Thanks!

Status: Fixed » Closed (fixed)

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