NarrowIdenticalWithConsecutiveRector

Narrow identical withConsecutive() and willReturnOnConsecutiveCalls() to single call

 use PHPUnit\Framework\TestCase;

 final class SomeTest extends TestCase
 {
     public function run()
     {
         $this->personServiceMock->expects($this->exactly(3))
             ->method('prepare')
-            ->withConsecutive(
-                [1],
-                [1],
-                [1],
-            )
-            ->willReturnOnConsecutiveCalls(
-                [2],
-                [2],
-                [2],
-            );
+            ->with([1])
+            ->willReturn([2]);
     }
 }

Configure your rector.php:

<?php

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

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