See InlineEntityFormBase::getEntityTypeLabels().
/**
* Gets the entity type managed by this handler.
*
* @return \Drupal\Core\Entity\EntityTypeInterface
* The entity type.
*/
protected function getEntityTypeLabels() {
// The admin has specified the exact labels that should be used.
if ($this->getSetting('override_labels')) {
return [
'singular' => $this->getSetting('label_singular'),
'plural' => $this->getSetting('label_plural'),
];
}
else {
$this->createInlineFormHandler();
return $this->inlineFormHandler->getEntityTypeLabels();
}
}
I was studying the code related to #3149783: Remove hardcoded word 'entities' in EntityInlineForm::getEntityTypeLabels() when I noticed that the return type of this docblock is wrong. Then I noticed that it's just completely unrelated. I'm kind of surprised that PHPStan didn't pick up on this. It found other incorrect return types at level 1.
Anyone attempting to patch this should probably check the other functions in the class for the same problem. Maybe some docblocks accidentally got swapped or something.
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | issues-3413645-fixed-wrong-doc-block.patch | 669 bytes | viren18febs |
Issue fork inline_entity_form-3413645
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
dcam commentedComment #3
viren18febs commentedHi , i have changed the doc block, and added a patch please review.
Thanks
Comment #4
dcam commented@viren18febS using
{@inheritdoc}is only applicable when the function is extended from another base class or interface. That isn't the case withgetEntityTypeLabels(). It's just an internal helper function for this class. You'll need to actually write a description of the function and its return type.Comment #7
sandeep sanwale commentedModified the docblock for InlineEntityFormBase::getEntityTypeLabels(), Please review .
Comment #8
fabienscotto commentedThe DocBlock in InlineEntityFormBase::getEntityTypeLabels() function appear to be conform to the expected standards. I've conducted tests using PHPCS (PHP CodeSniffer) with the Drupal coding standards, and it returned with 0 errors. Great job!
Comment #9
dcam commentedLooks ok to me. Thank you for working on this.
I am removing credit from @viren18febS since the original patch was not an appropriate fix and no attempt was made to correct the problem.
Comment #12
dwwThanks, everyone, for working on this. Pushed a slightly simplified version to 3.x.