Fix incorrect return type for getOptionByCode method #39389
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.
Description (*)
I've noticed that
\Magento\Catalog\Model\Product\Configuration\Item\ItemInterface::getOptionByCode
return type is defined as object all the time:magento2/app/code/Magento/Catalog/Model/Product/Configuration/Item/ItemInterface.php
Lines 24 to 30 in b2ce2a3
However, this interface implements 3 classes, and each of them returns object OR null, so it's a bug in the method definition on interface:
magento2/app/code/Magento/Quote/Model/Quote/Address/Item.php
Lines 200 to 210 in 6729b6e
magento2/app/code/Magento/Quote/Model/Quote/Item.php
Lines 726 to 738 in 2afe92f
magento2/app/code/Magento/Wishlist/Model/Item.php
Lines 697 to 709 in 795b2c6
This pull request fixes incorrect phpdoc block, which leads to confusion, which leads to bugs during development
Related Pull Requests
Fixed Issues (if relevant)
Manual testing scenarios (*)
Questions or comments
Contribution checklist (*)