- Issue created by @tvb
- π©πͺGermany gbyte Berlin
Did you try your steps above to reproduce? Drupal\simple_sitemap\Entity\SimpleSitemap is of type SitempInterface so this error should not be a thing. Please check if you have updated the module correctly.
- π¦πΊAustralia dpi Perth, Australia
Probably didnt import
SimpleSitemapInterface
to the file.In my modules, I typically reference classes in my api.php files fully, with no imports, so we dont get into support problems like this.
e.g.
function hook_simple_sitemap_links_alter(array &$links, SimpleSitemapInterface $sitemap) {
to
function hook_simple_sitemap_links_alter(array &$links, \Drupal\simple_sitemap\Entity\SimpleSitemapInterface $sitemap) {
so things are copy pasteable.
@gbyte Up to you, but it avoids issues like this.
- π¬π§United Kingdom aaron.ferris
aaron.ferris β made their first commit to this issueβs fork.
- π¬π§United Kingdom aaron.ferris
Seems to be a mixed bag in Core, obviously maintainers prerogative but pushed a change in case we want to go with this.
- last update
7 months ago 32 pass - π§πͺBelgium tvb
Probably didnt import SimpleSitemapInterface to the file.
Exactly.
Adding
use \Drupal\simple_sitemap\Entity\SimpleSitemapInterface;
to the module file fixes the issue, as do the modifications with full references (in merge request !95).Thank you!
- Status changed to Fixed
6 months ago 8:19am 7 May 2024 - π·πΊRussia walkingdexter
No changes are needed to the module. There is a coding standard β .
API documentation (in .api.php files) should use full class names. Note that if a class is used more than once in multiple hook signatures, it must still be "use"ed, and then only the short names of the class should be used in the function.
- π¦πΊAustralia dpi Perth, Australia
Well, that page is less a coding standard, just a wiki page. It was added by Crell in a 2012 revision, without any references to discussions.
The standard is the living Coder project.
To me, these two parts contradict eachother:
- API documentation (in .api.php files) should use full class names.
- Note that if a class is used more than once in multiple hook signatures, it must still be "use"ed, and then only the short names of the class should be used in the function.Is the second part referring to outside the .api.php file?
- π·πΊRussia walkingdexter
The standard is the living Coder project.
OK, using short class names in hook signatures is not a violation according to Coder.
Automatically closed - issue fixed for 2 weeks with no activity.