PHP array declaration indentation
Is it possible to configure PHPStorm to format array declarations using standard indents as opposed to continuation indents? I am a Moodle developer and need to do this in order to adhere to Moodle's coding style guidelines on line wrapping at https://docs.moodle.org/dev/Coding_style#Wrapping_lines.
Currently I have PHPStorm configured with a standard indent of 4 spaces and a continuation indent of 8 spaces, but this causes array declarations to indent by 8 spaces, like a wrapped line, but I need them to indent by 4 spaces. NetBeans has an additional setting specifically for array declarations (screen shot below) and I was wondering if the same thing existed somewhere in PHPStorm.

Thanks,
Tony
Please sign in to leave a comment.
I wasn't able to find a quick way to workaround this and we do not have such setting.
You can request to add this setting at https://youtrack.jetbrains.com/issue/WI-33643
@Dmitry I think that is something different (special case for a single line array declaration). Seems like either a separate setting for "Array Declaration Indentation" (as per screenshot) or a checkbox like "Use continuation indent for array declarations" (on by default for backwards compat) would do the job.
I'm also struggling with this.
I'm getting this formation code with
tab size: 4
ident: 4
continuation indent: 4
I'm expecting to have:
I can't find a way to set this up.
There's no predefined setting for that. You can manually press tab to add an additional indent. Reformat should keep that style
Dmitry, I think you're mixing up his actual vs expected results. He, like most of us I think, does NOT want the extra indentation.
Also, I think I just found out the cause of the problem. Does your file have mixed PHP/HTML content, or did you rename it from .html to .php? Check your HTML continuation indent under Editor -> Code Style -> HTML -> Tabs and Indents. Unlike with PHP, it defaults to 8 instead of 4. I changed mine to 4 and now my array declarations look right.
Thanks @Josh C what I'm expecting is to not have that extra indentation.
Why is this so hard? Others IDE let you setup this thing more easier.
@all: please submit this as a feature request at http://youtrack.jetbrains.com/issues/WI#newissue=yes describing the feature in details. Forum threads are rarely read by developers
They have many of this already.
https://youtrack.jetbrains.com/issue/WI-34320
https://youtrack.jetbrains.com/issues?q=array%20indentation
But just in case they're missing this case I opened a new issue as a bug.
https://youtrack.jetbrains.com/issue/WI-38385
Thanks @Luigi Guevara