Skip to content

Commit

Permalink
ENH PHP 8.1 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
emteknetnz committed Apr 13, 2022
1 parent 9a38e44 commit e7284d8
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/Filter/SlugFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ public function filter($value)
}

foreach ($replacements as $regex => $replace) {
$value = preg_replace($regex, $replace, $value);
$value = preg_replace($regex ?? '', $replace ?? '', $value ?? '');
}

if ($this->getAllowMultibyte()) {
$value = rawurlencode($value);
$value = rawurlencode($value ?? '');
}

return $value;
Expand Down
2 changes: 1 addition & 1 deletion tests/SegmentFieldTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function testSuggest()
));

$encoded = $field->suggest($this->getNewRequestMock());
$decoded = json_decode($encoded);
$decoded = json_decode($encoded ?? '');

$this->assertEquals('ARRAY-SUGGESTION', $decoded->suggestion);
$this->assertEquals('array-preview', $decoded->preview);
Expand Down
4 changes: 2 additions & 2 deletions tests/SegmentFieldTestModifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class SegmentFieldTestModifier extends AbstractSegmentFieldModifier
*/
public function getSuggestion($value)
{
return strtoupper($value);
return strtoupper($value ?? '');
}

/**
Expand All @@ -27,6 +27,6 @@ public function getSuggestion($value)
*/
public function getPreview($value)
{
return strtolower($value);
return strtolower($value ?? '');
}
}

0 comments on commit e7284d8

Please sign in to comment.