lmc/coding-standard
Deprecated PHP coding standard for Alma Career Czechia (formerly LMC). Based on PSR-12 and partially PER 2.0, delivered via EasyCodingStandard with rules for PHP-CS-Fixer and PHP_CodeSniffer to enforce readable, consistent code and catch common mistakes.
Install the package as a dev dependency:
composer require --dev lmc/coding-standard
⚠️ Critical note: This package is archived and deprecated. For new projects, use its official replacement: almacareer/coding-standard. Only use this legacy package if maintaining older codebases stuck on lmc/coding-standard.
Create ecs.php in your project root to load the standard:
<?php declare(strict_types=1);
use Symplify\EasyCodingStandard\Config\ECSConfig;
return ECSConfig::configure()
->withPaths([__DIR__ . '/src', __DIR__ . '/tests'])
->withRootFiles()
->withSets([__DIR__ . '/vendor/lmc/coding-standard/ecs.php']);
Run checks immediately:
vendor/bin/ecs check
Integrate into CI & Composer workflows:
Add to composer.json scripts for consistent usage:
"scripts": {
"analyze": "vendor/bin/ecs check --ansi",
"fix": "vendor/bin/ecs check --ansi --fix"
}
Run composer analyze before commits; composer fix for auto-correction.
Extend with project-specific rules using withRules() and withConfiguredRule():
->withRules([
SingleLineCommentSpacingFixer::class,
PhpUnitAttributesFixer::class, // (for PHPUnit 10+)
])
->withConfiguredRule(LineLengthSniff::class, ['absoluteLineLimit' => 120]);
Suppress rules selectively with withSkip() for edge cases:
->withSkip([
ForbiddenFunctionsSniff::class => [__DIR__ . '/src-tests/bootstrap.php'],
__DIR__ . '/legacy/*.php',
]);
Leverage version-specific behavior:
This package auto-loads rules appropriate for your runtime PHP version (e.g., PHP 8.1 features only run on PHP ≥8.1). Ensure CI and local dev use matching PHP versions.
⚠️ Deprecated & locked dependencies:
4.1.2 restricts php-cs-fixer to <3.65.0 due to a critical bug in NullableTypeDeclarationFixer.lmc/coding-standard 4.x – the repo is abandoned. Migrate to almacareer/coding-standard ASAP.Configuration breaking changes in v4.0.0:
ecs.php only).ecs-7.4.php, ecs-8.0.php, etc. — use a single ecs.php.PHPDoc alignment issues:
Version 4.1.1 disabled PhpdocAlignFixer due to incorrect behavior. Avoid re-enabling it unless thoroughly tested.
IDE integration pitfalls:
PHPStorm will only pick up fixes if your ecs.php is in the root and correctly referenced. Use the IDE guide — but note this package uses older ECS versions (v9/v12) — ensure compatibility.
Testing parity matters:
Since v4.0.0, the project includes test suites for its own sniffs. If extending the standard, ensure your project also tests fixers to avoid regressions.
Beware of PHP version drift:
If your project supports multiple PHP versions (e.g., 8.0–8.3), lmc/coding-standard only applies applicable rules — but fixer behavior may differ across versions. Run checks with the lowest supported PHP version in CI to avoid false passes.
How can I help you explore Laravel packages today?