Fork me on GitHub
a Sensio Labs Product

I ate three cookies πŸͺ (v3.40.2) edition

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