Skip to content

fix(quality): drop the else in parseExpression - #2952

Merged
rubenvdlinde merged 1 commit into
developmentfrom
fix/phpmd-else-in-parse-expression
Aug 28, 2026
Merged

fix(quality): drop the else in parseExpression#2952
rubenvdlinde merged 1 commit into
developmentfrom
fix/phpmd-else-in-parse-expression

Conversation

@rubenvdlinde

Copy link
Copy Markdown
Contributor

Fixes the PHP Quality (phpmd) failure on development — a single violation:

lib/Service/Aggregation/MetricExpressionEvaluator.php:180  ElseExpression
  The method parseExpression uses an else expression.

The change

 			if ($op === '+') {
 				$value = ($value + $rhs);
-			} else {
-				$value = ($value - $rhs);
+				continue;
 			}
+
+			$value = ($value - $rhs);

Why this shape

parseTerm, directly below it in the same file, already handles its two operators with a guard and a continue rather than if/else — and is clean. This makes parseExpression match its sibling rather than introducing a third style (a ternary would also have satisfied phpmd, but nothing else in the file reads that way).

The phpmd baseline carries no entry for this file, so parseTerm genuinely complies rather than being suppressed.

Behaviour

Identical. The while condition admits only + and -, so the guard plus the fall-through cover exactly the two branches the else did.

Verified: php -l clean; no else remains in parseExpression.

Surfaced by ConductionNL/.github#597development had not produced a completed CI verdict in months because every run was cancelled.

PHP Quality (phpmd) fails on development with a single violation:

  MetricExpressionEvaluator.php:180 ElseExpression
  The method parseExpression uses an else expression.

parseTerm, directly below it in the same file, already handles its two
operators with a guard and a continue rather than if/else, and is clean.
This makes parseExpression match its sibling.

Behaviour is identical: the while condition admits only + and -, so the
guard and the fall-through cover exactly the two branches the else did.
@github-actions

Copy link
Copy Markdown
Contributor

Quality Report — ConductionNL/openregister @ 05ff267

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

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

Download the full PDF report from the workflow artifacts.

@rubenvdlinde
rubenvdlinde merged commit 2673058 into development Aug 28, 2026
41 of 43 checks passed
@rubenvdlinde
rubenvdlinde deleted the fix/phpmd-else-in-parse-expression branch August 28, 2026 06:59
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