Skip to content

Not compatible with PHP 8.4 #122

@evs-xsarus

Description

@evs-xsarus

The module gives:

Deprecated Functionality: Emico\AttributeLanding\Model\UrlRewriteService::generateRewrite(): Implicitly marking parameter $suffix as nullable is deprecated, the explicit nullable type must be used instead in /sites/dlk_upgrade/magento/vendor/emico/m2-attributelanding/src/Model/UrlRewriteService.php on line 113

Please make the module compatible with PHP 8.4 . This diff can help:

--- a/vendor/emico/m2-attributelanding/src/Model/Config.php
+++ b/vendor/emico/m2-attributelanding/src/Model/Config.php
@@ -34,7 +34,7 @@
      * @param Store|null $store
      * @return mixed|string|null
      */
-    protected function getStoreConfig(string $path, Store $store = null)
+    protected function getStoreConfig(string $path, ?Store $store = null)
     {
         if ($store) {
             return $store->getConfig($path);
@@ -47,7 +47,7 @@
      * @param Store|null $store
      * @return bool
      */
-    public function isCrossLinkEnabled(Store $store = null): bool
+    public function isCrossLinkEnabled(?Store $store = null): bool
     {
         return (bool) $this->getStoreConfig('emico_attributelanding/general/allow_crosslink', $store);
     }
@@ -56,7 +56,7 @@
      * @param Store|null $store
      * @return bool
      */
-    public function isAppendCategoryUrlSuffix(Store $store = null): bool
+    public function isAppendCategoryUrlSuffix(?Store $store = null): bool
     {
         return (bool) $this->getStoreConfig('emico_attributelanding/general/append_category_url_suffix', $store);
     }
@@ -65,7 +65,7 @@
      * @param Store|null $store
      * @return string
      */
-    public function getCategoryUrlSuffix(Store $store = null)
+    public function getCategoryUrlSuffix(?Store $store = null)
     {
         return (string) $this->getStoreConfig(CategoryUrlPathGenerator::XML_PATH_CATEGORY_URL_SUFFIX, $store);
     }
@@ -74,7 +74,7 @@
      * @param Store|null $store
      * @return bool
      */
-    public function isCanonicalSelfReferencingEnabled(Store $store = null): bool
+    public function isCanonicalSelfReferencingEnabled(?Store $store = null): bool
     {
         return (bool) $this->config->isSetFlag(
             'emico_attributelanding/general/canonical_self_referencing',

--- a/vendor/emico/m2-attributelanding/src/Model/LandingPage.php
+++ b/vendor/emico/m2-attributelanding/src/Model/LandingPage.php
@@ -44,8 +44,8 @@
         ExtensionAttributesFactory $extensionFactory,
         AttributeValueFactory $customAttributeFactory,
         Config $config,
-        AbstractResource $resource = null,
-        AbstractDb $resourceCollection = null,
+        ?AbstractResource $resource = null,
+        ?AbstractDb $resourceCollection = null,
         array $data = []
     ) {
         parent::__construct(

--- a/vendor/emico/m2-attributelanding/src/Model/UrlFinder.php
+++ b/vendor/emico/m2-attributelanding/src/Model/UrlFinder.php
@@ -75,7 +75,7 @@
      * @param int|null $categoryId
      * @return string|null
      */
-    public function findUrlByFilters(array $filters, int $categoryId = null)
+    public function findUrlByFilters(array $filters, ?int $categoryId = null)
     {
         $result = null;
         $filterHash = $this->createHashForFilters($filters, $categoryId);
@@ -114,7 +114,7 @@
      *
      * phpcs:disable Magento2.Security.InsecureFunction.FoundWithAlternative
      */
-    protected function createHashForFilters(array $filters, int $categoryId = null): string
+    protected function createHashForFilters(array $filters, ?int $categoryId = null): string
     {
         usort($filters, [$this, 'sortFilterItems']);

--- a/vendor/emico/m2-attributelanding/src/Model/UrlRewriteService.php
+++ b/vendor/emico/m2-attributelanding/src/Model/UrlRewriteService.php
@@ -110,7 +110,7 @@
      * @param string|null $suffix
      * @throws \Magento\UrlRewrite\Model\Exception\UrlAlreadyExistsException|\Exception
      */
-    public function generateRewrite(UrlRewriteGeneratorInterface $page, string $suffix = null)
+    public function generateRewrite(UrlRewriteGeneratorInterface $page, ?string $suffix = null)
     {
         $this->removeExistingUrlRewrites($page);
         $urlRewritesToPersist = [];
@@ -129,7 +129,7 @@
      * @param string|null $suffix
      * @return array
      */
-    private function generateLandingPageRewrites(UrlRewriteGeneratorInterface $page, string $suffix = null): array
+    private function generateLandingPageRewrites(UrlRewriteGeneratorInterface $page, ?string $suffix = null): array
     {
         $urlRewritesToPersist = [];
         $allPages = $this->landingPageRepository->getAllPagesById($page->getPageId());
@@ -193,7 +193,7 @@
      * @param string|null $suffix
      * @return array
      */
-    private function generateOverviewPageRewrites(UrlRewriteGeneratorInterface $page, string $suffix = null): array
+    private function generateOverviewPageRewrites(UrlRewriteGeneratorInterface $page, ?string $suffix = null): array
     {
         $urlRewritesToPersist = [];

@@ -221,7 +221,7 @@
     private function createUrlRewrite(
         UrlRewriteGeneratorInterface $page,
         int $storeId,
-        string $suffix = null
+        ?string $suffix = null
     ): UrlRewrite {
         /** @var UrlRewrite $urlRewrite **/
         $urlRewrite = $this->urlRewriteFactory->create();


--- a/vendor/emico/m2-attributelanding/src/Model/FilterHider/FilterHiderInterface.php
+++ b/vendor/emico/m2-attributelanding/src/Model/FilterHider/FilterHiderInterface.php
@@ -21,6 +21,6 @@
     public function shouldHideFilter(
         LandingPageInterface $landingPage,
         FilterInterface $filter,
-        Item $filterItem = null
+        ?Item $filterItem = null
     ): bool;
 }

--- a/vendor/emico/m2-attributelanding/src/Model/FilterHider/MagentoFilterHider.php
+++ b/vendor/emico/m2-attributelanding/src/Model/FilterHider/MagentoFilterHider.php
@@ -27,7 +27,7 @@
     public function shouldHideFilter(
         LandingPageInterface $landingPage,
         FilterInterface $filter,
-        Item $filterItem = null
+        ?Item $filterItem = null
     ): bool {
         return false;
     }

--- a/vendor/emico/m2-attributelanding/src/Model/System/Config/AppendUrlSuffix.php
+++ b/vendor/emico/m2-attributelanding/src/Model/System/Config/AppendUrlSuffix.php
@@ -41,8 +41,8 @@
         ScopeConfigInterface $config,
         TypeListInterface $cacheTypeList,
         UrlRewriteService $rewriteService,
-        AbstractResource $resource = null,
-        AbstractDb $resourceCollection = null,
+        ?AbstractResource $resource = null,
+        ?AbstractDb $resourceCollection = null,
         array $data = []
     ) {
         parent::__construct(

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions