Add null default to properties with PHP 7.4 property nullable type
class SomeClass
{
- public ?string $name;
+ public ?string $name = null;
}
Configure your rector.php
:
<?php
use Rector\Config\RectorConfig;
use Rector\Php74\Rector\Property\RestoreDefaultNullToNullableTypePropertyRector;
return RectorConfig::configure()
->withRules([
RestoreDefaultNullToNullableTypePropertyRector::class,
]);