New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Laravel 6.6 - Unidentified symbol 'Route' in routes/web.php #780
Comments
You don't need to downgrade you can: Either disable undefined symbol diagnostics in the settings -- Or use an ide helper that adds stubs for laravel facades. See https://github.com/barryvdh/laravel-ide-helper . Also see https://laracasts.com/series/how-to-be-awesome-in-phpstorm/episodes/15 , it discusses phpstorm but is somewhat applicable. Please open a separate issue for the type error with some example code. |
@bmewburn Generating the Now, due to generating the _ide_helpers.php file, the auto-completion issues are back again. Results are now shown 2 times, for example the Session and Storage facades: Because those classes are also in the So I think duplicate entries need to be filtered out by the extension, or the extension should work, like before, with only the php storm meta file. |
@johanvanhelden I didnt think the laravel-ide-helper .phpstorm.meta.php had definitions. Are you sure there is not a second _ide_helper.php in the project? Also see if reindexing helps |
@bmewburn Disabling undefined symbol diagnostics doesn't solve the issue. My goal is not to hide the red squiggly lines, but to have class/function/attribute doc-lookup and click-navigation. I'd rather roll back to a previous version of intelephense where this worked. |
@bmewburn Yes, there is only 1 If I remove the If I re-generate the helper file and re-index the project the route file is fixed, but there are duplicate auto-complete entries. |
@bmewburn I really think it's something to do with the internals of the extension. Since if I alt-click the class, it does show the original definition (the one in The ide_helper does not help to point to So why, if I remove the ide_helper file, does it all of a sudden not know it should resolve to |
I have similar problems after the update and agree with @johanvanhelden - ide_helper.php does show duplicate entries. Another problem I am encountering is that when I use So any method which is not declared within the file is giving undefined symbol warning/error. This wasn't the case till the latest update. So am thinking to revert back to the previous release till this gets sorted out.
If I disable the undefinedSymbols - will I not miss out the actual warnings/errors also? |
I have a similar problem but with complex Symfony application and some USE statements. 1.3.1 didn't solved a problem. |
@johanvanhelden I think you are getting multiple go to definitions there because you have
And This does not explain why the duplicate globally namespaced facades are shown twice though. There must be another file where they are being defined. Are you able to do a text search for |
@bmewburn is this helpful?
Btw, both the global facades are duplicated, but also the non-global ones like Can this behavior not be rolled back to the 1.2 way? Since 1.2 was able to detect the Route facade just fine without the ide_helper file. I still don't fully understand why or how this changed. Could you explain that a bit more to help me understand? |
I have 1.3.1 version and I still have this problem. |
Yes, the problem persists in 1.3.1 - either with duplicate auto-completion entries with the ide-helpers file, or the unidentified symbol without it. |
I don't think that ide-helpers file is required. For me it works without the ide-helpers file except for:
The above two cases gives me Undefined symbol error - I have provided example file in #829 |
@johanvanhelden I managed to repro your issue with the following and with <?php
use Illuminate\Support\Facades\Route;
Rout| The duplicate @thinkstudeo I'll look into your issue in the other ticket. I'd recommend that anyone else seeing undefined laravel types to use https://github.com/barryvdh/laravel-ide-helper . The diagnostic will no longer appear and you will get completion suggestion too. If for some reason you don't want to or cant then there is #824 to disable undefined diagnostics for specific symbol kinds. I'm closing this one given that the OP is no longer experiencing an issue. |
just need to change |
In my case, for some reason, vendor folder was disabled on VS Code settings:
|
Today I opened VS Code to start working on my Laravel 6 project and suddenly I get an error in my routes/web.php file saying: "Undefined symbol 'Route'.
Also getting the following error in my FormsController.php (fresh controller, no error using Intelephense 1.2.3):
Expected type 'Illuminate\Http\Request'. Found 'Illuminate\Http\Request|string|array'.
I googled around and found this Stackoverflow post describing the problem and a fix.
FIX: downgrade to 1.2.3
It seems that Intelephense 1.3.0 introduced this problem. The error is quite annoying.
I am on Windows 10 using Intelephense 1.3.0
The text was updated successfully, but these errors were encountered: