PHP indents stuck on 4 spaces

I have all my indentation settings for PHP set to 2 spaces, and I have indentation auto-detection turned off, but PHP still always uses 4 spaces, and it shows in the bottom right. I have no .editorconfig either. I've searched everywhere and tried every solution, including fully reinstalling PHPStorm.

Only other thing I can think of is a broken settings file somewhere, but I want to confirm that there's no other solution before I fully wipe my settings.

0
7 comments

Hi,

Is it reproducible on new files/new project too?
Would it be possible to share your code style export? (Settings/Preferences | Editor | Code Style > Scheme > Export > XML) 

0

Hmm, yeah okay it's only happening in this project.

This is my Default code style export:

<code_scheme name="Default" version="173">
<option name="AUTODETECT_INDENTS" value="false" />
<codeStyleSettings language="JavaScript">
<indentOptions>
<option name="INDENT_SIZE" value="2" />
<option name="CONTINUATION_INDENT_SIZE" value="2" />
<option name="TAB_SIZE" value="2" />
</indentOptions>
</codeStyleSettings>
<codeStyleSettings language="PHP">
<indentOptions>
<option name="INDENT_SIZE" value="2" />
<option name="CONTINUATION_INDENT_SIZE" value="2" />
<option name="TAB_SIZE" value="2" />
</indentOptions>
</codeStyleSettings>
</code_scheme>

The Project one was empty.

0

Thank you for your reply.

Does it happen for all files in this specific project including newly created ones too?
Could you please share the affected project `.idea` folder? You may do that privately via our JetBrains Upload services (just let me know the upload id):
https://uploads.jetbrains.com

0

I'm having the same problem with just one project and it is triggered every time when I create a new file. If I close the IDE and open it again, it shows and uses the correct indent - 2 spaces and that's until the next new file.

0

Is there any chance that affected files have mixed HTML/PHP code? If this is the case, you might be experiencing the following issue:
https://youtrack.jetbrains.com/issue/WI-59720/HTML-indent-settings-are-used-in-PHP-HTML-mixed-code

1

In my case it's JavaScript - React JSX and it's 100% reproducible. Also, this was introduced in some of the last 2-3 updates of the IDE.

0

Do you have an `.editorconfig` file in this specific project? 

0

Please sign in to leave a comment.