Why xmlsitemap module implements hook_node_comment_delete this way? Does someone know why xmlsitemap.module implements every hook_node_comment_ hooks, with a StdClass casting for the object passed in param ?
example : 

/**
 * Implements hook_comment_delete().
 */
function xmlsitemap_node_comment_delete(stdClass $comment) {
  xmlsitemap_node_comment_update($comment);
}

(xmlsitemap_node.module l.95)


A teammate overrides some Drupal default comment behaviours by declaring a new entity, with CustomComment as "entity class" name.

Then, when we want to delete a comment, this xmlsitemap's casting fires an error because the loaded comment is not anymore a StdClass object, but a CustomComment object.

Do I have to hack that module ?
Any Idea ?
It seems like the author of that function might just have been a tiny bit over-zealous in trying to strongly-type the $comment parameter.

The hook_comment_delete() docs don't really give any indication that it should be implemented in this manner; but if you look at the signature for the Drupal 8 version of the function, you'll see the parameters are typed. It might be that the author was following that 'pattern' when creating the function (rightly or wrongly). That's a complete guess though.

I haven't seen hook parameters being typed like this in any other contrib modules that I can think of, so it's probably an isolated incident (although this format is consistent across most of the hooks for the xmlsitemap node module).

I think the best way forward would be to create a patch that fixes the issue, and perhaps submit it to the XmlSitemap issue queue for others to review.