Skip to content

Commit

Permalink
Fixed Pattern::escape() not returning a string
Browse files Browse the repository at this point in the history
  • Loading branch information
PHLAK committed May 19, 2021
1 parent 7724611 commit eb87ed6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Pattern.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,13 @@ public static function directorySeparator(string $separator): void
}

/** Escape glob pattern characters from a string. */
public static function escape(string $string): self
public static function escape(string $string): string
{
return new self(str_replace([
return str_replace([
'\\', '?', '*', '(', ')', '[', ']', '^', '{', '}', ',',
], [
'\\\\', '\\?', '\\*', '\\(', '\\)', '\\[', '\\]', '\\^', '\\{', '\\}', '\\,',
], $string));
], $string);
}

/** Convert the pattern a regular expression. */
Expand Down

0 comments on commit eb87ed6

Please sign in to comment.