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
51
51
public static function stringToArray (string $ string ): array
52
52
{
53
53
list ($ from , $ to ) = explode (self ::SEPARATOR , $ string );
54
- $ from = empty ( $ from)
54
+ $ from = '' === $ from
55
55
? self ::MINUS_INFINITE
56
56
: (is_numeric ($ from )
57
57
? (int ) $ from
58
58
: $ from );
59
59
60
- $ to = empty ( $ to)
60
+ $ to = '' === $ to
61
61
? self ::INFINITE
62
62
: (is_numeric ($ to )
63
63
? (int ) $ to
Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ class RangeTest extends TestCase
33
33
*/
34
34
public function testStringToArray (string $ string , array $ result )
35
35
{
36
- $ this ->assertEquals (
36
+ $ this ->assertSame (
37
37
$ result ,
38
38
Range::stringToArray ($ string )
39
39
);
@@ -53,6 +53,8 @@ public function dataStringToArray(): array
53
53
['0..100 ' , [0 , 100 ]],
54
54
['-100..0 ' , [-100 , 0 ]],
55
55
['.. ' , [Range::MINUS_INFINITE , Range::INFINITE ]],
56
+ ['0.. ' , [0 , Range::INFINITE ]],
57
+ ['..0 ' , [Range::MINUS_INFINITE , 0 ]],
56
58
];
57
59
}
58
60
@@ -66,7 +68,7 @@ public function dataStringToArray(): array
66
68
*/
67
69
public function testArrayToString (array $ array , string $ result )
68
70
{
69
- $ this ->assertEquals (
71
+ $ this ->assertSame (
70
72
$ result ,
71
73
Range::arrayToString ($ array )
72
74
);
@@ -94,7 +96,7 @@ public function dataArrayToString(): array
94
96
*/
95
97
public function testCreateRanges ()
96
98
{
97
- $ this ->assertEquals (
99
+ $ this ->assertSame (
98
100
[
99
101
'1..3 ' ,
100
102
'3..5 ' ,
@@ -103,7 +105,7 @@ public function testCreateRanges()
103
105
Range::createRanges (1 , 7 , 2 )
104
106
);
105
107
106
- $ this ->assertEquals (
108
+ $ this ->assertSame (
107
109
[
108
110
'0..2 ' ,
109
111
'2..4 ' ,
You can’t perform that action at this time.
0 commit comments