Skip to content

fix(notifier): two coding-standard errors phpcs refuses - #2890

Closed
rubenvdlinde wants to merge 2 commits into
developmentfrom
fix/notifier-coding-standard
Closed

fix(notifier): two coding-standard errors phpcs refuses#2890
rubenvdlinde wants to merge 2 commits into
developmentfrom
fix/notifier-coding-standard

Conversation

@rubenvdlinde

Copy link
Copy Markdown
Contributor

lib/Notification/Notifier.php carries the only two phpcs errors in the tree — 75 files scanned, one E.

They surfaced on an unrelated PR (#2884) that touches nothing but .github/dependabot.yml, which is how I know they belong to the tree rather than to that change.

line rule fix
89 Inline IF statements are not allowed return ($name === '' ? $uid : $name); → an explicit early return
285 All arguments in calls to internal code must use named arguments $this->displayName($principal)$this->displayName(uid: $principal)

The second is the file disagreeing with itself: every other internal call in it already uses named arguments — prepareConfigurationUpdate(notification: …, l: …) and its five neighbours. This one call was the exception, so the fix restores the file's own convention rather than imposing a new one.

Verification

Ran the tool rather than reading the rule: vendor/bin/phpcs lib/Notification/Notifier.php exits 0, and php -l reports no syntax errors.

🤖 Generated with Claude Code

`lib/Notification/Notifier.php` carries the only two phpcs ERRORS in the tree
(75 files scanned, one E). They surfaced on an unrelated PR that touches nothing
but `.github/dependabot.yml`, which is how I know they are the tree's and not
that change's.

  line  89  Inline IF statements are not allowed
            `return ($name === '' ? $uid : $name);` -> an explicit early return

  line 285  All arguments in calls to internal code must use named arguments
            `$this->displayName($principal)` -> `$this->displayName(uid: $principal)`

The second is the file disagreeing with itself: every other internal call in it
already uses named arguments (`prepareConfigurationUpdate(notification: …, l: …)`
and its five neighbours). This one call was the exception.

Verified by running the tool rather than reading the rule: `vendor/bin/phpcs
lib/Notification/Notifier.php` exits 0, and `php -l` reports no syntax errors.
@rubenvdlinde

Copy link
Copy Markdown
Contributor Author

Already on development — this can be closed.

Both hunks landed in #2885 (commit 0af15d0c5), which
fixed the same two phpcs errors as pre-existing debt encountered while working
in that file:

  • the inline if in displayName() is now a block
  • displayName(uid: $principal) uses the named argument

Verified on origin/development, not inferred from the PR state.

composer phpcs is clean on development as a result. #2882 covers the same two
hunks plus a NotifierTest — that test is the part still worth landing, so
it is the one to keep rather than this one.

Not closing it myself in case this branch is still open in another session.

@github-actions

Copy link
Copy Markdown
Contributor

Quality Report — ConductionNL/openregister @ 18d098c

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

Quality workflow — 2026-08-27 00:27 UTC

Download the full PDF report from the workflow artifacts.

The coding-standard fix expands an inline ternary into an if/return, which
phpcs requires ('Inline IF statements are not allowed'). That adds two
statements to Notifier.php, and the coverage guard failed the PR for adding
uncovered code -- correctly: no test exercised the branch.

This covers it, and the branch turns out to matter. With the fallback removed
the prompt renders 'X asks to act on your behalf' with an empty string where
the person should be -- a hole in the sentence rather than a bare uid. The
test was verified to FAIL against that broken version before being committed.

Asserts with a whitespace-only display name, not the empty string, so that
dropping the trim() would also be caught.
@github-actions

Copy link
Copy Markdown
Contributor

Quality Report — ConductionNL/openregister @ 9204467

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

Quality workflow — 2026-08-27 01:37 UTC

Download the full PDF report from the workflow artifacts.

@rubenvdlinde

Copy link
Copy Markdown
Contributor Author

Now fully superseded — safe to close.

#2882 merged, and it carried both of this PR's hunks plus a NotifierTest. development now has:

  • displayName()'s inline if as a block
  • displayName(uid: $principal) with the named argument
  • tests/Unit/Notification/NotifierTest.php — 12 tests, 28 assertions

Verified by content on origin/development. There is nothing left in this branch that is not already merged, so it will either conflict or produce an empty diff.

Leaving the close to whoever owns the branch rather than doing it from here.

@rubenvdlinde

Copy link
Copy Markdown
Contributor Author

Superseded by #2882, which landed the same two phpcs fixes on development together with an equivalent blank-display-name regression test. Nothing here is left to merge — closing rather than resolving the conflict against a tree that already contains the change.

@rubenvdlinde
rubenvdlinde deleted the fix/notifier-coding-standard branch August 27, 2026 05:07
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