Global variable or function should never be used 5

  • Major
  • Architecture

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

  1. if ($widgetCallback) {
  2. $widgetCallback($widget);
  3. }
  4. $GLOBALS['widget_template'] = $widget->template();

    $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
  5. yield $widget;
  6. }
  7. }
  1. if ($groupCallback) {
  2. $groupCallback($group);
  3. }
  4. $GLOBALS['widget_template'] = $group->template();

    $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
  5. if ($this->isTabbable() && $i > 1) {
  6. $group->isHidden = true;
  7. }
  8. $i++;
  1. $input->setL10nMode($this->l10nMode());
  2. }
  3. if ($inputCallback) {
  4. $inputCallback($input);
  5. }
  6. $GLOBALS['widget_template'] = $input->template();

    $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. yield $input->ident() => $input;
  8. }
  9. }
  10. /**
  1. $itemCallback = isset($itemCallback) ? $itemCallback : $this->itemCallback;
  2. foreach ($items as $item) {
  3. if ($itemCallback) {
  4. $itemCallback($item);
  5. }
  6. $GLOBALS['widget_template'] = $item->template();

    $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. yield $item->ident() => $item;
  8. }
  9. }
  10. /**
  1. $childCallback = isset($childCallback) ? $childCallback : $this->childCallback;
  2. foreach ($children as $child) {
  3. if ($childCallback) {
  4. $childCallback($child);
  5. }
  6. $GLOBALS['widget_template'] = $item->template();

    $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. yield $child->ident() => $child;
  8. }
  9. }
  10. /**

Source code should not contain TODO comments

  • Minor
  • Architecture

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

  1. }
  2. /**
  3. * Retrieve the path to the item's icon.
  4. *
  5. * @todo [mcaskill 2016-09-16] Move this to a tab interface in charcoal-admin

    TODO comments are left in the code when a feature (or a bug) isn't completely developed (or fixed). You should complete the implementation and remove the comment.

    Time to fix: about 4 hours
    Open Issue Permalink
    Last edited by Chauncey McAskill
  6. * so as to focus the icon getter/setter on being a Glyphicon.
  7. * @return string
  8. */
  9. public function icon()
  10. {

Unused use statement should be avoided

  • Minor
  • Deadcode

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

  1. use \Charcoal\Factory\GenericFactory as Factory;
  2. use \Charcoal\Ui\Form\FormBuilder;
  3. use \Charcoal\Ui\Form\FormInterface;
  4. use \Charcoal\Ui\Form\GenericForm;
  5. use \Charcoal\Ui\FormGroup\FormGroupBuilder;

    The class Charcoal\Ui\FormGroup\FormGroupBuilder is declared but never used. You should remove the use statement.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Mathieu Ducharme
  6. use \Charcoal\Ui\FormGroup\FormGroupInterface;
  7. use \Charcoal\Ui\FormGroup\GenericFormGroup;
  8. use \Charcoal\Ui\FormInput\FormInputBuilder;
  9. use \Charcoal\Ui\FormInput\FormInputInterface;
  10. use \Charcoal\Ui\FormInput\GenericFormInput;