Closed (fixed)
Project:
Generated Content
Version:
1.5.4
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
10 Oct 2025 at 05:47 UTC
Updated:
21 Mar 2026 at 08:20 UTC
Jump to comment: Most recent
In src/Helpers/GeneratedContentHelper.php
public static function getInstance(): GeneratedContentHelper {
if (empty(self::$instances[static::class])) {
// @phpstan-ignore-next-line
self::$instances[static::class] = \Drupal::service('class_resolver')
->getInstanceFromDefinition(static::class);
}
// @phpstan-ignore-next-line
return self::$instances[static::class];
}
When this class is extended and a GeneratedContentHelper's method is overridden, the MyHelper::getInstance() returns an instance of the code>GeneratedContentHelper class rather than MyHelper.
This is because GeneratedContentHelper returned instead of static. Similar with return self::$instances[static::class]; - should be return static::$instances[static::class];.
Comments
Comment #3
alex.skrypnyk