1

I am working on a Symfony project in PhpStorm and I created a PHP class, but this file isn't recognized by PhpStorm as a class, so I have no autocomplete and barely any syntax highlights for this class.

Here is how it looks (Notice the little file icon to the left of AdminGroupsContextBuilder.php, it should be a c like Kernel.php has):

enter image description here

I am not sure why this happens, and I tried this solution, but I don't have any unwanted patterns in the File Types.

I also tried deleting the file and recreating it, File > Invalidate Cache / Restart and deleting the .idea folder in the project dir but nothing will work.

Has anyone had a similar problem?

LazyOne
  • 158,824
  • 45
  • 388
  • 391
tobias ingold
  • 129
  • 1
  • 9
  • Don't you have a space after extension? Like `.php `? – freeek Oct 17 '19 at 12:18
  • Are there any annotations/comments in `Kernel.php` or `User.php` that would tell PHPstorm that those are classes? Does it work with other PHP classes you created? – brombeer Oct 17 '19 at 12:24
  • 3
    See https://stackoverflow.com/a/33068863/783119 -- that's the typical reason. – LazyOne Oct 17 '19 at 12:50
  • Please check all file types, it it's not under `Text` entry, then it must be some another type... P.S. Try disabling `php` in `Settings (Preferences on macOS) | Editor | TextMate Bundles` -- looks like file is handled by Textmate bundle... – LazyOne Oct 17 '19 at 13:09
  • @LazyOne I tried that but didn't find anything strange there. I ended up deleting the `.PhpStorm2019.2` folder in my home directory (I'm using linux), basically this gets rid of all config, plugins, etc for phpstorm, so be careful if anyone has the same problem. Backup before deleting anything! – tobias ingold Oct 18 '19 at 14:37
  • @tobiasingold Did you do the backup? Majority of the stuff could have been easily left as is (e.g. keymap, code style, templates etc). P.S. If that helped, then I would suggest to just run "find in files" with another editor (e.g. Notepad++ if you are on Windows) and look for matches that are similar to that file name. My best guess this far .. is that you have somehow marked that file as Plain Text (not via File Types, but manually via right click menu). Such file should have special file icon, but maybe something has changed in newer version .. as I saw only ordinary "Text file" icon. – LazyOne Oct 18 '19 at 14:59

0 Answers0