0

The coding standards at my current company requires 2 spaces per tab for PHP code (Drupal 6). I'm in the process of adding autoloading (PSR-4) so we can start using classes and OOP. The new namespace points to a classes/src directory that I wish to be PSR-2 compliant. Most developers here use PHPStorm. Is there a way to set PHPStorm to use 4 spaces for the classes/src directory (and any subdirectories) and 2 spaces for the rest of the project?

I'd like to avoid having the developers hit tab twice to get the effect of 4 spaces. I'd also like to avoid converting the rest of the codebase to 4 spaces as that will mess with our git history and have my name plastered everywhere.

I currently use Sublime Text 3 and this is all possible thanks to the Directory Settings package.

JudRoman
  • 743
  • 1
  • 6
  • 8

1 Answers1

2

No, there is no way to do this - current platform implementation does not allow storing code style settings per scope or per file/directory. Please follow IDEA-69685 for updates

lena
  • 90,154
  • 11
  • 145
  • 150
  • 1
    What about **EditorConfig plugin**? I'm not using it .. but as per description from http://editorconfig.org/ you should be able to make it work (as long as plugin supports it and IDE allows to make such setup, of course) – LazyOne Jun 25 '15 at 17:14
  • @LazyOne That seems to work. Thank you! You should make an answer so I can mark it as accepted. I had another developer test it with `[classes/**.php] indent_style = space indent_size = 4` in the .editorconfig file. – JudRoman Jun 29 '15 at 20:29