- Issue created by @codebymikey
- @codebymikey opened merge request.
- Status changed to Needs review
over 1 year ago 10:19am 26 April 2023
The module defines constants on the root level of the module.
The issue is that it also makes use of the t
function:
define('BOOTSTRAP_MODAL_MESSAGES_HEADER', '<h4 class="modal-title">' . t('Messages') . '</h4>');
Which causes issues with scanners such as phpstan
to fail with an error because Drupal has not been properly bootstrapped at that point.
Fatal error: Drupal\Core\DependencyInjection\ContainerNotInitializedException thrown while calling __toString on a Drupal\Core\StringTranslation\TranslatableMarkup object in /app/application/web/core/lib/Drupal.php on line 179: \Drupal::$container is not initialized yet. \Drupal::setContainer() must be called with a real container. in /app/application/web/core/lib/Drupal/Component/Utility/ToStringTrait.php on line 20
Attempt to scan the module with phpstan.
Remove the constant declarations and move the values directly into the functions which requires them.
N/A
Needs review
1.0
Code