$ phpcs --standard=Drupalpractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml user_bundle/
Xdebug: [Step Debug] Time-out connecting to debugging client, waited: 200 ms. Tried: localhost:9000 (through xdebug.client_host/xdebug.client_port) :-(

FILE: C:\Users\SI-001\Downloads\user_bundle\src\UserTypeForm.php
-----------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 9 WARNINGS AFFECTING 9 LINES
-----------------------------------------------------------------------------------------------------------------------------------------
25 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
28 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
42 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
43 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
48 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
51 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
57 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
79 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
80 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
-----------------------------------------------------------------------------------------------------------------------------------------

FILE: C:\Users\SI-001\Downloads\user_bundle\src\UserTypeListBuilder.php
-----------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
-----------------------------------------------------------------------------------------------------------------------------------------
20 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
22 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
-----------------------------------------------------------------------------------------------------------------------------------------

Time: 633ms; Memory: 8MB

Comments

Rakhi Soni created an issue. See original summary.

rakhi soni’s picture

Assigned: rakhi soni » Unassigned
Status: Active » Needs review
StatusFileSize
new4.22 KB

Kindly review patch,,

amateescu’s picture

Status: Needs review » Needs work
+++ b/src/UserTypeForm.php
@@ -6,11 +6,13 @@ use Drupal\Core\Entity\BundleEntityFormBase;
+use Drupal\Core\StringTranslation\StringTranslationTrait;
...
+  use StringTranslationTrait;

+++ b/src/UserTypeListBuilder.php
@@ -5,6 +5,7 @@ namespace Drupal\user_bundle;
+use Drupal\Core\StringTranslation\StringTranslationTrait;

@@ -12,14 +13,15 @@ use Drupal\Core\Entity\EntityInterface;
+  use StringTranslationTrait;

These are not needed, the parent classes already use the trait.

Also, can you combine this patch with #3301301: Drupal coding standard issue? Thanks.

sourabhjain’s picture

Assigned: Unassigned » sourabhjain

I am working on this

sourabhjain’s picture

I have checked the patch which is mentioned is perfectly solving both the ticket.
Attaching the patch here too.
Please review.

sourabhjain’s picture

Assigned: sourabhjain » Unassigned
Status: Needs work » Needs review
jaykumar95’s picture

@sourabhjain you mistakenly uploaded .txt file, please upload patch file

sourabhjain’s picture

StatusFileSize
new4.08 KB

Thanks for noticing @jay
Uploaded the patch file.

Munavijayalakshmi’s picture

StatusFileSize
new148.63 KB
Munavijayalakshmi’s picture

Status: Needs review » Reviewed & tested by the community

  • amateescu committed 845db12b on 8.x-1.x
    Issue #3301299 by sourabhjain, rakhi soni, amateescu:  t() calls should...
amateescu’s picture

Status: Reviewed & tested by the community » Fixed
Issue tags: -

Committed to 8.x-1.x, thanks!

Status: Fixed » Closed (fixed)

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