Skip to content

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

@paulbalandan paulbalandan force-pushed the no-useless-concat-operator branch from 0c74bda to bd5b2f6 Compare October 13, 2022 12:55
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.

@paulbalandan paulbalandan force-pushed the no-useless-concat-operator branch from bd5b2f6 to 64cd4bf Compare October 14, 2022 02:01
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.

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.

🤔


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

3 participants