t() calls should be avoided in classes

Created on 6 July 2023, over 1 year ago

Problem/Motivation

PHPCS throws the t() calls error for the file: LinkyCheckerRecheckForm.php

Steps to reproduce

Use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead.

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

📌 Task
Status

RTBC

Version

2.2

Component

Code

Created by

🇮🇳India sidharth_soman Bangalore

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @sidharth_soman
  • Open in Jenkins → Open on Drupal.org →
    Core: 10.1.x + Environment: PHP 8.1 & MySQL 8
    last update over 1 year ago
    5 pass
  • @sidharth_soman opened merge request.
  • Issue was unassigned.
  • Status changed to Needs review over 1 year ago
  • Status changed to RTBC over 1 year ago
  • 🇵🇭Philippines roberttabigue

    Hi,

    I reviewed the changes and applied the latest MR to the Linkychecker module against 2.2.x-dev, confirmed it resolves the t() calls errors.

    However, I'm still seeing some PHPCS errors:

    FILE: /Users/roberttabigue/Projects/drupalorgissues/docroot/modules/contrib/linkychecker/linkychecker.module
    ------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    ------------------------------------------------------------------------------------------------------------
     13 | WARNING | [x] Unused use statement
    ------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/roberttabigue/Projects/drupalorgissues/docroot/modules/contrib/linkychecker/src/Form/LinkyCheckerRecheckForm.php
    -----------------------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    -----------------------------------------------------------------------------------------------------------------------------
     90 | WARNING | Unused variable $severity.
    -----------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/roberttabigue/Projects/drupalorgissues/docroot/modules/contrib/linkychecker/src/Form/LinkyCheckerLinkyCheckForm.php
    -----------------------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AND 1 WARNING AFFECTING 2 LINES
    -----------------------------------------------------------------------------------------------------------------------------------------
     105 | ERROR   | The array declaration extends to column 105 (the limit is 80). The array content should be split up over multiple lines
     131 | WARNING | Unused variable $severity.
    -----------------------------------------------------------------------------------------------------------------------------------------
    
    Time: 383ms; Memory: 10MB

    I ran this command:
    phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig linkychecker/

    Since this ticket is intended to fix the t() calls only, I'm moving this now to RTBC.

    Please see the attached files for your reference.

    Thank you!

Production build 0.71.5 2024