When marking sources, PhpStorm automatically returns to previous settings on restart


I am trying to set some obscure namespaces in folders in a big project, but for some reason PhpStorm keeps returning to the default settings on restart. What might be causing this and how do I put a stop to it?

The project has a main folder, which is marked as "Content root", then it has the dot marked as being a Source Folder. It also has some vendors which are excluded. The directories I want to mark as being sources with a specific namespace prefix live inside some subfolders in a "custom" folder.

When I go to "Directories" and mark some of them as Source and then give them a specific prefix, it all seems to work. I can generate new classes and they get the right namespace. But then when I exit PhpStorm and restart it, the settings are removed again and I'm left only with the original settings again.

Things I have checked/tried:

- They seem to get saved to the settings properly; I can see the results in the .iml file in the project folder. They remain there until I reload PhpStorm, then the file gets updated and my changes are gone.

- I am not using a Settings Repository or Startup tasks

I am running PhpStorm 2017.3 on Ubuntu 17.10


Hi there,

That looks like IDE is synchronising these settings with your composer.json. This happens on project opening or when that file change is detected.

"Settings/Preferences | Languages & Frameworks | PHP | Composer" -- uncheck appropriate option there ("Synchronize IDE Settings with composer.json").


Alternatively -- just bump your PHP version in composer.json if you will be using that PHP version as minimal required version for sure.


P.S. 2017.3 should have been showing you the popup box offering to sync such settings (did for me). Later versions (2017.3.2 or so) may do this automatically and offer to revert the changes (not sure if implemented already or still in the works -- have not created any new projects recently).


P.P.S. Actual ticket to watch after: https://youtrack.jetbrains.com/issue/WI-39199


Thank you Andrly, that fixed it.



Thanks Andrly, works for me!


Thanks, works for me!


Oh, thanks… I was going to throw PhpStorm through the window because of this 🤣


Thank you for answering this Andriy Bazanov. I was ready to throw PhpStorm through the window as well.


Thank you Andriy, I didn't realize PHPStorm was syncing to composer.json (although it did ring a bell after reading your solution).  But... in doing this all my dependencies... well none broke.  Wow, I was expecting to go down another rabbit hole but luckily everything worked.  Thanks again!


Thanks, it worked!


Please sign in to leave a comment.