Skip to content

Enable PHPDoc fixer config with parity preserved - #101

Merged
TomasVotruba merged 5 commits into
mainfrom
blink-phpdoc-fixpoint
Sep 30, 2026
Merged

TomasVotruba merged 5 commits into
mainfrom
blink-phpdoc-fixpoint

Conversation

@TomasVotruba

Copy link
Copy Markdown
Member

Completes the configurability work (stacks on #100). Re-enables ECS config for the 9 PHPDoc fixers, so all 51 configurable fixers now honor their options through --blink.

The fix

Wiring the PHPDoc fixers earlier regressed --blink parity 1->45. Investigation showed it was not a single-vs-multi-pass (fixpoint) issue - blink already converges; it converged to the wrong result. The whole regression came from one bug in PhpdocLineSpanFixer: it treated an inline /** @var Type $x */ on a local variable as a class property and reformatted it (cascading into the inline-var docblock fixers). PHP-CS-Fixer's fixer only touches class members. Fix: a bare $var after a docblock is only a property when a modifier (public/var/static/...) precedes it.

Result

  • All 9 PHPDoc fixers enabled (line span, scalar, types, no-alias tag, tag casing, inline tag normalizer, order-by-value, return self-reference, general annotation remove, no-superfluous tags).
  • standalone parity vs ECS on rector-src: 0/1699
  • --blink parity on this repo: back to 1 (the pre-existing TypeToVarTag Skip @type inside docblock description in TypeToVarTagFixer #81 case, unrelated)
  • build, vet, gofmt -s, go fix, modernize, golangci-lint, go test all pass.

With #98 + #100 + this, all 51 configurable fixers honor their ECS config.

blink hardcoded snake_case for PhpUnitMethodCasingFixer and ignored the rule's
case option, so --blink rewrote camelCase test methods to snake_case on any
project whose config keeps the PHP-CS-Fixer default (camel_case), diverging from
ECS.

- add a ConfigurableFixer interface; turbo config resolution applies it
- PhpUnitMethodCasing reads case from the ECS config, defaults to camel_case
- support both directions (camelCase and snake_case), including @Depends refs
- cover both cases with unit tests
Wire per-fixer PHP-CS-Fixer options through the turbo/--blink path via the
ConfigurableFixer interface: array, operator, spacing, casing, language,
class, function, import, whitespace and control-structure fixers now read their
options from the dumped ECS config, with full option semantics and unit tests.
Zero-value structs keep today's behavior, so standalone parity stays 0/1699 and
--blink parity is unchanged.

PHPDoc fixers are deferred: honoring their options in a single pass diverges from
ECS's iterate-to-fixpoint phpdoc handling, so they keep their tuned behavior.
Re-enable ECS config for the 9 PHPDoc fixers (line span, scalar, types, no-alias,
tag casing, inline tag, order-by-value, return-self-reference, annotation-remove,
no-superfluous). The turbo regression they caused was a single bug in
PhpdocLineSpan: it classified an inline @var on a local variable as a property and
reformatted it, which the real fixer (class members only) never touches. Require a
preceding modifier before treating a bare $var as a property.

Standalone parity stays 0/1699 and --blink parity returns to baseline with all 51
configurable fixers now honoring their ECS options.
@TomasVotruba
TomasVotruba merged commit 052ae10 into main Sep 30, 2026
17 checks passed
@TomasVotruba
TomasVotruba deleted the blink-phpdoc-fixpoint branch September 30, 2026 06:38
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