ExplicitReturnNullRector

Add explicit return null to method/function that returns a value, but missed main return

 class SomeClass
 {
     /**
-     * @return string|void
+     * @return string|null
      */
     public function run(int $number)
     {
         if ($number > 50) {
             return 'yes';
         }
+
+        return null;
     }
 }

Configure your rector.php:

<?php

use Rector\CodeQuality\Rector\ClassMethod\ExplicitReturnNullRector;
use Rector\Config\RectorConfig;

return RectorConfig::configure()
    ->withRules([
        ExplicitReturnNullRector::class,
    ]);
SETS:  Code Quality