Php-cs-fixer: no_spaces_around_offset fixer mailforms Array Destruct from PHP 7.1

Created on 7 Jan 2017  路  6Comments  路  Source: FriendsOfPHP/PHP-CS-Fixer

faillll

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

kinbug

All 6 comments

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

Was this page helpful?
0 / 5 - 0 ratings