Since Composer 2.4.0, a new --strict-psr flag has been added to dump-autoload to check for PSR violations.
Here the result for churn-php:
# composer dump-autoload --optimize --strict-psr
Generating optimized autoload files
Class Churn\Tests\Integration\Command\Assets\TestAfterAnalysisHook located in ./tests/Integration/Command/Assets/hooks.php does not comply with psr-4 autoloading standard. Skipping.
Class Churn\Tests\Integration\Command\Assets\TestAfterFileAnalysisHook located in ./tests/Integration/Command/Assets/hooks.php does not comply with psr-4 autoloading standard. Skipping.
Class Churn\Tests\Integration\Command\Assets\TestBeforeAnalysisHook located in ./tests/Integration/Command/Assets/hooks.php does not comply with psr-4 autoloading standard. Skipping.
Class Churn\Tests\Unit\Assessors\CyclomaticComplexity\CyclomaticComplexityAssessorTest located in ./tests/Unit/Assessor/CyclomaticComplexityAssessorTest.php does not comply with psr-4 autoloading standard. Skipping.
Class Churn\Tests\Event\Event\AfterAnalysisEventTest located in ./tests/Unit/Event/Event/AfterAnalysisEventTest.php does not comply with psr-4 autoloading standard. Skipping.
Class Churn\Tests\Event\Event\AfterFileAnalysisEventTest located in ./tests/Unit/Event/Event/AfterFileAnalysisEventTest.php does not comply with psr-4 autoloading standard. Skipping.
Class Churn\Tests\Result\HighestScoresTest located in ./tests/Unit/Result/HighestScoresTest.php does not comply with psr-4 autoloading standard. Skipping.
Class Churn\Tests\Result\ResultAccumulatorTest located in ./tests/Unit/Result/ResultAccumulatorTest.php does not comply with psr-4 autoloading standard. Skipping.
Class Churn\Tests\Result\ResultTest located in ./tests/Unit/Result/ResultTest.php does not comply with psr-4 autoloading standard. Skipping.
Once these violations will be fixed, it'd be great to run this command in the CI to prevent new violations to appear.
Since Composer 2.4.0, a new
--strict-psr
flag has been added todump-autoload
to check for PSR violations.Here the result for churn-php:
Once these violations will be fixed, it'd be great to run this command in the CI to prevent new violations to appear.