I’m trying to display a simple page, but still getting this error.
Fatal error: Declaration of MacademyBlogControllerPostDetailInterceptor::execute() must be compatible with MacademyBlogControllerPostDetail::execute(): MagentoFrameworkViewResultPage in /var/www/html/generated/code/Macademy/Blog/Controller/Post/Detail/Interceptor.php on line 19
PHP 7.4.30
Magento 2.4.5
<?php
declare(strict_types = 1);
namespace MacademyBlogControllerPost;
use MagentoFrameworkAppActionHttpGetActionInterface;
use MagentoFrameworkViewResultPage;
use MagentoFrameworkViewResultPageFactory;
class Detail implements HttpGetActionInterface {
private $pageFactory;
public function __construct(
PageFactory $pageFactory
) {
$this->pageFactory = $pageFactory;
}
public function execute(): Page {
return $this->pageFactory->create();
}
}