Skip to content

style: apply php-cs-fixer across lib/ and tests/ (no behaviour change) - #815

Merged
rubenvdlinde merged 2 commits into
developmentfrom
chore/php-cs-fixer-sweep
Aug 21, 2026
Merged

style: apply php-cs-fixer across lib/ and tests/ (no behaviour change)#815
rubenvdlinde merged 2 commits into
developmentfrom
chore/php-cs-fixer-sweep

Conversation

@rubenvdlinde

Copy link
Copy Markdown
Contributor

composer cs:check was red on 119 files. php-cs-fixer is wired into no workflow, so this had drifted silently; running it brings the tree to the standard the repo declares.

This cannot change meaning by construction. Conduction\CodingStandard\Config extends Nextcloud's and its ADDITIONS array is empty by design — every rule the fleet wants beyond Nextcloud's is semantic rather than typographic and lives in PHP_CodeSniffer instead, "precisely so it cannot contradict the fixer".

Verified anyway, because an autofix can change meaning:

  • git diff -w (whitespace-blind) is not empty — 110 files — so the run did make token-level changes. Inspected rather than waved through; all three groups are syntactic: use statements reordered (identical text, moved lines), trailing commas added to multi-line signatures (PHP 8.0+, CI runs 8.3/8.4), and promoted constructor properties split across lines. No comparison operators, no declare(strict_types) insertion, nothing semantic.
  • All 119 changed files parse (php -l).
  • Suite identical before and after: 1153 tests, 4573 assertions, 0 failures — the same counts, which is what a purely typographic change should produce.
  • phpmd, psalm, phpstan all exit 0. cs:check now exits 0.

On composer phpcs still exiting 1 — unchanged by this commit and expected. The 108 SPDX-header InvalidEndChar warnings are deliberate: a full stop after SPDX-License-Identifier: EUPL-1.2 makes it a different, invalid identifier and breaks REUSE, so hydra-gates' shared ruleset downgrades that one code to a warning on purpose ("the two requirements are in direct conflict and REUSE wins"). CI counts errors only. I had previously mis-reported these warnings as resolved, off a broken CSV parse; they were never gone, and they should not be "fixed".

`composer cs:check` was red on 119 files. The fixer is wired into no
workflow, so this had drifted silently — running it now brings the tree to
the standard the repo declares.

The ruleset is exactly Nextcloud's: `Conduction\CodingStandard\Config`
extends it and its ADDITIONS array is EMPTY by design, because every rule
the fleet wants beyond Nextcloud's is semantic rather than typographic and
lives in PHP_CodeSniffer instead. So this can only move whitespace and
syntax, never meaning.

Verified rather than assumed, because an autofix CAN change meaning:

  * `git diff -w` (whitespace-blind) is NOT empty — 110 files — so the run
    did make token-level changes, and they were inspected rather than
    waved through. Every one falls into three groups: `use` statements
    REORDERED (identical text, moved lines), trailing commas added to
    multi-line signatures (PHP 8.0+; CI runs 8.3 and 8.4), and promoted
    constructor properties split across lines. No comparison operators, no
    `declare(strict_types)` insertion, nothing semantic.
  * All 119 changed files parse (`php -l`).
  * Suite identical before and after: 1153 tests, 4573 assertions, 0
    failures — the same counts, which is what a typographic change should
    produce.
  * phpmd, psalm, phpstan all exit 0. `cs:check` now exits 0.

`composer phpcs` still exits 1, unchanged by this commit and expected: the
108 SPDX-header `InvalidEndChar` warnings are DELIBERATE. A full stop after
`SPDX-License-Identifier: EUPL-1.2` makes it a different, invalid
identifier and breaks REUSE, so hydra-gates' shared ruleset downgrades that
one code to a warning on purpose. CI counts errors only.
…xer agree

The sweep introduced ONE phpcs error, caught by CI and confirmed by
measuring both branches: development has 0 files with errors, the sweep
branch had 1.

php-cs-fixer's docblock aligner indents a tag description to clear the
longest type on the block. Behind HealthController::engineBody()'s
88-character `array{...}|null` shape that lands at column 95, producing a
162-character line — over phpcs's 150-character budget, which the shared
ruleset adds deliberately because Nextcloud enforces no line length at all.

The two tools genuinely disagree here, so the fix is to remove what they
disagree about: the prose moves into the docblock body, leaving the tag with
nothing to over-align.

Verified against BOTH tools and against the baseline: phpcs errors 0 (same
as development), php-cs-fixer clean (exit 0), warnings still 108 (unchanged
— those are the deliberate SPDX ones REUSE requires), suite green.
@github-actions

Copy link
Copy Markdown
Contributor

Quality Report — ConductionNL/decidesk @ 8a08980

Check PHP Vue Security License Tests
lint
phpcs
phpmd
psalm
phpstan
phpmetrics
eslint
stylelint
build
check-manifest
check-nav-ceiling
test-l10n
format
composer ✅ 104/104
npm ✅ 538/538
app:check-code ⏭️
info.xml
REUSE
PHPUnit
Newman
Playwright
Hydra gates

Quality workflow — 2026-08-21 05:32 UTC

Download the full PDF report from the workflow artifacts.

@github-actions

Copy link
Copy Markdown
Contributor

Quality Report — ConductionNL/decidesk @ ca50196

Check PHP Vue Security License Tests
lint
phpcs
phpmd
psalm
phpstan
phpmetrics
eslint
stylelint
build
check-manifest
check-nav-ceiling
test-l10n
format
composer ✅ 104/104
npm ✅ 538/538
app:check-code ⏭️
info.xml
REUSE
PHPUnit
Newman
Playwright
Hydra gates

Quality workflow — 2026-08-21 06:24 UTC

Download the full PDF report from the workflow artifacts.

@rubenvdlinde
rubenvdlinde merged commit 7d0a095 into development Aug 21, 2026
78 of 80 checks passed
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