
Array Destruct feature in PHP 7.1
The PHP version you are using:
7.1
PHP CS Fixer version you are using:
2.0
The command you use to run the fixer:
vendor/bin/php-cs-fixer fix packages --rules=no_spaces_around_offset --diff --dry-run -v
A minimal sample of valid PHP code that is not fixed correctly (if applicable).
if (! $controllerName = $request->attributes->get('_controller')) {
return false;
}
[$class, $method] = $this->splitControllerClassAndMethod($controllerName);
The fixed version of that code after you run the fixer:
if (! $controllerName = $request->attributes->get('_controller')) {
return false;
} $method] = $this->splitControllerClassAndMethod($controllerName);
And the version you expected: no fixes
Thanks for the report. Lack of support for this construct is docuemted already in this issue: https://github.com/FriendsOfPHP/PHP-CS-Fixer/issues/2090.
However, actual breakage of code is not the same as lack of support. This is definitely a bug. :)
actually we claimed to support it with introduction of custom token. we do not have dedicated fixers, but syntax should be supported.
thanks for report
FYI: the problem is in the SquareBraceTransformer transformer, I might be able to look at this the upcoming days I hope.
should be fixed now https://github.com/FriendsOfPHP/PHP-CS-Fixer/pull/2475 is merged,
let me know if it isn't @TomasVotruba
Thank you!
you're welcome :D