Try these: PHP 7.4 Typed Properties create_function() Early Return Null Coalescing


Result

Used Rector version: No version set (parsed as 1.0.0)@

     public function run()
     {
         if ($this->hasDocBlock($tokens, $index)) {
-            $docToken = $tokens[$this->getDocBlockIndex($tokens, $index)];
-        } else {
-            $docToken = null;
+            return $tokens[$this->getDocBlockIndex($tokens, $index)];
         }
 
-        return $docToken;
+        return null;
     }
 }