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 4646use PhpCsFixer \Fixer \AttributeNotation \AttributeEmptyParenthesesFixer ;
4747use PhpCsFixer \Fixer \Basic \BracesFixer ;
4848use PhpCsFixer \Fixer \Basic \NoTrailingCommaInSinglelineFixer ;
49+ use PhpCsFixer \Fixer \Basic \OctalNotationFixer ;
4950use PhpCsFixer \Fixer \Basic \PsrAutoloadingFixer ;
5051use PhpCsFixer \Fixer \Basic \SingleLineEmptyBodyFixer ;
5152use PhpCsFixer \Fixer \Casing \ClassReferenceNameCasingFixer ;
244245 SingleLineEmptyBodyFixer::class, // Defined in PER 2.0
245246 // Values separated by a comma on a single line should not have a trailing comma.
246247 NoTrailingCommaInSinglelineFixer::class,
248+ // Literal octal must be in 0o notation.
249+ OctalNotationFixer::class,
247250 // Arrays should be formatted like function/method arguments
248251 TrimArraySpacesFixer::class,
249252 // 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
3939 ];
4040 }
4141
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+
4256 private function runEcsCheckOnFile (string $ file ): string
4357 {
4458 $ 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