Search code examples
phparrayssyntaxphpstorm

How to enforce long syntax for array declaration in phpstorm?


I am quite used to using the short array syntax [] instead of the longer one array(). Now, I am forced by the server environment into using the longer one.

PhpStorm allows to enforce the shorter syntax for arrays in Code Style > Php > Array declaration style > Force short declaration style:

PhpStorm Code Style Array Declartion Style Force Short Style

Now, I want to achieve the reverse.

Having it automatically replaced would be preferred, but it would already help to mark the short declaration style as an error.


Solution

  • From Project settings > PHP choose the PHP Language Level to 5.3 and it will mark the short array syntax as error.