How to exclude composer compiled classes?
I am using the latest phpStorm version 2019.3 and for some reason the IDE is seeing the same class twice as shown below:
That directory is excluded in the project:
I have tried the option "Invalidates cache/restart" but it does not work meaning the error is back.
Any ideas in how to fix this? Is this a bug or a missed configuration somewhere?
请先登录再写评论。
Hi there,
Please also check "Languages & Frameworks | PHP --> Include Paths"
Andriy Bazanov I did check there and you are right, is in there:
I have deleted such line and the error is gone, however if I close and open the IDE again that line gets back, How I can force it not to come back there?
Settings (Preferences on macOS) | Languages & Frameworks | PHP | Composer | Add packages as libraries
But it might be inconvenient to not to use it (as code from packages will be treated as your own -- you may see their TODOs, may participate in refactoring etc.
P.S. See if you can exclude a deeper folder (1 level down) -- will it work or will it be the same?
Andriy Bazanov well the only way to make this to work was by unchecking that `Add packages as libraries`. I can deal with those `TODO` when refactoring something.
About exclude a deeper folder it didn't work, composer get's excluded by default but then is added as a library as shown above. Maybe would be great to have it excluded even if I have the add packaged as libraries checked :)
>Maybe would be great to have it excluded even if I have the add packaged as libraries checked :)
It will not make sense for other packages then...
Plus, some packages may rely on actual Composer code.
Your case is different (classes cached by Composer -- I'm personally not aware of how to make it and what it does; I guess it's dump autoload or something? .. but it does not look like that at first glance...). I suggest to create a Feature Request ticket on Issue Tracker (together with instructions on how to reproduce such situation) and devs will look into optimising this "exclude handling" behaviour.
Great I will raise a ticket soon :)