From d3a41f5230426de212c74c1f66c99c7797f8b467 Mon Sep 17 00:00:00 2001 From: Ruben van der Linde Date: Sat, 19 Sep 2026 13:07:20 +0200 Subject: [PATCH] fix(quality): psalm and phpstan read two OpenRegister runtime types as 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. --- phpstan.neon | 16 ++++++++++++++++ psalm.xml | 8 ++++++++ 2 files changed, 24 insertions(+) diff --git a/phpstan.neon b/phpstan.neon index aa8127c94..3aa4beb95 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -129,10 +129,26 @@ parameters: - lib/Controller/EventsController.php - lib/Controller/JobsController.php - lib/Controller/LogsController.php + # MailIntakeService::intake() and ForwardService::forward() both + # return OCA\OpenRegister\Db\ObjectEntity, so getObject() on the + # result is an error type and the whole JSON payload reads as + # unresolvable. Same cause, same remedy, as the entries around it. + - lib/Controller/MailIntakeController.php + - lib/Controller/OutboundLogController.php - lib/Controller/OpenFormulierenController.php - lib/Controller/SourcesController.php - lib/Controller/SynchronizationsController.php - lib/Service/EndpointService.php + # The same OpenRegister-is-runtime-only effect, one layer further on. + # IntakeRoutingService::firstMatchingRule() fills $rules from + # ObjectEntity::getObject(), which resolves to an error type, so usort + # over that array is reported as unresolvable rather than the OR symbol + # itself. Scoped to the one file, like the JSONResponse block above. + - + message: '#Parameter \#?1? ?\$array of function usort contains unresolvable type#' + identifier: argument.unresolvableType + path: lib/Intake/IntakeRoutingService.php + # MappingService::executeMapping()'s `is_array($output) === false` guard. # The comment directly above it already records the situation: "The # is_array() guard is dead per static analysis but kept for safety diff --git a/psalm.xml b/psalm.xml index d70cbd089..7b19e9675 100644 --- a/psalm.xml +++ b/psalm.xml @@ -76,6 +76,14 @@ + +