CallbackSingleAssertToSimplerRector

Replaces use of with, callback and sole assertSame() to simple equalTo() matcher

 use PHPUnit\Framework\TestCase;

 final class SomeClass extends TestCase
 {
     public function test()
     {
         $builder->expects($this->exactly(2))
             ->method('add')
-            ->with($this->callback(function ($type): bool {
-                $this->assertSame(TextType::class, $type);
-
-                return true;
-            }));
+            ->with($this->equalTo(TextType::class));
     }
 }

Configure your rector.php:

<?php

use Rector\Config\RectorConfig;
use Rector\PHPUnit\CodeQuality\Rector\MethodCall\CallbackSingleAssertToSimplerRector;

return RectorConfig::configure()
    ->withRules([
        CallbackSingleAssertToSimplerRector::class,
    ]);
SETS:  Code Quality