Remove expect($this->any())
from mocks as it has no added value
use PHPUnit\Framework\TestCase;
class SomeClass extends TestCase
{
public function test()
{
$translator = $this->getMock('SomeClass');
- $translator->expects($this->any())
- ->method('trans')
+ $translator->method('trans')
->willReturn('translated max {{ max }}!');
}
}
Configure your rector.php
:
<?php
use Rector\Config\RectorConfig;
use Rector\PHPUnit\CodeQuality\Rector\MethodCall\RemoveExpectAnyFromMockRector;
return RectorConfig::configure()
->withRules([
RemoveExpectAnyFromMockRector::class,
]);