Skip to content

Commit ebf5a7d

Browse files
committed
Fixed some failing tests
1 parent d04d462 commit ebf5a7d

File tree

2 files changed

+84
-20
lines changed

2 files changed

+84
-20
lines changed

Ui/Component/Listing/Columns/CategoryActions.php

Lines changed: 42 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
<?php
2+
3+
declare(strict_types=1);
4+
25
namespace Baldwin\UrlDataIntegrityChecker\Ui\Component\Listing\Columns;
36

47
use Magento\Framework\UrlInterface;
58
use Magento\Framework\View\Element\UiComponent\ContextInterface;
69
use Magento\Framework\View\Element\UiComponentFactory;
10+
use Magento\Framework\View\Element\UiComponentInterface;
711
use Magento\Ui\Component\Listing\Columns\Column;
812

913
class CategoryActions extends Column
1014
{
11-
/** @var UrlInterface */
12-
protected UrlInterface $urlBuilder;
15+
private $urlBuilder;
1316

1417
/**
15-
* @param ContextInterface $context
16-
* @param UiComponentFactory $uiComponentFactory
17-
* @param UrlInterface $urlBuilder
18-
* @param array $components
19-
* @param array $data
18+
* @param array<UiComponentInterface> $components
19+
* @param array<mixed> $data
2020
*/
2121
public function __construct(
2222
ContextInterface $context,
@@ -26,21 +26,53 @@ public function __construct(
2626
array $data = []
2727
) {
2828
$this->urlBuilder = $urlBuilder;
29+
2930
parent::__construct($context, $uiComponentFactory, $components, $data);
3031
}
3132

33+
/**
34+
* @param array{
35+
* data: ?array{
36+
* items: array{
37+
* array{
38+
* catId: int,
39+
* name: string,
40+
* storeId: int,
41+
* problem: string,
42+
* hash: string
43+
* }
44+
* },
45+
* totalRecords: int
46+
* }
47+
* } $dataSource
48+
*
49+
* @return array{
50+
* data: ?array{
51+
* items: array{
52+
* array{
53+
* catId: int,
54+
* name: string,
55+
* storeId: int,
56+
* problem: string,
57+
* hash: string
58+
* }
59+
* },
60+
* totalRecords: int
61+
* }
62+
* }
63+
*/
3264
public function prepareDataSource(array $dataSource)
3365
{
3466
if (isset($dataSource['data']['items'])) {
3567
foreach ($dataSource['data']['items'] as &$item) {
3668
$item[$this->getData('name')]['edit'] = [
37-
'href' => $this->urlBuilder->getUrl(
69+
'href' => $this->urlBuilder->getUrl(
3870
'catalog/category/edit',
3971
['id' => $item['catId'], 'store' => $item['storeId']]
4072
),
4173
'ariaLabel' => __('Edit ') . $item['name'],
42-
'label' => __('Edit'),
43-
'hidden' => false,
74+
'label' => __('Edit'),
75+
'hidden' => false,
4476
];
4577
}
4678
}

Ui/Component/Listing/Columns/ProductActions.php

Lines changed: 42 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
<?php
2+
3+
declare(strict_types=1);
4+
25
namespace Baldwin\UrlDataIntegrityChecker\Ui\Component\Listing\Columns;
36

47
use Magento\Framework\UrlInterface;
58
use Magento\Framework\View\Element\UiComponent\ContextInterface;
69
use Magento\Framework\View\Element\UiComponentFactory;
10+
use Magento\Framework\View\Element\UiComponentInterface;
711
use Magento\Ui\Component\Listing\Columns\Column;
812

913
class ProductActions extends Column
1014
{
11-
/** @var UrlInterface */
12-
protected UrlInterface $urlBuilder;
15+
private $urlBuilder;
1316

1417
/**
15-
* @param ContextInterface $context
16-
* @param UiComponentFactory $uiComponentFactory
17-
* @param UrlInterface $urlBuilder
18-
* @param array $components
19-
* @param array $data
18+
* @param array<UiComponentInterface> $components
19+
* @param array<mixed> $data
2020
*/
2121
public function __construct(
2222
ContextInterface $context,
@@ -26,21 +26,53 @@ public function __construct(
2626
array $data = []
2727
) {
2828
$this->urlBuilder = $urlBuilder;
29+
2930
parent::__construct($context, $uiComponentFactory, $components, $data);
3031
}
3132

33+
/**
34+
* @param array{
35+
* data: ?array{
36+
* items: array{
37+
* array{
38+
* productId: int,
39+
* sku: string,
40+
* storeId: int,
41+
* problem: string,
42+
* hash: string
43+
* }
44+
* },
45+
* totalRecords: int
46+
* }
47+
* } $dataSource
48+
*
49+
* @return array{
50+
* data: ?array{
51+
* items: array{
52+
* array{
53+
* productId: int,
54+
* sku: string,
55+
* storeId: int,
56+
* problem: string,
57+
* hash: string
58+
* }
59+
* },
60+
* totalRecords: int
61+
* }
62+
* }
63+
*/
3264
public function prepareDataSource(array $dataSource)
3365
{
3466
if (isset($dataSource['data']['items'])) {
3567
foreach ($dataSource['data']['items'] as &$item) {
3668
$item[$this->getData('name')]['edit'] = [
37-
'href' => $this->urlBuilder->getUrl(
69+
'href' => $this->urlBuilder->getUrl(
3870
'catalog/product/edit',
3971
['id' => $item['productId'], 'store' => $item['storeId']]
4072
),
4173
'ariaLabel' => __('Edit ') . $item['sku'],
42-
'label' => __('Edit'),
43-
'hidden' => false,
74+
'label' => __('Edit'),
75+
'hidden' => false,
4476
];
4577
}
4678
}

0 commit comments

Comments
 (0)