From 54b5d8e6a31f6491ae11842cb5ac4f7f6dff8a01 Mon Sep 17 00:00:00 2001 From: Liam Toohey Date: Tue, 9 Jun 2020 10:16:32 +0100 Subject: [PATCH 1/4] Fix static analysis --- composer.json | 3 ++- dev/tests/_support/AcceptanceTester.php | 3 ++- dev/tests/acceptance/CheckoutCest.php | 4 +++- src/Model/GetInventoryRequestFromOrder.php | 2 +- src/Model/GetItemsToDeductFromOrder.php | 2 +- src/Model/GetSourceSelectionResultFromOrder.php | 5 +++-- src/Plugin/SourceDeductionProcessor.php | 2 +- 7 files changed, 13 insertions(+), 8 deletions(-) diff --git a/composer.json b/composer.json index 6619870..c434fd5 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,8 @@ "src/registration.php" ], "psr-4": { - "Ampersand\\DisableStockReservation\\": "src" + "Ampersand\\DisableStockReservation\\": "src", + "Ampersand\\DisableStockReservation\\": "dev" } }, "repositories": [ diff --git a/dev/tests/_support/AcceptanceTester.php b/dev/tests/_support/AcceptanceTester.php index 11ad6d0..aabab30 100644 --- a/dev/tests/_support/AcceptanceTester.php +++ b/dev/tests/_support/AcceptanceTester.php @@ -1,5 +1,6 @@ getGuestQuote(); - $I->expectThrowable(Exception\RequestedQtyNotAvailable::class, function() use ($newCartId, $I) { + $I->expectThrowable(Exception\RequestedQtyNotAvailable::class, function () use ($newCartId, $I) { $I->addSimpleProductToQuote($newCartId, 'amp_verify_stock_deduction_prevents_add_to_basket', 30); }); diff --git a/src/Model/GetInventoryRequestFromOrder.php b/src/Model/GetInventoryRequestFromOrder.php index 9142945..19ea768 100644 --- a/src/Model/GetInventoryRequestFromOrder.php +++ b/src/Model/GetInventoryRequestFromOrder.php @@ -107,7 +107,7 @@ public function execute(OrderInterface $order, array $requestItems): InventoryRe */ private function getAddressFromOrder(OrderInterface $order): ?AddressInterface { - /** @var Address $shippingAddress */ + /** @var Address|null $shippingAddress */ $shippingAddress = $order->getShippingAddress(); if ($shippingAddress === null) { return null; diff --git a/src/Model/GetItemsToDeductFromOrder.php b/src/Model/GetItemsToDeductFromOrder.php index 183d3c4..a290dea 100644 --- a/src/Model/GetItemsToDeductFromOrder.php +++ b/src/Model/GetItemsToDeductFromOrder.php @@ -52,7 +52,7 @@ public function execute(Order $order): array { $itemsToOrder = []; - /** @var \Magento\Sales\Model\Order\Item $orderItem */ + /** @var \Magento\Sales\Model\Order\Item|null $orderItem */ foreach ($order->getAllVisibleItems() as $orderItem) { if ($orderItem->getParentItem() !== null) { continue; diff --git a/src/Model/GetSourceSelectionResultFromOrder.php b/src/Model/GetSourceSelectionResultFromOrder.php index 8b2a42a..8ede399 100644 --- a/src/Model/GetSourceSelectionResultFromOrder.php +++ b/src/Model/GetSourceSelectionResultFromOrder.php @@ -82,12 +82,13 @@ public function execute(OrderInterface $order): SourceSelectionResultInterface /** * Get selection request items * - * @param OrderItemInterface[]|Traversable $orderItems + * @param OrderItemInterface[] $orderItems * @return array */ - private function getSelectionRequestItems(iterable $orderItems): array + private function getSelectionRequestItems($orderItems): array { $selectionRequestItems = []; + /** @var \Magento\Sales\Model\Order\Item $orderItem */ foreach ($orderItems as $orderItem) { if ($orderItem->isDummy()) { continue; diff --git a/src/Plugin/SourceDeductionProcessor.php b/src/Plugin/SourceDeductionProcessor.php index 3644edd..6f3bcd2 100644 --- a/src/Plugin/SourceDeductionProcessor.php +++ b/src/Plugin/SourceDeductionProcessor.php @@ -78,7 +78,7 @@ public function __construct( * @param OrderService $subject * @param OrderInterface $result * - * @return OrderInterface + * @return OrderInterface|void * @throws CouldNotSaveException * @throws InputException * @throws LocalizedException From 6cfd45454b8be1dd83442d7819efce5c0a4d1ac4 Mon Sep 17 00:00:00 2001 From: Liam Toohey Date: Tue, 9 Jun 2020 10:24:33 +0100 Subject: [PATCH 2/4] Revert phpcs namespace for dev dir --- composer.json | 3 +-- dev/tests/_support/AcceptanceTester.php | 2 -- dev/tests/acceptance/CheckoutCest.php | 2 -- 3 files changed, 1 insertion(+), 6 deletions(-) diff --git a/composer.json b/composer.json index c434fd5..6619870 100644 --- a/composer.json +++ b/composer.json @@ -12,8 +12,7 @@ "src/registration.php" ], "psr-4": { - "Ampersand\\DisableStockReservation\\": "src", - "Ampersand\\DisableStockReservation\\": "dev" + "Ampersand\\DisableStockReservation\\": "src" } }, "repositories": [ diff --git a/dev/tests/_support/AcceptanceTester.php b/dev/tests/_support/AcceptanceTester.php index aabab30..0d3e817 100644 --- a/dev/tests/_support/AcceptanceTester.php +++ b/dev/tests/_support/AcceptanceTester.php @@ -1,7 +1,5 @@ Date: Tue, 9 Jun 2020 10:37:34 +0100 Subject: [PATCH 3/4] Update .travis.yml --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index e3fe4e7..99ca0a0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,7 +17,7 @@ install: - cd vendor/ampersand/travis-vanilla-magento/instances/disablestockres - export COMPOSER_MEMORY_LIMIT=-1 - composer config repo.disablestockres git "../../../../../" - - composer require ampersand/magento2-disable-stock-reservation dev-$TRAVIS_BRANCH || composer require ampersand/magento2-disable-stock-reservation $TRAVIS_BRANCH + - composer require -vvv ampersand/magento2-disable-stock-reservation dev-$TRAVIS_BRANCH || composer require -vvv ampersand/magento2-disable-stock-reservation $TRAVIS_BRANCH - php bin/magento setup:upgrade # compile magento - php bin/magento setup:di:compile From 801be69594ddd929eef2107840413ae762827f9d Mon Sep 17 00:00:00 2001 From: Luke Rodgers Date: Tue, 28 Apr 2020 10:02:33 +0100 Subject: [PATCH 4/4] Fix travis failure (#19) Prevent travis tests from using non tagged versions --- composer.json | 1 - 1 file changed, 1 deletion(-) diff --git a/composer.json b/composer.json index 6619870..4d6223d 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,6 @@ "name": "ampersand/magento2-disable-stock-reservation", "description": "This module disables the inventory reservation logic introduced as part of MSI in Magento 2.3.3", "type": "magento2-module", - "minimum-stability": "dev", "require": { "magento/framework": "*", "php": "^7.1"