Skip to content

style(phpcs): clear the one phpcs ERROR (inline IF not allowed) - #2582

Merged
rubenvdlinde merged 3 commits into
developmentfrom
fix/phpcs-error-debt
Aug 19, 2026
Merged

style(phpcs): clear the one phpcs ERROR (inline IF not allowed)#2582
rubenvdlinde merged 3 commits into
developmentfrom
fix/phpcs-error-debt

Conversation

@rubenvdlinde

Copy link
Copy Markdown
Contributor

Precondition for ConductionNL/.github#483, which makes phpcs errors fail the gate. That PR must not land while any repo still carries errors — .github@main is consumed live, so the flip reaches every repo the instant it merges.

The ternary picking postgres vs mysql quoting for _uuid becomes an explicit if/else. Same two branches, same values, no behaviour change — the sniff objects to the form, not the logic.

Measured, with a control:

before: FOUND 1 ERROR  AND 2 WARNINGS AFFECTING 3 LINES   (614 | ERROR | Inline IF statements are not allowed)
after:  FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES

Warning count unchanged on purpose — this clears errors and leaves the warning debt #483 keeps passing.

Conduction Release Bot added 2 commits August 19, 2026 18:25
Precondition for ConductionNL/.github#483, which makes phpcs ERRORS fail the
gate. That PR must not land while any repo still carries errors, because
`.github@main` is consumed live and the flip reaches every repo the instant it
merges.

The ternary picking the postgres vs mysql quoting for `_uuid` becomes an
explicit if/else. Same two branches, same values, no behaviour change — the
sniff objects to the form, not the logic.

Measured, with a control: before, `FOUND 1 ERROR AND 2 WARNINGS` naming line
614; after, `FOUND 0 ERRORS AND 2 WARNINGS`. The warning count is unchanged on
purpose — this clears errors and leaves the warning debt #483 keeps passing.
The first attempt at this fix traded one gate for two others, and each caught
it in turn:

  ternary        -> phpcs:  "Inline IF statements are not allowed"
  if/else        -> phpmd:  "ElseExpression ... you can simplify the code"
  if-then-override -> coverage ratchet: 9/344 -> 9/346 statements, "coverage of
                     the files this change touches dropped by 0.02%"

That last one is the ratchet working exactly as designed, on a change that adds
STATEMENTS without adding coverage — and it is right to, even though this is a
formatting-only edit. The lesson is to add no statements rather than to buy the
coverage back with a filler test.

`match` is one statement, precisely like the ternary it replaces, so the
statement count does not move. It is not an inline IF and it has no else.

Verified: `php -l` clean, no line over 150 characters, and all four
(needsPreUpdateState x isPostgres) combinations produce byte-identical output to
the original ternary.
@github-actions

Copy link
Copy Markdown
Contributor

Quality Report — ConductionNL/openregister @ 8661c0b

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

Quality workflow — 2026-08-19 16:43 UTC

Download the full PDF report from the workflow artifacts.

@github-actions

Copy link
Copy Markdown
Contributor

Quality Report — ConductionNL/openregister @ 4479210

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

Quality workflow — 2026-08-19 17:04 UTC

Download the full PDF report from the workflow artifacts.

…e count

Third attempt, and the two failures in between were both real findings rather
than noise. Four rules meet on this single line:

  ternary          -> phpcs "Inline IF statements are not allowed"   (the original)
  if/else          -> phpmd "ElseExpression"
  if-then-override -> +2 statements, 344 -> 346, ratchet FAIL -0.02%
  match (2 arms)   -> +3 statements, 344 -> 347, ratchet FAIL -0.03%

I asserted in the last commit that "a match arm is one statement". That was
wrong, and the ratchet said so: clover counts each executable LINE, so a
two-arm match adds three. Any multi-line form adds uncovered statements to a
change that alters no behaviour whatsoever.

A single-expression lookup keyed on the boolean is one statement, exactly like
the ternary it replaces, and is neither an inline IF nor an else.

Verified: `php -l` clean; all four (needsPreUpdateState x isPostgres)
combinations byte-identical to the original ternary; and the count of
`existsColumns =` assignment lines is unchanged against HEAD at 2, which is
what the ratchet actually measures.
@github-actions

Copy link
Copy Markdown
Contributor

Quality Report — ConductionNL/openregister @ 39dc233

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

Quality workflow — 2026-08-19 17:24 UTC

Download the full PDF report from the workflow artifacts.

@rubenvdlinde
rubenvdlinde merged commit 85b30e0 into development Aug 19, 2026
75 of 111 checks passed
@rubenvdlinde
rubenvdlinde deleted the fix/phpcs-error-debt branch August 19, 2026 17:29
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