Skip to content

Promote --generate-baseline from a check option to a first-class generate-baseline command #648

Description

@fain182

Problem

check --generate-baseline is an action disguised as an option. When the flag is present, Check::execute takes a completely different code path: it calls Runner::baseline() instead of Runner::run(), prints no violations, and always returns SUCCESS. So check doesn't actually "check" anything in that mode — the command has two responsibilities hidden behind one verb.

This is also inconsistent with the rest of the CLI: other actions (init, debug:expression) are already standalone commands.

Proposal

Introduce a dedicated command, with an optional filename argument:

phparkitect generate-baseline [filename]
  • Defaults to phparkitect-baseline.json when no filename is given (same as today).
  • Shares the relevant options with check (--config, --autoload, --ignore-baseline-linenumbers), probably by extracting the common option definitions into a base command or trait.

Migration: fail fast with a clear error

Generating a baseline is a one-off, manual operation — it shouldn't appear in any CI workflow. So instead of a soft deprecation period, check --generate-baseline should fail immediately with a clear error pointing to the new command:

Error: the --generate-baseline option has been moved to its own command.
Run: phparkitect generate-baseline [filename]

Keeping the option defined (but failing) is deliberate: simply removing it would make Symfony Console exit with a generic "option does not exist" error, which is far less helpful. The failing stub can then be dropped entirely in a later release.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions