Fix the issues reported by phpcs

Created on 22 November 2022, about 2 years ago
Updated 4 September 2023, over 1 year ago

Hi, While reviewing the module for best practices and standards. I have found these issues with the help of PHPCS:

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

FILE: /var/www/html/dContri/pdf_api/src/Plugin/PdfGeneratorInterface.php
--------------------------------------------------------------------------------
FOUND 6 ERRORS AFFECTING 6 LINES
--------------------------------------------------------------------------------
   3 | ERROR | [x] Namespaced classes, interfaces and traits should not begin
     |       |     with a file doc comment
  92 | ERROR | [x] Expected
     |       |     "PdfGeneratorInterfacePORTRAIT|PdfGeneratorInterfaceLANDSCAPE"
     |       |     but found
     |       |     "PdfGeneratorInterface::PORTRAIT|PdfGeneratorInterface::LANDSCAPE"
     |       |     for parameter type
 142 | ERROR | [ ] Doc comment for parameter $string does not match actual
     |       |     variable name <undefined>
 150 | ERROR | [ ] Doc comment for parameter $html does not match actual
     |       |     variable name <undefined>
 158 | ERROR | [x] Expected "bool" but found "boolean" for function return type
 180 | ERROR | [ ] Missing parameter name
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------


FILE: /var/www/html/dContri/pdf_api/src/Plugin/PdfGeneratorBase.php
--------------------------------------------------------------------------------
FOUND 37 ERRORS AFFECTING 37 LINES
--------------------------------------------------------------------------------
   3 | ERROR | [x] Namespaced classes, interfaces and traits should not begin
     |       |     with a file doc comment
  25 | ERROR | [x] Short array syntax must be used to define arrays
  61 | ERROR | [x] Expected "array|false" but found "array|FALSE" for function
     |       |     return type
  93 | ERROR | [x] Short array syntax must be used to define arrays
  94 | ERROR | [x] Short array syntax must be used to define arrays
  98 | ERROR | [x] Short array syntax must be used to define arrays
 102 | ERROR | [x] Short array syntax must be used to define arrays
 106 | ERROR | [x] Short array syntax must be used to define arrays
 110 | ERROR | [x] Short array syntax must be used to define arrays
 114 | ERROR | [x] Short array syntax must be used to define arrays
 118 | ERROR | [x] Short array syntax must be used to define arrays
 122 | ERROR | [x] Short array syntax must be used to define arrays
 126 | ERROR | [x] Short array syntax must be used to define arrays
 130 | ERROR | [x] Short array syntax must be used to define arrays
 134 | ERROR | [x] Short array syntax must be used to define arrays
 138 | ERROR | [x] Short array syntax must be used to define arrays
 142 | ERROR | [x] Short array syntax must be used to define arrays
 146 | ERROR | [x] Short array syntax must be used to define arrays
 150 | ERROR | [x] Short array syntax must be used to define arrays
 154 | ERROR | [x] Short array syntax must be used to define arrays
 158 | ERROR | [x] Short array syntax must be used to define arrays
 162 | ERROR | [x] Short array syntax must be used to define arrays
 166 | ERROR | [x] Short array syntax must be used to define arrays
 170 | ERROR | [x] Short array syntax must be used to define arrays
 174 | ERROR | [x] Short array syntax must be used to define arrays
 178 | ERROR | [x] Short array syntax must be used to define arrays
 182 | ERROR | [x] Short array syntax must be used to define arrays
 186 | ERROR | [x] Short array syntax must be used to define arrays
 190 | ERROR | [x] Short array syntax must be used to define arrays
 194 | ERROR | [x] Short array syntax must be used to define arrays
 198 | ERROR | [x] Short array syntax must be used to define arrays
 202 | ERROR | [x] Short array syntax must be used to define arrays
 206 | ERROR | [x] Short array syntax must be used to define arrays
 210 | ERROR | [x] Short array syntax must be used to define arrays
 240 | ERROR | [x] Expected "bool" but found "boolean" for function return type
 261 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but
     |       |     found "true"
 264 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but
     |       |     found "false"
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 37 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------


FILE: /var/www/html/dContri/pdf_api/src/Plugin/PdfGenerator/DompdfGenerator.php
--------------------------------------------------------------------------------
FOUND 4 ERRORS AND 2 WARNINGS AFFECTING 6 LINES
--------------------------------------------------------------------------------
   3 | ERROR   | [x] Namespaced classes, interfaces and traits should not begin
     |         |     with a file doc comment
  12 | WARNING | [x] Unused use statement
  13 | WARNING | [x] Unused use statement
  82 | ERROR   | [x] Short array syntax must be used to define arrays
 114 | ERROR   | [x] Expected 1 blank line after function; 2 found
 129 | ERROR   | [x] Short array syntax must be used to define arrays
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 6 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------


