Skip to content

Add PER-CS 3.0 prepared set - #76

Merged
TomasVotruba merged 1 commit into
mainfrom
add-per-cs-set
Sep 7, 2026
Merged

Add PER-CS 3.0 prepared set#76
TomasVotruba merged 1 commit into
mainfrom
add-per-cs-set

Conversation

@TomasVotruba

Copy link
Copy Markdown
Member

Adds native ECS support for the PER Coding Style 3.0.

Before this, PER-CS was only reachable through the deprecated withPhpCsFixerSets(), which is now a no-op - so there was no way to apply PER-CS through ECS.

What

  • config/set/per-cs.php - prepared set mirroring PHP-CS-Fixer @PER-CS3x0 (non-risky rules only), expanded to individual fixer classes to match the existing prepared-set style.
  • SetList::PER_CS constant.
  • withPreparedSets(perCs: true) flag.

Reachable both ways:

$ecsConfig->withPreparedSets(perCs: true);
// or
$ecsConfig->withSets([SetList::PER_CS]);

Notes

  • Non-risky set only, matching how the other prepared sets ship. Risky PER-CS rules (@PER-CS3x0:risky) are intentionally left out.
  • Faithful to php-cs-fixer v3.95 @PER-CS3x0 resolution (rules + configs verified against the resolved ruleset). The official spec is now at 3.1, but php-cs-fixer does not yet ship a 3.1 set.

Tests

Added tests/Set/PerCs/PerCsTest.php with a fixture covering the 3.0 deltas (nullable type shorthand, short arrays, spacing, trailing commas).

phpstan, rector, check-cs, and phpunit all pass locally.

Mirrors PHP-CS-Fixer @PER-CS3x0 (non-risky) as a native ECS prepared set.
Reachable via SetList::PER_CS or withPreparedSets(perCs: true).
@TomasVotruba
TomasVotruba merged commit 96f1578 into main Sep 7, 2026
8 checks passed
@TomasVotruba
TomasVotruba deleted the add-per-cs-set branch September 7, 2026 07:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant