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: \"Division by zero\"\nRun Rector with \"--debug\" option and post the report here: https://github.com/rectorphp/rector/issues/new", "file": "/var/www/storage/demo/4jvkeb16l6c6pie4q2kg/rector_analyzed_file.php", "line": 185 } ] }
Run Rector on your code to see what it can do for you:
PHP snippet to change
<?php function test($mode) { $x = 1 / 0; }
Config
rector.php
<?php use Rector\Config\RectorConfig; return RectorConfig::configure() ->withRules([ \Rector\CodeQuality\Rector\Foreach_\ForeachItemsAssignToEmptyArrayToAssignRector::class ]);
Run Rector
Rector version:
d04dcf
- released at 2025-09-04 16:01