Problem/Motivation
\Drupal\Core\Entity\EntityTypeInterface::getKey
is incorrectly typed and causes static analysis tools like PHPStan to trip up.
Steps to reproduce
Run PHPStan on max where code calls \Drupal\Core\Entity\EntityTypeInterface::getKey
. PHPStan will assume the returned variable is either string or bool. Where in fact there is never TRUE.
Proposed resolution
Change typehint from string|bool
to string|false
.
Remaining tasks
Implement
Issue fork drupal-3269215
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
Comment #2
dpiComment #5
sluceroComment #6
dpiLGTM!
Comment #7
quietone CreditAttribution: quietone at PreviousNext commentedI often forget about this one so I checked again Indicating data types in documentation and confirmed that the 'false' is allowed.
This looks fine to me. I'll wait for feedback from a committer.
Comment #8
xjmJust fixing the title. :)
Comment #10
dpiNot sure why #9 was needed, as the only file in the original MR hasn't had any new changes upstream. Anyway, MR is still fine.
Comment #11
dpiTypo typhinted->typehinted
Comment #12
alexpott@yogeshmpawar thank you for looking into this issue.
The push in comment #9 is unnecessary as merge request could still be applied to HEAD.
So, I've removed the issue credit for that push. In the future, you can get credit for updates to issues that are required. More information on the issue credit guidelines.
Thank you!
Crediting @dpi for filing the issue.
Comment #13
alexpottCommitted and pushed 9e8f4c8ed3 to 10.0.x and d99a0f626e to 9.5.x and 70fc227fa7 to 9.4.x. Thanks!
Backported to 9.4.x as this is a docs fix.