Skip to content

Evaluate phpmnd integration for magic value quality checks #268

@coisa

Description

@coisa

Problem

phpmnd can detect magic-number and magic-flag anti-patterns, but current workflows do not surface this style debt.

Magic numbers remain a maintainability and readability burden, especially across larger teams.

Proposal

Evaluate adding optional phpmnd checks under analysis quality commands.

Suggested defaults:

  • Add as opt-in static-quality command/flag.
  • Use rule presets tuned for repository size.
  • Report findings by file and context with stable sorting.

Goals

  • Reduce numeric literal drift and improve readability in long-term maintained code.
  • Keep enforcement off by default until teams accept baselines.
  • Preserve low-friction migration path for existing projects.

Expected Benefits

  • Cleaner, more consistent code standards.
  • Lower cognitive load in legacy and shared packages.

Why Not (if skipped)

  • False positives in numerically heavy domains can cause low-signal noise.
  • Some teams intentionally prefer explicit domain constants already handled elsewhere.

Non-goals

  • Enforcing strict numeric style globally in all repos at once.
  • Replacing existing code-style tooling.

Acceptance Criteria

  • Option path is defined and documented (flag or new subcommand).
  • Command output is deterministic and machine-readable when requested.
  • Adoption path includes baseline handling guidance.

Architectural / Isolation Criteria

  • MUST: phpmnd execution is isolated from composer/dependency checks.
  • MUST: The analysis command remains additive and backward compatible.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions