Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable no_trailing_comma_in_singleline #6482

Merged

Conversation

paulbalandan
Copy link
Member

Description

$ vendor/bin/php-cs-fixer describe no_trailing_comma_in_singleline
Description of no_trailing_comma_in_singleline rule.
If a list of values separated by a comma is contained on a single line, then the last item MUST NOT have a trailing comma.

Fixer is configurable using following option:
* elements (a subset of ['arguments', 'array_destructuring', 'array', 'group_import']): which elements to fix; defaults to ['arguments', 'array_destructuring', 'array', 'group_import']

Fixing examples:
 * Example #1. Fixing with the default configuration.
   ---------- begin diff ----------
   --- Original
   +++ New
   @@ -1,5 +1,5 @@
    <?php
   -foo($a,);
   -$foo = array(1,);
   -[$foo, $bar,] = $array;
   -use a\{ClassA, ClassB,};
   +foo($a);
   +$foo = array(1);
   +[$foo, $bar] = $array;
   +use a\{ClassA, ClassB};

   ----------- end diff -----------

 * Example #2. Fixing with configuration: ['elements' => ['array_destructuring']].
   ---------- begin diff ----------
   --- Original
   +++ New
   @@ -1,3 +1,3 @@
    <?php
    foo($a,);
   -[$foo, $bar,] = $array;
   +[$foo, $bar] = $array;

   ----------- end diff -----------

Checklist:

  • Securely signed commits
  • Component(s) with PHPDoc blocks, only if necessary or adds value
  • Unit testing, with >80% coverage
  • User guide updated
  • Conforms to style guide

@paulbalandan paulbalandan force-pushed the no-trailing-comma-in-single-line branch from 15451ad to 7a32c6d Compare September 4, 2022 14:56
@MGatner
Copy link
Member

MGatner commented Sep 4, 2022

I'm going to get some of these in so they can make it in the release.

@MGatner MGatner merged commit 780f2e0 into codeigniter4:develop Sep 4, 2022
@paulbalandan paulbalandan deleted the no-trailing-comma-in-single-line branch September 5, 2022 02:41
paulbalandan added a commit to CodeIgniter/coding-standard that referenced this pull request Sep 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants