Skip to content

Rector makes Regexs in Controller Route Annotation to be invalid #3075

@UFTimmy

Description

@UFTimmy

Bug Report

Subject Details
Rector version Rector v0.7.6
Installed as composer dependency

Rector is converting regexes that make sure a route parameter match into an invalid format.

Minimal PHP Code Causing Issue

https://getrector.org/demo/542a1bea-7013-47fb-9581-b944e29640fe

It's converting [a-z] to {a-z}.

It doesn't seem to matter what sets you use. On my box I was using php74 and I did a dry run. It reported the following rectors made changes:

 * Rector\Core\Rector\Argument\ArgumentAdderRector
 * Rector\Core\Rector\ClassMethod\WrapReturnRector
 * Rector\Core\Rector\Argument\ArgumentDefaultValueReplacerRector
 * Rector\Core\Rector\Argument\ArgumentRemoverRector

So I added all of those to the skipped rectors, and it still made the change.

Also, it's converting the letter= to letter:. That doesn't seem to break anything, but why is it making that change?

Expected Behaviour

Do nothing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions