NewInInitializerRector

Replace property declaration of new state with direct new

 class SomeClass
 {
-    private Logger $logger;
-
     public function __construct(
-        ?Logger $logger = null,
+        private Logger $logger = new NullLogger,
     ) {
-        $this->logger = $logger ?? new NullLogger;
     }
 }

Configure your rector.php:

<?php

use Rector\Config\RectorConfig;
use Rector\Php81\Rector\ClassMethod\NewInInitializerRector;

return RectorConfig::configure()
    ->withRules([
        NewInInitializerRector::class,
    ]);
SETS:  PHP 8.1