Skip to content

Bug: Using withComposedBased doesn't work as expected #473

@MrYamous

Description

@MrYamous

I'm currently upgrading a project using Rector and I'm in trouble with composer based configurations.

My project is in Laravel 11, I want to upgrade to Laravel 12.
In my composer.json, Laravel 12 is required.

If I run rector with this config, no file is changed :

    ->withPaths([
        __DIR__ . '/app',
        __DIR__ . '/bootstrap',
        __DIR__ . '/config',
        __DIR__ . '/public',
        __DIR__ . '/resources',
        __DIR__ . '/routes',
        __DIR__ . '/tests',
    ])
    ->withSetProviders(LaravelSetProvider::class)
    ->withComposerBased(laravel: true);

Then I change my config to :

    ->withPaths([
        __DIR__ . '/app',
        __DIR__ . '/bootstrap',
        __DIR__ . '/config',
        __DIR__ . '/public',
        __DIR__ . '/resources',
        __DIR__ . '/routes',
        __DIR__ . '/tests',
    ])
    ->withSets([LaravelLevelSetList::UP_TO_LARAVEL_120]);

And 8 files are changed.

This behavior looks wrong to me, as I'm expecting withComposerBased can detect my Laravel version and apply rules from UP_TO_LARAVEL_120 set list

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