Fix the issues reported by phpcs

Created on 19 December 2022, almost 2 years ago
Updated 1 March 2024, 9 months ago

Getting the following issues and warning in phpcs

FILE: /Applications/MAMP/htdocs/d9/web/modules/contrib/printable/tests/src/Unit/Plugin/Block/PrintableLinkBlockTest.php
-----------------------------------------------------------------------------------------------------------------------
FOUND 3 ERRORS AFFECTING 3 LINES
-----------------------------------------------------------------------------------------------------------------------
 15 | ERROR | Missing member variable doc comment
 17 | ERROR | Missing member variable doc comment
 19 | ERROR | Missing member variable doc comment
-----------------------------------------------------------------------------------------------------------------------


FILE: /Applications/MAMP/htdocs/d9/web/modules/contrib/printable/printable.module
-------------------------------------------------------------------------------------------------
FOUND 3 ERRORS AFFECTING 2 LINES
-------------------------------------------------------------------------------------------------
  76 | ERROR | [x] Expected 1 space after "="; 2 found
  76 | ERROR | [x] Namespaced classes/interfaces/traits should be referenced with use statements
 123 | ERROR | [x] Namespaced classes/interfaces/traits should be referenced with use statements
-------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------


FILE: /Applications/MAMP/htdocs/d9/web/modules/contrib/printable/modules/printable_pdf/printable_pdf.module
-----------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------------------
 12 | ERROR | [x] Namespaced classes/interfaces/traits should be referenced with use statements
-----------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------------------


FILE: /Applications/MAMP/htdocs/d9/web/modules/contrib/printable/modules/printable_pdf/src/Plugin/PrintableFormat/PdfFormat.php
-------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------------------------------------
 5 | WARNING | [x] Unused use statement
-------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------------------------------


FILE: /Applications/MAMP/htdocs/d9/web/modules/contrib/printable/src/Form/PrintableConfigurationForm.php
--------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 3 LINES
--------------------------------------------------------------------------------------------------------
 126 | WARNING | #options values usually have to run through t() for translation
 127 | WARNING | #options values usually have to run through t() for translation
 128 | WARNING | #options values usually have to run through t() for translation
--------------------------------------------------------------------------------------------------------


FILE: /Applications/MAMP/htdocs/d9/web/modules/contrib/printable/src/Form/FormatConfigurationFormPdf.php
------------------------------------------------------------------------------------------------------------------------------------------
FOUND 2 ERRORS AND 2 WARNINGS AFFECTING 3 LINES
------------------------------------------------------------------------------------------------------------------------------------------
  47 | ERROR   | Parameter $pluginManager is not described in comment
 197 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 209 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
 209 | ERROR   | Concatenating translatable strings is not allowed, use placeholders instead and only one string literal
------------------------------------------------------------------------------------------------------------------------------------------


FILE: /Applications/MAMP/htdocs/d9/web/modules/contrib/printable/src/Tests/PrintableBlockTest.php
-----------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 5 WARNINGS AFFECTING 5 LINES
-----------------------------------------------------------------------------------------------------------------------------------------
 65 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
 73 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
 74 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
 75 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
 76 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
-----------------------------------------------------------------------------------------------------------------------------------------


FILE: /Applications/MAMP/htdocs/d9/web/modules/contrib/printable/src/Tests/PrintablePdfTest.php
------------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 4 WARNINGS AFFECTING 4 LINES
------------------------------------------------------------------------------------------------------------------------------------------
  70 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
  73 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
  92 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
 109 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
------------------------------------------------------------------------------------------------------------------------------------------


FILE: /Applications/MAMP/htdocs/d9/web/modules/contrib/printable/src/Tests/PrintablePageTest.php
-----------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 3 LINES
-----------------------------------------------------------------------------------------------------------------------------------------
 62 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
 65 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
 92 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
-----------------------------------------------------------------------------------------------------------------------------------------


FILE: /Applications/MAMP/htdocs/d9/web/modules/contrib/printable/src/Tests/PrintableFormTest.php
-----------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------------------------------------------------
 55 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
-----------------------------------------------------------------------------------------------------------------------------------------


FILE: /Applications/MAMP/htdocs/d9/web/modules/contrib/printable/src/Tests/PrintablePdfFormTest.php
-----------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------------------------------------------------
 63 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
-----------------------------------------------------------------------------------------------------------------------------------------


FILE: /Applications/MAMP/htdocs/d9/web/modules/contrib/printable/src/Tests/PrintableUninstallTest.php
-----------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
-----------------------------------------------------------------------------------------------------------------------------------------
 54 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
 57 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
-----------------------------------------------------------------------------------------------------------------------------------------


FILE: /Applications/MAMP/htdocs/d9/web/modules/contrib/printable/src/Tests/PrintableLinkTest.php
-----------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 3 LINES
-----------------------------------------------------------------------------------------------------------------------------------------
 49 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
 63 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
 66 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
-----------------------------------------------------------------------------------------------------------------------------------------


FILE: /Applications/MAMP/htdocs/d9/web/modules/contrib/printable/src/Plugin/PrintableFormatBase.php
---------------------------------------------------------------------------------------------------
FOUND 1 ERROR AND 1 WARNING AFFECTING 2 LINES
---------------------------------------------------------------------------------------------------
 232 | ERROR   | [x] Expected 1 space after SWITCH keyword; 0 found
 248 | WARNING | [ ] Line exceeds 80 characters; contains 90 characters
---------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------


FILE: /Applications/MAMP/htdocs/d9/web/modules/contrib/printable/src/Plugin/PrintableFormatInterface.php
--------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AND 1 WARNING AFFECTING 2 LINES
--------------------------------------------------------------------------------------------------------
 43 | WARNING | Line exceeds 80 characters; contains 90 characters
 66 | ERROR   | Missing parameter name
--------------------------------------------------------------------------------------------------------


FILE: /Applications/MAMP/htdocs/d9/web/modules/contrib/printable/src/PrintableCssInclude.php
-------------------------------------------------------------------------------------------------
FOUND 1 ERROR AND 1 WARNING AFFECTING 2 LINES
-------------------------------------------------------------------------------------------------
 46 | ERROR   | [x] list(...) is forbidden, use [...] instead.
 47 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
-------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------


FILE: /Applications/MAMP/htdocs/d9/web/modules/contrib/printable/src/Controller/PrintableController.php
-------------------------------------------------------------------------------------------------------
FOUND 3 ERRORS AFFECTING 3 LINES
-------------------------------------------------------------------------------------------------------
  91 | ERROR | [ ] Type hint "array" missing for $configuration
 124 | ERROR | [ ] Type hint "array" missing for $configuration
 144 | ERROR | [x] Expected newline after closing brace
-------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------


FILE: /Applications/MAMP/htdocs/d9/web/modules/contrib/printable/src/StreamWrapper/PrintableStream.php
-----------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
-----------------------------------------------------------------------------------------------------------------------------------------
 17 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
 24 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
-----------------------------------------------------------------------------------------------------------------------------------------

Time: 901ms; Memory: 12MB

Child Issue 🐛 Fix translations by just render Text with t Fixed

Steps to reproduce

phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig .

📌 Task
Status

Fixed

Version

3.0

Component

Code

Created by

🇮🇳India noorulshameera

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

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