diff --git a/rules-tests/CodeQuality/Rector/FuncCall/SimplifyRegexPatternRector/Fixture/slash_delimiter.php.inc b/rules-tests/CodeQuality/Rector/FuncCall/SimplifyRegexPatternRector/Fixture/slash_delimiter.php.inc new file mode 100644 index 00000000000..36bac9c3f75 --- /dev/null +++ b/rules-tests/CodeQuality/Rector/FuncCall/SimplifyRegexPatternRector/Fixture/slash_delimiter.php.inc @@ -0,0 +1,27 @@ + +----- + diff --git a/rules/CodeQuality/Rector/FuncCall/SimplifyRegexPatternRector.php b/rules/CodeQuality/Rector/FuncCall/SimplifyRegexPatternRector.php index 6c2d49ea604..4e599aa2fd6 100644 --- a/rules/CodeQuality/Rector/FuncCall/SimplifyRegexPatternRector.php +++ b/rules/CodeQuality/Rector/FuncCall/SimplifyRegexPatternRector.php @@ -21,12 +21,12 @@ final class SimplifyRegexPatternRector extends AbstractRector * @var array */ private const COMPLEX_PATTERN_TO_SIMPLE = [ - '[0-9]' => '\d', - '[a-zA-Z0-9_]' => '\w', - '[A-Za-z0-9_]' => '\w', - '[0-9a-zA-Z_]' => '\w', - '[0-9A-Za-z_]' => '\w', - '[\r\n\t\f\v ]' => '\s', + '[0-9]' => '\\d', + '[a-zA-Z0-9_]' => '\\w', + '[A-Za-z0-9_]' => '\\w', + '[0-9a-zA-Z_]' => '\\w', + '[0-9A-Za-z_]' => '\\w', + '[\r\n\t\f\v ]' => '\\s', ]; public function __construct(