-
-
Notifications
You must be signed in to change notification settings - Fork 736
Closed
Labels
Description
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+$/'.