Repository navigation
v2.0.0: build every set on PER Coding Style 3.0 and easy-coding-standard 13 - #41
Merged
Merged
Conversation
rugbymauri
force-pushed
the
feat/ecs-13
branch
3 times, most recently
from
September 9, 2026 12:02
ec70d32 to
df6ebb1
Compare
rugbymauri
force-pushed
the
feat/ecs-13
branch
4 times, most recently
from
September 9, 2026 15:07
e8f5c69 to
7907aa8
Compare
tuxes3
reviewed
Sep 9, 2026
rugbymauri
force-pushed
the
feat/ecs-13
branch
from
September 9, 2026 16:12
a5ddb2b to
6a7eaf2
Compare
tuxes3
requested changes
Sep 15, 2026
tuxes3
left a comment
Member
There was a problem hiding this comment.
der ecs check sollte im ci auf sich selber laufen.
MethodChainingNewlineFixer ist eine grosse Änderung, ist aber nicht dokumentiert.
rugbymauri
force-pushed
the
feat/ecs-13
branch
from
September 16, 2026 12:34
4d0fbba to
73e79bd
Compare
tuxes3
requested changes
Oct 22, 2026
tuxes3
left a comment
Member
There was a problem hiding this comment.
@rugbymauri change the version pin in composer.json and we ready to merge
The upstream attribution now lives in the class docblock text instead of an `@author` annotation, which the standard strips on `--fix`. Signed-off-by: Maurizio Monticelli <maurizio@whatwedo.ch>
ECS 13 bundles php-cs-fixer 3.95 and PHP_CodeSniffer 4, which lifts the version caps on kubawerlos/php-cs-fixer-custom-fixers and slevomat/coding-standard again. BREAKING CHANGE: after updating, run `vendor/bin/ecs check --fix` once — the refreshed rule set reports additional findings on code that passed under ECS 12, so pipelines fail until the new findings are fixed. refs: #36 Signed-off-by: Maurizio Monticelli <maurizio@whatwedo.ch>
Install with `--dev`, since a coding standard is never needed at runtime, and pick the Symfony, WordPress or common set from a single list, shown as the `ecs.php` fluent config format ECS expects. refs: #36 Signed-off-by: Maurizio Monticelli <maurizio@whatwedo.ch>
ECS 13 deprecates the `return function (ECSConfig $ecsConfig): void {}` format the
sets used and warns on every run; consumers may keep either style. The move also
drops `SetList::CLEAN_CODE`, already imported by `SetList::COMMON` in full, and 17
skips for rules no ECS 13 set ships any more — the effective checker list stays at
162 active rules, verified with `ecs list` on every config.
Signed-off-by: Maurizio Monticelli <maurizio@whatwedo.ch>
`WhatwedoSets::COMMON`, `::SYMFONY` and `::WORDPRESS` carry the paths to the shipped sets, so an `ecs.php` names a class constant instead of a vendor path that breaks silently on a rename; passing the file path keeps working. Both examples now declare the directories to check as `__DIR__`-relative paths, so `vendor/bin/ecs check` needs no directory argument and works from any working directory. refs: #36 Signed-off-by: Maurizio Monticelli <maurizio@whatwedo.ch>
PER Coding Style 3.0 is the successor of PSR-12, so every set now builds on `SetList::PER_CS` plus the two points it leaves to the caller, `declare()` parentheses and alphabetically sorted imports. The whatwedo rules move into one file loaded last, where they give up the ten overrides that held back rules the sets ship and every sniff and fixer that rewrote correct code: the Squiz file and class comment sniffs, the `@throws` sniff PHPStan answers from the call chain, the risky `?bool` fixer, and the class element order that moved enum cases below the methods. BREAKING CHANGE: run `vendor/bin/ecs check --fix` once after the update — the first run reformats existing code, most visibly by adding trailing commas to multiline argument and parameter lists, spacing casts and rewriting Yoda comparisons. The order of properties, constants and methods is no longer enforced. refs: #36 Signed-off-by: Maurizio Monticelli <maurizio@whatwedo.ch>
`^13` also resolves the earlier 13.x patches, on which the shipped sets are neither developed nor run. Requiring the current 13.3.2 as the minimum keeps a fresh install on the same php-cs-fixer and PHP_CodeSniffer versions the sets are verified against, instead of silently landing on an older 13.0 or 13.1 patch. The `>=7.4` floor outlived the versions it was written for in the same way: every whatwedo project that consumes this standard runs on PHP 8.2 or newer, and the sets are neither run nor verified on anything older. The dependencies would still install on 7.4, so the floor is set here on purpose rather than inherited. BREAKING CHANGE: a project on PHP 7.4, 8.0 or 8.1 no longer resolves this package and stays on the previous release. refs: #36 Signed-off-by: Maurizio Monticelli <maurizio@whatwedo.ch>
A fluent chain is no longer split onto one call per line and re-indented, so a short `$this->foo()->bar()` stays on one line and a deliberately wrapped builder chain keeps its own breaks. refs: #36 Signed-off-by: Maurizio Monticelli <maurizio@whatwedo.ch>
The Symfony set now normalises the indentation, spacing and array assignments inside Doctrine annotations, which until now were left untouched in projects that still carry mapping or validation in docblocks rather than attributes. BREAKING CHANGE: run `vendor/bin/ecs check --fix` once after the update — the first run reformats existing Doctrine annotations. refs: #36 Signed-off-by: Maurizio Monticelli <maurizio@whatwedo.ch>
Allow only patch updates of slevomat/coding-standard, kubawerlos/php-cs-fixer-custom-fixers and symplify/easy-coding-standard so a new upstream minor release cannot change the formatting result without a release of this package. Signed-off-by: Maurizio Monticelli <maurizio@whatwedo.ch>
Signed-off-by: Maurizio Monticelli <maurizio@whatwedo.ch>
Run `make ecs` on pushes to main and on pull requests and fail the build when ECS would change a file. Signed-off-by: Maurizio Monticelli <maurizio@whatwedo.ch>
rugbymauri
force-pushed
the
feat/ecs-13
branch
from
November 9, 2026 08:52
ecfdb28 to
e35cdd1
Compare
tuxes3
approved these changes
Nov 10, 2026
tuxes3
left a comment
Member
There was a problem hiding this comment.
@rugbymauri ok...
Ich Persönlich bin der Meinung wir sollten ~ verwenden. Wir hatten schon Probleme damit, siehe zB diesen commit: 3b1a66f
Man kann es aber einfach im Projekt blockieren, somit ok. Aber überleg es dir doch nochmals 👍
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
refs: #36
Summary
This branch becomes v2.0.0 of the whatwedo coding standard. Two changes make it a major:
the base standard moves from PSR-12 to PER Coding Style 3.0, and
symplify/easy-coding-standardgoes from 12 to 13 (bundling php-cs-fixer 3.95.24 and PHP_CodeSniffer 4.0.4). Both reformat code
that passed under v1, so the first run in a consuming project produces a large diff.
Alongside that, the shipped sets move to ECS's fluent config format and can now be referenced
through
WhatwedoSetsclass constants instead of a vendor path, ten overrides that held back rulesof the sets are gone, and seven rules leave the standard — two of them because they were defective.
Rule balance
^13The +68 has two separate causes, isolated by measuring three configs with the same command:
So the dependency update alone accounts for +60/−5, and the config changes in this branch
for +20/−7. The old config still loads under ECS 13, which is what makes the split measurable
rather than guessed.
Breaking changes
PER-CS, 3 more come from
COMMON. The single rule PER-CS does not cover,DeclareParenthesesFixer, is registered explicitly in the common set so the switch does notlose it.
VisibilityRequiredFixerdisappears — it is a@deprecatedproxy ontoModifierKeywordsFixer, which PER-CS brings with the same default (const, method, property).above all through the ~20 new Symplify commenting fixers pulled in by
DOCBLOCKandSPACES.Pipelines fail until
vendor/bin/ecs check --fixhas been run once.configuration. What that changes in checked code: casts are spaced (
(int) $x), comparisons dropthe Yoda order (
$x === null, and an existingnull === $xis rewritten),$i ++becomes$i++, broken PHPDoc inline tags are normalised (@{TAG}to{@TAG}),@return nulland@subpackageare dropped, a blank line follows thenamespacestatement, every call in a methodchain is indented to one level, and every operator in a multiline expression moves to the beginning of the continuation line, where the
previous
only_booleanssetting limited that to&&and||.Most visible reformatting on the first run: trailing commas in multiline argument and parameter
lists (now also
matchand destructuring),fn()instead offn (),?intinstead of? int,Foo::barwithout spaces around::, single-line empty bodies, chained-call indentation,multiline operators at the beginning of the line, Yoda comparisons rewritten, a blank line after
namespace, and docblock cleanup.Rules that leave the standard
Seven of the rules v1 registered are no longer active. Two of them were defective on a PHP 8.3+
code base, and both defects shipped in v1.3.2, which is why they are typed
fix:.NoNullableBooleanTypeFixer?booltobooland leaves the body untouched, soecs --fixturns working tri-state code into aTypeErroron the next call withnull. ECS has no--allow-riskygate anywhere in its source, so it cannot be tamed by configuration.FileCommentSniff@copyright 2026 whatwedo GmbHto@copyright 2026 Squiz Pty Ltd (ABN 77 084 670 600)and asks for@author Squiz Pty Ltd <products@squiz.net>. A file with a/** */header also never converged — after--fixthe sniff still reportedMissingPackageTag,MissingSubpackageTag,PackageTagOrderandSpacingAfterOpen, none of them fixable.FunctionCommentThrowTagSniff@throwstags it demands are incomplete and it misses the ones that matter. PHPStan answers the same question from the call chain.ClassCommentSniff.Missingskipped, so it never asked for a class docblock — it only policed the shape of the ones that exist, which the sets cover for every other docblock.PhpdocVarAnnotationCorrectOrderFixerSwitchedTypeAndNameFixerfrom theDOCBLOCKset already turns/** @var $cache array */into/** @var array $cache */.ForbiddenAnnotationsSniffVisibilityRequiredFixer@deprecatedproxy ontoModifierKeywordsFixer, which PER-CS brings with the same default.Three skips remain, all of them deliberate style decisions rather than workarounds:
IsNullFixer,NotOperatorWithSuccessorSpaceFixerandPhpdocNoAliasTagFixer, plusValidClassNameSniffrestricted to**/whatwedo*.php.What does not break
ecs.php. Bothsets([<path>])in the old callable format andwithSets([<path>])in the fluent format load the new set files; verified against a probeproject with each style.
WhatwedoSetsis an addition, not a replacement.php: >=7.4stays. ECS 13.3.2 itself only requiresphp >=7.2, and both custom-fixerpackages allow
^7.4 || ^8.0.$a.$b. TheConcatSpaceFixeroverride withspacing: noneisdeliberate — the Symfony coding standard concatenates without spaces where the ECS sets use one —
and now carries a comment saying so, so it does not get "cleaned up" next time.
PER_CSset setssort_algorithm: nonebecause PER-CS leavesimport order open; the common set pins it back to
alpha, which the whatwedo standard has alwaysused.
@templateand@implementsare safe.ClassCommentSniff.TagNotAllowedwarns on every tagit sees, but that code proved unreachable in the shipped combination — and the sniff is gone now
anyway.
For reviewers — commit by commit
Thirteen commits, each of which passes
vendor/bin/ecs checkon its own (verified per commit, notonly at the tip).
style(fixer): align dump fixer file header…@author, so the upstream attribution moves into the docblock text.chore(deps)!: update to symplify/easy-coding-standard ^13kubawerlos/php-cs-fixer-custom-fixersandslevomat/coding-standardare lifted.docs(readme): rework the install and usage section--devinstall, the set to reference per project type,ecs.phpin the fluent format.refactor(config): move the shipped sets to the ECS fluent config formatCLEAN_CODE(imported byCOMMONin full) and 17 skips that targeted rules no ECS 13 set ships any more.feat(config): reference the shipped sets through WhatwedoSets constantswhatwedo\PhpCodingStandard\Set\WhatwedoSetswithCOMMON,SYMFONY,WORDPRESSand the internalRULES.feat(config)!: build every set on PER-CS 3.0 instead of PSR-12config/whatwedo-rules.php, loaded last so they win over the base set.docs: declare the paths to check in ecs.php__DIR__-relative paths, sovendor/bin/ecs checkneeds no directory argument.feat(config)!: let the sets apply the rules we had suppressedNoExtraBlankLinesFixerskip had no effect (PER_CSnarrows that fixer to blank lines between imports, whichNoBlankLineBetweenImportsFixeralready removes), and thepositionset next toonly_booleanswas the php-cs-fixer default.refactor(config): drop the registrations that have no effectAssignmentInConditionSniffregistered and skipped in the same file, the redundant@varorder fixer, the unconfigured forbidden-annotations sniff. Results unchanged.fix(config): keep enum cases at the top of the enumOrderedClassElementsFixernever listedcase, and every type the list omits is sorted to the end — so--fixmoved the cases of a correct enum below its methods. Fixed by dropping the own order entirely rather than patching it:PER_CSconfigures the fixer asorder => ['use_trait'], which sorts trait imports up and leaves the rest of the class alone. The cost: the order of properties, constants and methods is no longer enforced.fix(config): keep the nullability of bool types?bool→boolTypeError, see the table above.fix(config): keep the copyright of the file headerfeat(config): leave the docblock checks to phpstan and the sets@throws, class docblock style).Ordering note: the
ECSConfigBuilderalways processessets→paths→skip→rules→rulesWithConfiguration, regardless of call order in the file. Own rules therefore always win overthe sets, and skips apply wherever they stand.
Open points
LanguageConstructSpacingSniffdoes not show up as active in the shipped set combination eventhough
SpacesLevelreferences it (PHPCS 4 moved it fromSquiztoGeneric). Worth a check ifwe want the rule.
config/whatwedo-rules.phpandWhatwedoSets::RULESexist to run one rule list on two base sets.With PER-CS as the only base, the split has lost its purpose and could be folded back into
whatwedo-common.php.NoImportFromGlobalNamespaceFixerstays, so\DateTimeImmutableis written inline rather thanimported. That is a style decision, not a necessity — flagging it because on PHP 8.3+ it also
covers
\Stringable,\JsonExceptionand\SensitiveParameter.skip()example. There is now no example for excluding rules or files — worth a follow-up if we want that
back.
CHANGELOG.md's## [Unreleased]becomes## [2.0.0]. The releasesv1.3.1and
v1.3.2are tagged but never made it into the changelog.How the numbers were produced
composer.jsonfrom681fe9ain a separate directory,composer update(resolves ECS 12.6.2),then
vendor/bin/ecs list-checkerswith the common config of that tag.ecs list --config).ecs list --config config/whatwedo-common.phpon this branch.and compared with
comm. Deduplication matters:ecs listprints one line per registration, and23 classes are registered by more than one set (
OrderedImportsFixerfour times,ArraySyntaxFixerthree), so at the tip the raw line count is 200 against 175 distinct rules.
ECSConfig::$checkerConfiguration, sinceecs listonly prints class names.