8
8
9
9
namespace Magento \Cms \Controller \Noroute ;
10
10
11
- use Magento \Cms \Helper \Page ;
12
- use Magento \Framework \App \Action \Context ;
13
- use Magento \Framework \Controller \Result \ForwardFactory ;
14
- use Magento \Framework \Controller \ResultInterface ;
15
- use Magento \Framework \Controller \Result \Forward ;
16
-
17
11
/**
18
12
* @SuppressWarnings(PHPMD.AllPurposeAction)
19
13
*/
20
14
class Index extends \Magento \Framework \App \Action \Action
21
15
{
22
16
/**
23
- * @var ForwardFactory
17
+ * @var \Magento\Framework\Controller\Result\ ForwardFactory
24
18
*/
25
- protected ForwardFactory $ resultForwardFactory ;
19
+ protected \ Magento \ Framework \ Controller \ Result \ ForwardFactory $ resultForwardFactory ;
26
20
27
21
/**
28
- * @param Context $context
29
- * @param ForwardFactory $resultForwardFactory
22
+ * @param \Magento\Framework\App\Action\ Context $context
23
+ * @param \Magento\Framework\Controller\Result\ ForwardFactory $resultForwardFactory
30
24
*/
31
25
public function __construct (
32
- Context $ context ,
33
- ForwardFactory $ resultForwardFactory
26
+ \ Magento \ Framework \ App \ Action \ Context $ context ,
27
+ \ Magento \ Framework \ Controller \ Result \ ForwardFactory $ resultForwardFactory
34
28
) {
35
29
$ this ->resultForwardFactory = $ resultForwardFactory ;
36
30
parent ::__construct ($ context );
@@ -39,27 +33,27 @@ public function __construct(
39
33
/**
40
34
* Render CMS 404 Not found page
41
35
*
42
- * @return ResultInterface|Forward
36
+ * @return \Magento\Framework\Controller\ ResultInterface
43
37
*/
44
- public function execute (): ResultInterface | Forward
38
+ public function execute ()
45
39
{
46
40
$ pageId = $ this ->_objectManager ->get (
47
41
\Magento \Framework \App \Config \ScopeConfigInterface::class,
48
42
\Magento \Store \Model \ScopeInterface::SCOPE_STORE
49
43
)->getValue (
50
- Page::XML_PATH_NO_ROUTE_PAGE ,
44
+ \ Magento \ Cms \ Helper \ Page::XML_PATH_NO_ROUTE_PAGE ,
51
45
\Magento \Store \Model \ScopeInterface::SCOPE_STORE
52
46
);
53
- /** @var Page $pageHelper */
54
- $ pageHelper = $ this ->_objectManager ->get (Page::class);
47
+ /** @var \Magento\Cms\Helper\ Page $pageHelper */
48
+ $ pageHelper = $ this ->_objectManager ->get (\ Magento \ Cms \ Helper \ Page::class);
55
49
$ resultPage = $ pageHelper ->prepareResultPage ($ this , $ pageId );
56
50
if ($ resultPage ) {
57
51
$ resultPage ->setStatusHeader (404 , '1.1 ' , 'Not Found ' );
58
52
$ resultPage ->setHeader ('Status ' , '404 File not found ' );
59
53
$ resultPage ->setHeader ('Cache-Control ' , 'no-store, no-cache, must-revalidate, max-age=0 ' , true );
60
54
return $ resultPage ;
61
55
} else {
62
- /** @var Forward $resultForward */
56
+ /** @var \Magento\Framework\Controller\Result\ Forward $resultForward */
63
57
$ resultForward = $ this ->resultForwardFactory ->create ();
64
58
$ resultForward ->setController ('index ' );
65
59
$ resultForward ->forward ('defaultNoRoute ' );
0 commit comments