File tree 4 files changed +41
-0
lines changed
4 files changed +41
-0
lines changed Original file line number Diff line number Diff line change 145
145
use PhpCsFixer \Fixer \Strict \StrictComparisonFixer ;
146
146
use PhpCsFixer \Fixer \Strict \StrictParamFixer ;
147
147
use PhpCsFixer \Fixer \StringNotation \MultilineStringToHeredocFixer ;
148
+ use PhpCsFixer \Fixer \StringNotation \SimpleToComplexStringVariableFixer ;
148
149
use PhpCsFixer \Fixer \StringNotation \SingleQuoteFixer ;
149
150
use PhpCsFixer \Fixer \Whitespace \ArrayIndentationFixer ;
150
151
use PhpCsFixer \Fixer \Whitespace \BlankLineBeforeStatementFixer ;
408
409
StrictComparisonFixer::class,
409
410
// Convert multiline string to heredoc or nowdoc.
410
411
MultilineStringToHeredocFixer::class,
412
+ // Converts explicit variables in double-quoted strings from simple to complex format (${ to {$).
413
+ SimpleToComplexStringVariableFixer::class,
411
414
// Convert double quotes to single quotes for simple strings
412
415
SingleQuoteFixer::class,
413
416
// 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
53
53
);
54
54
}
55
55
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
+
56
70
private function runEcsCheckOnFile (string $ file ): string
57
71
{
58
72
$ 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