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/gq7sfvrntg1nlbi31c2q/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\ValueObject\PhpVersion; return RectorConfig::configure() ->withPhpSets(php83: true) ->withRules([ RemoveParentDelegatingConstructorRector::class, ]) ; //
Run Rector
Rector version:
cad967
- released at 2026-01-09 01:40