Skip to content

Commit

Permalink
Apply str_contains to replace the strpos usage
Browse files Browse the repository at this point in the history
  • Loading branch information
peter279k committed Oct 3, 2023
1 parent 999fb1c commit dca5713
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 dca5713

Please sign in to comment.