FILE: /var/www/html/dContri/pdf_api/src/Plugin/PdfGenerator/MpdfGenerator.php
--------------------------------------------------------------------------------
FOUND 5 ERRORS AND 4 WARNINGS AFFECTING 9 LINES
--------------------------------------------------------------------------------
   3 | ERROR   | [x] Namespaced classes, interfaces and traits should not begin
     |         |     with a file doc comment
  13 | WARNING | [x] Unused use statement
  14 | WARNING | [x] Unused use statement
  18 | WARNING | [x] Unused use statement
  71 | WARNING | [ ] Possible useless method overriding detected
 130 | ERROR   | [x] Short array syntax must be used to define arrays
 138 | ERROR   | [x] Short array syntax must be used to define arrays
 151 | ERROR   | [x] Short array syntax must be used to define arrays
 159 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 5
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 8 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------


FILE: /var/www/html/dContri/pdf_api/src/Plugin/PdfGenerator/TcpdfGenerator.php
--------------------------------------------------------------------------------
FOUND 2 ERRORS AND 2 WARNINGS AFFECTING 4 LINES
--------------------------------------------------------------------------------
  3 | ERROR   | [x] Namespaced classes, interfaces and traits should not begin
    |         |     with a file doc comment
 12 | WARNING | [x] Unused use statement
 13 | WARNING | [x] Unused use statement
 14 | ERROR   | [x] When importing a class with "use", do not include a leading
    |         |     \
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 4 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------


FILE: .../www/html/dContri/pdf_api/src/Plugin/PdfGenerator/WkhtmltopdfGenerator.php
--------------------------------------------------------------------------------
FOUND 11 ERRORS AND 2 WARNINGS AFFECTING 13 LINES
--------------------------------------------------------------------------------
   3 | ERROR   | [x] Namespaced classes, interfaces and traits should not begin
     |         |     with a file doc comment
  12 | WARNING | [x] Unused use statement
  13 | WARNING | [x] Unused use statement
  41 | ERROR   | [x] Expected "\Drupal\Core\Messenger" but found
     |         |     "\Drupal\Core\Messenger;" for @var tag in member variable
     |         |     comment
  74 | ERROR   | [x] Short array syntax must be used to define arrays
  85 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 5
  86 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 5
 100 | ERROR   | [x] Short array syntax must be used to define arrays
 107 | ERROR   | [x] Short array syntax must be used to define arrays
 115 | ERROR   | [x] Short array syntax must be used to define arrays
 130 | ERROR   | [x] Short array syntax must be used to define arrays
 146 | ERROR   | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE"
     |         |     but found "true"
 155 | ERROR   | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE"
     |         |     but found "false"
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 13 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------


FILE: /var/www/html/dContri/pdf_api/src/Annotation/PdfGenerator.php
--------------------------------------------------------------------------------
FOUND 4 ERRORS AFFECTING 3 LINES
--------------------------------------------------------------------------------
  3 | ERROR | [x] Namespaced classes, interfaces and traits should not begin
    |       |     with a file doc comment
 40 | ERROR | [ ] The @var tag must be the first tag in a member variable
    |       |     comment
 49 | ERROR | [ ] The @var tag must be the first tag in a member variable
    |       |     comment
 49 | ERROR | [x] Expected "\Drupal\Core\Annotation\Translationoptional" but
    |       |     found "\Drupal\Core\Annotation\Translation (optional)" for
    |       |     @var tag in member variable comment
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------


FILE: /var/www/html/dContri/pdf_api/src/PdfGeneratorPluginManager.php
--------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
--------------------------------------------------------------------------------
  3 | ERROR | [x] Namespaced classes, interfaces and traits should not begin
    |       |     with a file doc comment
 45 | ERROR | [x] Short array syntax must be used to define arrays
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------


