Skip to content

Commit

Permalink
Feat: Add ClassReferenceNameCasingFixer (part of #94)
Browse files Browse the repository at this point in the history
  • Loading branch information
OndraM committed May 6, 2024
1 parent 419c6cd commit 851a0a3
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions ecs.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
use PhpCsFixer\Fixer\Basic\BracesFixer;
use PhpCsFixer\Fixer\Basic\NoTrailingCommaInSinglelineFixer;
use PhpCsFixer\Fixer\Basic\PsrAutoloadingFixer;
use PhpCsFixer\Fixer\Casing\ClassReferenceNameCasingFixer;
use PhpCsFixer\Fixer\Casing\MagicMethodCasingFixer;
use PhpCsFixer\Fixer\Casing\NativeFunctionCasingFixer;
use PhpCsFixer\Fixer\Casing\NativeTypeDeclarationCasingFixer;
Expand Down Expand Up @@ -231,6 +232,8 @@
WhitespaceAfterCommaInArrayFixer::class,
// Classes must be in a path that matches their namespace
PsrAutoloadingFixer::class,
// When referencing an internal class it must be written using the correct casing.
ClassReferenceNameCasingFixer::class,
// Magic method definitions and calls must be using the correct casing
MagicMethodCasingFixer::class,
// Function defined by PHP should be called using the correct casing
Expand Down
2 changes: 2 additions & 0 deletions tests/Integration/Fixtures/Basic.correct.php.inc
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ class Basic
$uselessSprintf = 'bar';
// NoSpaceAroundDoubleColonFixer
$className = DateTime::class;
// ClassReferenceNameCasingFixer
$date = new \DateTime();
// SingleSpaceAfterConstructFixer
if ($a == $b) {
return true;
Expand Down
2 changes: 2 additions & 0 deletions tests/Integration/Fixtures/Basic.wrong.php.inc
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ class Basic
$uselessSprintf = sprintf('bar');
// NoSpaceAroundDoubleColonFixer
$className = DateTime :: class;
// ClassReferenceNameCasingFixer
$date = new \datetime();
// SingleSpaceAfterConstructFixer
if ($a == $b) { return true; }
return false; // BlankLineBeforeStatementFixer
Expand Down

0 comments on commit 851a0a3

Please sign in to comment.