A method named like a test is not public, so PHPUnit never runs it

tx0/php:test-method-not-publicstrictwarningmaintainability/testsdepth fastbug

What it finds

A method named like a test is not public, so PHPUnit never runs it

Example from the rule's tests
<?phpclass NameTest extends TestCase{    private function testRejectsEmptyName(): voidtx0 reports: testRejectsEmptyName is not public    {        $this->assertFalse(valid(''));    }     protected function test_trims_spaces(): voidtx0 reports: test_trims_spaces is not public    {        $this->assertSame('a', clean(' a '));    }     public function testAcceptsName(): void    {        $this->testValue('Ann');    }     private function testValue(string $name): void    {        $this->assertTrue(valid($name));    }     private function testable(): bool    {        return true;    }} class NotATest{    private function testSomething(): void    {    }}
Highlighted lines are the ones tx0 reports, with its message under each; the other lines are left alone.

Turn it on, off or suppress it

The rule runs from the strict tier up. To turn it on in a lower tier, give it a level in tx0.toml:

tx0.toml
[rules]
"tx0/php:test-method-not-public" = "warning"

To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:

// tx0: ignore[tx0/php:test-method-not-public] reason="..."

tx0 explain tx0/php:test-method-not-public shows the same in the terminal. Found a false positive? Report it.