FILE: /var/www/html/dContri/pdf_api/modules/puphpeteer/puphpeteer.install
-------------------------------------------------------------------------
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/dContri/pdf_api/modules/puphpeteer/src/Form/Configuration.php
--------------------------------------------------------------------------------
FOUND 24 ERRORS AND 6 WARNINGS AFFECTING 29 LINES
--------------------------------------------------------------------------------
  10 | ERROR   | [x] Missing class doc comment
  18 | WARNING | [ ] Possible useless method overriding detected
  40 | ERROR   | [x] Visibility must be declared on method "getFormId"
  40 | ERROR   | [x] Missing function doc comment
  44 | ERROR   | [x] Missing function doc comment
 116 | WARNING | [ ] #options values usually have to run through t() for
     |         |     translation
 117 | WARNING | [ ] #options values usually have to run through t() for
     |         |     translation
 118 | WARNING | [ ] #options values usually have to run through t() for
     |         |     translation
 131 | WARNING | [ ] #description values usually have to run through t() for
     |         |     translation
 211 | WARNING | [x] A comma should follow the last multiline array item.
     |         |     Found: '<em>When debugging with headful Chrome, you can
     |         |     preview the print media version by pressing
     |         |     Control+Shift+P. Type "Rendering" and select Show
     |         |     Rendering. In the Emulate CSS media dropdown, select
     |         |     print.</em>'
 237 | ERROR   | [x] Missing function doc comment
 276 | ERROR   | [x] Missing function doc comment
 280 | ERROR   | [x] Missing function doc comment
 284 | ERROR   | [x] Array indentation error, expected 6 spaces but found 15
 285 | ERROR   | [x] Array indentation error, expected 6 spaces but found 15
 286 | ERROR   | [x] Array indentation error, expected 6 spaces but found 15
 287 | ERROR   | [x] Array indentation error, expected 6 spaces but found 15
 288 | ERROR   | [x] Array indentation error, expected 6 spaces but found 15
 289 | ERROR   | [x] Array indentation error, expected 6 spaces but found 15
 290 | ERROR   | [x] Array indentation error, expected 6 spaces but found 15
 291 | ERROR   | [x] Array indentation error, expected 6 spaces but found 15
 292 | ERROR   | [x] Array indentation error, expected 6 spaces but found 15
 293 | ERROR   | [x] Array indentation error, expected 6 spaces but found 15
 294 | ERROR   | [x] Array indentation error, expected 6 spaces but found 15
 295 | ERROR   | [x] Array indentation error, expected 6 spaces but found 15
 296 | ERROR   | [x] Array indentation error, expected 6 spaces but found 15
 297 | ERROR   | [x] Array indentation error, expected 6 spaces but found 15
 298 | ERROR   | [x] Array indentation error, expected 6 spaces but found 15
 299 | ERROR   | [x] Array indentation error, expected 6 spaces but found 15
 300 | ERROR   | [x] Array closing indentation error, expected 4 spaces but
     |         |     found 13
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 25 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------


FILE: ...pdf_api/modules/puphpeteer/src/Plugin/PdfGenerator/PuphpeteerGenerator.php
--------------------------------------------------------------------------------
FOUND 23 ERRORS AND 6 WARNINGS AFFECTING 29 LINES
--------------------------------------------------------------------------------
   3 | ERROR   | [x] Namespaced classes, interfaces and traits should not begin
     |         |     with a file doc comment
  11 | WARNING | [x] Unused use statement
  19 | WARNING | [x] Unused use statement
  55 | ERROR   | [x] Doc comment short description must end with a full stop
 115 | ERROR   | [ ] Class property $page_size should use lowerCamel naming
     |         |     without underscores
 148 | ERROR   | [x] Expected "bool" but found "boolean" for @var tag in member
     |         |     variable comment
 155 | ERROR   | [x] Expected "bool" but found "boolean" for @var tag in member
     |         |     variable comment
 160 | WARNING | [ ] Line exceeds 80 characters; contains 89 characters
 169 | ERROR   | [x] Expected "bool" but found "boolean" for @var tag in member
     |         |     variable comment
 236 | ERROR   | [x] Opening brace should be on the same line as the
     |         |     declaration
 319 | ERROR   | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE"
     |         |     but found "false"
 330 | WARNING | [x] A comma should follow the last multiline array item.
     |         |     Found: '--start-maximized'
 352 | ERROR   | [x] Expected newline after closing brace
 372 | ERROR   | [x] Expected newline after closing brace
 403 | ERROR   | [x] Opening brace should be on the same line as the
     |         |     declaration
 411 | WARNING | [ ] Line exceeds 80 characters; contains 96 characters
 434 | ERROR   | [x] TRUE, FALSE and NULL must be uppercase; expected "NULL"
     |         |     but found "null"
 435 | WARNING | [ ] Line exceeds 80 characters; contains 92 characters
 438 | ERROR   | [x] Expected newline after closing brace
 462 | ERROR   | [x] Array indentation error, expected 14 spaces but found 12
 463 | ERROR   | [x] Array indentation error, expected 14 spaces but found 12
 464 | ERROR   | [x] Array closing indentation error, expected 12 spaces but
     |         |     found 10
 473 | ERROR   | [x] Expected newline after closing brace
 478 | ERROR   | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE"
     |         |     but found "true"
 500 | ERROR   | [x] Expected newline after closing brace
 521 | ERROR   | [x] Expected 1 space(s) after cast statement; 0 found
 524 | ERROR   | [x] Expected 1 space(s) after cast statement; 0 found
 528 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks,
     |         |     question marks, colons, or closing parentheses
 552 | ERROR   | [x] Short array syntax must be used to define arrays
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 25 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------


FILE: .../www/html/dContri/pdf_api/modules/puphpeteer/src/Controller/Puphpeteer.php
--------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
--------------------------------------------------------------------------------
 15 | ERROR | [ ] Missing member variable doc comment
 18 | ERROR | [x] Doc comment short description must end with a full stop
--------------------------------------------------------------------------------
๐Ÿ“Œ Task
Status

Closed: outdated

Version

2.0

Component

Code

Created by

๐Ÿ‡ฎ๐Ÿ‡ณIndia akshay.singh Noida

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