amir9480 / vscode-laravel-extra-intellisense

This extension adds extra autocompletion for laravel projects to VSCode.
https://marketplace.visualstudio.com/items?itemName=amiralizadeh9480.laravel-extra-intellisense
MIT License
3.44k stars 55 forks source link

Fatal error every minute when extension is enabled, Laravel 5.4, undefined Gate::policies() #66

Closed wallheater closed 1 year ago

wallheater commented 2 years ago

I have been getting the errors below spamming my laravel.log, once per minute, in a Docker local dev setup with PHP 5.6 and Laravel 5.4. Today I tried searching for tips again, and found this Stack Overflow answer saying this extension is the cause. So I disabled the extension and presto, the errors stopped! Seems like an issue?

022-01-10 17:26:14] local.ERROR: Symfony\Component\Debug\Exception\FatalErrorException: Uncaught Error: Call to undefined method Illuminate\Auth\Access\Gate::policies() in /home/alex/myproject/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php:221 Stack trace:

0 Command line code(1): Illuminate\Support\Facades\Facade::__callStatic()

1 {main}

thrown in /home/alex/myproject/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php:221 Stack trace:

0 {main}

[2022-01-10 17:27:14] local.ERROR: Symfony\Component\Debug\Exception\FatalErrorException: Uncaught Error: Call to undefined method Illuminate\Auth\Access\Gate::policies() in /home/alex/myproject/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php:221 Stack trace:

0 Command line code(1): Illuminate\Support\Facades\Facade::__callStatic()

1 {main}

thrown in /home/alex/myproject/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php:221 Stack trace:

0 {main}

Thanks for your work on this extension!

saidbakr commented 2 years ago

Yes I have that issue too with Laravel 5.4 and PHP 7.4.28 by ondrej PPA repo on Kubuntu 20.04

amir9480 commented 2 years ago

@saidbakr @wallheater Laravel extra intellisense running background php codes to get information from your application and use them to provide auto-complete. I don't have any plans to add support for older versions of Laravel but PRs are welcome.

damsfx commented 1 year ago

@saidbakr @wallheater Laravel extra intellisense running background php codes to get information from your application and use them to provide auto-complete. I don't have any plans to add support for older versions of Laravel but PRs are welcome.

One solution will be to add an extra configuration option LaravelExtraIntellisense.disableAuth just like for blade : https://github.com/amir9480/vscode-laravel-extra-intellisense/blob/13d5eccf9e8cc5eedfef500a480046d68f400fa2/src/BladeProvider.ts#L18-L20

This can be usefull for project running Laravel in background but doesn't use Laravel's authentication methods (Illuminate\Contracts\Auth\Access\Gate).

damsfx commented 1 year ago

Work's like a charm ... Very usefull when using Laravel Extra Intellisense extension in Laravel based CMS like WinterCMS that use their own authentification methods.
Thank's a lot @amir9480 .