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

 
 final class DemoFile
 {
-    public function run(bool $param)
+    public function run(bool $param): int|string
     {
         if ($this->isTrue($param)) {
             return 5;
         return '10';
     }
 
-    private function isTrue($value)
+    private function isTrue(bool $value): bool
     {
         return $value === true;
     }
PHP snippet to change
Config  rector.php
Rector version: 142f1c - released at 2026-02-06 17:31