4
4
* Copyright © Magento, Inc. All rights reserved.
5
5
* See COPYING.txt for license details.
6
6
*/
7
+ declare (strict_types=1 );
8
+
7
9
namespace Magento \Widget \Controller \Adminhtml \Widget \Instance ;
8
10
9
11
use Magento \Backend \App \Action ;
14
16
use Magento \Framework \Controller \ResultFactory ;
15
17
use Magento \Framework \Controller \ResultInterface ;
16
18
use Magento \Framework \Exception \NoSuchEntityException ;
17
- use Magento \Widget \Model \DeleteWidgetInstanceById ;
19
+ use Magento \Widget \Model \DeleteWidgetById ;
18
20
19
21
/**
20
22
* Class MassDelete
@@ -29,20 +31,20 @@ class MassDelete extends Action implements HttpPostActionInterface
29
31
const ADMIN_RESOURCE = 'Magento_Widget::widget_instance ' ;
30
32
31
33
/**
32
- * @var DeleteWidgetInstanceById
34
+ * @var DeleteWidgetById
33
35
*/
34
- private $ deleteWidgetInstanceById ;
36
+ private $ deleteWidgetById ;
35
37
36
38
/**
37
39
* @param Context $context
38
- * @param DeleteWidgetInstanceById $deleteWidgetInstanceById
40
+ * @param DeleteWidgetById $deleteWidgetById
39
41
*/
40
42
public function __construct (
41
43
Context $ context ,
42
- DeleteWidgetInstanceById $ deleteWidgetInstanceById
44
+ DeleteWidgetById $ deleteWidgetById
43
45
) {
44
46
parent ::__construct ($ context );
45
- $ this ->deleteWidgetInstanceById = $ deleteWidgetInstanceById ;
47
+ $ this ->deleteWidgetById = $ deleteWidgetById ;
46
48
}
47
49
48
50
/**
@@ -51,7 +53,7 @@ public function __construct(
51
53
* @return Redirect
52
54
* @throws \Exception
53
55
*/
54
- public function execute ()
56
+ public function execute (): Redirect
55
57
{
56
58
$ deletedInstances = 0 ;
57
59
$ notDeletedInstances = [];
@@ -69,7 +71,7 @@ public function execute()
69
71
70
72
foreach ($ instanceIds as $ instanceId ) {
71
73
try {
72
- $ this ->deleteWidgetInstanceById ->execute ((int ) $ instanceId );
74
+ $ this ->deleteWidgetById ->execute ((int ) $ instanceId );
73
75
$ deletedInstances ++;
74
76
} catch (NoSuchEntityException $ e ) {
75
77
$ notDeletedInstances [] = $ instanceId ;
@@ -96,7 +98,7 @@ public function execute()
96
98
/**
97
99
* @return array
98
100
*/
99
- private function getInstanceIds ()
101
+ private function getInstanceIds (): array
100
102
{
101
103
$ instanceIds = $ this ->getRequest ()->getParam ('delete ' );
102
104
@@ -110,7 +112,7 @@ private function getInstanceIds()
110
112
/**
111
113
* @return ResultInterface|RedirectInterface
112
114
*/
113
- private function getResultPage ()
115
+ private function getResultPage (): ? ResultInterface
114
116
{
115
117
return $ this ->resultFactory ->create (ResultFactory::TYPE_REDIRECT );
116
118
}
0 commit comments