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

[BUG] ArrayListItemNelineFixer adds newline in interpolated string value #59

Open
Reinis opened this issue Dec 5, 2024 · 0 comments
Open

Comments

@Reinis
Copy link

Reinis commented Dec 5, 2024

Test fixture:
tests/Fixer/ArrayNotation/ArrayListItemNewlineFixer/Fixture/skip_comma_in_string_interpolation.php.inc

<?php

namespace Symplify\CodingStandard\Tests\Fixer\ArrayNotation\ArrayListItemNewlineFixer\Fixture;

final class SimpleTwoItems
{
    private function run(): array
    {
        $a = 'A';
        $b = 'B';

        return [
            'text' => "{$a},{$b}",
        ];
    }
}

?>
-----
<?php

namespace Symplify\CodingStandard\Tests\Fixer\ArrayNotation\ArrayListItemNewlineFixer\Fixture;

final class SimpleTwoItems
{
    private function run(): array
    {
        $a = 'A';
        $b = 'B';

        return [
            'text' => "{$a},{$b}",
        ];
    }
}

?>
PHPUnit 10.5.38 by Sebastian Bergmann and contributors.

Runtime:       PHP 8.3.6
Configuration: phpunit.xml

F....                                                               5 / 5 (100%)

Time: 00:00.024, Memory: 14.00 MB

There was 1 failure:

1) Symplify\CodingStandard\Tests\Fixer\ArrayNotation\ArrayListItemNewlineFixer\ArrayListItemNewlineFixerTest::test with data set #0 ('...hp.inc')
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
         $b = 'B';\n
 \n
         return [\n
-            'text' => "{$a},{$b}",\n
+            'text' => "{$a},\n
+{$b}",\n
         ];\n
     }\n
 }\n

vendor/symplify/easy-coding-standard/src/Testing/PHPUnit/AbstractCheckerTestCase.php:66
tests/Fixer/ArrayNotation/ArrayListItemNewlineFixer/ArrayListItemNewlineFixerTest.php:16

FAILURES!
Tests: 5, Assertions: 5, Failures: 1.
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

No branches or pull requests

1 participant