Skip to content

Conversation

@TomasVotruba
Copy link
Member

@TomasVotruba TomasVotruba commented Jan 26, 2026

Since PHPUnit 12, you get notice for using mocks without any expectations.

Instead, the createStub() should be used instead:

final class SomeTest extends TestCase
{
    public function test()
    {
        // HERE ↓
-       $this->someMethod($this->createMock(SomeClass::class));
+       $this->someMethod($this->createStub(SomeClass::class));
    }

    private function someMethod($someClass)
    {
    }
}

@TomasVotruba TomasVotruba merged commit 265b670 into main Jan 26, 2026
7 checks passed
@TomasVotruba TomasVotruba deleted the tv-stubs branch January 26, 2026 11:26
}

$hasChanges = false;

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

first class callable check needs to be checked early here

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants