imanghafoori1 / laravel-microscope

Fearless refactoring, it does a lot of smart checks to find certain errors.
MIT License
1.48k stars 96 forks source link

Conflict with Laravel Fortify #254

Closed ALTELMA closed 1 year ago

ALTELMA commented 1 year ago

Your package is fantastic and I used to find many things not suitable for a long time. Since Today I've found an issue when running the command. It scans the vendor folder and sees the incorrect code from Fortify package

1 errors found for views
   1 Incorrect namespace.
   ['namespace' => 'Laravel\Fortify\Http\Controllers'] passed to Route::group(...) is not correct.
Route::group([
    'namespace' => 'Laravel\Fortify\Http\Controllers',
    'domain' => config('fortify.domain', null),
    'prefix' => config('fortify.prefix'),
], function () {
    $this->loadRoutesFrom(__DIR__.'/../routes/routes.php');
});

I have no choice but to fix it. Need to PR to their repo. So I try to ignore it but can't find the correct to do that. Could you please suggest how to ignore folders or files that prevent scanning?

    /**
     * An array of root namespaces to be ignored while scanning for errors.
     */
    'ignored_namespaces' => [
        // 'Laravel\\Nova\\',
        // 'Laravel\\Nova\\Tests\\'
        'Laravel\\Fortify\\',
    ],

Update As I spend more time looking at your package. I've found the problem from SpyRouter

https://github.com/imanghafoori1/laravel-microscope/blob/v1.0.288/src/SpyClasses/SpyRouter.php
$dir = ComposerJson::make()->getRelativePathFromNamespace($namespace);

From Above $dir always returns an empty string. Now I pin version to 1.0.287 instead of 1.0.288 to avoid an issue.

imanghafoori1 commented 1 year ago

Thanks for the report. I think this issue should have been fixed in the v1.0.289 patch.

ALTELMA commented 1 year ago

Thanks for your quick response. Now it was fixed