Fork me on GitHub
a Sensio Labs Product

Space Sets (v3.64.0) edition

Rule array_syntax

PHP arrays should be declared using the configured syntax.

Configuration

syntax

Whether to use the long or short array syntax.

Allowed values: 'long' and 'short'

Default value: 'short'

Examples

Example #1

Default configuration.

--- Original
+++ New
 <?php
-array(1,2);
+[1,2];

Example #2

With configuration: ['syntax' => 'long'].

--- Original
+++ New
 <?php
-[1,2];
+array(1,2);

Rule sets

The rule is part of the following rule sets:

References

The test class defines officially supported behaviour. Each test case is a part of our backward compatibility promise.