Global variable or function should never be used 3

  • Major
  • Architecture

More information: https://insight.sensiolabs.com/what-we-analyse/php.use_global_variable_or_function

  1. );
  2. }
  3. // Legacy dynamic template hack
  4. if ($varName === 'widget_template') {
  5. $GLOBALS['widget_template'] = $templateIdent;

    $widget_template adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by Mathieu Ducharme
  6. }
  7. $this->dynamicTemplates[$varName] = $templateIdent;
  8. }
  1. );
  2. }
  3. // Legacy dynamic template hack
  4. if ($varName === 'widget_template') {
  5. $GLOBALS['widget_template'] = null;

    $widget_template adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by Mathieu Ducharme
  6. }
  7. unset($this->dynamicTemplates[$varName]);
  8. }
  1. * @return void
  2. */
  3. public function clearDynamicTemplates()
  4. {
  5. // Legacy dynamic template hack
  6. $GLOBALS['widget_template'] = null;

    $widget_template adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by Mathieu Ducharme
  7. $this->dynamicTemplates = [];
  8. }
  9. /**