Try Rector
Docs
Hire Team
Find Rule
Blog
Contact
AST
Try Rector
Docs
Hire Team
Find Rule
Blog
Contact
AST
Rector run Failed:
{ "totals": { "changed_files": 0, "errors": 1 }, "errors": [ { "message": "System error: \"Scope not available on \"PhpParser\\Node\\ArrayItem\" node. Fix scope refresh on changed nodes first\"\nRun Rector with \"--debug\" option and post the report here: https://github.com/rectorphp/rector/issues/new", "file": "/var/www/storage/demo/tmgvzx7qftorrenyf9m8/rector_analyzed_file.php", "line": 19 } ] }
Run Rector on your code to see what it can do for you:
PHP snippet to change
<?php $regex = '/(?P<version>\d+\.\d+\.\d+)/'; $contents = 'VERSION: 1.0.0'; $operations = []; if (preg_match_all($regex, $contents, $matches, PREG_OFFSET_CAPTURE | PREG_SET_ORDER) > 0) { foreach ($matches as ['version' => [$fullVersion, $offset]]) { $operations[] = [$fullVersion, $offset]; } }
Config
rector.php
<?php use Rector\Config\RectorConfig; use Rector\PHPUnit\CodeQuality\Rector\CallLike\DirectInstanceOverMockArgRector; use Rector\ValueObject\PhpVersion; return RectorConfig::configure() ->withPreparedSets(codeQuality: true) ->withRules([ DirectInstanceOverMockArgRector::class, ]) ->withPhpVersion(PhpVersion::PHP_84);
Run Rector
Rector version:
5ce62c
- released at 2026-02-03 19:00