Fix the errors/warnings reported by Php_CodeSniffer

Created on 6 July 2023, over 1 year ago
Updated 28 July 2023, over 1 year ago

Problem/Motivation

FILE: C:\xampp\htdocs\backendassignment\web\modules\contrib\switch_theme\src\Controller\SwitchthemeController.php
-------------------------------------------------------------------------------------------------------------------
FOUND 21 ERRORS AND 2 WARNINGS AFFECTING 21 LINES
-------------------------------------------------------------------------------------------------------------------
   1 | ERROR   | [x] End of line character is invalid; expected "\n" but found "\r\n"
  31 | ERROR   | [ ] Parameter $connection is not described in comment
  32 | ERROR   | [x] Doc comment short description must end with a full stop
  34 | ERROR   | [ ] Missing parameter comment
  34 | ERROR   | [ ] Doc comment for parameter $databaseConnection does not match actual variable name $connection
  35 | ERROR   | [x] Whitespace found at end of line
  43 | ERROR   | [x] Doc comment short description must end with a full stop
  45 | ERROR   | [ ] Description for the @return value is missing
  49 | ERROR   | [x] Whitespace found at end of line
  72 | WARNING | [x] A comma should follow the last multiline array item. Found: 'name'
  74 | ERROR   | [x] Whitespace found at end of line
  81 | ERROR   | [ ] Inline doc block comments are not allowed; use "/* Comment */" or "// Comment" instead
  85 | ERROR   | [x] Whitespace found at end of line
  86 | ERROR   | [ ] Inline doc block comments are not allowed; use "/* Comment */" or "// Comment" instead
  91 | WARNING | [x] A comma should follow the last multiline array item. Found: name
  94 | ERROR   | [ ] Inline doc block comments are not allowed; use "/* Comment */" or "// Comment" instead
  94 | ERROR   | [x] Whitespace found at end of line
 116 | ERROR   | [x] Whitespace found at end of line
 118 | ERROR   | [x] Spaces must be used for alignment; tabs are not allowed
 120 | ERROR   | [x] Spaces must be used for alignment; tabs are not allowed
 121 | ERROR   | [x] Spaces must be used for alignment; tabs are not allowed
 126 | ERROR   | [x] Expected 1 blank line after function; 0 found
 127 | ERROR   | [x] The closing brace for the class must have an empty line before it
-------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 16 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------------------


FILE: C:\xampp\htdocs\backendassignment\web\modules\contrib\switch_theme\src\Form\DeleteForm.php
------------------------------------------------------------------------------------------------
FOUND 65 ERRORS AFFECTING 60 LINES
------------------------------------------------------------------------------------------------
  1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
 11 | ERROR | [x] Missing class doc comment
 13 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
 18 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
 19 | ERROR | [x] Whitespace found at end of line
 20 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
 21 | ERROR | [x] Doc comment short description must end with a full stop
 25 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
 26 | ERROR | [x] Whitespace found at end of line
 27 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
 28 | ERROR | [x] Doc comment short description must end with a full stop
 30 | ERROR | [x] Parameter comment must be on the next line
 30 | ERROR | [x] Parameter comment must end with a full stop
 32 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
 33 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
 34 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
 35 | ERROR | [x] Whitespace found at end of line
 36 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
 37 | ERROR | [x] Doc comment short description must end with a full stop
 39 | ERROR | [ ] Missing parameter comment
 39 | ERROR | [x] Data types in @param tags need to be fully namespaced
 41 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
 42 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
 43 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
 44 | ERROR | [x] Whitespace found at end of line
 45 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
 48 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
 49 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
 50 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
 51 | ERROR | [x] Whitespace found at end of line
 52 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
 55 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
 56 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
 57 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
 58 | ERROR | [x] Whitespace found at end of line
 59 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
 62 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
 63 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
 64 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
 65 | ERROR | [x] Whitespace found at end of line
 66 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
 69 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
 69 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "NULL" but found "null"
 70 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
 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
 77 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
 78 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
 79 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 12
 80 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 12
 81 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 12
 82 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 12
 84 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 12
 85 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
 85 | ERROR | [x] Expected newline after closing brace
 86 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 12
 87 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
 88 | ERROR | [x] Whitespace found at end of line
 89 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
 90 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
 91 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
 91 | ERROR | [x] Expected 1 blank line after function; 0 found
 92 | ERROR | [x] The closing brace for the class must have an empty line before it
------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 64 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------


FILE: C:\xampp\htdocs\backendassignment\web\modules\contrib\switch_theme\src\Form\EditForm.php
-------------------------------------------------------------------------------------------------------------
FOUND 146 ERRORS AND 9 WARNINGS AFFECTING 130 LINES
-------------------------------------------------------------------------------------------------------------
   1 | ERROR   | [x] End of line character is invalid; expected "\n" but found "\r\n"
  14 | ERROR   | [x] Doc comment short description must end with a full stop
  18 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
  23 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
  25 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
  30 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
  32 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
  33 | ERROR   | [x] Doc comment short description must end with a full stop
  37 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
  39 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
  40 | ERROR   | [x] Doc comment short description must end with a full stop
  42 | ERROR   | [x] Expected 1 spaces after parameter type; 8 found
  42 | ERROR   | [x] Parameter comment must be on the next line
  42 | ERROR   | [x] Parameter comment must end with a full stop
  43 | ERROR   | [x] Parameter comment must be on the next line
  43 | ERROR   | [x] Parameter comment must end with a full stop
  44 | ERROR   | [x] Whitespace found at end of line
  47 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
  48 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 8
  49 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 8
  50 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
  51 | ERROR   | [x] Whitespace found at end of line
  52 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
  53 | ERROR   | [x] Doc comment short description must start with a capital letter
  53 | ERROR   | [x] Doc comment short description must end with a full stop
  55 | ERROR   | [ ] Missing parameter comment
  55 | ERROR   | [x] Data types in @param tags need to be fully namespaced
  57 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
  58 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 8
  62 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
  64 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
  67 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
  68 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 8
  69 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
  71 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
  72 | ERROR   | [x] Doc comment short description must end with a full stop
  73 | ERROR   | [x] Whitespace found at end of line
  74 | ERROR   | [ ] Missing parameter comment
  74 | ERROR   | [x] Expected 1 spaces after parameter type; 14 found
  75 | ERROR   | [ ] Missing parameter comment
  75 | ERROR   | [x] Data types in @param tags need to be fully namespaced
  77 | ERROR   | [ ] If there is no return value for a function, there must not be a @return tag.
  77 | ERROR   | [ ] Description for the @return value is missing
  78 | ERROR   | [x] Expected 5 space(s) before asterisk; 4 found
  79 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
  80 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 8
  80 | WARNING | [ ] Role::loadMultiple calls should be avoided in classes, use dependency injection instead
  81 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 8
  81 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
  82 | ERROR   | [x] Whitespace found at end of line
  83 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 8
  84 | ERROR   | [x] Line indented incorrectly; expected 6 spaces, found 12
  85 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 8
  87 | 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 6 spaces, found 12
  91 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 8
  93 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 8
  94 | ERROR   | [x] Line indented incorrectly; expected 6 spaces, found 12
  95 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 8
  97 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 8
  98 | ERROR   | [x] Line indented incorrectly; expected 6 spaces, found 12
  99 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 8
 100 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
 101 | ERROR   | [x] Whitespace found at end of line
 102 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
 103 | ERROR   | [x] Doc comment short description must end with a full stop
 104 | ERROR   | [x] Whitespace found at end of line
 105 | ERROR   | [ ] Missing parameter comment
 105 | ERROR   | [x] Expected 1 spaces after parameter type; 30 found
 106 | ERROR   | [ ] Missing parameter comment
 106 | ERROR   | [x] Expected 1 spaces after parameter type; 17 found
 106 | ERROR   | [x] Data types in @param tags need to be fully namespaced
 107 | ERROR   | [ ] Missing parameter comment
 107 | ERROR   | [ ] Parameter type "int|null           Switch theme id" must not contain spaces
 109 | ERROR   | [ ] Description for the @return value is missing
 111 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
 111 | ERROR   | [x] TRUE, FALSE and NULL must be uppercase; expected "NULL" but found "null"
 112 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 8
 113 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 8
 114 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 8
 116 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 8
 116 | WARNING | [ ] Role::loadMultiple calls should be avoided in classes, use dependency injection instead
 117 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 8
 117 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
 118 | ERROR   | [x] Whitespace found at end of line
 119 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 8
 120 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 8
 121 | ERROR   | [x] Line indented incorrectly; expected 6 spaces, found 12
 122 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 8
 124 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 8
 129 | WARNING | [x] A comma should follow the last multiline array item. Found: true
 129 | ERROR   | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
 131 | ERROR   | [x] Whitespace found at end of line
 132 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 8
 137 | ERROR   | [x] TRUE, FALSE and NULL must be uppercase; expected "NULL" but found "null"
 138 | WARNING | [x] A comma should follow the last multiline array item. Found: true
 138 | ERROR   | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
 140 | ERROR   | [x] Whitespace found at end of line
 141 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 8
 146 | WARNING | [x] A comma should follow the last multiline array item. Found: true
 146 | ERROR   | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
 149 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 8
 150 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 8
 151 | ERROR   | [x] Line indented incorrectly; expected 6 spaces, found 12
 152 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 8
 154 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 8
 160 | WARNING | [x] A comma should follow the last multiline array item. Found: true
 160 | ERROR   | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
 162 | ERROR   | [x] Whitespace found at end of line
 163 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 8
 164 | ERROR   | [x] Array indentation error, expected 10 spaces but found 12
 165 | ERROR   | [x] Array indentation error, expected 10 spaces but found 12
 166 | ERROR   | [x] Array indentation error, expected 10 spaces but found 12
 168 | ERROR   | [x] Whitespace found at end of line
 169 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 8
 170 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
 172 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
 175 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
 176 | ERROR   | [x] Whitespace found at end of line
 177 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 8
 178 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 8
 179 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 8
 180 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 8
 181 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 8
 182 | ERROR   | [x] Whitespace found at end of line
 183 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 8
 184 | ERROR   | [x] Line indented incorrectly; expected 6 spaces, found 12
 185 | ERROR   | [x] Object operator not indented correctly; expected 14 spaces but found 12
 188 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 8
 188 | ERROR   | [x] Expected newline after closing brace
 189 | ERROR   | [x] Line indented incorrectly; expected 6 spaces, found 12
 190 | ERROR   | [x] Object operator not indented correctly; expected 14 spaces but found 12
 192 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 8
 194 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 8
 195 | ERROR   | [x] Object operator not indented correctly; expected 10 spaces but found 8
 198 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 8
 199 | ERROR   | [x] Object operator not indented correctly; expected 10 spaces but found 8
 202 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 8
 203 | ERROR   | [x] Object operator not indented correctly; expected 10 spaces but found 8
 206 | WARNING | [ ] Unused variable $query.
 206 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 8
 207 | ERROR   | [x] Object operator not indented correctly; expected 10 spaces but found 8
 210 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 8
 211 | ERROR   | [x] Object operator not indented correctly; expected 10 spaces but found 8
 214 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 8
 215 | ERROR   | [x] Object operator not indented correctly; expected 10 spaces but found 8
 217 | ERROR   | [x] Whitespace found at end of line
 218 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 8
 220 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 8
 221 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 8
 222 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
 222 | ERROR   | [x] Expected 1 blank line after function; 0 found
 222 | ERROR   | [x] Whitespace found at end of line
 223 | ERROR   | [x] The closing brace for the class must have an empty line before it
