Remove useless return Expr in __construct()
class SomeClass
{
public function __construct()
{
if (rand(0, 1)) {
$this->init();
- return true;
+ return;
}
if (rand(2, 3)) {
- return parent::construct();
+ parent::construct();
+ return;
}
$this->execute();
}
}
Configure your rector.php
:
<?php
use Rector\Config\RectorConfig;
use Rector\DeadCode\Rector\ClassMethod\RemoveUselessReturnExprInConstructRector;
return RectorConfig::configure()
->withRules([
RemoveUselessReturnExprInConstructRector::class,
]);