driftingly / rector-laravel

Rector upgrades rules for Laravel
http://getrector.org
MIT License
469 stars 48 forks source link

dispatchNow is not converted to dispatchSync #215

Closed jeff1326 closed 1 month ago

jeff1326 commented 2 months ago

When i run rector laravel with this configuration, the dispatchNow is not replaced by dispatchSync.

In rector.php

return RectorConfig::configure()
    ->withPaths([
        __DIR__ . '/app',
        __DIR__ . '/config',
        __DIR__ . '/database',
        __DIR__ . '/modules',
        __DIR__ . '/public',
        __DIR__ . '/resources',
        __DIR__ . '/tests',
    ])
    ->withSets([
        LevelSetList::UP_TO_PHP_83,
        LaravelLevelSetList::UP_TO_LARAVEL_100,
    ]);

(I tried with PHPUnitSetList::PHPUNIT_100 too)

In my code

// Arrange
$product = Product::factory()->create();
$user = auth()->user();

// Act
ExportProduct::dispatchNow($product->id, $user->email);

// Assert

The line with Product::factory() has been changed by rector in this file, so it's parsed