fix: fully-qualify item types in Api/Data SearchResults docblocks - #50
Merged
Conversation
Updated all RMA `*SearchResultsInterface` service contracts to use fully qualified interface names in `getItems()` and `setItems()` docblocks. This removes namespace ambiguity and improves API documentation consistency and static analysis for typed item arrays.
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.
Summary
Every REST list endpoint the module ships (
V1/rma,V1/rma/*/comments,V1/rma/*/attachments,V1/rma/*/items,V1/rma/reasons,V1/rma/statuses,V1/rma/resolution-types,V1/rma/item-conditions) currently fails with a 500:Each
Api/Data/*SearchResultsInterface.phpin the module declares its item type in PHPDoc using the short class name:\Magento\Framework\Reflection\TypeProcessorresolves PHPDoc short names against the interface's ownuseblock only — it does not fall back to the file's own namespace — so the stringCommentInterfacereachesnew ReflectionClass()unqualified and throws.Reproduced against Magento 2.4.8-p5 (PHP 8.3.16) with
mage-os/module-rmaatdev-main(9a0ae70).Change
Fully qualify item types in
@returnand@paramongetItems()/setItems()across all 8Api/Data/*SearchResultsInterface.phpfiles:This matches Magento core convention — e.g.
Magento\Customer\Api\Data\CustomerSearchResultsInterfaceandMagento\Sales\Api\Data\OrderSearchResultInterfaceboth FQ their item types in PHPDoc for the same reason.Only the interface docblocks are touched; the concrete
Model\Data\*SearchResults.phpclasses already have a matchingusefor the item interface, so they never hit this path.Test plan
V1/rma/1/comments?searchCriteria[pageSize]=1reproduces the 500 without the patch.CommentSearchResultsInterfacepayload after the patch (Magento 2.4.8-p5, PHP 8.3.16).