Run Rector on your code to see what it can do for you:
<?php use PHPUnit\Framework\TestCase;
$this->createMock('SomeClass') ->expects($this->once()) ->method('someMethod') - ->with($this->callback(static function (array $args): bool { - return count($args) === 2 && $args[0] === 'correct'; + ->with($this->callback(static function (array $args): bool { + $this->assertCount(2, $args); + $this->assertSame('correct', $args[0]); + return true; })); } }
Applied Rules:
Not a change you expect?
rector.php