Closed ashrafkamarudin closed 3 years ago
Hi @ashrafkamarudin
First issue:
It's weird because Arr
class is an alias class in laravel.
https://github.com/laravel/laravel/blob/c66546e75fcbf208d2884b5ac7a3a858137753a3/config/app.php#L194
Second issue:
About AuthServiceProvider
, it's a commented line by default and should not be filled with non-existing
class.
https://github.com/laravel/laravel/blob/c66546e75fcbf208d2884b5ac7a3a858137753a3/app/Providers/AuthServiceProvider.php#L16
Third issue: It's weird, I used this method to get middleware names. You can see it's definition here:
Make sure you are using the latest version of laravel in your project.
I see. yes i've check the files it seems that these changes is applied to Laravel's 5.8 and above. So the one who used Laravel 5.7 and below will get these errors in their laravel log.
Do you plan on supporting old laravel ?
also btw, I think you should update your log handler seems to not be working as it logs to laravel's log file on this line https://github.com/amir9480/vscode-laravel-extra-intellisense/blob/740dd4f8a82d23d55ea003024f9aedfd0c2a0d8b/src/helpers.ts#L66
maybe you can try it with
$this->app['log']->getLogger()->pushHandler(new \\Monolog\\Handler\\NullHandler());
@ashrafkamarudin
No, I do not have any plans to support older versions of laravel. I highly recommend you to update your laravel application to the latest version.
Also about this handler please make a pull request to fix, So I can check and use your solution, thanks.
Alright, I'll do it.
@amir9480 You should consider using FQN instead of assuming people have their aliases registerered. Some people might upgrade their Laravel projects without updating configs cause it's never included in the upgrade guides unless it's a breaking change. Aliases will NEVER be a breaking change in configs. They're made for the convenience of the developer. They're optional, not required.
@mwkcoding Hi I don't understand what you mean.
Can you please send me a sample code to disable the Laravel log? The current code is: https://github.com/amir9480/vscode-laravel-extra-intellisense/blob/master/src/helpers.ts#L80
@amir9480 I mean for example with helper classes like Arr
https://github.com/amir9480/vscode-laravel-extra-intellisense/blob/master/src/AuthProvider.ts#L55
Instead of expecting there to be an alias for it in the project, use the FQN Illuminate\Support\Arr
. That would solve this error on Laravel ^6.0 which might not have the class registered as an alias in their config from upgrading from Laravel 5.
@mwkcoding Got it.
Contributions are welcome. Please fix this and make a pull request.
I found 3 issue within the plugin all error is logged in
laravel's log
The first issue is :
I dig down and found the caused. It was from file
/src/authprovider.ts
on line 55. The caused of it was the usage ofArr::flatten()
. This will cause error for users who don't haveIlluminate\support\Arr
registered as alias.Second Issue I found is:
After fixing the
Arr::flatten()
issue, I got a new error.I see that you added a new feature, autocompleting policies. But for people who don't use policies and actually have a default policy registered when you first installed laravel at
\app\AuthServiceProvider.php
will receive this error.AuthServiceProvider.php
for user who don't use policy and didn't have the file in that location, that error log will consistently came out. it's best if you have some kind of handler for this. I find the fix is pretty simple. Just comment the line and it works fine. But I think this should be handled within the plugin itself.
The third issue is :
I don't know much about this one since i didn't look into it. But it is an issue nonetheless.