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.

Command icon 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

dcam created an issue. See original summary.

dcam’s picture

Title: getEntityTypeLabels() has the wrong docblock » InlineEntityFormBase::getEntityTypeLabels() has the wrong docblock
viren18febs’s picture

Status: Active » Needs review
StatusFileSize
new669 bytes

Hi , i have changed the doc block, and added a patch please review.
Thanks

dcam’s picture

Status: Needs review » Needs work

@viren18febS using {@inheritdoc} is only applicable when the function is extended from another base class or interface. That isn't the case with getEntityTypeLabels(). 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.

Sandeep Sanwale made their first commit to this issue’s fork.

sandeep sanwale’s picture

Status: Needs work » Needs review

Modified the docblock for InlineEntityFormBase::getEntityTypeLabels(), Please review .

fabienscotto’s picture

The 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!

dcam’s picture

Status: Needs review » Reviewed & tested by the community

Looks 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.

dww made their first commit to this issue’s fork.

  • dww committed 4551cbb8 on 3.x
    docs: #3413645 InlineEntityFormBase::getEntityTypeLabels() has the wrong...
dww’s picture

Status: Reviewed & tested by the community » Fixed

Thanks, everyone, for working on this. Pushed a slightly simplified version to 3.x.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.