Problem/Motivation

Amongst the current suppressions found in the PHPStan level 1 baseline, introduce by the adding of phpstan/phpstan-phpunit, is: Class already @covers \Foo\Bar so the method @covers is redundant..

This issue exists to fix all of those.

Steps to reproduce

- Run PHPStan on level 1 and see the above issue amongst all others.

Proposed resolution

- Solve all of the reported issues for the above mentioned.
- Run PHPStan on level 1 and don't see the above issue any more.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Issue fork drupal-3351067

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

Spokje created an issue. See original summary.

spokje’s picture

Title: Fix PHPStan L1 errors "" » Fix PHPStan L1 errors "Class already @covers \Foo\Bar so the method @covers is redundant."

spokje’s picture

Assigned: spokje » Unassigned
Status: Active » Needs review
spokje’s picture

Issue tags: +PHPStan-1
smustgrave’s picture

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

From what I can tell this is a valid cleanup.

The MR passing shows it applies cleanly and doesn't generate errors.

catch’s picture

Status: Reviewed & tested by the community » Needs work

I'm seeing errors like

Ignored error pattern #^Annotation "@covers\:\:buildLocalUrl" is                          
         invalid, "@covers" should be followed by a space and a value\.$# in                       
         path                                                                                      
         /home/catch/www/drupal/core/tests/Drupal/Tests/Core/Utility/UnroutedUrlAssemblerTest.php  
         was not matched in reported errors.                                                       

in core commit checks.

spokje’s picture

Hmmm, that specific one is handled in #3351073: Fix PHPStan L1 errors "Annotation "@covers::foo" is invalid, "@covers" should be followed by a space and a value.", unsure why that shows up in commit checks for this one.

Also: What are these commit checks and can mere mortal people trigger those?
If not and TestBot is green, I'm not sure what I can do about it, since I will never get to see those errors.

catch’s picture

Status: Needs work » Reviewed & tested by the community

You can run ./core/scripts/dev/commit-code-check.sh

Also I think I was missing a composer update

spokje’s picture

You can run ./core/scripts/dev/commit-code-check.sh

Ah, i actually (almost) use that on any issue.
Thought there might be some "special sauce" somewhere.

Also I think I was missing a composer update

Root cause found, normality restored.

catch’s picture

Status: Reviewed & tested by the community » Fixed

Yep, that was the problem.

Committed/pushed to 10.1.x, thanks!

  • catch committed 821cc64a on 10.1.x
    Issue #3351067 by Spokje: Fix PHPStan L1 errors "Class already @covers \...
catch’s picture

Status: Fixed » Closed (fixed)

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