mayflower/mo4-coding-standard
MO4 Coding Standard is a PHP CodeSniffer ruleset extending the Symfony standard with extra rules for array alignment and formatting, property doc blocks, namespace usage, and string interpolation. Install it via Composer to enforce consistent, modern PHP coding conventions across your projects.
What this package actually is: a dev-only Composer package that registers a PHP_CodeSniffer "standard" named MO4. It contains no runtime code — it is a ruleset.xml that composes ~7 custom sniffs with rules pulled from Symfony Coding Standard, Slevomat Coding Standard, PSR-12 and PHPCS core. The custom sniffs are mostly cosmetic/structural (aligned => in arrays, multiline array formatting, @var docblocks, alphabetical use ordering, {$var} interpolation, const spacing, single blank lines).
Architecture fit
dealerdirect/phpcodesniffer-composer-installer, which mutates PHPCS's global installed_paths. That is a Composer plugin, requiring allow-plugins allowlisting on Composer 2.2+, and it behaves differently in Docker/CI vs. a developer machine. A manual phpcs --config-set installed_paths or a phpcs.xml.dist with explicit <rule ref="vendor/mayflower/..."> paths is more predictable.Integration feasibility
composer require --dev mayflower/mo4-coding-standard, then vendor/bin/phpcs --standard=MO4 app/. Most violations are auto-fixable with phpcbf.order property on AlphabeticalUseStatements (dictionary default vs. string/string-locale/string-case-insensitive) is the one knob most likely to conflict with an existing project convention; it must be pinned explicitly in a project ruleset so behavior doesn't change under you.Technical risk
composer update can move three coupled dependencies at once.=> alignment and multiline array layout conflicts with Pint's defaults. This is a people risk, not a technical one, but it lands on the TPM.Key questions
ReferenceUsedNamesOnly) or redundant (formatting)? We should not run two formatters.UnnecessaryNamespaceUsage, AlphabeticalUseStatements, PropertyComment; consider excluding ArrayDoubleArrowAlignment and MultiLineArray if Pint owns layout.Stack fit
Migration path
^11.0) and pin PHPCS, Slevomat, Symfony CS, and the composer-installer plugin in composer.lock. Commit the lockfile.phpcs.xml.dist that references MO4, sets the AlphabeticalUseStatements.order property explicitly, and <exclude>s any sniffs that collide with Pint or the team's existing style.vendor/bin/phpcs --standard=phpcs.xml.dist --report=summary app/ in a dedicated CI job, continue-on-error: true, for one sprint. Use --cache and scope to app/, src/, tests/ — never vendor.phpcs --standard=MO4 -e to list every active sniff, and --report=source to rank violations by sniff. Decide fix vs. baseline per sniff, not per file.phpcbf branch (review it — autofixers on VariableInDoubleQuotedString and ArrayDoubleArrowAlignment can produce large, low-signal diffs), or a diff-aware gate that only enforces on changed lines/files.Compatibility
phpcs -i lists both MO4 and Symfony after install; the README's troubleshooting note ("MO4 not installed" / installed_paths) is the most common first-day failure and should go in the onboarding doc.allow-plugins policy permits dealerdirect/phpcodesniffer-composer-installer; if not, register the standard path manually.Sequencing
phpcbf diff size.Maintenance
installed_paths setup. Decide this up front.Support
Scaling
--cache (persisted between CI runs), scope to changed directories in PR jobs and run the full scan nightly, and split the run across parallel CI jobs by directory.Failure modes to plan for
installed_paths drift after a cache restore or image rebuild) → silent zero-violation pass. Add a guard step that asserts phpcs -i | grep MO4.phpcbf sweeps deliberately.Ramp-up
ruleset.xml syntax, -e/--report=source/--cache flags, phpcbf caution). No PHP framework knowledge required.How can I help you explore Laravel packages today?