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

 <?php
 
 final class DemoFile implements \Stringable
 {
     public function __toString(): string
     {
-        throw new \Exception('Not implemented');
+        throw new \Exception('Not implemented');
+        return '';
     }
 }
PHP snippet to change

Applied Rules:

Not a change you expect?

Config  rector.php
Rector version: 2.2.14 - released at 2025-12-09 11:53