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

     public function getString(): string {
         return $this->getNull() ?? 'Hey';
     }
-
-    private function getNull(): ?string {
-        return null;
-    }
 }
PHP snippet to change

Applied Rules:

Not a change you expect?

Config  rector.php
Rector version: 841315 - released at 2026-01-21 18:06