Replaces use of with, callable and instance assert to simple isInstanceOf() method
-use PHPUnit\Framework\TestCase
+use PHPUnit\Framework\TestCase;
final class SomeClass extends TestCase
{
public function test()
{
$someMock = $this->createMock(SomeClass::class)
->method('someMethod')
- ->with($this->callable(function ($arg): bool {
- return $arg instanceof SomeType;
- }));
+ ->with($this->isInstanceOf(SomeType::class));
}
}
Configure your rector.php:
<?php
use Rector\Config\RectorConfig;
use Rector\PHPUnit\CodeQuality\Rector\MethodCall\SimplerWithIsInstanceOfRector;
return RectorConfig::configure()
->withRules([
SimplerWithIsInstanceOfRector::class,
]);