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: \"Rector\\DeadCode\\Rector\\ClassMethod\\RemoveParentDelegatingConstructorRector::matchParentConstructorCallArgs(): Argument #1 ($stmt) must be of type PhpParser\\Node\\Stmt, null given, called in /var/www/vendor/rector/rector/rules/DeadCode/Rector/ClassMethod/RemoveParentDelegatingConstructorRector.php on line 100\"\nRun Rector with \"--debug\" option and post the report here: https://github.com/rectorphp/rector/issues/new", "file": "/var/www/storage/demo/b3jqw5l5nt5mm7h2wk8s/rector_analyzed_file.php", "line": 135 } ] }
Run Rector on your code to see what it can do for you:
PHP snippet to change
<?php class A { public function __construct() { $this->init(); } private function init(): void { echo 'A init'; } } final class B extends A { private string $prop; public function __construct(string $prop) { $this->prop = $prop; parent::__construct(); } public function prop(): string { return $this->prop; } }
Config
rector.php
<?php use Rector\Config\RectorConfig; use Rector\DeadCode\Rector\ClassMethod\RemoveParentDelegatingConstructorRector; use Rector\Php80\Rector\Class_\ClassPropertyAssignToConstructorPromotionRector; return RectorConfig::configure() ->withRules([ ClassPropertyAssignToConstructorPromotionRector::class, RemoveParentDelegatingConstructorRector::class, ]);
Run Rector
Rector version:
e91db1
- released at 2026-01-03 00:21