Skip to content

Commit 946d412

Browse files
committed
Minor improvements
1 parent 96974c1 commit 946d412

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/Map.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3631,6 +3631,8 @@ public function pos( $value ) : ?int
36313631

36323632
++$pos;
36333633
}
3634+
3635+
return null;
36343636
}
36353637

36363638
if( ( $key = array_search( $value, $list, true ) ) !== false
@@ -4265,7 +4267,7 @@ public function shuffled( bool $assoc = false ) : self
42654267
*/
42664268
public function skip( $offset ) : self
42674269
{
4268-
if( is_scalar( $offset ) ) {
4270+
if( is_numeric( $offset ) ) {
42694271
return new static( array_slice( $this->list(), (int) $offset, null, true ) );
42704272
}
42714273

@@ -5168,7 +5170,7 @@ public function take( int $size, $offset = 0 ) : self
51685170
{
51695171
$list = $this->list();
51705172

5171-
if( is_scalar( $offset ) ) {
5173+
if( is_numeric( $offset ) ) {
51725174
return new static( array_slice( $list, (int) $offset, $size, true ) );
51735175
}
51745176

tests/MapTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2929,7 +2929,7 @@ public function testSkip()
29292929
}
29302930

29312931

2932-
public function testSkipFunction()
2932+
public function testSkipClosure()
29332933
{
29342934
$fcn = function( $item, $key ) {
29352935
return $item < 4;
@@ -3383,7 +3383,7 @@ public function testTakeNegativeOffset()
33833383
}
33843384

33853385

3386-
public function testTakeFunction()
3386+
public function testTakeClosure()
33873387
{
33883388
$fcn = function( $item, $key ) {
33893389
return $item < 2;

0 commit comments

Comments
 (0)