Container Dependency Issue

Created on 5 July 2023, over 1 year ago
Updated 6 May 2024, 7 months ago

Problem/Motivation

When I tried to enable the module I am getting the following error and the site is breaking.
Fatal error: Declaration of Drupal\domain_simple_sitemap\Controller\DomainSimpleSitemapController::create(Symfony\Component\DependencyInjection\ContainerInterface $container) must be compatible with Drupal\simple_sitemap\Controller\SimpleSitemapController::create(Symfony\Component\DependencyInjection\ContainerInterface $container): Drupal\simple_sitemap\Controller\SimpleSitemapController in /var/www/html/modules/contrib/domain_simple_sitemap/src/Controller/DomainSimpleSitemapController.php on line 59

FILE: modules/contrib/domain_simple_sitemap/src/Controller/DomainSimpleSitemapController.php
-----------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------------------------
16 | WARNING | The class short comment should describe what the class does and not simply repeat the class name
-----------------------------------------------------------------------------------------------------------------

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Needs work

Version

2.0

Component

Code

Created by

🇮🇳India Gnanagowthaman sankar Puducherry

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @Gnanagowthaman sankar
  • 🇮🇳India Gnanagowthaman sankar Puducherry

    Hi Everyone, The above PR to fix the dependency issue and the phpcs issue.

  • @ayushpandey opened merge request.
  • 🇮🇳India ayush.pandey

    I have checked the PR, but it does not resolve the issue completely. It throws an error Class "Drupal\simple_sitemap\Controller\SimplesitemapController" not found in include() (line 17 of modules/contrib/domain_simple_sitemap/src/Controller/DomainSimpleSitemapController.php).
    Also, the change added in PR, public static function create(ContainerInterface $container): DomainSitemapController , will resolve the issue for create function, but will throw error for getSitemap child function.

  • 🇮🇳India Gnanagowthaman sankar Puducherry

    Hi @ayush.pandey ,

    In your local site did you installed the simple_sitemap module ?

  • 🇮🇳India ayush.pandey

    Yes, I have simple_sitemap installed.

  • Regarding comment #8: There is an issue with Class naming between domain_simple_sitemap and simple_sitemap.
    Drupal\simple_sitemap\Controller\SimplesitemapController. (Notice Simplesitemap Vs SimpleSitemap).
    May need to install the compatible versions with correct naming to fix this issue.
    Please verify the source control system (eg: git) to make sure that the updates to the files are properly done after an update of the simple_sitemap module to fix the names.

  • When simple_sitemap is upgraded to 4.1, I am also seeing the Container Dependency issue:
    Fatal error: Declaration of Drupal\domain_simple_sitemap\Controller\DomainSimpleSitemapController::create(Symfony\Component\DependencyInjection\ContainerInterface $container) must be compatible with Drupal\simple_sitemap\Controller\SimpleSitemapController::create(Symfony\Component\DependencyInjection\ContainerInterface $container): Drupal\simple_sitemap\Controller\SimpleSitemapController in /app/web/modules/contrib/domain_simple_sitemap/src/Controller/DomainSimpleSitemapController.php on line 59

    This is a blocker for us to upgrade simple_sitemap to 4.1

  • Issue was unassigned.
  • Status changed to Needs work 7 months ago
  • 🇧🇪Belgium tim-diels Belgium 🇧🇪

    You need to update to the 3.x version. It is not reproducable anymore with the next versions:

    We're on the next versions:

    • domain_simple_sitemap 3.0.0-beta1
    • simple_sitemap 4.1.9

    And if you see there, your fix is also not correct.

    Also the bug report is not clear. You talk about a faulty declaration but also provide a (partially) PHP CS report?

    FILE: modules/contrib/domain_simple_sitemap/src/Controller/DomainSimpleSitemapController.php
    -----------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    -----------------------------------------------------------------------------------------------------------------
    16 | WARNING | The class short comment should describe what the class does and not simply repeat the class name
    -----------------------------------------------------------------------------------------------------------------
    

    And if you want to solve the CS issue, please read carefully how to do that as your provided solution is not correct. The comment should be descriptive and not just being fixed with adding an 'of' between.

    I would say we close this issue? At least it needs work.

Production build 0.71.5 2024