ForRepeatedCountToOwnVariableRector

Change count() in for function to own variable

 class SomeClass
 {
     public function run($items)
     {
-        for ($i = 5; $i <= count($items); $i++) {
+        $itemsCount = count($items);
+        for ($i = 5; $i <= $itemsCount; $i++) {
             echo $items[$i];
         }
     }
 }

Configure your rector.php:

<?php

use Rector\CodeQuality\Rector\For_\ForRepeatedCountToOwnVariableRector;
use Rector\Config\RectorConfig;

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