Drupal Coding Standards Issues | phpcs

Created on 12 January 2023, almost 2 years ago
Updated 30 August 2024, 3 months ago

Problem/Motivation

Getting following error/warnings
FILE: /var/www/html/modules/contrib/commerce_product_tax/tests/src/Functional/TaxRateDefaultWidgetTest.php
------------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
------------------------------------------------------------------------------------------------------------------------------------------
117 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
------------------------------------------------------------------------------------------------------------------------------------------

FILE: /var/www/html/modules/contrib/commerce_product_tax/src/Plugin/Field/FieldType/TaxRateItem.php
------------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
------------------------------------------------------------------------------------------------------------------------------------------
95 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
119 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
------------------------------------------------------------------------------------------------------------------------------------------

FILE: /var/www/html/modules/contrib/commerce_product_tax/src/Plugin/Field/FieldType/TaxRateItemList.php
-----------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------------------------------------------------
21 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
-----------------------------------------------------------------------------------------------------------------------------------------

FILE: /var/www/html/modules/contrib/commerce_product_tax/src/Plugin/Field/FieldFormatter/TaxRatePercentageFormatter.php
-----------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------------------------------
12 | WARNING | Line exceeds 80 characters; contains 81 characters
-----------------------------------------------------------------------------------------------------------------------

FILE: /var/www/html/modules/contrib/commerce_product_tax/src/Plugin/Validation/Constraint/TaxRateConstraint.php
---------------------------------------------------------------------------------------------------------------
FOUND 3 ERRORS AFFECTING 3 LINES
---------------------------------------------------------------------------------------------------------------
17 | ERROR | Missing member variable doc comment
18 | ERROR | Missing member variable doc comment
19 | ERROR | Missing member variable doc comment
---------------------------------------------------------------------------------------------------------------

Time: 2.63 secs; Memory: 6MB

Steps to reproduce

Run following command

phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml modules/contrib/commerce_product_tax/

Proposed resolution

Above error/warnings need to be fixed

🐛 Bug report
Status

Closed: duplicate

Version

1.0

Component

Code

Created by

🇮🇳India samit.310@gmail.com

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024