Skip to content

Commit

Permalink
Merge pull request #1112 from peter279k/apply_str_contains
Browse files Browse the repository at this point in the history
Apply str_contains to replace the strpos usage
  • Loading branch information
veewee authored Oct 3, 2023
2 parents 999fb1c + dca5713 commit da1d97b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Util/Regex.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ private function toRegex(string $string): string
public function addPatternModifier(string $modifier): void
{
/** @psalm-suppress InvalidLiteralArgument */
if ('' === $modifier || false === strpos(self::ALLOWED_MODIFIERS, $modifier)) {
if ('' === $modifier || !str_contains(self::ALLOWED_MODIFIERS, $modifier)) {
throw new RuntimeException('Invalid regex modifier: '.$modifier);
}

Expand All @@ -68,7 +68,7 @@ public function addPatternModifier(string $modifier): void
$modifiers = $matches[0];

// Skip if the modifier is already available
if (false !== strpos($modifiers, $modifier)) {
if (str_contains($modifiers, $modifier)) {
return;
}

Expand Down

0 comments on commit da1d97b

Please sign in to comment.