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

 <?php
 
 $arr = [
 ];
 $checkDate = new DateTimeImmutable("2025-03-20 00:00:00");
 $foundDate = array_shift($arr);
-while ($foundDate < $checkDate && ($foundDate = array_shift($arr)) !== null);
 
-var_dump($foundDate);
+var_dump($foundDate);
PHP snippet to change

Applied Rules:

Not a change you expect?

Config  rector.php
Rector version: e61473 - released at 2025-09-10 00:40