mayflower/mo4-coding-standard
PHP_CodeSniffer ruleset implementing the MO4 coding standard. Extends Symfony’s standard with extra sniffs for array formatting and alignment, multiline arrays, property docblock @var rules, and lexicographically sorted use statements (configurable ordering).
Strengths:
use statement conventions). This reduces friction for Laravel projects already using Symfony components or following PSR standards.use statement sorting, variable interpolation) without being overly restrictive (e.g., optional docblocks, flexible license placement). This fits Laravel’s pragmatic approach to coding standards.phpcbf (PHP Code Beautifier and Fixer), enabling seamless integration into CI/CD pipelines for automated enforcement.Gaps:
laravel-shift/coding-standard).Symfony.Components.AnnotationFormat) may not apply to Laravel projects, requiring customization via ruleset.xml.nunomaduro/larastan or custom rules).phpcs CLI or PHPStan.phpcs/phpcbf.ruleset.xml, allowing team-specific adjustments.PSR12 or SquizLabs as a baseline if MO4’s rules are too opinionated.ruleset.xml or custom sniffs.phpcbf run automatically in CI, or require manual fixes?AlphabeticalUseStatements order) via ruleset.xml?php-parallel-lint) be used for speed?nunomaduro/larastan).phpcbf in PRs, then enforce in CI)?phpstan/extension-installer or custom configs.phpcs in parallel with tests (e.g., GitHub Actions matrix).pre-commit to run phpcbf locally (via husky or pre-commit framework).phpcs in the after hook.phpcs in composer.json:
"scripts": {
"lint": "phpcs --standard=MO4 app/",
"fix": "phpcbf --standard=MO4 app/"
}
composer require --dev mayflower/mo4-coding-standard and test locally.--warning-severity=0.phpcbf in CI to auto-fix issues.ruleset.xml to:
AlphabeticalUseStatements order).phpcs configs (merge or override).PSR12, SquizLabs).phpstan/extension-installer.phpcs or use a separate tool (e.g., nunomaduro/larastan).phpcs with --report=full).use statement sorting).composer.json and test locally.phpcs in parallel with tests.--warning-severity=0 in CI.--warning-severity=5.ruleset.xml based on team feedback.phpcbf, reducing manual effort.How can I help you explore Laravel packages today?