Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Example:
/**
* If banners decorator mode is on, decorates the node content with banners.
*
* @param stdClass $node
* The node to decorate.
* @param string $view_mode
* The node display mode.
*/
static public function addBannersDecoratorToNode(stdClass &$node, $view_mode) {
Gives Coder error report:
Expected "object" but found "stdClass" for parameter type
In fact if you use 'object' as the type hint with PHP5.3 as far as I can tell it crashes:
Recoverable fatal error: Argument 1 passed to Drupal\flagplus\banner\BannerHelper::addBannersDecoratorToNode() must be an instance of Drupal\flagplus\banner\object, instance of stdClass given
Comments
Comment #1
webel CreditAttribution: webel commentedComment #2
webel CreditAttribution: webel commentedComment #3
klausiThat error is flagged against the @param doc type, which should be "object" instead of stdClass. See https://www.drupal.org/coding-standards/docs#types , so Coder is just following our standard here.
Comment #4
klausiAh, so there was still a false positive if you use "object" in the docs and "stdClass" for the actual type hint, which should be allowed. Committed a fix for that.