Why the non-default choices in the shared mago.toml are what they are. The
configuration was extracted from the phpdb-validator refactor — the first
php-db component migrated to Mago — and reflects what survived contact with a
real codebase.
print-width = 120, 4-space indentation — carried over from the laminas-coding-standard era; matches the existing codebase style.preserve-breaking-*family — intentional line breaks (broken argument lists, member-access chains, arrays, conditionals) survive reformatting instead of being collapsed when they fit the print width. This dramatically reduces diff churn on already-formatted code.align-assignment-like/sort-class-methods— opinionated readability choices ratified during the validator refactor.sort-class-methodsmakes method order deterministic, eliminating "where does this method go" review comments.space-after-logical-not-unary-prefix-operator—! $fooover!$foo, matching the laminas-coding-standard convention.
minimum-fail-level = "Help"— everything the linter reports fails the build. Rules relegated tolevel = "Help"are still enforced; the level only affects display severity.integrations = ["laminas", "phpunit"]— enables framework-aware rules for the two ecosystems every php-db component sits in.- Naming rules (
class-name,interface-name,trait-namewithpsr = true; camelCase methods/variables) — direct continuation of the PSR-12/laminas-coding-standard naming policy. yoda-conditions— ratified during the refactor; guards against accidental assignment in conditions.function-nameexcludessrc/functions/*— free functions in the conventional functions directory may use snake_case, matching common PHP library practice.too-many-methodsexcludestest/— test cases legitimately accumulate many test methods.
excludes = ["test"]— analysis focuses on shipped code; tests are covered by the linter (including thephpunitintegration) and by running.check-throws+ sharedunchecked-exceptions— enforces documented@throwsfor checked exceptions.Error,LogicException(programmer errors), and PHPUnit's internal exceptions are unchecked, as isLaminas\Validator\Exception\RuntimeExceptionwhich laminas-validator throws pervasively.enforce-class-finality/require-api-or-internal— every class is final unless deliberately opened; every symbol declares whether it is public API. These are the strictest choices in the base and the most likely migration friction; repositories may relax them locally with a tracking issue.class-initializers— the base lists only the one initializer every php-db component shares,PHPUnit\Framework\TestCase::setUp. Because arrays concatenate on merge, repositories append their own (e.g. Laminas'Element::init/BaseInputFilter::init, ...) without repeating the base list.
Following laminas-coding-standard's precedent: enabling new rules (or tightening existing ones) lands only in major releases of this package. Minor and patch releases may fix documentation, templates, or relax/adjust rules in a backwards-compatible direction.