Fix the issues reported by phpcs

Created on 26 December 2023, over 1 year ago
Updated 9 January 2024, over 1 year ago

Problem/Motivation

Steps to reproduce

Running phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig shows the following warnings/errors, which should be fixed.

Result:

FILE: ...pp/web/themes/contrib/radix/Commands/radix/ComponentCommands.php
----------------------------------------------------------------------
FOUND 23 ERRORS AND 5 WARNINGS AFFECTING 25 LINES
----------------------------------------------------------------------
  15 | WARNING | [ ] The class short comment should describe what the
     |         |     class does and not simply repeat the class name
  17 | ERROR   | [x] Opening brace should be on the same line as the
     |         |     declaration
  28 | ERROR   | [x] Expected 1 blank line before function; 0 found
  29 | ERROR   | [x] Opening brace should be on the same line as the
     |         |     declaration
  35 | ERROR   | [x] Expected 1 blank line after function; 2 found
  46 | WARNING | [ ] Line exceeds 80 characters; contains 82
     |         |     characters
  49 | ERROR   | [x] Opening brace should be on the same line as the
     |         |     declaration
  61 | ERROR   | [x] Inline comments must end in full-stops,
     |         |     exclamation marks, question marks, colons, or
     |         |     closing parentheses
  61 | ERROR   | [x] Comments may not appear after statements
  68 | WARNING | [ ] Line exceeds 80 characters; contains 81
     |         |     characters
  76 | ERROR   | [x] Expected newline after closing brace
  85 | ERROR   | [x] Opening brace should be on the same line as the
     |         |     declaration
 108 | WARNING | [ ] Line exceeds 80 characters; contains 129
     |         |     characters
 108 | ERROR   | [x] Inline comments must end in full-stops,
     |         |     exclamation marks, question marks, colons, or
     |         |     closing parentheses
 108 | ERROR   | [x] Comments may not appear after statements
 111 | ERROR   | [x] Expected newline after closing brace
 114 | ERROR   | [x] Expected newline after closing brace
 124 | WARNING | [ ] Line exceeds 80 characters; contains 84
     |         |     characters
 132 | ERROR   | [x] Opening brace should be on the same line as the
     |         |     declaration
 137 | ERROR   | [x] Inline comments must end in full-stops,
     |         |     exclamation marks, question marks, colons, or
     |         |     closing parentheses
 143 | ERROR   | [x] Inline comments must end in full-stops,
     |         |     exclamation marks, question marks, colons, or
     |         |     closing parentheses
 148 | ERROR   | [x] Inline comments must end in full-stops,
     |         |     exclamation marks, question marks, colons, or
     |         |     closing parentheses
 157 | ERROR   | [x] Opening brace should be on the same line as the
     |         |     declaration
 166 | ERROR   | [x] Opening brace should be on the same line as the
     |         |     declaration
 167 | ERROR   | [x] Namespaced classes/interfaces/traits should be
     |         |     referenced with use statements
 177 | ERROR   | [x] Opening brace should be on the same line as the
     |         |     declaration
 178 | ERROR   | [x] Namespaced classes/interfaces/traits should be
     |         |     referenced with use statements
 179 | ERROR   | [x] Expected 1 blank line after function; 0 found
----------------------------------------------------------------------
PHPCBF CAN FIX THE 23 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------


