This repository was archived by the owner on Jun 25, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -51,13 +51,13 @@ class Range
5151 public static function stringToArray (string $ string ): array
5252 {
5353 list ($ from , $ to ) = explode (self ::SEPARATOR , $ string );
54- $ from = empty ( $ from)
54+ $ from = '' === $ from
5555 ? self ::MINUS_INFINITE
5656 : (is_numeric ($ from )
5757 ? (int ) $ from
5858 : $ from );
5959
60- $ to = empty ( $ to)
60+ $ to = '' === $ to
6161 ? self ::INFINITE
6262 : (is_numeric ($ to )
6363 ? (int ) $ to
Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ class RangeTest extends TestCase
3333 */
3434 public function testStringToArray (string $ string , array $ result )
3535 {
36- $ this ->assertEquals (
36+ $ this ->assertSame (
3737 $ result ,
3838 Range::stringToArray ($ string )
3939 );
@@ -53,6 +53,8 @@ public function dataStringToArray(): array
5353 ['0..100 ' , [0 , 100 ]],
5454 ['-100..0 ' , [-100 , 0 ]],
5555 ['.. ' , [Range::MINUS_INFINITE , Range::INFINITE ]],
56+ ['0.. ' , [0 , Range::INFINITE ]],
57+ ['..0 ' , [Range::MINUS_INFINITE , 0 ]],
5658 ];
5759 }
5860
@@ -66,7 +68,7 @@ public function dataStringToArray(): array
6668 */
6769 public function testArrayToString (array $ array , string $ result )
6870 {
69- $ this ->assertEquals (
71+ $ this ->assertSame (
7072 $ result ,
7173 Range::arrayToString ($ array )
7274 );
@@ -94,7 +96,7 @@ public function dataArrayToString(): array
9496 */
9597 public function testCreateRanges ()
9698 {
97- $ this ->assertEquals (
99+ $ this ->assertSame (
98100 [
99101 '1..3 ' ,
100102 '3..5 ' ,
@@ -103,7 +105,7 @@ public function testCreateRanges()
103105 Range::createRanges (1 , 7 , 2 )
104106 );
105107
106- $ this ->assertEquals (
108+ $ this ->assertSame (
107109 [
108110 '0..2 ' ,
109111 '2..4 ' ,
You can’t perform that action at this time.
0 commit comments