Skip to content

chore: enforce the code style and Rector gates - #29

Merged
ogorzalka merged 3 commits into
mainfrom
chore/enforce-gates
Nov 17, 2026
Merged

ogorzalka merged 3 commits into
mainfrom
chore/enforce-gates

Conversation

@ogorzalka

Copy link
Copy Markdown
Member

Turns two of the three observed gates of this repository into blocking ones: Code style and Rector. Static analysis stays observed, with the reason below.

Code style. The harness Pint preset (vendor/pollora/harness/presets/pint.json) is stricter than the repository's own configuration, which is why the gate had been left observed. It fixed 41 files: 33 test files lacked declare(strict_types=1) (added: only tests/ changes here for that rule, src/ already had it), and in 8 classes the order of the class elements and the separation of attributes now follow the preset.

Rector. 22 files: typed class constants (final public const string …, PHP 8.3), separate use statements, first-class callables, one constructor promotion, a redundant union @return removed, and in_array(…, true) in TaxQueryBuilder::field() (the value and the allowed list are strings, so the result is the same).

Static analysis (left observed): 26 errors, down from 38. The 12 new static() errors are fixed with @phpstan-consistent-constructor on the six query classes. The 26 left: 19 come from the SubQuery trait reading properties of the class that uses it by a built name ($this->{$field}), which PHPStan cannot follow; 4 are array-shape docblocks of DateQueryBuilder; 3 are others. Two of them point at something that may be a real typing slip, not fixed here: in Traits/Tag.php (lines 87 and 97) $tagSlug_And is typed array<string>|null but receives array<int>, and $tagSlug_In is the other way round. Making this gate blocking needs either a baseline (it would widen the ratchet from 0) or a rework of the trait; that is a separate decision.

Checked. 429 tests pass; pollora-qa check --mutation passes every gate that is not observed, mutation score 95.56 % (floor 93) and line coverage 97.66 % (floor 97.12), both "improved". Pint with the harness preset and Rector --dry-run are clean. The public API surface check (QA-04/QA-05) runs in this pull request's CI: typed constants are the only change that could touch it.

Olivier Gorzalka added 3 commits November 17, 2026 17:09
@ogorzalka
ogorzalka merged commit 272dae7 into main Nov 17, 2026
17 checks passed
@ogorzalka
ogorzalka deleted the chore/enforce-gates branch November 17, 2026 17:26
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