Skip to content

Introduce coding-standards tooling (php-cs-fixer, PER-CS) with CI enforcement #629

Description

@lisachenko

Motivation

The repo has no CS tooling at all — no .php-cs-fixer.dist.php, .phpcs.xml, rector.php, or .editorconfig — and drift is already visible: bin/aspect:4 uses declare(strict_types = 1) (spaces) while src/ consistently uses declare(strict_types=1). Notably, CI already installs cs2pr (.github/workflows/phpunit.yml:53) but nothing ever uses it.

Proposed change

  • Add friendsofphp/php-cs-fixer (dev dep) with a @PER-CS ruleset + declare_strict_types and risky rules kept minimal.
  • Add .editorconfig matching current conventions (4 spaces, LF, final newline).
  • Add a CI cs job running php-cs-fixer check --diff reported through cs2pr.
  • One-off php-cs-fixer fix commit, kept separate from the config commit for reviewability.

Acceptance criteria

  • composer cs / composer cs:fix (or documented equivalent) work locally; CI fails on style violations.
  • The fix commit produces no behavioral diff (phpunit + PHPStan level 10 green).

Note: should land after the other open modernization PRs to avoid repo-wide formatting conflicts.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions