Problem/Motivation

$ phpcs --standard=DrupalPractice .

FILE: /var/www/html/drupal_contrib/web/modules/custom/faker_generate/src/Form/FakerGenerateContentForm.php
------------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 9 WARNINGS AFFECTING 9 LINES
------------------------------------------------------------------------------------------------------------------------------------------
  20 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
  35 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
  60 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
  83 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
  88 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 112 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
 114 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
 115 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
 116 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
------------------------------------------------------------------------------------------------------------------------------------------

Proposed resolution

Use dependency injection instead of /Drupal calls and use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead of t() calls.

User interface changes

NONE

API changes

NONE

Data model changes

NONE

CommentFileSizeAuthor
#2 3166376-2.patch5.08 KBankithashetty

Comments

ankithashetty created an issue. See original summary.

ankithashetty’s picture

Status: Active » Needs review
StatusFileSize
new5.08 KB

Replaced t() calls with $this->t() and used depedency injection in the following patch, please review.

Thank you.

gaurav.kapoor’s picture

Status: Needs review » Reviewed & tested by the community

Thanks for working on this.

gaurav.kapoor’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.