Drupal Coding Standards Issues | phpcs

Created on 13 January 2023, about 2 years ago
Updated 16 January 2023, about 2 years ago

Problem/Motivation

Getting following error/warnings

FILE: /var/www/html/modules/contrib/views_contact_form/views_contact_form.module
--------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------
1 | ERROR | [x] Missing file doc comment
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

FILE: /var/www/html/modules/contrib/views_contact_form/src/Plugin/Field/FieldFormatter/ViewsContactFormEmailFormatter.php
------------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 11 WARNINGS AFFECTING 11 LINES
------------------------------------------------------------------------------------------------------------------------------------------
45 | WARNING | Unused variable $delta.
53 | WARNING | ContactForm::load calls should be avoided in classes, use dependency injection instead
66 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
74 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
76 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
85 | WARNING | ContactForm::load calls should be avoided in classes, use dependency injection instead
88 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
93 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
105 | WARNING | ContactForm::loadMultiple calls should be avoided in classes, use dependency injection instead
120 | WARNING | #description values usually have to run through t() for translation
130 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
------------------------------------------------------------------------------------------------------------------------------------------

Time: 1.16 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/views_contact_form/

Proposed resolution

Above error/warnings need to be fixed

🐛 Bug report
Status

RTBC

Version

2.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.

  • Issue was unassigned.
  • Status changed to RTBC about 2 years ago
Production build 0.71.5 2024