Skip to content
This repository was archived by the owner on Jun 25, 2025. It is now read-only.

Commit fd4ecd1

Browse files
authored
Merge pull request #114 from apisearch-io/fix/fixed-range-when-0
Fixed comparision, as 0 !== null
2 parents a126f12 + 49bd371 commit fd4ecd1

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

Query/Range.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,10 @@ public static function stringToArray(string $string): array
7575
*/
7676
public static function arrayToString(array $values): string
7777
{
78-
if (self::MINUS_INFINITE == $values[0]) {
78+
if (self::MINUS_INFINITE === $values[0]) {
7979
$values[0] = '';
8080
}
81-
if (self::INFINITE == $values[1]) {
81+
if (self::INFINITE === $values[1]) {
8282
$values[1] = '';
8383
}
8484

Tests/Query/RangeTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ public function dataStringToArray(): array
5050
['2..5', [2, 5]],
5151
['..10', [Range::MINUS_INFINITE, 10]],
5252
['2..', [2, Range::INFINITE]],
53+
['0..100', [0, 100]],
54+
['-100..0', [-100, 0]],
5355
['..', [Range::MINUS_INFINITE, Range::INFINITE]],
5456
];
5557
}
@@ -82,6 +84,8 @@ public function dataArrayToString(): array
8284
[[Range::MINUS_INFINITE, 10], '..10'],
8385
[[2, Range::INFINITE], '2..'],
8486
[[Range::MINUS_INFINITE, Range::INFINITE], '..'],
87+
[[0, 100], '0..100'],
88+
[[-100, 0], '-100..0'],
8589
];
8690
}
8791

0 commit comments

Comments
 (0)