Reputation: 21
I got undefined type on my project when addressing classes autoloaded with composer json.
this is the extract of my composer.json file
"autoload": {
"psr-4": {
"App\\": "app/",
"Shared\\": "../Shared/"
},
"classmap": [
"database/seeds",
"database/factories"
],
"files": [
"app/helpers.php"
]
},
The auto-complete doesn't recognize anything inside Shared.
In the LanguageServer Log i found that vs-code parsed all autoload files correctly.
This is a problem related only on vs-code and intellisense/intelephense; when I run the project all work like a charm.
Any help would be appreciated.
Upvotes: 2
Views: 1189
Reputation: 444
Just add this below json value in .vscode/settings.json file:
{
"intelephense.environment.includePaths": [
"../Shared/"
]
}
Not only the error disappears, but also the code completion starts to work!
Upvotes: 1