Skip to content

fix(quality): psalm and phpstan read two OpenRegister runtime types as errors - #2087

Merged
rubenvdlinde merged 1 commit into
developmentfrom
fix/psalm-phpstan-inherited
Sep 19, 2026
Merged

rubenvdlinde merged 1 commit into
developmentfrom
fix/psalm-phpstan-inherited

Conversation

@rubenvdlinde

Copy link
Copy Markdown
Contributor

What was wrong

Two analysers were red on development, and both failures had the same root:
a type that exists only when OpenRegister is installed.

psalm reported UndefinedClass twice for
OCA\OpenRegister\Event\RegistrySubscriptionRequestedEvent, once where
Application registers a lazy service listener for it and once where the
listener checks it with instanceof. Its five sibling events
(ObjectCreatedEvent, ObjectUpdatedEvent, ObjectDeletedEvent and the two
...ingEvents) are already named in the UndefinedClass suppression list for
exactly that reason.

phpstan reported three argument.unresolvableType errors, which is the same
limitation one layer on. MailIntakeService::intake() and
ForwardService::forward() both return OCA\OpenRegister\Db\ObjectEntity, so
getObject() on the result resolves to an error type and the whole
new JSONResponse($data) argument reads as unresolvable.
IntakeRoutingService::firstMatchingRule() fills its rule list from the same
call, so usort over that array reads the same way.

What changed

Configuration only. No file under lib/ is touched.

  • psalm.xml names RegistrySubscriptionRequestedEvent beside its five
    siblings, with the reason written out.
  • phpstan.neon adds MailIntakeController and OutboundLogController to the
    JSONResponse unresolvable-type block that already lists nine paths for this
    effect, and adds a usort entry scoped to lib/Intake/IntakeRoutingService.php.

Both are scoped to named files rather than silencing the identifier across the
tree, which is the rule the existing block states: "every path listed here
references OCA\OpenRegister; re-check that before adding another." Checked:
all three do, by return type.

Verified

  • ./vendor/bin/psalm --threads=1 --no-cache: no errors. It was 2.
  • ./vendor/bin/phpstan analyse --memory-limit=1G: no errors. It was 3.
  • phpstan reports unmatched ignores, and reported none, so the usort pattern
    matched a real error rather than sitting dead.

Inherited, reported not fixed

phpcs (482 errors), phpmd (123 findings), prettier (18 files),
test:l10n (4 strings), check:schema-l10n (261 over baseline) and five hydra
gates are all red on development independently of this change. Each is its
own PR in this sweep.

🤖 Generated with Claude Code

…s errors

psalm could not see OCA\OpenRegister\Event\RegistrySubscriptionRequestedEvent,
which Application registers a lazy service listener for and the listener
itself checks with instanceof. Its five sibling events are already named in
the UndefinedClass suppression list for the same reason, so it joins them.

phpstan reported three unresolvable types with the same root cause one layer
on. MailIntakeService::intake() and ForwardService::forward() both return
OCA\OpenRegister\Db\ObjectEntity, so getObject() on the result is an error
type and the JSON payload built from it cannot resolve; IntakeRoutingService
fills its rule list from the same call and usort over it reads the same way.
Both are scoped to the named files, beside the nine paths already listed for
this effect, rather than silencing the identifier across the tree.

No lib/ file changes. psalm: no errors, was 2. phpstan: no errors, was 3.
@github-actions

Copy link
Copy Markdown
Contributor

Quality Report — ConductionNL/integriq @ b049fad

Check PHP Vue Security License Tests
lint ✅
phpcs ❌
phpmd ❌
psalm ✅
phpstan ✅
phpmetrics ✅
eslint ✅
stylelint ✅
build ✅
build ✅
check-specs ✅
test-l10n ❌
format ❌
check-schema-l10n ❌
check-l10n-js ✅
composer ✅ ✅ 141/141
npm ✅ ✅ 545/545
app:check-code ⏭️
info.xml ✅
REUSE ❌
lockfile sync ✅
PHPUnit ⏭️ not run for this diff — no file in this diff matches the code globs, and none carries a source extension — the heavy tier has nothing to decide about it.
Newman ✅
Playwright ⏭️ deferred: E2E runs locally and on the promotion path only. This pull request targets development, so the suite is asked once per promotion into beta and main rather than once per push per open pull request. Run it on any branch from the Actions tab, or locally with npx playwright test.
Hydra gates ❌
Hydra gates (axe) ✅

Quality workflow — 2026-09-19 11:12 UTC

Download the full PDF report from the workflow artifacts.

@rubenvdlinde
rubenvdlinde merged commit 040f549 into development Sep 19, 2026
41 of 49 checks passed
@rubenvdlinde
rubenvdlinde deleted the fix/psalm-phpstan-inherited branch September 19, 2026 12:51
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