Skip to content

refactor: add null guards in db mappers and fix JsonResponse return type for Psalm 6#12874

Open
ChristophWurst wants to merge 1 commit intomainfrom
fix/psalm-6-null-guards
Open

refactor: add null guards in db mappers and fix JsonResponse return type for Psalm 6#12874
ChristophWurst wants to merge 1 commit intomainfrom
fix/psalm-6-null-guards

Conversation

@ChristophWurst
Copy link
Copy Markdown
Member

Summary

  • LocalMessageMapper: add null guard for getLocalMessageId() before using as array key in getAllForUser, findDue, findDueDrafts; use ?? [] for getRecipients() in updateWithRecipients
  • MessageMapper: extract getMessageId() to a local variable with null guard before using as array key in updateTags and findRelatedData
  • JsonResponse: align @return static@return self on errorFromThrowable to match the actual PHP return type hint

These are Psalm 6 PossiblyNullArrayOffset and MoreSpecificReturnType errors that remain after the Psalm v6 upgrade in #11224.

Test plan

  • PHP unit tests pass (composer test:unit)
  • Psalm static analysis passes (composer psalm)

Part of #11224

…ype for Psalm 6

- LocalMessageMapper: guard getLocalMessageId() before using as array key in
  findAll, findDue, findDueDrafts; use ?? [] for getRecipients()
- MessageMapper: extract getMessageId() to variable with null guard before
  using as array key in updateTags and findRelatedData
- JsonResponse: align @return static → @return self on errorFromThrowable
  to match actual return type hint

AI-assisted: Claude Code (claude-sonnet-4-6)
Signed-off-by: Christoph Wurst <1374172+ChristophWurst@users.noreply.github.com>
@ChristophWurst ChristophWurst requested a review from kesselb as a code owner May 5, 2026 11:41
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