Add explicit expects() to method() mock calls, to make expectations count explicit
use PHPUnit\Framework\TestCase;
final class SomeClass extends TestCase
{
public function testMe()
{
$someMock = $this->createMock(\stdClass::class);
- $someMock->method('some');
+ $someMock->expects($this->atLeastOnce())->method('some');
}
}
Configure your rector.php:
<?php
use Rector\Config\RectorConfig;
use Rector\PHPUnit\PHPUnit120\Rector\MethodCall\ExplicitMockExpectsCallRector;
return RectorConfig::configure()
->withRules([
ExplicitMockExpectsCallRector::class,
]);