Unable to exclude directory in ignored sub-directory

Answered

Greetings!

I'm getting a class name conflict with a vendor package and I want to exclude the specific directory within the package that contains the conflicting classes. The vendor directory is ignored by the VCS, and shows us as gray. For some reason, though, some of the packages show up as brown, and I have no idea why. The brown directories don't have the option to mark the directory (in order to exclude).

Am I missing something? Why are those directories brown? If it's due to being ignored by the VCS, shouldn't the whole vendor directory be that way?

Here's the directory structure: https://cl.ly/05c168989e06

Thank you!

6 comments
Comment actions Permalink

>So the mystery remains as to what is special about the "vendor/composer" and "vendor/laravel/*" packages.

Nothing special. The same would be with other packages. Expand "monolog" or "nikic" and you will see brown stuff again.

 

>I know they're being indexed as I'm getting "multiple definitions exist" for classes within those packages.

So .. just ignore/disable that inspection. It's expected to see such warning if some lib re-declares a class/interface this way.

Or just use "Mark as Plain Text" as I have mentioned earlier.

2
Comment actions Permalink

Hi there,

1) VCS status does nothing here

2) Such folder is already excluded but then must be re-added as "PHP Included path" entry (standard behaviour) -- check that (Languages & Frameworks | PHP).

0
Comment actions Permalink

Hi Andriy!

Thanks for replying!

Ok, I'm looking at the include paths: https://cl.ly/6a95a11fdef0

It appears that every vendor package is included in there, which is fine. Specifically I see `vendor/composer` and the `vendor/laravel` packages in there, so why do those act differently than all the others in there? Those are highlighted as brown and I can't exclude specific sub-directories of the package.

0
Comment actions Permalink

"Brown" means excluded (BTW, it's light yellow bg colour in light GUI theme).

"composer" folder is top level, while other ones (e.g. laravel/tinker or /cashier) are sub-folders of specific vendor (I mean -- "laravel/tinker" is a package root folder and not just "laravel").

All good here. If you check "Settings | Directories" you will see them excluded (so they are not treated as your own code) .. and in "PHP | Include Paths" they are included back as Libraries so they participate in code completion and stuff.

Such automatic inclusion behaviour is controlled by "Settings/ Preferences | Languages & Frameworks | PHP | Composer | Add packages as libraries"

 

If you do not need specific library, remove it from "Include Paths". If you want to exclude specific file .. see if you can right click and "Mark as Plain Text" (plain text files are not getting parsed as PHP).

0
Comment actions Permalink

Ok, thank you, I'm certainly learning a lot here.

As far as I can tell every package is excluded in "Settings | Directories" and then added as a library in the Include Paths. So the mystery remains as to what is special about the "vendor/composer" and "vendor/laravel/*" packages. I know they're being indexed as I'm getting "multiple definitions exist" for classes within those packages. I don't want to exclude the entire package, just the specific places within the package that those classes are defined (most of them are stubs and shims).

Here is an example of a library class that's causing the "multiple definitions" warning: https://cl.ly/eed88d24f188

Does what I'm trying to do make sense?

0
Comment actions Permalink

Ah, you are completely right. I somehow missed your earlier idea to "Mark as Plain Text". Since Included Paths can't have excluded sub-directories, marking files as plain text is the best way to go.

Thank you for your help!

0

Please sign in to leave a comment.