FILE: ...app/web/themes/contrib/radix/Commands/radix/SubThemeCommands.php
----------------------------------------------------------------------
FOUND 102 ERRORS AND 2 WARNINGS AFFECTING 88 LINES
----------------------------------------------------------------------
  15 | WARNING | [ ] The class short comment should describe what the
     |         |     class does and not simply repeat the class name
  17 | ERROR   | [x] Opening brace should be on the same line as the
     |         |     declaration
  18 | ERROR   | [x] Line indented incorrectly; expected 2 spaces,
     |         |     found 4
  23 | ERROR   | [ ] Parameter tags must be grouped together in a doc
     |         |     comment
  23 | ERROR   | [x] Parameter comment must be on the next line
  24 | ERROR   | [x] Separate the @param and @bootstrap sections by a
     |         |     blank line.
  29 | WARNING | [ ] Line exceeds 80 characters; contains 82
     |         |     characters
  31 | ERROR   | [x] Line indented incorrectly; expected 2 spaces,
     |         |     found 4
  31 | ERROR   | [x] Expected 1 blank line before function; 0 found
  32 | ERROR   | [x] Line indented incorrectly; expected 4 spaces,
     |         |     found 8
  33 | ERROR   | [x] Line indented incorrectly; expected 6 spaces,
     |         |     found 12
  34 | ERROR   | [x] Line indented incorrectly; expected 6 spaces,
     |         |     found 12
  35 | ERROR   | [x] Line indented incorrectly; expected 6 spaces,
     |         |     found 12
  36 | ERROR   | [x] Whitespace found at end of line
  37 | ERROR   | [x] Line indented incorrectly; expected 6 spaces,
     |         |     found 12
  37 | ERROR   | [x] Inline comments must end in full-stops,
     |         |     exclamation marks, question marks, colons, or
     |         |     closing parentheses
  38 | ERROR   | [x] Line indented incorrectly; expected 6 spaces,
     |         |     found 12
  39 | ERROR   | [x] Whitespace found at end of line
  40 | ERROR   | [x] Line indented incorrectly; expected 6 spaces,
     |         |     found 12
  41 | ERROR   | [x] Line indented incorrectly; expected 6 spaces,
     |         |     found 12
  42 | ERROR   | [x] Whitespace found at end of line
  43 | ERROR   | [x] Line indented incorrectly; expected 6 spaces,
     |         |     found 12
  44 | ERROR   | [x] Line indented incorrectly; expected 6 spaces,
     |         |     found 12
  45 | ERROR   | [x] Line indented incorrectly; expected 6 spaces,
     |         |     found 12
  46 | ERROR   | [x] Line indented incorrectly; expected 6 spaces,
     |         |     found 12
  47 | ERROR   | [x] Whitespace found at end of line
  48 | ERROR   | [x] Line indented incorrectly; expected 6 spaces,
     |         |     found 12
  49 | ERROR   | [x] Line indented incorrectly; expected 6 spaces,
     |         |     found 12
  50 | ERROR   | [x] Line indented incorrectly; expected 6 spaces,
     |         |     found 12
  52 | ERROR   | [x] Line indented incorrectly; expected 6 spaces,
     |         |     found 12
  53 | ERROR   | [x] Line indented incorrectly; expected 6 spaces,
     |         |     found 12
  54 | ERROR   | [x] Whitespace found at end of line
  55 | ERROR   | [x] Line indented incorrectly; expected 6 spaces,
     |         |     found 12
  56 | ERROR   | [x] Line indented incorrectly; expected 6 spaces,
     |         |     found 12
  57 | ERROR   | [x] Line indented incorrectly; expected 6 spaces,
     |         |     found 12
  59 | ERROR   | [x] Line indented incorrectly; expected 6 spaces,
     |         |     found 12
  60 | ERROR   | [x] Whitespace found at end of line
  61 | ERROR   | [x] Line indented incorrectly; expected 6 spaces,
     |         |     found 12
  62 | ERROR   | [x] Line indented incorrectly; expected 6 spaces,
     |         |     found 12
  63 | ERROR   | [x] Line indented incorrectly; expected 6 spaces,
     |         |     found 12
  64 | ERROR   | [x] Line indented incorrectly; expected 6 spaces,
     |         |     found 12
  66 | ERROR   | [x] Line indented incorrectly; expected 6 spaces,
     |         |     found 12
  67 | ERROR   | [x] Line indented incorrectly; expected 6 spaces,
     |         |     found 12
  68 | ERROR   | [x] Line indented incorrectly; expected 6 spaces,
     |         |     found 12
  69 | ERROR   | [x] Line indented incorrectly; expected 4 spaces,
     |         |     found 8
  69 | ERROR   | [x] Expected newline after closing brace
  70 | ERROR   | [x] Line indented incorrectly; expected 6 spaces,
     |         |     found 12
  71 | ERROR   | [x] Line indented incorrectly; expected 4 spaces,
     |         |     found 8
  72 | ERROR   | [x] Line indented incorrectly; expected 2 spaces,
     |         |     found 4
  73 | ERROR   | [x] Whitespace found at end of line
  74 | ERROR   | [x] Line indented incorrectly; expected 2 spaces,
     |         |     found 4
  74 | ERROR   | [x] Missing function doc comment
  75 | ERROR   | [x] Line indented incorrectly; expected 4 spaces,
     |         |     found 8
  76 | ERROR   | [x] Line indented incorrectly; expected 4 spaces,
     |         |     found 8
  77 | ERROR   | [x] Line indented incorrectly; expected 2 spaces,
     |         |     found 4
  78 | ERROR   | [x] Whitespace found at end of line
  79 | ERROR   | [x] Line indented incorrectly; expected 2 spaces,
     |         |     found 4
  79 | ERROR   | [x] Missing function doc comment
  80 | ERROR   | [x] Line indented incorrectly; expected 4 spaces,
     |         |     found 8
  81 | ERROR   | [x] Line indented incorrectly; expected 4 spaces,
     |         |     found 8
  82 | ERROR   | [x] Line indented incorrectly; expected 2 spaces,
     |         |     found 4
  84 | ERROR   | [x] Line indented incorrectly; expected 2 spaces,
     |         |     found 4
  84 | ERROR   | [x] Missing function doc comment
  85 | ERROR   | [x] Line indented incorrectly; expected 4 spaces,
     |         |     found 8
  86 | ERROR   | [x] Line indented incorrectly; expected 4 spaces,
     |         |     found 8
  86 | ERROR   | [x] Namespaced classes/interfaces/traits should be
     |         |     referenced with use statements
  87 | ERROR   | [x] Line indented incorrectly; expected 4 spaces,
     |         |     found 8
  88 | ERROR   | [x] Line indented incorrectly; expected 4 spaces,
     |         |     found 8
  89 | ERROR   | [x] Line indented incorrectly; expected 4 spaces,
     |         |     found 8
  90 | ERROR   | [x] Line indented incorrectly; expected 2 spaces,
     |         |     found 4
  91 | ERROR   | [x] Whitespace found at end of line
  92 | ERROR   | [x] Line indented incorrectly; expected 2 spaces,
     |         |     found 4
  92 | ERROR   | [x] Missing function doc comment
  93 | ERROR   | [x] Line indented incorrectly; expected 4 spaces,
     |         |     found 8
  93 | ERROR   | [x] Namespaced classes/interfaces/traits should be
     |         |     referenced with use statements
  94 | ERROR   | [x] Line indented incorrectly; expected 4 spaces,
     |         |     found 8
  95 | ERROR   | [x] Array indentation error, expected 10 spaces but
     |         |     found 12
  97 | ERROR   | [x] Line indented incorrectly; expected 4 spaces,
     |         |     found 8
  98 | ERROR   | [x] Whitespace found at end of line
  99 | ERROR   | [x] Line indented incorrectly; expected 4 spaces,
     |         |     found 8
 100 | ERROR   | [x] Line indented incorrectly; expected 6 spaces,
     |         |     found 12
 101 | ERROR   | [x] Line indented incorrectly; expected 4 spaces,
     |         |     found 8
 102 | ERROR   | [x] Line indented incorrectly; expected 2 spaces,
     |         |     found 4
 104 | ERROR   | [x] Line indented incorrectly; expected 2 spaces,
     |         |     found 4
 104 | ERROR   | [x] Missing function doc comment
 105 | ERROR   | [x] Line indented incorrectly; expected 4 spaces,
     |         |     found 8
 106 | ERROR   | [x] Line indented incorrectly; expected 4 spaces,
     |         |     found 8
 107 | ERROR   | [x] Line indented incorrectly; expected 2 spaces,
     |         |     found 4
 109 | ERROR   | [x] Line indented incorrectly; expected 2 spaces,
     |         |     found 4
 109 | ERROR   | [ ] Missing short description in doc comment
 112 | ERROR   | [x] Line indented incorrectly; expected 2 spaces,
     |         |     found 4
 113 | ERROR   | [x] Line indented incorrectly; expected 4 spaces,
     |         |     found 8
 114 | ERROR   | [x] Line indented incorrectly; expected 4 spaces,
     |         |     found 8
 115 | ERROR   | [x] Line indented incorrectly; expected 6 spaces,
     |         |     found 12
 116 | ERROR   | [x] Line indented incorrectly; expected 4 spaces,
     |         |     found 8
 117 | ERROR   | [x] Line indented incorrectly; expected 4 spaces,
     |         |     found 8
 117 | ERROR   | [x] TRUE, FALSE and NULL must be uppercase; expected
     |         |     "NULL" but found "null"
 118 | ERROR   | [x] Line indented incorrectly; expected 2 spaces,
     |         |     found 4
 120 | ERROR   | [x] Line indented incorrectly; expected 2 spaces,
     |         |     found 4
 120 | ERROR   | [x] Missing function doc comment
 120 | ERROR   | [x] Expected 1 space before opening brace; found 0
 121 | ERROR   | [x] Line indented incorrectly; expected 4 spaces,
     |         |     found 8
 122 | ERROR   | [x] Line indented incorrectly; expected 2 spaces,
     |         |     found 4
 122 | ERROR   | [x] Expected 1 blank line after function; 0 found
----------------------------------------------------------------------
PHPCBF CAN FIX THE 100 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------


FILE: ...hemes/contrib/radix/src/kits/radix_starterkit/src/StarterKit.php
----------------------------------------------------------------------
FOUND 3 ERRORS AND 1 WARNING AFFECTING 4 LINES
----------------------------------------------------------------------
  8 | WARNING | [x] Unused use statement
 10 | ERROR   | [x] Missing class doc comment
 44 | ERROR   | [x] Expected 1 blank line after function; 0 found
 45 | ERROR   | [x] The closing brace for the class must have an
    |         |     empty line before it
----------------------------------------------------------------------
PHPCBF CAN FIX THE 4 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Fixed

Version

6.0

Component

Code

Created by

🇮🇳India Tirupati_Singh

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024