refactor: add null guards in db mappers and fix JsonResponse return type for Psalm 6#12874
refactor: add null guards in db mappers and fix JsonResponse return type for Psalm 6#12874ChristophWurst wants to merge 1 commit into
Conversation
…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>
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughThis PR addresses null-safety in data mapper operations by preventing null keys from being used in array lookups across three database mapper classes. In 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
Summary
LocalMessageMapper: add null guard forgetLocalMessageId()before using as array key ingetAllForUser,findDue,findDueDrafts; use?? []forgetRecipients()inupdateWithRecipientsMessageMapper: extractgetMessageId()to a local variable with null guard before using as array key inupdateTagsandfindRelatedDataJsonResponse: align@return static→@return selfonerrorFromThrowableto match the actual PHP return type hintThese are Psalm 6
PossiblyNullArrayOffsetandMoreSpecificReturnTypeerrors that remain after the Psalm v6 upgrade in #11224.Test plan
composer test:unit)composer psalm)Part of #11224