deprecated-packages / symplify

[DISCONTINUED] Check split packages in their own repositories :)
MIT License
619 stars 188 forks source link

[ECS] `TrailingCommaInMultilineFixer` config failing when using new `match` option #4236

Closed driftingly closed 2 years ago

driftingly commented 2 years ago

I'm running into an issue when trying to configure TrailingCommaInMultilineFixer with the new match rule added in 3.9.1.

https://github.com/FriendsOfPHP/PHP-CS-Fixer/pull/6381 https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases/tag/v3.9.1

I'm using ECS 11.0.8.

<?php

use PhpCsFixer\Fixer\ControlStructure\TrailingCommaInMultilineFixer;
use Symplify\EasyCodingStandard\Config\ECSConfig;

return static function (ECSConfig $ecsConfig): void {
    $ecsConfig->ruleWithConfiguration(TrailingCommaInMultilineFixer::class, [
        'elements' => ['arrays', 'arguments', 'parameters', 'match'],
    ]);
};
Fatal error: Uncaught ECSPrefix202207\Symfony\Component\OptionsResolver\Exception\InvalidOptionsException: The option "elements" with value array is invalid. in /Users/anthony/Sites/whomar/vendor/symplify/easy-coding-standard/vendor/symfony/options-resolver/OptionsResolver.php:904

This configuration works:

<?php

use PhpCsFixer\Fixer\ControlStructure\TrailingCommaInMultilineFixer;
use Symplify\EasyCodingStandard\Config\ECSConfig;

return static function (ECSConfig $ecsConfig): void {
    $ecsConfig->ruleWithConfiguration(TrailingCommaInMultilineFixer::class, [
        'elements' => ['arrays', 'arguments', 'parameters'],
    ]);
};
TomasVotruba commented 2 years ago

What version php-cs-fixer version ECS uses? Try dev-main

TomasVotruba commented 2 years ago

This is php-cs-fixer issue. Please report there.

driftingly commented 2 years ago

Thanks @TomasVotruba, will do.