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;
             }));
     }
 }
PHP snippet to change

Applied Rules:

Not a change you expect?

Config  rector.php
Rector version: 0594c1 - released at 2026-05-08 19:57