Repository: spatie/opening-hours (php)

Issue:
nextOpen function: Xdebug has detected a possible infinite loop, and aborted your script with a stack depth of '256' frames
We use the latest spatie/opening-hours version (4.0.1) and the following code will create a possible infinity loop and is aborted with the error message 

> Xdebug has detected a possible infinite loop, and aborted your script with a stack depth of '256' frames

:

```
   public function test_infinity_loop()
   {
      $ohConfig = ["monday" => ["00:01-00:00"], "tuesday" => ["00:01-00:00"], "wednesday" => ["00:01-00:00"], "thursday" => ["00:01-00:00"], "friday" => ["00:01-00:00"], "saturday" => ["00:01-00:00"], "sunday" => ["00:01-00:00"]];
      $openingHoursObject = OpeningHours::create($ohConfig);
      $nextOpen = $openingHoursObject->nextOpen(new Carbon("2024-10-22 00:00:00"));
      $this->assertNotNull($nextOpen);
   }
```

And this error also persists if you increase the xdebug.max_nesting_level (e.g. 1024).

I know that the input data should probably be "00:00-23:59" instead of "00:01-00:00" but we get the opening hours from an external data provider and sometimes people create opening hours like this. So it would be great if it was handled by the lib. 

Pull request description:
Handle opening-time with the first minute of day only
Fix #255

Patch:
diff --git a/src/OpeningHours.php b/src/OpeningHours.php
index 948719f..aa5ba51 100644
--- a/src/OpeningHours.php
+++ b/src/OpeningHours.php
@@ -504,7 +504,7 @@ class OpeningHours
             $this->isOpenAt($this->copyAndModify($dateTime, '-1 second'))
         ) {
             return $this->getDateWithTimezone(
-                $this->nextOpen($dateTime->modify('+1 minute')),
+                $this->nextOpen($dateTime->modify('+1 second')),
                 $outputTimezone
             );
         }


Test patch:
diff --git a/tests/OpeningHoursTest.php b/tests/OpeningHoursTest.php
index 7b89e75..ac11acf 100644
--- a/tests/OpeningHoursTest.php
+++ b/tests/OpeningHoursTest.php
@@ -8,6 +8,7 @@ use DateTimeZone;
 use InvalidArgumentException;
 use PHPUnit\Framework\Attributes\DataProvider;
 use PHPUnit\Framework\Attributes\Test;
+use PHPUnit\Framework\Attributes\TestWith;
 use PHPUnit\Framework\TestCase;
 use Spatie\OpeningHours\Day;
 use Spatie\OpeningHours\Exceptions\InvalidDateRange;
@@ -1647,4 +1648,41 @@ class OpeningHoursTest extends TestCase
             ],
         ]);
     }
+
+    #[TestWith([true])]
+    #[TestWith([false])]
+    public function testFirstDayMinuteOpenEveryDay(bool $overflow)
+    {
+        $config = [
+            'monday' => ['00:01-00:00'],
+            'tuesday' => ['00:01-00:00'],
+            'wednesday' => ['00:01-00:00'],
+            'thursday' => ['00:01-00:00'],
+            'friday' => ['00:01-00:00'],
+            'saturday' => ['00:01-00:00'],
+            'sunday' => ['00:01-00:00'],
+            'overflow' => $overflow,
+        ];
+        $openingHoursObject = OpeningHours::create($config);
+
+        $nextOpen = $openingHoursObject->nextOpen(new DateTimeImmutable('2024-10-22 00:00:00'));
+
+        $this->assertSame('2024-10-22 00:01:00.000000', $nextOpen->format('Y-m-d H:i:s.u'));
+
+        $nextOpen = $openingHoursObject->nextOpen(new DateTimeImmutable('2024-10-22 00:00:30'));
+
+        $this->assertSame('2024-10-22 00:01:00.000000', $nextOpen->format('Y-m-d H:i:s.u'));
+
+        $nextOpen = $openingHoursObject->nextOpen(new DateTimeImmutable('2024-10-22 00:01:00'));
+
+        $this->assertSame('2024-10-23 00:01:00.000000', $nextOpen->format('Y-m-d H:i:s.u'));
+
+        $nextOpen = $openingHoursObject->nextOpen(new DateTimeImmutable('2024-10-22 00:01:00'));
+
+        $this->assertSame('2024-10-23 00:01:00.000000', $nextOpen->format('Y-m-d H:i:s.u'));
+
+        $nextOpen = $openingHoursObject->nextOpen(new DateTimeImmutable('2024-10-22 23:59:59.999999'));
+
+        $this->assertSame('2024-10-23 00:01:00.000000', $nextOpen->format('Y-m-d H:i:s.u'));
+    }
 }