multiple definitions exist for class

You should just ignore the complete cache folder.

  • Go to Settings > Directories
  • Choose var\cache
  • Set it to 'Excluded'

From: https://github.com/Haehnchen/idea-php-symfony2-plugin/issues/301


Is there any way to tell PhpStorm which class definition is correct?

You cannot, unfortunately.

https://youtrack.jetbrains.com/issue/WI-17646 -- watch this ticket (star/vote/comment) to get notified on any progress.

ATM you either just ignore the under-waving .. or you can configure that inspection to not to report such cases (Settings/Preferences | Editor | Inspections | PHP | Undefined | Undefined class, it has Don't report multiple class declaration potential problems checkbox).

Even with that inspection configured, IDE will still ask you what class declaration to jump to (and this is correct behaviour as IDE does not know if you want to see the original implementation or implement your own).


The only other way is to ensure that there is only one class with the same name in the project. For that you may use:

  • Mark whole folder as excluded
  • Mark individual file as Plain Text

Both are available via content menu in Project View and applicable to project files only (e.g. will be unavailable or will do nothing useful if tried to apply in Library scope).


I've found a possible solution to my problem - I can mark file as plain

Tags:

Phpstorm