Skip to content

StringToClassConstantRector (laravel52 set) incorrectly rewrites view('auth.login') — collides with Breeze/UI default view name #535

Description

@neurotools

rector-laravel version: ^2.5 (composer.json)
Set: LaravelLevelSetList::UP_TO_LARAVEL_120 (pulls in config/sets/laravel52.php)

The laravel52.php set configures StringToClassConstantRector with:
new StringToClassConstant('auth.login', 'Illuminate\Auth\Events\Login', 'class')

This is intended for legacy Event::listen('auth.login', ...) calls, but the underlying core rule matches any string literal equal to 'auth.login' regardless of call context. Since 'auth.login' is also the conventional Blade view name used by Laravel Breeze/UI's default AuthenticatedSessionController, running this set rewrites:

return view('auth.login');

into:

return view(\Illuminate\Auth\Events\Login::class);

...which breaks the login page (passes an Event class where a view name is expected).

Repro: any fresh Laravel Breeze app + LaravelLevelSetList::UP_TO_LARAVEL_120.

Suggestion: scope this StringToClassConstant mapping to Event::listen/dispatch call arguments only, or drop these legacy 5.0-5.4 string-event mappings from default level sets since they're far more likely to collide with modern Blade view names than to find an actual legacy Event::listen() call.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions