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_useless_concat_operator #6678

Merged
merged 2 commits into from
Oct 14, 2022

Conversation

paulbalandan
Copy link
Member

Description
Depends on #6674

$ vendor/bin/php-cs-fixer describe no_useless_concat_operator
Description of no_useless_concat_operator rule.
There should not be useless concat operations.

Fixer is configurable using following option:
* juggle_simple_strings (bool): allow for simple string quote juggling if it results in more concat-operations merges; defaults to false

Fixing examples:
 * Example #1. Fixing with the default configuration.
   ---------- begin diff ----------
   --- Original
   +++ New
   @@ -1,2 +1,2 @@
    <?php
   -$a = 'a'.'b';
   +$a = 'ab';

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

 * Example #2. Fixing with configuration: ['juggle_simple_strings' => true].
   ---------- begin diff ----------
   --- Original
   +++ New
   @@ -1,2 +1,2 @@
    <?php
   -$a = 'a'."b";
   +$a = "ab";

   ----------- 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

Copy link
Member

@kenjis kenjis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please rebase.

Copy link
Member

@MGatner MGatner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually got some changes out of this one! Nice rule.

@@ -413,7 +413,7 @@ public function testImageConvert()
public function testImageReorientLandscape()
{
for ($i = 0; $i <= 8; $i++) {
$source = $this->origin . 'EXIFsamples/landscape_' . '' . $i . '.jpg';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔

@@ -156,7 +156,7 @@ public function testAppendBody()

$this->message->appendBody('\n');

$this->assertSame('moo' . '\n', $this->message->getBody());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one almost got me 😆

@kenjis kenjis merged commit c08de60 into codeigniter4:develop Oct 14, 2022
@kenjis kenjis mentioned this pull request Oct 14, 2022
2 tasks
@paulbalandan paulbalandan deleted the no-useless-concat-operator branch October 15, 2022 02:30
paulbalandan added a commit to CodeIgniter/coding-standard that referenced this pull request Oct 15, 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.

None yet

3 participants