RemoveReturnThisFromSetterClassMethodRector

Remove return $this from setter method, to make explicit setter without return value. Goal is to make code unambiguous with one way to set value

 class SomeClass
 {
     private $name;

-    public function setName(string $name): self
+    public function setName(string $name): void
     {
         $this->name = $name;
-        return $this;
     }
 }

Configure your rector.php:

<?php

use Rector\Config\RectorConfig;
use Rector\Unambiguous\Rector\Class_\RemoveReturnThisFromSetterClassMethodRector;

return RectorConfig::configure()
    ->withRules([
        RemoveReturnThisFromSetterClassMethodRector::class,
    ]);