Skip to content

Commit 7efde87

Browse files
committed
#99 - Add Strict Typing - add DataProviders
1 parent dcf565a commit 7efde87

3 files changed

Lines changed: 8 additions & 2 deletions

File tree

Inventory/Ui/DataProvider/Product/Form/Modifier/Sources.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
declare(strict_types=1);
7+
68
namespace Magento\Inventory\Ui\DataProvider\Product\Form\Modifier;
79

810
use Magento\Catalog\Ui\DataProvider\Product\Form\Modifier\AbstractModifier;

Inventory/Ui/DataProvider/SourceDataProvider.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
declare(strict_types=1);
7+
68
namespace Magento\Inventory\Ui\DataProvider;
79

810
use Magento\InventoryApi\Api\Data\SourceInterface;
@@ -81,7 +83,7 @@ public function getData()
8183
// It is need for support of several fieldsets.
8284
// For details see \Magento\Ui\Component\Form::getDataSourceData
8385
if ($data['totalRecords'] > 0) {
84-
$sourceId = $data['items'][0][SourceInterface::SOURCE_ID];
86+
$sourceId = (int) $data['items'][0][SourceInterface::SOURCE_ID];
8587
$sourceGeneralData = $data['items'][0];
8688
$sourceGeneralData['carrier_codes'] = $this->getAssignedCarrierCodes($sourceId);
8789
$dataForSingle[$sourceId] = [

Inventory/Ui/DataProvider/StockDataProvider.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
declare(strict_types=1);
7+
68
namespace Magento\Inventory\Ui\DataProvider;
79

810
use Magento\InventoryApi\Api\Data\SourceInterface;
@@ -91,7 +93,7 @@ public function getData()
9193
// It is need for support of several fieldsets.
9294
// For details see \Magento\Ui\Component\Form::getDataSourceData
9395
if ($data['totalRecords'] > 0) {
94-
$stockId = $data['items'][0][StockInterface::STOCK_ID];
96+
$stockId = (int) $data['items'][0][StockInterface::STOCK_ID];
9597
$stockGeneralData = $data['items'][0];
9698
$dataForSingle[$stockId] = [
9799
'general' => $stockGeneralData,

0 commit comments

Comments
 (0)