I am working on a PHP Laravel project with a team that requires spaces within brackets like this:
$t = $one[ 0 ];
I attempted to accomplish this by set the following requirement in the Code Style Preference:
The highlights show that spaces should be added within brackets as needed. However, after saving and restarting, I do not get this style applied, no matter how many time I press Ctrl+Alt+L.
Worse still, PhpStorm strips out the spaces that already exist within brackets, which causes a huge headache when I try to auto format existing code.
So this:
Is reformatted and becomes this:
I've set up other custom code style setting, and the other custom setting are getting applied.
Could someone offer some help with fixing this style problem?
That option works just fine. It is for accessing individual array elements (e.g. $t = $one[ 0 ];
).
But on your screenshots, where it does not work... it's array initializer (in other words, $var = array('aaa', 'bbb');
)... and for that you need to use appropriate option -- "Array initializer parentheses" (which is just a bit below of what you have tried above).