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

 {
     public function run()
     {
-        if ( $user_id === 0 ) {
-            // some important comment
-            $access = true;
-        } else {
-            // some another important comment
-            $access = false;
-        }
+        $access = $user_id === 0 ? true : false;
     }
 }
PHP snippet to change

Applied Rules:

Not a change you expect?

Config  rector.php
Rector version: 5dfb29 - released at 2026-06-16 21:20