Ilija
Ilija

Reputation: 4413

PhpStorm indent multi-line array elements

How to configure PhpStorm's PHP coding style settings so this code:

<?php

$array = [
'element1' => 'value1',
'element2' => 'value2',
'element3' => 'value3',
];

Is reformatted like this:

<?php

$array = [
    'element1' => 'value1',
    'element2' => 'value2',
    'element3' => 'value3',
];

Problem is that even if I format arrays like I want, any call to reformat option will "destroy" that formatting and bring me back to unindented elements.

I am interested in short array declaration only.

Upvotes: 1

Views: 1623

Answers (1)

LazyOne
LazyOne

Reputation: 165088

Based on your current code style: please change Continuation indent from 0 to the desired value (I guess it will be 4, based on your code sample).

This can be done for all languages at once (General node) or just PHP.

Upvotes: 1

Related Questions