Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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.
Comment | File | Size | Author |
---|---|---|---|
#2 | 3108081-2.patch | 759 bytes | tstoeckler |
Comments
Comment #2
tstoecklerHere's a patch that applies to 8.8.x, 8.9.x and 9.0.x.
Comment #3
longwaveConfirmed that
getFormClass()
returns NULL ifhasHandlerClass()
returns FALSE for the provided arguments.Comment #6
catchCommitted d0d8e87 and pushed to 9.0.x and 8.9.x. Thanks!