Configurable

NewToStaticCallRector

Change new Object to static call

 class SomeClass
 {
     public function run()
     {
-        new Cookie($name);
+        Cookie::create($name);
     }
 }

Configure your rector.php:

<?php

use Rector\Config\RectorConfig;
use Rector\Transform\Rector\New_\NewToStaticCallRector;
use Rector\Transform\ValueObject\NewToStaticCall;

return RectorConfig::configure()
    ->withConfiguredRule(NewToStaticCallRector::class, [
        new NewToStaticCall('Cookie', 'Cookie', 'create'),
    ]);
SETS:  symfony/* 4.2