Skip to content

Commit 2cdafe7

Browse files
committed
Fix: Allow creating a Duration from 0 milliseconds
1 parent b128883 commit 2cdafe7

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/Duration.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public static function fromSecondsAndNanoseconds(
6565
*/
6666
public static function fromMilliseconds(int $milliseconds): self
6767
{
68-
if (0 >= $milliseconds) {
68+
if (0 > $milliseconds) {
6969
throw Exception\InvalidMilliseconds::notGreaterThanZero($milliseconds);
7070
}
7171

test/Unit/DurationTest.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,6 @@ public function testFromSecondsAndNanosecondsReturnsDuration(): void
9494

9595
/**
9696
* @dataProvider \Ergebnis\DataProvider\IntProvider::lessThanZero
97-
* @dataProvider \Ergebnis\DataProvider\IntProvider::zero
9897
*/
9998
public function testFromMillisecondsRejectsInvalidValue(int $milliseconds): void
10099
{
@@ -123,6 +122,11 @@ public function testFromMillisecondsReturnsDuration(
123122
public static function provideMillisecondsSecondsAndNanoseconds(): iterable
124123
{
125124
$values = [
125+
'zero' => [
126+
0,
127+
0,
128+
0,
129+
],
126130
'one' => [
127131
1,
128132
0,

0 commit comments

Comments
 (0)