Skip to content

AddRouteAnnotationRector rule should be case-insensitive when matching controllers #9549

@yuuuusha

Description

@yuuuusha

Bug Report

Subject Details
Rector version 2.2.13

Hi,

I ran into an issue with the AddRouteAnnotationRector rule: my YAML config file defined a route whose controller name used a different case than the actual method name.

Because of that case mismatch, the rule didn't detect the controller. It turned out to be a typo that I caught by comparing the old routing (debug:router) with the newly refactored one.

I managed to make the rule catch it by applying a strtolower, but I'm wondering whether this is something you would consider a bug and could fix properly on your side.

Minimal PHP Code Causing Issue

class MyController
{
    public function myAction() // notice the A
    {
    }
}
# yaml routing file
do_stuff:
    path: /a_path
    controller: App\Controller\MyController::myaction # notice the typo

Expected Behaviour

The code is changed and the Route annotation is added to the myaction method.

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