Repository navigation
refactor(support): read results through SearchesObjects in the contact, transition and subsidy readers - #5883
Merged
Conversation
…subsidy readers before sharing them Assisted-by: ClaudeCode:claude-opus-5-5
…t, transition and subsidy readers Seven classes carried their own copy of the reading SearchesObjects already has: keep an array, take an entity's jsonSerialize() array, anything else is empty. Support\SerialisedResult offers the trait's reading to classes that do not compose it; each private toArray() now delegates to it. Assisted-by: ClaudeCode:claude-opus-5-5
rubenvdlinde
requested review from
WilcoLouwerse,
bbrands02 and
rjzondervan
as code owners
November 11, 2026 15:42
This was referenced Nov 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
Seven classes carried their own copy of a reading
Support\SearchesObjectsalready has (objectToArrayOrNull()): keep an array, take an entity'sjsonSerialize()array, and treat anything else (an object withoutjsonSerialize(), a serialisation that is not an array, a scalar, null) as empty. Two spellings existed (array first, or object first), with the same answers.Service\Support\SerialisedResultoffers the trait's reading to classes that do not composeSearchesObjects:rowOf()(the row or null) andarrayOf()(the row or an empty array). It adds no reading of its own; it composes the trait and calls it. Each privatetoArray()keeps its name and delegates toSerialisedResult::arrayOf(), so every caller stays untouched, including the methods changed by open PRs #5340, #5349 and #5353.Classes:
SubsidieRegisterController,Kcc\CallbackService,Kcc\ContactMomentService,Kcc\RoutingRuleService,StateMachineService,Transitions\CaseResultWriter,Transitions\CaseTypeReader.This replaces #5860, whose new static helper repeated the trait's reading and so was itself reported as a new duplicated fragment while other copies remained.
Characterisation tests
tests/Unit/Service/Support/ResultArrayContactCopiesTest.php, committed first and green on the old code: every copy (by reflection) against nine kinds of result (array, empty array, serialisable to an array, serialisable to a string, plain object,ArrayObject, string, integer, null). 63 cases.What ran
phpunit -c phpunit-unit.xmlon the new test, every unit test class that names one of the seven classes, andtests/Unit/Architecture: 641 tests, all green but two inherited failures.phpcsandphpstan analyseon the touched files: no findings.Inherited:
ServiceCatchReturnsNullTest::testEveryAllowlistEntryNamesALiveSiteis red on development too (a stale allowlist entry forlib/Service/Settings/OpenRegisterBridge.php), andStatusEntryRequirementsGuardTest::testTheEvaluatorReadsTheCaseAsTheFilterDoesneeds an installed openregister checkout beside the app; both untouched here.Duplication figures (duplicated 6-line windows, before -> after)
CallbackService<->ContactMomentService: 23 -> 13 (what remains sits incancelandupdate, both changed by refactor(dossiq): save objects through ObjectSaveOptions #5353, and inresolve,get,relatedandfindOwned)CallbackService<->RoutingRuleService: 9 -> 0CaseTypeReader<->CaseResultWriter: 8 -> 0SubsidieRegisterController<->CaseTypeReader: 8 -> 0AI-assisted: prepared with Claude Code (claude-opus-5-5); reviewed by a maintainer before merge.
Generated by Claude Code