Run Rector on your code to see what it can do for you:

 <?php
 
 namespace Rector\Tests\Php80\Rector\Class_\ClassPropertyAssignToConstructorPromotionRector\Fixture;
 
 class WithInterfaceAndItsImplementation
 {
-    private SomeInterface $x;
-
-    public function __construct(
-        FirstImplementation $x,
-    ) {
-        $this->x = $x;
+    public function __construct(private SomeInterface $x)
+    {
     }
 }
 
 ?>
PHP snippet to change

Applied Rules:

Not a change you expect?

Config  rector.php
Rector version: e30087 - released at 2026-04-23 17:48