-------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 140 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------------


FILE: C:\xampp\htdocs\backendassignment\web\modules\contrib\switch_theme\src\SwitchthemeManager.php
---------------------------------------------------------------------------------------------------
FOUND 32 ERRORS AFFECTING 29 LINES
---------------------------------------------------------------------------------------------------
  1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
  8 | ERROR | [x] Doc comment short description must end with a full stop
 11 | ERROR | [x] Whitespace found at end of line
 13 | ERROR | [x] Doc comment short description must end with a full stop
 18 | ERROR | [x] Whitespace found at end of line
 19 | ERROR | [ ] Missing short description in doc comment
 25 | ERROR | [x] Whitespace found at end of line
 27 | ERROR | [x] Doc comment short description must end with a full stop
 28 | ERROR | [x] Whitespace found at end of line
 29 | ERROR | [ ] Description for the @return value is missing
 44 | ERROR | [x] Whitespace found at end of line
 48 | ERROR | [x] Array indentation error, expected 8 spaces but found 10
 49 | ERROR | [x] Array indentation error, expected 8 spaces but found 10
 50 | ERROR | [x] Array indentation error, expected 8 spaces but found 10
 54 | ERROR | [x] Whitespace found at end of line
 58 | ERROR | [x] Doc comment short description must end with a full stop
 59 | ERROR | [x] Whitespace found at end of line
 60 | ERROR | [ ] Missing parameter comment
 60 | ERROR | [ ] Parameter type "int Switch theme id" must not contain spaces
 62 | ERROR | [x] Expected "object|null" but found "\stdClass|null" for function return type
 62 | ERROR | [ ] Description for the @return value is missing
 69 | ERROR | [x] Whitespace found at end of line
 74 | ERROR | [x] Object operator not indented correctly; expected 6 spaces but found 8
 78 | ERROR | [x] Doc comment short description must end with a full stop
 80 | ERROR | [ ] Missing parameter comment
 80 | ERROR | [ ] Parameter type "int Switch theme id" must not contain spaces
 81 | ERROR | [x] Whitespace found at end of line
 82 | ERROR | [ ] Description for the @return value is missing
 86 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 6
 87 | ERROR | [x] Object operator not indented correctly; expected 8 spaces but found 10
 91 | ERROR | [x] Expected 1 blank line after function; 0 found
 92 | ERROR | [x] The closing brace for the class must have an empty line before it
---------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 24 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------


FILE: C:\xampp\htdocs\backendassignment\web\modules\contrib\switch_theme\src\SwitchthemeManagerInterface.php
------------------------------------------------------------------------------------------------------------
FOUND 13 ERRORS AFFECTING 13 LINES
------------------------------------------------------------------------------------------------------------
  1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
  5 | ERROR | [x] Missing interface doc comment
  6 | ERROR | [x] Whitespace found at end of line
  7 | ERROR | [x] Whitespace found at end of line
  8 | ERROR | [x] Doc comment short description must end with a full stop
 10 | ERROR | [ ] Description for the @return value is missing
 14 | ERROR | [x] Whitespace found at end of line
 15 | ERROR | [x] Doc comment short description must end with a full stop
 17 | ERROR | [ ] Description for the @return value is missing
 21 | ERROR | [x] Whitespace found at end of line
 22 | ERROR | [x] Doc comment short description must end with a full stop
 23 | ERROR | [x] Whitespace found at end of line
 24 | ERROR | [ ] Description for the @return value is missing
------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 10 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------


FILE: C:\xampp\htdocs\backendassignment\web\modules\contrib\switch_theme\src\Theme\ThemeNegotiator.php
------------------------------------------------------------------------------------------------------------
FOUND 84 ERRORS AND 8 WARNINGS AFFECTING 71 LINES
------------------------------------------------------------------------------------------------------------
   1 | ERROR   | [x] End of line character is invalid; expected "\n" but found "\r\n"
   9 | ERROR   | [x] Missing class doc comment
  10 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
  11 | ERROR   | [x] Doc comment short description must end with a full stop
  12 | ERROR   | [x] Whitespace found at end of line
  15 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
  17 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
  18 | ERROR   | [x] Doc comment short description must end with a full stop
  19 | ERROR   | [x] Whitespace found at end of line
  21 | ERROR   | [x] Whitespace found at end of line
  22 | ERROR   | [ ] The @var tag must be the first tag in a member variable comment
  24 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
  26 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
  29 | ERROR   | [x] Data types in @var tags need to be fully namespaced
  31 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
  33 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
  34 | ERROR   | [x] Doc comment short description must end with a full stop
  36 | ERROR   | [x] Data types in @param tags need to be fully namespaced
  36 | ERROR   | [x] Parameter comment must be on the next line
  36 | ERROR   | [x] Parameter comment must end with a full stop
  37 | ERROR   | [x] Whitespace found at end of line
  40 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
  41 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 8
  42 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
  44 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
  45 | WARNING | [ ] Line exceeds 80 characters; contains 113 characters
  47 | ERROR   | [ ] Missing parameter comment
  47 | ERROR   | [x] Data types in @param tags need to be fully namespaced
  48 | ERROR   | [x] Whitespace found at end of line
  49 | ERROR   | [x] Expected "bool" but found "boolean" for function return type
  49 | ERROR   | [ ] Description for the @return value is missing
  51 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
  53 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 8
  53 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
  54 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 8
  54 | ERROR   | [ ] Inline doc block comments are not allowed; use "/* Comment */" or "// Comment" instead
  57 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 8
  59 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 8
  59 | ERROR   | [ ] Inline doc block comments are not allowed; use "/* Comment */" or "// Comment" instead
  60 | WARNING | [ ] Line exceeds 80 characters; contains 98 characters
  62 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 8
  63 | ERROR   | [x] Line indented incorrectly; expected 6 spaces, found 12
  63 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
  64 | ERROR   | [x] Line indented incorrectly; expected 6 spaces, found 12
  64 | ERROR   | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
  65 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 8
  67 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 8
  67 | ERROR   | [ ] Inline doc block comments are not allowed; use "/* Comment */" or "// Comment" instead
  70 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 8
  72 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 8
  72 | ERROR   | [ ] Inline doc block comments are not allowed; use "/* Comment */" or "// Comment" instead
  73 | WARNING | [ ] Line exceeds 80 characters; contains 100 characters
  74 | ERROR   | [x] Whitespace found at end of line
  77 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 8
  77 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
  79 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 8
  79 | ERROR   | [ ] Inline doc block comments are not allowed; use "/* Comment */" or "// Comment" instead
  82 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 8
  83 | ERROR   | [x] Line indented incorrectly; expected 6 spaces, found 12
  83 | ERROR   | [ ] Inline doc block comments are not allowed; use "/* Comment */" or "// Comment" instead
  86 | ERROR   | [x] Line indented incorrectly; expected 6 spaces, found 12
  87 | ERROR   | [x] Line indented incorrectly; expected 6 spaces, found 12
  87 | ERROR   | [ ] Inline doc block comments are not allowed; use "/* Comment */" or "// Comment" instead
  90 | ERROR   | [x] Line indented incorrectly; expected 6 spaces, found 12
  92 | ERROR   | [x] Line indented incorrectly; expected 6 spaces, found 12
  92 | ERROR   | [ ] Inline doc block comments are not allowed; use "/* Comment */" or "// Comment" instead
  93 | WARNING | [ ] Line exceeds 80 characters; contains 125 characters
  95 | ERROR   | [x] Line indented incorrectly; expected 6 spaces, found 12
  97 | ERROR   | [x] Line indented incorrectly; expected 8 spaces, found 16
  98 | ERROR   | [x] Line indented incorrectly; expected 8 spaces, found 16
  98 | ERROR   | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
  99 | ERROR   | [x] Line indented incorrectly; expected 6 spaces, found 12
 100 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 8
 101 | ERROR   | [x] Whitespace found at end of line
 102 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 8
 102 | ERROR   | [ ] Inline doc block comments are not allowed; use "/* Comment */" or "// Comment" instead
 103 | WARNING | [ ] Line exceeds 80 characters; contains 108 characters
 105 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 8
 105 | ERROR   | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
 106 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
 108 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
 109 | ERROR   | [x] Doc comment short description must end with a full stop
 111 | ERROR   | [ ] Missing parameter comment
 111 | ERROR   | [x] Data types in @param tags need to be fully namespaced
 112 | ERROR   | [x] Whitespace found at end of line
 113 | ERROR   | [ ] Description for the @return value is missing
 114 | ERROR   | [x] Whitespace found at end of line
 115 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
 116 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 8
 117 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
 117 | ERROR   | [x] Expected 1 blank line after function; 0 found
 118 | ERROR   | [x] The closing brace for the class must have an empty line before it
------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 70 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------


FILE: C:\xampp\htdocs\backendassignment\web\modules\contrib\switch_theme\switch_theme.install
---------------------------------------------------------------------------------------------
FOUND 19 ERRORS AND 4 WARNINGS AFFECTING 19 LINES
---------------------------------------------------------------------------------------------
   1 | ERROR   | [x] Missing file doc comment
   1 | ERROR   | [x] The PHP open tag must be followed by exactly one blank line
   1 | ERROR   | [x] End of line character is invalid; expected "\n" but found "\r\n"
   5 | ERROR   | [x] Expected 1 space(s) before asterisk; 0 found
   6 | ERROR   | [x] Expected 1 space(s) before asterisk; 0 found
   7 | ERROR   | [x] Expected 1 space(s) before asterisk; 0 found
   8 | ERROR   | [x] Expected 1 space(s) before asterisk; 0 found
   9 | ERROR   | [x] Expected 1 space(s) before asterisk; 0 found
  10 | ERROR   | [x] Expected 1 space(s) before asterisk; 0 found
  11 | ERROR   | [x] Expected 1 space(s) before asterisk; 0 found
  12 | ERROR   | [x] Expected 1 space(s) before asterisk; 0 found
  28 | WARNING | [x] A comma should follow the last multiline array item. Found: ]
  49 | WARNING | [x] A comma should follow the last multiline array item. Found: ]
  70 | WARNING | [x] A comma should follow the last multiline array item. Found: ]
  91 | WARNING | [x] A comma should follow the last multiline array item. Found: ]
  97 | ERROR   | [x] Expected 1 space(s) before asterisk; 0 found
  97 | ERROR   | [x] Doc comment short description must start with a capital letter
  97 | ERROR   | [x] Doc comment short description must end with a full stop
  98 | ERROR   | [x] Expected 1 space(s) before asterisk; 0 found
 103 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
 104 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
 105 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
 106 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
---------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 23 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------

Time: 1.56 secs; Memory: 6MB

Steps to reproduce

Run the phpcs command on the module.

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

📌 Task
Status

Fixed

Version

1.0

Component

Code

Created by

🇮🇳India sidharth_soman Bangalore

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

  • Issue created by @sidharth_soman
  • @sidharth_soman opened merge request.
  • Issue was unassigned.
  • Status changed to Needs review over 1 year ago
  • 🇮🇳India sidharth_soman Bangalore

    I've fixed most of the trivial issues. The ones remaining are to do with filling out/editing doc comments and such.

    Please review the MR.

  • Status changed to Needs work over 1 year ago
  • 🇵🇭Philippines roberttabigue

    Hi,

    When I applied the latest MR to the Switch Theme against 1.0.x-dev, confirmed it resolves some of the PHPCS errors but not everything, please see:

    FILE: /Users/roberttabigue/Projects/drupalorgissues/docroot/modules/contrib/switch_theme/CHANGELOG.md
    -----------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 3 LINES
    -----------------------------------------------------------------------------------------------------
      8 | WARNING | Line exceeds 80 characters; contains 99 characters
      9 | WARNING | Line exceeds 80 characters; contains 107 characters
     10 | WARNING | Line exceeds 80 characters; contains 97 characters
    -----------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/roberttabigue/Projects/drupalorgissues/docroot/modules/contrib/switch_theme/README.md
    --------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    --------------------------------------------------------------------------------------------------
     34 | WARNING | Line exceeds 80 characters; contains 105 characters
    --------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/roberttabigue/Projects/drupalorgissues/docroot/modules/contrib/switch_theme/src/Form/DeleteForm.php
    ----------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ----------------------------------------------------------------------------------------------------------------
     11 | ERROR | Doc comment is empty
    ----------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/roberttabigue/Projects/drupalorgissues/docroot/modules/contrib/switch_theme/src/Form/EditForm.php
    --------------------------------------------------------------------------------------------------------------
    FOUND 3 ERRORS AND 4 WARNINGS AFFECTING 6 LINES
    --------------------------------------------------------------------------------------------------------------
      82 | ERROR   | If there is no return value for a function, there must not be a @return tag.
      82 | ERROR   | Description for the @return value is missing
      85 | WARNING | Role::loadMultiple calls should be avoided in classes, use dependency injection instead
      86 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
     117 | ERROR   | Description for the @return value is missing
     124 | WARNING | Role::loadMultiple calls should be avoided in classes, use dependency injection instead
     125 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
    --------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/roberttabigue/Projects/drupalorgissues/docroot/modules/contrib/switch_theme/src/SwitchthemeManagerInterface.php
    ----------------------------------------------------------------------------------------------------------------------------
    FOUND 4 ERRORS AFFECTING 4 LINES
    ----------------------------------------------------------------------------------------------------------------------------
      5 | ERROR | Doc comment is empty
     13 | ERROR | Description for the @return value is missing
     20 | ERROR | Description for the @return value is missing
     27 | ERROR | Description for the @return value is missing
    ----------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/roberttabigue/Projects/drupalorgissues/docroot/modules/contrib/switch_theme/src/Controller/SwitchthemeController.php
    ---------------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ---------------------------------------------------------------------------------------------------------------------------------
     46 | ERROR | Description for the @return value is missing
    ---------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/roberttabigue/Projects/drupalorgissues/docroot/modules/contrib/switch_theme/src/Theme/ThemeNegotiator.php
    ----------------------------------------------------------------------------------------------------------------------
    FOUND 13 ERRORS AND 8 WARNINGS AFFECTING 21 LINES
    ----------------------------------------------------------------------------------------------------------------------
       9 | ERROR   | Doc comment is empty
      25 | ERROR   | The @var tag must be the first tag in a member variable comment
      49 | WARNING | Line exceeds 80 characters; contains 111 characters
      54 | ERROR   | Description for the @return value is missing
      58 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
      59 | ERROR   | Inline doc block comments are not allowed; use "/* Comment */" or "// Comment" instead
      64 | ERROR   | Inline doc block comments are not allowed; use "/* Comment */" or "// Comment" instead
      65 | WARNING | Line exceeds 80 characters; contains 94 characters
      68 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
      72 | ERROR   | Inline doc block comments are not allowed; use "/* Comment */" or "// Comment" instead
      77 | ERROR   | Inline doc block comments are not allowed; use "/* Comment */" or "// Comment" instead
      78 | WARNING | Line exceeds 80 characters; contains 96 characters
      82 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
      84 | ERROR   | Inline doc block comments are not allowed; use "/* Comment */" or "// Comment" instead
      88 | ERROR   | Inline doc block comments are not allowed; use "/* Comment */" or "// Comment" instead
      92 | ERROR   | Inline doc block comments are not allowed; use "/* Comment */" or "// Comment" instead
      97 | ERROR   | Inline doc block comments are not allowed; use "/* Comment */" or "// Comment" instead
      98 | WARNING | Line exceeds 80 characters; contains 119 characters
     107 | ERROR   | Inline doc block comments are not allowed; use "/* Comment */" or "// Comment" instead
     108 | WARNING | Line exceeds 80 characters; contains 104 characters
     119 | ERROR   | Description for the @return value is missing
    ----------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/roberttabigue/Projects/drupalorgissues/docroot/modules/contrib/switch_theme/src/SwitchthemeManager.php
    -------------------------------------------------------------------------------------------------------------------
    FOUND 4 ERRORS AFFECTING 4 LINES
    -------------------------------------------------------------------------------------------------------------------
     19 | ERROR | Missing short description in doc comment
     29 | ERROR | Description for the @return value is missing
     63 | ERROR | Description for the @return value is missing
     84 | ERROR | Description for the @return value is missing
    -------------------------------------------------------------------------------------------------------------------
    
    Time: 187ms; Memory: 10MB

    I run this command:
    phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig switch_theme/

    I'm moving this to Needs work for now.

    Thank you.

  • Assigned to racol
  • Status changed to Fixed over 1 year ago
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024