Skip to content

Commit

Permalink
#99 - Add Strict Typing
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrey Zabara committed Nov 3, 2017
1 parent 307de4f commit 4571d70
Show file tree
Hide file tree
Showing 22 changed files with 37 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .htaccess
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
############################################
## adjust memory limit

php_value memory_limit 768M
php_value memory_limit 2048M
php_value max_execution_time 18000

############################################
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Magento\Inventory\Controller\Adminhtml\Source;

use Magento\Backend\App\Action;
Expand Down Expand Up @@ -48,7 +50,7 @@ public function execute()
{
$sourceId = $this->getRequest()->getParam(SourceInterface::SOURCE_ID);
try {
$source = $this->sourceRepository->get($sourceId);
$source = $this->sourceRepository->get((int)$sourceId);

/** @var Page $result */
$result = $this->resultFactory->create(ResultFactory::TYPE_PAGE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public function execute()
foreach ($requestData as $itemData) {
try {
$source = $this->sourceRepository->get(
$itemData[SourceInterface::SOURCE_ID]
(int)$itemData[SourceInterface::SOURCE_ID]
);
$this->dataObjectHelper->populateWithArray($source, $itemData, SourceInterface::class);
$this->sourceRepository->save($source);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ private function processSave(array $requestData, int $sourceId = null): int
/** @var SourceInterface $source */
$source = $this->sourceFactory->create();
} else {
$source = $this->sourceRepository->get($sourceId);
$source = $this->sourceRepository->get((int)$sourceId);
}
$source = $this->sourceHydrator->hydrate($source, $requestData);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function execute()
{
$stockId = $this->getRequest()->getParam(StockInterface::STOCK_ID);
try {
$stock = $this->stockRepository->get($stockId);
$stock = $this->stockRepository->get((int)$stockId);

/** @var Page $result */
$result = $this->resultFactory->create(ResultFactory::TYPE_PAGE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public function execute()
foreach ($requestData as $itemData) {
try {
$stock = $this->stockRepository->get(
$itemData[StockInterface::STOCK_ID]
(int)$itemData[StockInterface::STOCK_ID]
);
$this->dataObjectHelper->populateWithArray($stock, $itemData, StockInterface::class);
$this->stockRepository->save($stock);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public function execute()
$deletedItemsCount = 0;
foreach ($this->massActionFilter->getIds() as $id) {
try {
$this->stockRepository->deleteById($id);
$this->stockRepository->deleteById((int) $id);
$deletedItemsCount++;
} catch (CouldNotDeleteException $e) {
$errorMessage = __('[ID: %1] ', $id) . $e->getMessage();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Magento\InventoryApi\Api;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Magento\InventoryApi\Api\Data;

use Magento\Framework\Api\ExtensibleDataInterface;
Expand Down
2 changes: 2 additions & 0 deletions app/code/Magento/InventoryApi/Api/Data/SourceInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Magento\InventoryApi\Api\Data;

use Magento\Framework\Api\ExtensibleDataInterface;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Magento\InventoryApi\Api\Data;

use Magento\Framework\Api\ExtensibleDataInterface;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Magento\InventoryApi\Api\Data;

use Magento\Framework\Api\SearchResultsInterface;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Magento\InventoryApi\Api\Data;

use Magento\Framework\Api\SearchResultsInterface;
Expand Down
2 changes: 2 additions & 0 deletions app/code/Magento/InventoryApi/Api/Data/StockInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Magento\InventoryApi\Api\Data;

use Magento\Framework\Api\ExtensibleDataInterface;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Magento\InventoryApi\Api\Data;

use Magento\Framework\Api\SearchResultsInterface;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Magento\InventoryApi\Api;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Magento\InventoryApi\Api;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Magento\InventoryApi\Api;

use Magento\Framework\Api\SearchCriteriaInterface;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Magento\InventoryApi\Api;

use Magento\Framework\Api\SearchCriteriaInterface;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Magento\InventoryApi\Api;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Magento\InventoryCatalog\Api;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Magento\InventoryCatalog\Api;

Expand Down

0 comments on commit 4571d70

Please sign in to comment.