File tree Expand file tree Collapse file tree 4 files changed +41
-0
lines changed
Expand file tree Collapse file tree 4 files changed +41
-0
lines changed Original file line number Diff line number Diff line change 145145use PhpCsFixer \Fixer \Strict \StrictComparisonFixer ;
146146use PhpCsFixer \Fixer \Strict \StrictParamFixer ;
147147use PhpCsFixer \Fixer \StringNotation \MultilineStringToHeredocFixer ;
148+ use PhpCsFixer \Fixer \StringNotation \SimpleToComplexStringVariableFixer ;
148149use PhpCsFixer \Fixer \StringNotation \SingleQuoteFixer ;
149150use PhpCsFixer \Fixer \Whitespace \ArrayIndentationFixer ;
150151use PhpCsFixer \Fixer \Whitespace \BlankLineBeforeStatementFixer ;
408409 StrictComparisonFixer::class,
409410 // Convert multiline string to heredoc or nowdoc.
410411 MultilineStringToHeredocFixer::class,
412+ // Converts explicit variables in double-quoted strings from simple to complex format (${ to {$).
413+ SimpleToComplexStringVariableFixer::class,
411414 // Convert double quotes to single quotes for simple strings
412415 SingleQuoteFixer::class,
413416 // Each element of an array must be indented exactly once.
Original file line number Diff line number Diff line change @@ -53,6 +53,20 @@ public function shouldFixPhp81(): void
5353 );
5454 }
5555
56+ /**
57+ * @test
58+ * @requires PHP >= 8.2
59+ */
60+ public function shouldFixPhp82 (): void
61+ {
62+ $ fixedFile = $ this ->runEcsCheckOnFile (__DIR__ . '/Fixtures/Php82.wrong.php.inc ' );
63+
64+ $ this ->assertStringEqualsFile (
65+ __DIR__ . '/Fixtures/Php82.correct.php.inc ' ,
66+ file_get_contents ($ fixedFile ),
67+ );
68+ }
69+
5670 private function runEcsCheckOnFile (string $ file ): string
5771 {
5872 $ fixtureFile = $ this ->initTempFixtureFile ();
Original file line number Diff line number Diff line change 1+ <?php declare (strict_types=1 );
2+
3+ namespace Lmc \CodingStandard \Integration \Fixtures ;
4+
5+ class Php82
6+ {
7+ public function php82features (): void
8+ {
9+ $ name = 'John ' ;
10+ $ complexString = "Hello {$ name }! " ;
11+ }
12+ }
Original file line number Diff line number Diff line change 1+ <?php declare (strict_types=1 );
2+
3+ namespace Lmc \CodingStandard \Integration \Fixtures ;
4+
5+ class Php82
6+ {
7+ public function php82features (): void
8+ {
9+ $ name = 'John ' ;
10+ $ complexString = "Hello $ {name}! " ;
11+ }
12+ }
You can’t perform that action at this time.
0 commit comments