phpstormphpstorm-2017.2

PHPStorm - Force array() String Declaration With Code Style


In PHPStorm, you can force arrays to be declared as [] in the "Code Style" section of Settings.

enter image description here

Is there anyway to do the opposite and force arrays to be declared with array()? For example, I would like the following:

$myArray = ['one', 'two'];

to become

$myArray = array('one', 'two');

when I reformat a script using the editor.


Solution

  • There's an Intention for this: convert array

    Unfortunately there's no way to have it performed automatically on "reformat code".