t() calls should be avoided in classes

Created on 15 May 2023, over 1 year ago
Updated 13 June 2023, over 1 year ago

Problem/Motivation

t() calls should be avoided in classes, use this->t() instead

Steps to reproduce

Run the command:

phpcs --standard=DrupalPractice
/web/modules/contrib/stripe_customer_portal/

Proposed resolution

Fix the following coding standards issues and upload the patch or create an MR with fixes.

FILE: \modules\contrib\stripe_customer_portal\src\StripeCustomerPortalStripe.php
--------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------------------------------------------------------------------------------
 112 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
--------------------------------------------------------------------------------------------------------
📌 Task
Status

RTBC

Version

1.0

Component

Code

Created by

🇮🇳India Shanu Chouhan

Live updates comments and jobs are added and updated live.
  • Coding standards

    It involves compliance with, or the content of coding standards. Requires broad community agreement.

Sign in to follow issues

Comments & Activities

  • Issue created by @Shanu Chouhan
  • Issue was unassigned.
  • Status changed to Needs review over 1 year ago
  • 🇮🇳India Shanu Chouhan

    I have Created a patch to fix this issue.

  • 🇸🇾Syria hodba Dubai

    Thanks for stopping by. Actually, your patch will not work in the implementation as the StripeCustomerPortalStripe service does not use the StringTranslationTrait.
    I will update the code soon to allow using $this->t() method.

  • Status changed to Needs work over 1 year ago
  • Status changed to Needs review over 1 year ago
  • 🇮🇳India ashutosh ahirwal India

    Fixed the issue and providing patch

  • Status changed to RTBC over 1 year ago
  • 🇵🇭Philippines kenyoOwen

    Hi Ashutosh Ahirwal

    I reviewed and applied your patch and confirmed that the phpcs issue mentioned is resolved. Please see the screenshots attached.

    Thank you.

Production build 0.71.5 2024