Problem/Motivation

Coder 8.3.21

False positive Drupal.Commenting.VariableComment.Missing: Missing member variable doc comment when when declaring typehints with intersecting parameters.

Steps to reproduce

  /**
   * Mock of the user storage.
   *
   * @var \Drupal\user\UserStorageInterface&\PHPUnit\Framework\MockObject\MockObject
   */
  protected UserStorageInterface&MockObject $userStorageMock;

Proposed resolution

TBD

Remaining tasks

Patch

User interface changes

None

API changes

None

Data model changes

None

Comments

cmlara created an issue. See original summary.

  • klausi authored ba6e6230 on 8.3.x
    fix(VariableComment): Allow intersection types in @var comment (#3392423...
klausi’s picture

Status: Active » Fixed

Pushed a fix, thanks a lot for reporting!

Tip of the day: if you define an explicit type, then you don't need to repeat it in @var comments.

solideogloria’s picture

Tip of the day: if you define an explicit type, then you don't need to repeat it in @var comments.

Thanks for the info! I began writing my project back when the @var comments were necessary to pass code review, even when an explicit type was declared, but it's helpful to know that only one is needed now. I tested it, and it passes code review as you said.

Status: Fixed » Closed (fixed)

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