Problem/Motivation

The doc for \Drupal\Component\Plugin\Attribute\Plugin::__construct type hints the $deriver param as class-string|null. Many child classes are using the looser string|null typehint for this property. At phpstan level 4 we get the following error:

PHPDoc type string of property Bar::$class is not covariant with PHPDoc type class-string of overridden property Foo::$class.

Steps to reproduce

PHPStan playground example

Proposed resolution

Use class-string|null instead of string|null

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

CommentFileSizeAuthor
#4 3426217-nr-bot.txt90 bytesneeds-review-queue-bot

Issue fork drupal-3426217

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:

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mstrelan created an issue. See original summary.

mstrelan’s picture

Status: Active » Needs review
needs-review-queue-bot’s picture

Status: Needs review » Needs work
FileSize
90 bytes

The Needs Review Queue Bot tested this issue. It no longer applies to Drupal core. Therefore, this issue status is now "Needs work".

This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.

Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.

mstrelan’s picture

Status: Needs work » Needs review

Rebased

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: +Needs Review Queue Initiative

Searched for @param string|null $deriver and there are 10 instances that were all replaced.

Agree on the one param change, it's own ticket would be overkill

  • catch committed 5f208d1b on 10.3.x
    Issue #3426217 by mstrelan: Fix @param docs for $deriver on plugin...

  • catch committed 0a847106 on 11.x
    Issue #3426217 by mstrelan: Fix @param docs for $deriver on plugin...
catch’s picture

Version: 11.x-dev » 10.3.x-dev
Status: Reviewed & tested by the community » Fixed

Committed/pushed to 11.x and cherry-picked to 10.3.x, thanks!

Status: Fixed » Closed (fixed)

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