Overview

PHPStan: Test methods should never have optional parameters from a data provider.
This is a big smell that have caused bugs in test coverage in the past.

Proposed resolution

Create phpstan rule.

User interface changes

None.

Issue fork canvas-3585319

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

penyaskito created an issue. See original summary.

phenaproxima’s picture

Status: Active » Reviewed & tested by the community

One question, but absolutely a great call. This should be in core's code quality checks, if you ask me. Approved.

  • penyaskito committed a3cc2b0b on 1.x
    chore(PHPStan): #3585319 PHPStan: Test methods should never have...
penyaskito’s picture

Status: Reviewed & tested by the community » Fixed

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.

wim leers’s picture

👏 Yes please! 🤩

This is one of those things I've pointed in dozens of MR reviews, and I've seen everyone do it: from junior to wizard (@larowlan). It's introduced confusing test coverage that led to both painful WTFs and regressions, many times!

THANKS SO MUCH!!! This made my Friday 😄

Status: Fixed » Closed (fixed)

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