Skip to content

Commit 2174475

Browse files
committed
Avoid notice if array key is NULL
1 parent 96a6a2e commit 2174475

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/Map.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1928,8 +1928,8 @@ public function get( $key, $default = null )
19281928
{
19291929
$list = $this->list();
19301930

1931-
if( array_key_exists( $key, $list ) ) {
1932-
return $list[$key];
1931+
if( array_key_exists( $key ?? '', $list ) ) {
1932+
return $list[$key ?? ''];
19331933
}
19341934

19351935
if( ( $v = $this->val( $list, explode( $this->sep, (string) $key ) ) ) !== null ) {
@@ -3911,8 +3911,8 @@ public function prepend( $value, $key = null ) : self
39113911
*/
39123912
public function pull( $key, $default = null )
39133913
{
3914-
$value = $this->get( $key, $default );
3915-
unset( $this->list()[$key] );
3914+
$value = $this->get( $key ?? '', $default );
3915+
unset( $this->list()[$key ?? ''] );
39163916

39173917
return $value;
39183918
}

0 commit comments

Comments
 (0)