Bug Report
The SimplifyRegexPatternRector produces broken regular expressions where the escape character is missing.
| Subject |
Details |
| Rector version |
last dev-main |
| Installed as |
composer dependency |
Minimal PHP Code Causing Issue
See https://getrector.com/demo/e0420e6c-273f-42d1-a8e5-3a9020bda3cb
<?php
final class DemoFile
{
public function run(string $param)
{
return preg_match('/^[0-9]+$/', $param);
}
}
Responsible rules
SimplifyRegexPatternRector
Expected Behavior
The escape character should be added: '/^\d+$/' instead of '/^d+$/'.
Bug Report
The
SimplifyRegexPatternRectorproduces broken regular expressions where the escape character is missing.Minimal PHP Code Causing Issue
See https://getrector.com/demo/e0420e6c-273f-42d1-a8e5-3a9020bda3cb
Responsible rules
SimplifyRegexPatternRectorExpected Behavior
The escape character should be added:
'/^\d+$/'instead of'/^d+$/'.