Skip to content

Add inline_constructor_arguments option to class_definition #6486

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

Merged
merged 1 commit into from
Sep 4, 2022

Conversation

paulbalandan
Copy link
Member

Description

$ vendor/bin/php-cs-fixer describe class_definition     
Description of class_definition rule.
Whitespace around the keywords of a class, trait, enum or interfaces definition should be one space.

Fixer is configurable using following options:
* multi_line_extends_each_single_line (bool): whether definitions should be multiline; defaults to false
* single_item_single_line (bool): whether definitions should be single line when including a single item; defaults to false
* single_line (bool): whether definitions should be single line; defaults to false
* space_before_parenthesis (bool): whether there should be a single space after the parenthesis of anonymous class (PSR12) or not; defaults to false
* inline_constructor_arguments (bool): whether constructor argument list in anonymous classes should be single line; defaults to true      

Fixing examples:
 
[REDACTED]

 * Example #6. Fixing with configuration: ['inline_constructor_arguments' => true].
   ---------- begin diff ----------
   --- Original
   +++ New
   @@ -1,5 +1,2 @@
    <?php
   -$foo = new class(
   -    $bar,
   -    $baz
   -) {};
   +$foo = new class($bar, $baz) {};

   ----------- 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 merged commit 836a5aa into codeigniter4:develop Sep 4, 2022
@paulbalandan paulbalandan deleted the class-definition branch September 4, 2022 13:24
paulbalandan added a commit to CodeIgniter/coding-standard that referenced this pull request Sep 4, 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