Run Rector on your code to see what it can do for you:

 <?php
 
 final class DemoFile
 {
-    /**
-     * @return Iterator<DemoFile>
-     */
-    public function run(): Iterator
+    /**
+     * @return \ArrayIterator<DemoFile>
+     */
+    public function run(): \ArrayIterator
     {
         $arr = [new DemoFile];
         return new ArrayIterator($arr);
     }
 }
PHP snippet to change

Applied Rules:

Not a change you expect?

Config  rector.php
Rector version: 51d617 - released at 2026-07-12 20:08