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 46
46
use PhpCsFixer \Fixer \AttributeNotation \AttributeEmptyParenthesesFixer ;
47
47
use PhpCsFixer \Fixer \Basic \BracesFixer ;
48
48
use PhpCsFixer \Fixer \Basic \NoTrailingCommaInSinglelineFixer ;
49
+ use PhpCsFixer \Fixer \Basic \OctalNotationFixer ;
49
50
use PhpCsFixer \Fixer \Basic \PsrAutoloadingFixer ;
50
51
use PhpCsFixer \Fixer \Basic \SingleLineEmptyBodyFixer ;
51
52
use PhpCsFixer \Fixer \Casing \ClassReferenceNameCasingFixer ;
244
245
SingleLineEmptyBodyFixer::class, // Defined in PER 2.0
245
246
// Values separated by a comma on a single line should not have a trailing comma.
246
247
NoTrailingCommaInSinglelineFixer::class,
248
+ // Literal octal must be in 0o notation.
249
+ OctalNotationFixer::class,
247
250
// Arrays should be formatted like function/method arguments
248
251
TrimArraySpacesFixer::class,
249
252
// In array declaration, there MUST be a whitespace after each comma
Original file line number Diff line number Diff line change @@ -39,6 +39,20 @@ public function provideFilesToFix(): array
39
39
];
40
40
}
41
41
42
+ /**
43
+ * @test
44
+ * @requires PHP >= 8.1
45
+ */
46
+ public function shouldFixPhp81 (): void
47
+ {
48
+ $ fixedFile = $ this ->runEcsCheckOnFile (__DIR__ . '/Fixtures/Php81.wrong.php.inc ' );
49
+
50
+ $ this ->assertStringEqualsFile (
51
+ __DIR__ . '/Fixtures/Php81.correct.php.inc ' ,
52
+ file_get_contents ($ fixedFile ),
53
+ );
54
+ }
55
+
42
56
private function runEcsCheckOnFile (string $ file ): string
43
57
{
44
58
$ 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 Php81
6
+ {
7
+ public function php81features (): void
8
+ {
9
+ // OctalNotationFixer
10
+ $ numberInOctalNotation = 0o123 ;
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 Php81
6
+ {
7
+ public function php81features (): void
8
+ {
9
+ // OctalNotationFixer
10
+ $ numberInOctalNotation = 0123 ;
11
+ }
12
+ }
You can’t perform that action at this time.
0 commit comments