Problem/Motivation

FILE: .../modules/contrib/duplicate_role/tests/src/Functional/DuplicateRoleTest.php
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
--------------------------------------------------------------------------------
  89 | WARNING | t() calls should be avoided in classes, use
     |         | \Drupal\Core\StringTranslation\StringTranslationTrait and
     |         | $this->t() instead
 113 | WARNING | t() calls should be avoided in classes, use
     |         | \Drupal\Core\StringTranslation\StringTranslationTrait and
     |         | $this->t() instead
--------------------------------------------------------------------------------

Time: 2.25 secs; Memory: 10MB

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

Rohit Rana created an issue. See original summary.

rohit rana’s picture

Assigned: rohit rana » Unassigned
Status: Active » Needs review
StatusFileSize
new1.61 KB
aditi saraf’s picture

Status: Needs review » Needs work

Due to failure moving this to need Work

aditi saraf’s picture

Assigned: Unassigned » aditi saraf

i am checking this issue .

aditi saraf’s picture

StatusFileSize
new363 bytes
new1.42 KB

i have uploaded patch , please review .

aditi saraf’s picture

Status: Needs work » Needs review
aditi saraf’s picture

Assigned: aditi saraf » Unassigned
aditi saraf’s picture

StatusFileSize
new1.42 KB
raveen_thakur51’s picture

Absolutely, in Drupal 8 and 9, the t() function is indeed discouraged for use within classes. Instead, you can use the \Drupal\Core\StringTranslation\StringTranslationTrait and the $this->t() method for translation within classes.

admirlju made their first commit to this issue’s fork.

admirlju’s picture

Created an issue fork, and applied the patches. Locally the tests are passing, but because Drupal CI is deprecated, they will not pass with that. So I just added a basic gitlab-ci. And from what I see they are passing there. Still because of some CS fixes I'll leave this as needs review.

bohart’s picture

Status: Needs review » Needs work

After the latest changes at 8.x-1.x-dev branch, it looks like all changes at DuplicateRoleForm.php and .gitlab-ci.yml files must be removed from MR !7.

Marking this one as Needs work.

alt.dev made their first commit to this issue’s fork.

  • bohart committed 898f9e4c on 8.x-1.x authored by admirlju
    Issue #3393576 by admirlju, Aditi Saraf, alt.dev, bohart: t() calls...
bohart’s picture

Status: Needs work » Fixed

Merged. The changes will be a part of the next module release. Thanks!

Status: Fixed » Closed (fixed)

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