t() calls should be avoided in classes

Created on 14 March 2024, 4 months ago
Updated 17 June 2024, 11 days ago

Problem/Motivation

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

๐Ÿ“Œ Task
Status

Needs review

Version

1.0

Component

Code

Created by

๐Ÿ‡ฎ๐Ÿ‡ณIndia chaitanyadessai

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

Merge Requests

Comments & Activities

  • Issue created by @chaitanyadessai
  • Merge request !11FIxed t() calls. โ†’ (Open) created by chaitanyadessai
  • Open in Jenkins โ†’ Open on Drupal.org โ†’
    Core: 9.5.x + Environment: PHP 8.0 & MySQL 5.7
    last update 4 months ago
    22 pass
  • Issue was unassigned.
  • Status changed to Needs review 4 months ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia chaitanyadessai

    Please review MR.

  • Status changed to Needs work about 1 month ago
  • ๐Ÿ‡ต๐Ÿ‡ญPhilippines cleavinjosh

    Hi @chaitanyadessai,

    I applied MR!11 and verified that the t() calls issues have been fixed.

    However, when I run phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml there are still issues found.

    โžœ  physical git:(8.x-1.3) curl https://git.drupalcode.org/project/physical/-/merge_requests/11.diff | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100  2610    0  2610    0     0   7187      0 --:--:-- --:--:-- --:--:--  7209
    patching file src/Plugin/Field/FieldType/MeasurementItem.php
    patching file src/Plugin/Validation/Constraint/DimensionsConstraintValidator.php
    โžœ  physical git:(8.x-1.3) โœ— ..
    โžœ  contrib git:(main) โœ— phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml physical
    
    FILE: /Users/interns/Demo-site/drupal-orgissue/web/modules/contrib/physical/css/physical.admin.css
    --------------------------------------------------------------------------------------------------
    FOUND 2 ERRORS AFFECTING 2 LINES
    --------------------------------------------------------------------------------------------------
      6 | ERROR | [x] Multiple selectors should each be on a single line
     14 | ERROR | [x] Multiple selectors should each be on a single line
    --------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/interns/Demo-site/drupal-orgissue/web/modules/contrib/physical/tests/modules/physical_test/physical_test.routing.yml
    ---------------------------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
    ---------------------------------------------------------------------------------------------------------------------------------
      8 | WARNING | Open page callback found, please add a comment before the line why there is no access restriction
     17 | WARNING | Open page callback found, please add a comment before the line why there is no access restriction
    ---------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/interns/Demo-site/drupal-orgissue/web/modules/contrib/physical/tests/modules/physical_test/src/Form/MeasurementTestForm.php
    ----------------------------------------------------------------------------------------------------------------------------------------
    FOUND 2 ERRORS AFFECTING 2 LINES
    ----------------------------------------------------------------------------------------------------------------------------------------
      6 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Form\FormBase.
     10 | ERROR | [x] Missing class doc comment
    ----------------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ----------------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/interns/Demo-site/drupal-orgissue/web/modules/contrib/physical/tests/modules/physical_test/src/Form/DimensionsTestForm.php
    ---------------------------------------------------------------------------------------------------------------------------------------
    FOUND 2 ERRORS AFFECTING 2 LINES
    ---------------------------------------------------------------------------------------------------------------------------------------
      6 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Form\FormBase.
     10 | ERROR | [x] Missing class doc comment
    ---------------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ---------------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/interns/Demo-site/drupal-orgissue/web/modules/contrib/physical/tests/src/Unit/VolumeTest.php
    ---------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AND 1 WARNING AFFECTING 2 LINES
    ---------------------------------------------------------------------------------------------------------
     33 | ERROR   | Doc comment short description must start with a capital letter
     37 | WARNING | Unused variable $volume.
    ---------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/interns/Demo-site/drupal-orgissue/web/modules/contrib/physical/tests/src/Unit/WeightTest.php
    ---------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AND 1 WARNING AFFECTING 2 LINES
    ---------------------------------------------------------------------------------------------------------
     33 | ERROR   | Doc comment short description must start with a capital letter
     37 | WARNING | Unused variable $weight.
    ---------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/interns/Demo-site/drupal-orgissue/web/modules/contrib/physical/tests/src/Unit/TemperatureTest.php
    --------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AND 1 WARNING AFFECTING 2 LINES
    --------------------------------------------------------------------------------------------------------------
     49 | ERROR   | Doc comment short description must start with a capital letter
     53 | WARNING | Unused variable $temperature.
    --------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/interns/Demo-site/drupal-orgissue/web/modules/contrib/physical/tests/src/Unit/MeasurementTest.php
    --------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AND 1 WARNING AFFECTING 2 LINES
    --------------------------------------------------------------------------------------------------------------
     34 | ERROR   | Doc comment short description must start with a capital letter
     38 | WARNING | Unused variable $measurement.
    --------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/interns/Demo-site/drupal-orgissue/web/modules/contrib/physical/tests/src/Unit/LengthTest.php
    ---------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AND 1 WARNING AFFECTING 2 LINES
    ---------------------------------------------------------------------------------------------------------
     33 | ERROR   | Doc comment short description must start with a capital letter
     37 | WARNING | Unused variable $length.
    ---------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/interns/Demo-site/drupal-orgissue/web/modules/contrib/physical/tests/src/Unit/AreaTest.php
    -------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AND 1 WARNING AFFECTING 2 LINES
    -------------------------------------------------------------------------------------------------------
     33 | ERROR   | Doc comment short description must start with a capital letter
     37 | WARNING | Unused variable $area.
    -------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/interns/Demo-site/drupal-orgissue/web/modules/contrib/physical/README.md
    -------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    -------------------------------------------------------------------------------------
     14 | WARNING | Line exceeds 80 characters; contains 82 characters
    -------------------------------------------------------------------------------------
    
    
    FILE: /Users/interns/Demo-site/drupal-orgissue/web/modules/contrib/physical/src/Plugin/Field/FieldWidget/MeasurementDefaultWidget.php
    -------------------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    -------------------------------------------------------------------------------------------------------------------------------------
     6 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Field\FieldItemListInterface.
    -------------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    -------------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/interns/Demo-site/drupal-orgissue/web/modules/contrib/physical/src/Plugin/Field/FieldWidget/DimensionsDefaultWidget.php
    ------------------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ------------------------------------------------------------------------------------------------------------------------------------
     6 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Field\FieldItemListInterface.
    ------------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ------------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/interns/Demo-site/drupal-orgissue/web/modules/contrib/physical/src/Plugin/Field/FieldType/MeasurementItem.php
    -----------------------------------------------------------------------------------------------------------------------------------------------
    FOUND 2 ERRORS AFFECTING 1 LINE
    -----------------------------------------------------------------------------------------------------------------------------------------------
     12 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\StringTranslation\StringTranslationTrait.
     12 | ERROR | [x] There must be one blank line after the last USE statement; 2 found;
    -----------------------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    -----------------------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/interns/Demo-site/drupal-orgissue/web/modules/contrib/physical/src/Plugin/Field/FieldFormatter/DimensionsDefaultFormatter.php
    ------------------------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ------------------------------------------------------------------------------------------------------------------------------------------
     34 | ERROR | [x] Use null coalesce operator instead of ternary operator.
    ------------------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ------------------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/interns/Demo-site/drupal-orgissue/web/modules/contrib/physical/src/Plugin/Field/FieldFormatter/MeasurementDefaultFormatter.php
    -------------------------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    -------------------------------------------------------------------------------------------------------------------------------------------
     34 | ERROR | [x] Use null coalesce operator instead of ternary operator.
    -------------------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    -------------------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/interns/Demo-site/drupal-orgissue/web/modules/contrib/physical/src/Plugin/Validation/Constraint/DimensionsConstraint.php
    -------------------------------------------------------------------------------------------------------------------------------------
    FOUND 2 ERRORS AFFECTING 2 LINES
    -------------------------------------------------------------------------------------------------------------------------------------
     18 | ERROR | Missing member variable doc comment
     19 | ERROR | Missing member variable doc comment
    -------------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/interns/Demo-site/drupal-orgissue/web/modules/contrib/physical/src/Plugin/Validation/Constraint/DimensionsConstraintValidator.php
    ----------------------------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ----------------------------------------------------------------------------------------------------------------------------------------------
     7 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\StringTranslation\StringTranslationTrait.
    ----------------------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ----------------------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/interns/Demo-site/drupal-orgissue/web/modules/contrib/physical/src/Element/Number.php
    --------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    --------------------------------------------------------------------------------------------------------------------
     7 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Render\Element.
    --------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/interns/Demo-site/drupal-orgissue/web/modules/contrib/physical/src/Calculator.php
    ----------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ----------------------------------------------------------------------------------------------
     178 | ERROR | [x] Use null coalesce operator instead of ternary operator.
    ----------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ----------------------------------------------------------------------------------------------
    
    
    FILE: /Users/interns/Demo-site/drupal-orgissue/web/modules/contrib/physical/src/Measurement.php
    -----------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 3 LINES
    -----------------------------------------------------------------------------------------------
     244 | WARNING | Line exceeds 80 characters; contains 84 characters
     272 | WARNING | Line exceeds 80 characters; contains 91 characters
     278 | WARNING | Line exceeds 80 characters; contains 88 characters
    -----------------------------------------------------------------------------------------------
    
    Time: 749ms; Memory: 12MB
    
    โžœ  contrib git:(main) โœ—

    Thank you.

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia dev16.addweb

    silvi.addweb โ†’ made their first commit to this issueโ€™s fork.

  • Open in Jenkins โ†’ Open on Drupal.org โ†’
    Core: 9.5.x + Environment: PHP 8.0 & MySQL 5.7
    last update 11 days ago
    22 pass
  • Status changed to Needs review 11 days ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia dev16.addweb

    Hi, I have fix some phpcs issue, Please review.

Production build 0.69.0 2024