Fork me on GitHub
a Sensio Labs Product

7th Gear (v3.59.3) edition

Rule list_syntax

List (array destructuring) assignment should be declared using the configured syntax. Requires PHP >= 7.1.



Whether to use the long or short syntax for array destructuring.

Allowed values: 'long' and 'short'

Default value: 'short'


Example #1

Default configuration.

--- Original
+++ New
-list($sample) = $array;
+[$sample] = $array;

Example #2

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

--- Original
+++ New
-[$sample] = $array;
+list($sample) = $array;

Rule sets

The rule is part of the following rule sets:


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