In the require-dev section of composer.json change the version constraint:
- "almacareer/coding-standard": "^4.2",
+ "almacareer/coding-standard": "^5.0",Then run composer update almacareer/coding-standard.
[BC break] The namespace has been changed from Lmc\CodingStandard to AlmaOss\CodingStandard.
Update your ecs.php file to use the new namespace:
<?php
declare(strict_types=1);
-use Lmc\CodingStandard\Set\SetList;
+use AlmaOss\CodingStandard\Set\SetList;
use Symplify\EasyCodingStandard\Config\ECSConfig;
return ECSConfig::configure()
->withSets(
[
SetList::ALMACAREER,
]
);If you are using any custom sniffs or fixers from this package in your configuration, update their namespace as well:
-use Lmc\CodingStandard\Fixer\SpecifyArgSeparatorFixer;
+use AlmaOss\CodingStandard\Fixer\SpecifyArgSeparatorFixer;
-use Lmc\CodingStandard\Sniffs\Naming\ClassNameSuffixByParentSniff;
+use AlmaOss\CodingStandard\Sniffs\Naming\ClassNameSuffixByParentSniff;[BC break] The BlankLineAfterOpeningTagFixer is no longer skipped. This means that a blank line after the opening PHP tag (<?php) is now required to be PSR-12 compliant.
Before (no longer valid):
<?php
declare(strict_types=1);After (PSR-12 compliant):
<?php
declare(strict_types=1);If your codebase does not follow this convention yet, running vendor/bin/ecs check --fix will automatically add the blank lines.
If you want to keep the old behavior and skip this check, you can add it to your ecs.php:
use PhpCsFixer\Fixer\Whitespace\BlankLineAfterOpeningTagFixer;
return ECSConfig::configure()
// ...
->withSkip([
BlankLineAfterOpeningTagFixer::class,
]);After updating the namespace, run the code style checks to ensure everything is working correctly:
vendor/bin/ecs checkTo automatically fix the code style issues (including the blank line after opening tag):
vendor/bin/ecs check --fixYou can ensure all predefined checks are loaded by running:
vendor/bin/ecs list-checkersThe output should show all the loaded checkers from both PHP-CS-Fixer and PHP_CodeSniffer.