Skip to content

Latest commit

 

History

History
64 lines (44 loc) · 1.26 KB

list_syntax.rst

File metadata and controls

64 lines (44 loc) · 1.26 KB

Rule list_syntax

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

Configuration

syntax

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

Allowed values: 'long' and 'short'

Default value: 'short'

Examples

Example #1

Default configuration.

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

Example #2

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

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

Rule sets

The rule is part of the following rule sets:

Source class

PhpCsFixer\Fixer\ListNotation\ListSyntaxFixer