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

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.



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


@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


$fields = $fields + [
t---t---'autoship_status' => 1,


I'm expecting to have:


$fields = $fields + [
t---'field_status' => $current_status,


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 describing the feature in details. Forum threads are rarely read by developers



Please sign in to leave a comment.