MoveInnerFunctionToTopLevelRector

Move an inner named function to the top level, as inner named functions are not supported by PHPStan

-function outer(): void
+function inner(): void
 {
-    function inner(): void
-    {
-        echo 'hello';
-    }
+    echo 'hello';
+}

+function outer(): void
+{
     inner();
 }

Configure your rector.php:

<?php

use Rector\CodeQuality\Rector\StmtsAwareInterface\MoveInnerFunctionToTopLevelRector;
use Rector\Config\RectorConfig;

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