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
Proposed resolution
Use class-string|null
instead of string|null
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
Comment | File | Size | Author |
---|---|---|---|
#4 | 3426217-nr-bot.txt | 90 bytes | needs-review-queue-bot |
Issue fork drupal-3426217
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:
- 3426217-class-string changes, plain diff MR !6945
Comments
Comment #3
mstrelan CreditAttribution: mstrelan at PreviousNext commentedComment #4
needs-review-queue-bot CreditAttribution: needs-review-queue-bot as a volunteer commentedThe 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.
Comment #5
mstrelan CreditAttribution: mstrelan at PreviousNext commentedRebased
Comment #6
smustgrave CreditAttribution: smustgrave at Mobomo commentedSearched 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
Comment #9
catchCommitted/pushed to 11.x and cherry-picked to 10.3.x, thanks!