Classes must be in a path that matches their namespace, be at least one namespace deep and the class name should match the file name.
Warning
Using this rule is risky.
This fixer may change your class name, which will break the code that depends on the old name.
If provided, the directory where the project code is placed.
Allowed types: null
, string
Default value: null
Default configuration.
--- Original
+++ New
@@ -1,3 +1,3 @@
<?php
namespace PhpCsFixer\FIXER\Basic;
-class InvalidName {}
+class PsrAutoloadingFixer {}
With configuration: ['dir' => './src']
.
--- Original
+++ New
@@ -1,3 +1,3 @@
<?php
-namespace PhpCsFixer\FIXER\Basic;
-class InvalidName {}
+namespace PhpCsFixer\Fixer\Basic;
+class PsrAutoloadingFixer {}
The rule is part of the following rule sets:
- @PhpCsFixer:risky
- Using the @PhpCsFixer:risky rule set will enable the
psr_autoloading
rule with the default config. - @Symfony:risky
- Using the @Symfony:risky rule set will enable the
psr_autoloading
rule with the default config.