Change simple property init and assign to constructor promotion
class SomeClass
{
- public float $price;
-
public function __construct(
- float $price = 0.0
+ public float $price = 0.0
) {
- $this->price = $price;
}
}
Configure your rector.php
:
<?php
use Rector\Config\RectorConfig;
use Rector\Php80\Rector\Class_\ClassPropertyAssignToConstructorPromotionRector;
return RectorConfig::configure()
->withConfiguredRule(ClassPropertyAssignToConstructorPromotionRector::class, [
'inline_public' => false,
'rename_property' => true,
]);