From cbc85da4d139e00e06e60e013b8c6c8346848284 Mon Sep 17 00:00:00 2001 From: Vinai Kopp Date: Sat, 27 Jun 2015 12:06:56 +0200 Subject: [PATCH] Make Api\SearchResults implement Api\SearchResultsInterface Purpose == Make the implementation actually fulfill the contract defined by the interface. Background == The return type hints of almost all the repository implementations of the `getList()` method indicate a return type of `\Magento\Framework\Api\SearchResultsInterface` or one of its sub-interfaces. One example of many is `\Magento\Catalog\Api\ProductRepositoryInterface::getList()`. The return type hint states it returns `\Magento\Catalog\Api\Data\ProductSearchResultsInterface`, which in turn extends `\Magento\Framework\Api\SearchResultsInterface`. However, the concrete implementation preference for that interface is `\Magento\Framework\Api\SearchResults`, which does not implement `\Magento\Framework\Api\SearchResultsInterface` (or any interface for that matter). Reasons for this PR == This PR makes `Api\SearchResults` actually implement `Api\SearchResultsInterface`, forcing all implementations to match the contract. It also improves developer experience because this is pretty much what should be expected of the code anyway. It also makes the preference configuration technically more correct, because the configured concrete class is guaranteed to at least partially fulfill the contract defined by the interface. --- .../Api/Data/CategoryAttributeSearchResultsInterface.php | 2 +- .../Api/Data/ProductAttributeSearchResultsInterface.php | 2 +- .../Catalog/Api/Data/ProductSearchResultsInterface.php | 2 +- .../CatalogInventory/Api/Data/StockCollectionInterface.php | 2 +- .../Api/Data/StockItemCollectionInterface.php | 2 +- .../Api/Data/StockStatusCollectionInterface.php | 2 +- .../Magento/Cms/Api/Data/BlockSearchResultsInterface.php | 2 +- .../Magento/Cms/Api/Data/PageSearchResultsInterface.php | 2 +- .../Customer/Api/Data/AddressSearchResultsInterface.php | 2 +- .../Customer/Api/Data/CustomerSearchResultsInterface.php | 2 +- .../Customer/Api/Data/GroupSearchResultsInterface.php | 2 +- .../Eav/Api/Data/AttributeGroupSearchResultsInterface.php | 2 +- .../Eav/Api/Data/AttributeSearchResultsInterface.php | 2 +- .../Eav/Api/Data/AttributeSetSearchResultsInterface.php | 2 +- .../Magento/Quote/Api/Data/CartSearchResultsInterface.php | 4 ++-- .../Api/Data/CreditmemoCommentSearchResultInterface.php | 2 +- .../Sales/Api/Data/CreditmemoItemSearchResultInterface.php | 2 +- .../Sales/Api/Data/CreditmemoSearchResultInterface.php | 2 +- .../Sales/Api/Data/InvoiceCommentSearchResultInterface.php | 2 +- .../Sales/Api/Data/InvoiceItemSearchResultInterface.php | 2 +- .../Magento/Sales/Api/Data/InvoiceSearchResultInterface.php | 2 +- .../Sales/Api/Data/OrderAddressSearchResultInterface.php | 2 +- .../Sales/Api/Data/OrderItemSearchResultInterface.php | 2 +- .../Sales/Api/Data/OrderPaymentSearchResultInterface.php | 2 +- .../Api/Data/OrderStatusHistorySearchResultInterface.php | 2 +- .../Sales/Api/Data/ShipmentCommentSearchResultInterface.php | 2 +- .../Sales/Api/Data/ShipmentItemSearchResultInterface.php | 2 +- .../Sales/Api/Data/ShipmentSearchResultInterface.php | 2 +- .../Sales/Api/Data/ShipmentTrackSearchResultInterface.php | 2 +- .../Sales/Api/Data/TransactionSearchResultInterface.php | 2 +- .../Magento/Tax/Api/Data/TaxClassSearchResultsInterface.php | 2 +- .../Magento/Tax/Api/Data/TaxRateSearchResultsInterface.php | 2 +- .../Magento/Tax/Api/Data/TaxRuleSearchResultsInterface.php | 2 +- .../Magento/Tax/Test/Unit/Model/TaxClass/RepositoryTest.php | 1 + .../Magento/Ui/Api/Data/BookmarkSearchResultsInterface.php | 2 +- lib/internal/Magento/Framework/Api/SearchResults.php | 6 +++--- .../Magento/Framework/Api/SearchResultsInterface.php | 4 ++-- 37 files changed, 41 insertions(+), 40 deletions(-) diff --git a/app/code/Magento/Catalog/Api/Data/CategoryAttributeSearchResultsInterface.php b/app/code/Magento/Catalog/Api/Data/CategoryAttributeSearchResultsInterface.php index 9decc3aaab231..396e779c7a22e 100644 --- a/app/code/Magento/Catalog/Api/Data/CategoryAttributeSearchResultsInterface.php +++ b/app/code/Magento/Catalog/Api/Data/CategoryAttributeSearchResultsInterface.php @@ -24,5 +24,5 @@ public function getItems(); * @param \Magento\Catalog\Api\Data\CategoryAttributeInterface[] $items * @return $this */ - public function setItems(array $items = null); + public function setItems(array $items); } diff --git a/app/code/Magento/Catalog/Api/Data/ProductAttributeSearchResultsInterface.php b/app/code/Magento/Catalog/Api/Data/ProductAttributeSearchResultsInterface.php index 1d8ed8d78c7ac..efb35c89a3751 100644 --- a/app/code/Magento/Catalog/Api/Data/ProductAttributeSearchResultsInterface.php +++ b/app/code/Magento/Catalog/Api/Data/ProductAttributeSearchResultsInterface.php @@ -24,5 +24,5 @@ public function getItems(); * @param \Magento\Catalog\Api\Data\ProductAttributeInterface[] $items * @return $this */ - public function setItems(array $items = null); + public function setItems(array $items); } diff --git a/app/code/Magento/Catalog/Api/Data/ProductSearchResultsInterface.php b/app/code/Magento/Catalog/Api/Data/ProductSearchResultsInterface.php index 67c3b5ddef820..888a795f73a5b 100644 --- a/app/code/Magento/Catalog/Api/Data/ProductSearchResultsInterface.php +++ b/app/code/Magento/Catalog/Api/Data/ProductSearchResultsInterface.php @@ -24,5 +24,5 @@ public function getItems(); * @param \Magento\Catalog\Api\Data\ProductInterface[] $items * @return $this */ - public function setItems(array $items = null); + public function setItems(array $items); } diff --git a/app/code/Magento/CatalogInventory/Api/Data/StockCollectionInterface.php b/app/code/Magento/CatalogInventory/Api/Data/StockCollectionInterface.php index c3f4b5dcc4d01..a656b049c93a8 100644 --- a/app/code/Magento/CatalogInventory/Api/Data/StockCollectionInterface.php +++ b/app/code/Magento/CatalogInventory/Api/Data/StockCollectionInterface.php @@ -30,5 +30,5 @@ public function getItems(); * @param \Magento\CatalogInventory\Api\Data\StockInterface[] $items * @return $this */ - public function setItems(array $items = null); + public function setItems(array $items); } diff --git a/app/code/Magento/CatalogInventory/Api/Data/StockItemCollectionInterface.php b/app/code/Magento/CatalogInventory/Api/Data/StockItemCollectionInterface.php index bd649dc6f41c3..ee670c352f18a 100644 --- a/app/code/Magento/CatalogInventory/Api/Data/StockItemCollectionInterface.php +++ b/app/code/Magento/CatalogInventory/Api/Data/StockItemCollectionInterface.php @@ -30,7 +30,7 @@ public function getItems(); * @param \Magento\CatalogInventory\Api\Data\StockItemInterface[] $items * @return $this */ - public function setItems(array $items = null); + public function setItems(array $items); /** * Get search criteria. diff --git a/app/code/Magento/CatalogInventory/Api/Data/StockStatusCollectionInterface.php b/app/code/Magento/CatalogInventory/Api/Data/StockStatusCollectionInterface.php index 6f53ba8238eb0..a06aa1ebd0a4a 100644 --- a/app/code/Magento/CatalogInventory/Api/Data/StockStatusCollectionInterface.php +++ b/app/code/Magento/CatalogInventory/Api/Data/StockStatusCollectionInterface.php @@ -27,7 +27,7 @@ public function getItems(); * @param \Magento\CatalogInventory\Api\Data\StockStatusInterface[] $items * @return $this */ - public function setItems(array $items = null); + public function setItems(array $items); /** * Get search criteria. diff --git a/app/code/Magento/Cms/Api/Data/BlockSearchResultsInterface.php b/app/code/Magento/Cms/Api/Data/BlockSearchResultsInterface.php index 682910c4cdcab..7e3335d206a18 100644 --- a/app/code/Magento/Cms/Api/Data/BlockSearchResultsInterface.php +++ b/app/code/Magento/Cms/Api/Data/BlockSearchResultsInterface.php @@ -26,5 +26,5 @@ public function getItems(); * @param \Magento\Cms\Api\Data\BlockInterface[] $items * @return $this */ - public function setItems(array $items = null); + public function setItems(array $items); } diff --git a/app/code/Magento/Cms/Api/Data/PageSearchResultsInterface.php b/app/code/Magento/Cms/Api/Data/PageSearchResultsInterface.php index 58141ae9bf5df..155a0961cf7bf 100644 --- a/app/code/Magento/Cms/Api/Data/PageSearchResultsInterface.php +++ b/app/code/Magento/Cms/Api/Data/PageSearchResultsInterface.php @@ -26,5 +26,5 @@ public function getItems(); * @param \Magento\Cms\Api\Data\PageInterface[] $items * @return $this */ - public function setItems(array $items = null); + public function setItems(array $items); } diff --git a/app/code/Magento/Customer/Api/Data/AddressSearchResultsInterface.php b/app/code/Magento/Customer/Api/Data/AddressSearchResultsInterface.php index f74c607091c2c..bc3cc9c56caef 100644 --- a/app/code/Magento/Customer/Api/Data/AddressSearchResultsInterface.php +++ b/app/code/Magento/Customer/Api/Data/AddressSearchResultsInterface.php @@ -26,5 +26,5 @@ public function getItems(); * @param \Magento\Customer\Api\Data\AddressInterface[] $items * @return $this */ - public function setItems(array $items = null); + public function setItems(array $items); } diff --git a/app/code/Magento/Customer/Api/Data/CustomerSearchResultsInterface.php b/app/code/Magento/Customer/Api/Data/CustomerSearchResultsInterface.php index 9cf801526d308..db5aec8ef40ef 100644 --- a/app/code/Magento/Customer/Api/Data/CustomerSearchResultsInterface.php +++ b/app/code/Magento/Customer/Api/Data/CustomerSearchResultsInterface.php @@ -26,5 +26,5 @@ public function getItems(); * @param \Magento\Customer\Api\Data\CustomerInterface[] $items * @return $this */ - public function setItems(array $items = null); + public function setItems(array $items); } diff --git a/app/code/Magento/Customer/Api/Data/GroupSearchResultsInterface.php b/app/code/Magento/Customer/Api/Data/GroupSearchResultsInterface.php index f8effeeb8fc5a..818baf4a3c26d 100644 --- a/app/code/Magento/Customer/Api/Data/GroupSearchResultsInterface.php +++ b/app/code/Magento/Customer/Api/Data/GroupSearchResultsInterface.php @@ -26,5 +26,5 @@ public function getItems(); * @param \Magento\Customer\Api\Data\GroupInterface[] $items * @return $this */ - public function setItems(array $items = null); + public function setItems(array $items); } diff --git a/app/code/Magento/Eav/Api/Data/AttributeGroupSearchResultsInterface.php b/app/code/Magento/Eav/Api/Data/AttributeGroupSearchResultsInterface.php index fd9a4416c42ca..6c7a6349ddfcc 100644 --- a/app/code/Magento/Eav/Api/Data/AttributeGroupSearchResultsInterface.php +++ b/app/code/Magento/Eav/Api/Data/AttributeGroupSearchResultsInterface.php @@ -21,5 +21,5 @@ public function getItems(); * @param \Magento\Eav\Api\Data\AttributeGroupInterface[] $items * @return $this */ - public function setItems(array $items = null); + public function setItems(array $items); } diff --git a/app/code/Magento/Eav/Api/Data/AttributeSearchResultsInterface.php b/app/code/Magento/Eav/Api/Data/AttributeSearchResultsInterface.php index ccf026345d871..1b010cae41f30 100644 --- a/app/code/Magento/Eav/Api/Data/AttributeSearchResultsInterface.php +++ b/app/code/Magento/Eav/Api/Data/AttributeSearchResultsInterface.php @@ -21,5 +21,5 @@ public function getItems(); * @param \Magento\Eav\Api\Data\AttributeInterface[] $items * @return $this */ - public function setItems(array $items = null); + public function setItems(array $items); } diff --git a/app/code/Magento/Eav/Api/Data/AttributeSetSearchResultsInterface.php b/app/code/Magento/Eav/Api/Data/AttributeSetSearchResultsInterface.php index ef0d07da39cd2..4840175ebd194 100644 --- a/app/code/Magento/Eav/Api/Data/AttributeSetSearchResultsInterface.php +++ b/app/code/Magento/Eav/Api/Data/AttributeSetSearchResultsInterface.php @@ -21,5 +21,5 @@ public function getItems(); * @param \Magento\Eav\Api\Data\AttributeSetInterface[] $items * @return $this */ - public function setItems(array $items = null); + public function setItems(array $items); } diff --git a/app/code/Magento/Quote/Api/Data/CartSearchResultsInterface.php b/app/code/Magento/Quote/Api/Data/CartSearchResultsInterface.php index 8a161def692b0..9a4bbbfee3b19 100644 --- a/app/code/Magento/Quote/Api/Data/CartSearchResultsInterface.php +++ b/app/code/Magento/Quote/Api/Data/CartSearchResultsInterface.php @@ -35,7 +35,7 @@ public function getItems(); * @param \Magento\Quote\Api\Data\CartInterface[] $items * @return $this */ - public function setItems(array $items = null); + public function setItems(array $items); /** * Get search criteria. @@ -50,7 +50,7 @@ public function getSearchCriteria(); * @param \Magento\Framework\Api\SearchCriteriaInterface $searchCriteria * @return $this */ - public function setSearchCriteria(\Magento\Framework\Api\SearchCriteriaInterface $searchCriteria = null); + public function setSearchCriteria(\Magento\Framework\Api\SearchCriteriaInterface $searchCriteria); /** * Get total count. diff --git a/app/code/Magento/Sales/Api/Data/CreditmemoCommentSearchResultInterface.php b/app/code/Magento/Sales/Api/Data/CreditmemoCommentSearchResultInterface.php index 6c669297ee40b..a99bc34c29820 100644 --- a/app/code/Magento/Sales/Api/Data/CreditmemoCommentSearchResultInterface.php +++ b/app/code/Magento/Sales/Api/Data/CreditmemoCommentSearchResultInterface.php @@ -29,5 +29,5 @@ public function getItems(); * @param \Magento\Sales\Api\Data\CreditmemoCommentInterface[] $items * @return $this */ - public function setItems(array $items = null); + public function setItems(array $items); } diff --git a/app/code/Magento/Sales/Api/Data/CreditmemoItemSearchResultInterface.php b/app/code/Magento/Sales/Api/Data/CreditmemoItemSearchResultInterface.php index ad037370d3485..329c36ba27869 100644 --- a/app/code/Magento/Sales/Api/Data/CreditmemoItemSearchResultInterface.php +++ b/app/code/Magento/Sales/Api/Data/CreditmemoItemSearchResultInterface.php @@ -29,5 +29,5 @@ public function getItems(); * @param \Magento\Sales\Api\Data\CreditmemoItemInterface[] $items * @return $this */ - public function setItems(array $items = null); + public function setItems(array $items); } diff --git a/app/code/Magento/Sales/Api/Data/CreditmemoSearchResultInterface.php b/app/code/Magento/Sales/Api/Data/CreditmemoSearchResultInterface.php index 854443a60eca6..38fa62e51bd11 100644 --- a/app/code/Magento/Sales/Api/Data/CreditmemoSearchResultInterface.php +++ b/app/code/Magento/Sales/Api/Data/CreditmemoSearchResultInterface.php @@ -28,5 +28,5 @@ public function getItems(); * @param \Magento\Sales\Api\Data\CreditmemoInterface[] $items * @return $this */ - public function setItems(array $items = null); + public function setItems(array $items); } diff --git a/app/code/Magento/Sales/Api/Data/InvoiceCommentSearchResultInterface.php b/app/code/Magento/Sales/Api/Data/InvoiceCommentSearchResultInterface.php index fd46600844985..3d18d051536d1 100644 --- a/app/code/Magento/Sales/Api/Data/InvoiceCommentSearchResultInterface.php +++ b/app/code/Magento/Sales/Api/Data/InvoiceCommentSearchResultInterface.php @@ -27,5 +27,5 @@ public function getItems(); * @param \Magento\Sales\Api\Data\InvoiceCommentInterface[] $items * @return $this */ - public function setItems(array $items = null); + public function setItems(array $items); } diff --git a/app/code/Magento/Sales/Api/Data/InvoiceItemSearchResultInterface.php b/app/code/Magento/Sales/Api/Data/InvoiceItemSearchResultInterface.php index 50132c276f220..519ff0f1e6fed 100644 --- a/app/code/Magento/Sales/Api/Data/InvoiceItemSearchResultInterface.php +++ b/app/code/Magento/Sales/Api/Data/InvoiceItemSearchResultInterface.php @@ -26,5 +26,5 @@ public function getItems(); * @param \Magento\Sales\Api\Data\InvoiceItemInterface[] $items * @return $this */ - public function setItems(array $items = null); + public function setItems(array $items); } diff --git a/app/code/Magento/Sales/Api/Data/InvoiceSearchResultInterface.php b/app/code/Magento/Sales/Api/Data/InvoiceSearchResultInterface.php index 3be17c7084718..a0cc54740867e 100644 --- a/app/code/Magento/Sales/Api/Data/InvoiceSearchResultInterface.php +++ b/app/code/Magento/Sales/Api/Data/InvoiceSearchResultInterface.php @@ -26,5 +26,5 @@ public function getItems(); * @param \Magento\Sales\Api\Data\InvoiceInterface[] $items * @return $this */ - public function setItems(array $items = null); + public function setItems(array $items); } diff --git a/app/code/Magento/Sales/Api/Data/OrderAddressSearchResultInterface.php b/app/code/Magento/Sales/Api/Data/OrderAddressSearchResultInterface.php index d0a9d55c08c6a..6b6964f847557 100644 --- a/app/code/Magento/Sales/Api/Data/OrderAddressSearchResultInterface.php +++ b/app/code/Magento/Sales/Api/Data/OrderAddressSearchResultInterface.php @@ -28,5 +28,5 @@ public function getItems(); * @param \Magento\Sales\Api\Data\OrderAddressInterface[] $items * @return $this */ - public function setItems(array $items = null); + public function setItems(array $items); } diff --git a/app/code/Magento/Sales/Api/Data/OrderItemSearchResultInterface.php b/app/code/Magento/Sales/Api/Data/OrderItemSearchResultInterface.php index 4fa7587d80fab..20a9ee79f44a5 100644 --- a/app/code/Magento/Sales/Api/Data/OrderItemSearchResultInterface.php +++ b/app/code/Magento/Sales/Api/Data/OrderItemSearchResultInterface.php @@ -28,5 +28,5 @@ public function getItems(); * @param \Magento\Sales\Api\Data\OrderItemInterface[] $items * @return $this */ - public function setItems(array $items = null); + public function setItems(array $items); } diff --git a/app/code/Magento/Sales/Api/Data/OrderPaymentSearchResultInterface.php b/app/code/Magento/Sales/Api/Data/OrderPaymentSearchResultInterface.php index 474b015aff872..3f19b2d9d4a66 100644 --- a/app/code/Magento/Sales/Api/Data/OrderPaymentSearchResultInterface.php +++ b/app/code/Magento/Sales/Api/Data/OrderPaymentSearchResultInterface.php @@ -28,5 +28,5 @@ public function getItems(); * @param \Magento\Sales\Api\Data\OrderPaymentInterface[] $items * @return $this */ - public function setItems(array $items = null); + public function setItems(array $items); } diff --git a/app/code/Magento/Sales/Api/Data/OrderStatusHistorySearchResultInterface.php b/app/code/Magento/Sales/Api/Data/OrderStatusHistorySearchResultInterface.php index 05d2ffc7e90fb..3ff98f4153130 100644 --- a/app/code/Magento/Sales/Api/Data/OrderStatusHistorySearchResultInterface.php +++ b/app/code/Magento/Sales/Api/Data/OrderStatusHistorySearchResultInterface.php @@ -28,5 +28,5 @@ public function getItems(); * @param \Magento\Sales\Api\Data\OrderStatusHistoryInterface[] $items * @return $this */ - public function setItems(array $items = null); + public function setItems(array $items); } diff --git a/app/code/Magento/Sales/Api/Data/ShipmentCommentSearchResultInterface.php b/app/code/Magento/Sales/Api/Data/ShipmentCommentSearchResultInterface.php index 442f6ee17c215..4a3847d906879 100644 --- a/app/code/Magento/Sales/Api/Data/ShipmentCommentSearchResultInterface.php +++ b/app/code/Magento/Sales/Api/Data/ShipmentCommentSearchResultInterface.php @@ -27,5 +27,5 @@ public function getItems(); * @param \Magento\Sales\Api\Data\ShipmentCommentInterface[] $items * @return $this */ - public function setItems(array $items = null); + public function setItems(array $items); } diff --git a/app/code/Magento/Sales/Api/Data/ShipmentItemSearchResultInterface.php b/app/code/Magento/Sales/Api/Data/ShipmentItemSearchResultInterface.php index 54b6f999fba13..ffa2e5417b57a 100644 --- a/app/code/Magento/Sales/Api/Data/ShipmentItemSearchResultInterface.php +++ b/app/code/Magento/Sales/Api/Data/ShipmentItemSearchResultInterface.php @@ -27,5 +27,5 @@ public function getItems(); * @param \Magento\Sales\Api\Data\ShipmentItemInterface[] $items * @return $this */ - public function setItems(array $items = null); + public function setItems(array $items); } diff --git a/app/code/Magento/Sales/Api/Data/ShipmentSearchResultInterface.php b/app/code/Magento/Sales/Api/Data/ShipmentSearchResultInterface.php index 41aed7955a1bf..6a3e77477faa8 100644 --- a/app/code/Magento/Sales/Api/Data/ShipmentSearchResultInterface.php +++ b/app/code/Magento/Sales/Api/Data/ShipmentSearchResultInterface.php @@ -29,5 +29,5 @@ public function getItems(); * @param \Magento\Sales\Api\Data\ShipmentInterface[] $items * @return $this */ - public function setItems(array $items = null); + public function setItems(array $items); } diff --git a/app/code/Magento/Sales/Api/Data/ShipmentTrackSearchResultInterface.php b/app/code/Magento/Sales/Api/Data/ShipmentTrackSearchResultInterface.php index e34a4003452d6..d6e20cf1ae9e1 100644 --- a/app/code/Magento/Sales/Api/Data/ShipmentTrackSearchResultInterface.php +++ b/app/code/Magento/Sales/Api/Data/ShipmentTrackSearchResultInterface.php @@ -28,5 +28,5 @@ public function getItems(); * @param \Magento\Sales\Api\Data\ShipmentTrackInterface[] $items * @return $this */ - public function setItems(array $items = null); + public function setItems(array $items); } diff --git a/app/code/Magento/Sales/Api/Data/TransactionSearchResultInterface.php b/app/code/Magento/Sales/Api/Data/TransactionSearchResultInterface.php index 20e23a5f9bd33..3f783f9f811ea 100644 --- a/app/code/Magento/Sales/Api/Data/TransactionSearchResultInterface.php +++ b/app/code/Magento/Sales/Api/Data/TransactionSearchResultInterface.php @@ -26,5 +26,5 @@ public function getItems(); * @param \Magento\Sales\Api\Data\TransactionInterface[] $items * @return $this */ - public function setItems(array $items = null); + public function setItems(array $items); } diff --git a/app/code/Magento/Tax/Api/Data/TaxClassSearchResultsInterface.php b/app/code/Magento/Tax/Api/Data/TaxClassSearchResultsInterface.php index 0124ff349f686..828f05088c191 100644 --- a/app/code/Magento/Tax/Api/Data/TaxClassSearchResultsInterface.php +++ b/app/code/Magento/Tax/Api/Data/TaxClassSearchResultsInterface.php @@ -25,5 +25,5 @@ public function getItems(); * @param \Magento\Tax\Api\Data\TaxClassInterface[] $items * @return $this */ - public function setItems(array $items = null); + public function setItems(array $items); } diff --git a/app/code/Magento/Tax/Api/Data/TaxRateSearchResultsInterface.php b/app/code/Magento/Tax/Api/Data/TaxRateSearchResultsInterface.php index b467b844d19a3..cf037ad071bd3 100644 --- a/app/code/Magento/Tax/Api/Data/TaxRateSearchResultsInterface.php +++ b/app/code/Magento/Tax/Api/Data/TaxRateSearchResultsInterface.php @@ -28,5 +28,5 @@ public function getItems(); * @param \Magento\Tax\Api\Data\TaxRateInterface[] $items * @return $this */ - public function setItems(array $items = null); + public function setItems(array $items); } diff --git a/app/code/Magento/Tax/Api/Data/TaxRuleSearchResultsInterface.php b/app/code/Magento/Tax/Api/Data/TaxRuleSearchResultsInterface.php index dc0e83dcfe724..1d141188169d8 100644 --- a/app/code/Magento/Tax/Api/Data/TaxRuleSearchResultsInterface.php +++ b/app/code/Magento/Tax/Api/Data/TaxRuleSearchResultsInterface.php @@ -25,5 +25,5 @@ public function getItems(); * @param \Magento\Tax\Api\Data\TaxRuleInterface[] $items * @return $this */ - public function setItems(array $items = null); + public function setItems(array $items); } diff --git a/app/code/Magento/Tax/Test/Unit/Model/TaxClass/RepositoryTest.php b/app/code/Magento/Tax/Test/Unit/Model/TaxClass/RepositoryTest.php index bfab6b77acc7f..277c10f7b2bfc 100644 --- a/app/code/Magento/Tax/Test/Unit/Model/TaxClass/RepositoryTest.php +++ b/app/code/Magento/Tax/Test/Unit/Model/TaxClass/RepositoryTest.php @@ -222,6 +222,7 @@ public function testGetList() $collection->expects($this->any())->method('getSize')->willReturn(2); $collection->expects($this->any())->method('setItems')->with([$taxClassOne, $taxClassTwo]); + $collection->expects($this->any())->method('getItems')->willReturn([$taxClassOne, $taxClassTwo]); $collection->expects($this->once())->method('setCurPage')->with(0); $collection->expects($this->once())->method('setPageSize')->with(20); diff --git a/app/code/Magento/Ui/Api/Data/BookmarkSearchResultsInterface.php b/app/code/Magento/Ui/Api/Data/BookmarkSearchResultsInterface.php index ba120e37f1e4f..36df199ab9b56 100644 --- a/app/code/Magento/Ui/Api/Data/BookmarkSearchResultsInterface.php +++ b/app/code/Magento/Ui/Api/Data/BookmarkSearchResultsInterface.php @@ -26,5 +26,5 @@ public function getItems(); * @param \Magento\Ui\Api\Data\BookmarkInterface[] $items * @return $this */ - public function setItems(array $items = null); + public function setItems(array $items); } diff --git a/lib/internal/Magento/Framework/Api/SearchResults.php b/lib/internal/Magento/Framework/Api/SearchResults.php index e828617e416da..2a2ebba53e28f 100644 --- a/lib/internal/Magento/Framework/Api/SearchResults.php +++ b/lib/internal/Magento/Framework/Api/SearchResults.php @@ -9,7 +9,7 @@ /** * SearchResults Service Data Object used for the search service requests */ -class SearchResults extends AbstractSimpleObject +class SearchResults extends AbstractSimpleObject implements SearchResultsInterface { const KEY_ITEMS = 'items'; const KEY_SEARCH_CRITERIA = 'search_criteria'; @@ -49,10 +49,10 @@ public function getSearchCriteria() /** * Set search criteria * - * @param \Magento\Framework\Api\SearchCriteria $searchCriteria + * @param SearchCriteriaInterface $searchCriteria * @return $this */ - public function setSearchCriteria(\Magento\Framework\Api\SearchCriteria $searchCriteria) + public function setSearchCriteria(\Magento\Framework\Api\SearchCriteriaInterface $searchCriteria) { return $this->setData(self::KEY_SEARCH_CRITERIA, $searchCriteria); } diff --git a/lib/internal/Magento/Framework/Api/SearchResultsInterface.php b/lib/internal/Magento/Framework/Api/SearchResultsInterface.php index 08c86090cbfcf..67870b2870139 100644 --- a/lib/internal/Magento/Framework/Api/SearchResultsInterface.php +++ b/lib/internal/Magento/Framework/Api/SearchResultsInterface.php @@ -26,7 +26,7 @@ public function getItems(); * @param \Magento\Framework\Api\ExtensibleDataInterface[] $items * @return $this */ - public function setItems(array $items = null); + public function setItems(array $items); /** * Get search criteria. @@ -41,7 +41,7 @@ public function getSearchCriteria(); * @param \Magento\Framework\Api\SearchCriteriaInterface $searchCriteria * @return $this */ - public function setSearchCriteria(\Magento\Framework\Api\SearchCriteriaInterface $searchCriteria = null); + public function setSearchCriteria(\Magento\Framework\Api\SearchCriteriaInterface $searchCriteria); /** * Get total count.