Fix the errors/warnings reported by PHP_CodeSniffer

Created on 14 March 2024, 8 months ago
Updated 5 August 2024, 3 months ago

Problem/Motivation

The module must follow the correct Drupal coding standards. So, when developing it, make sure to run phpcs --standard=Drupal,DrupalPractice on the project. This will fix most issues that reviewers might find.

Steps to reproduce

Run the following command:

phpcs --standard=Drupal --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml {module_path e.g /web/custom/module.}

FILE: /Users/mac/contribution/username/css/username.style.css
------------------------------------------------------------------------------------------------
FOUND 5 ERRORS AFFECTING 5 LINES
------------------------------------------------------------------------------------------------
   1 | ERROR | [x] Selectors must be on a single line
  45 | ERROR | [x] CSS colours must be defined in lowercase; expected #b3cefb but found #B3CEFB
  64 | ERROR | [x] CSS colours must be defined in lowercase; expected #d9e7fd but found #D9E7FD
 139 | ERROR | [x] CSS colours must be defined in lowercase; expected #d9e7fd but found #D9E7FD
 188 | ERROR | [x] CSS colours must be defined in lowercase; expected #b3cefb but found #B3CEFB
------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 5 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------


FILE: /Users/mac/contribution/username/README.md
----------------------------------------------------------------------
FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 3 LINES
----------------------------------------------------------------------
  7 | WARNING | Line exceeds 80 characters; contains 85 characters
 13 | WARNING | Line exceeds 80 characters; contains 120 characters
 25 | WARNING | Line exceeds 80 characters; contains 103 characters
----------------------------------------------------------------------


FILE: /Users/mac/contribution/username/username.module
----------------------------------------------------------------------------------------------------------------------------------------------
FOUND 31 ERRORS AND 15 WARNINGS AFFECTING 43 LINES
----------------------------------------------------------------------------------------------------------------------------------------------
   18 | WARNING | [x] Unused use statement
   19 | WARNING | [x] Unused use statement
   24 | WARNING | [x] Unused use statement
   27 | ERROR   | [x] Doc comment short description must end with a full stop
  120 | ERROR   | [x] Case breaking statements must be followed by a single blank line
  123 | ERROR   | [x] Case breaking statements must be followed by a single blank line
  279 | ERROR   | [x] Expected 1 space after comma in argument list; 2 found
  279 | ERROR   | [x] Expected one space after the comma, 2 found
  497 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
  856 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
  889 | ERROR   | [ ] The array declaration extends to column 96 (the limit is 80). The array content should be split up over multiple lines
  939 | ERROR   | [x] Parameter comment indentation must be 3 spaces, found 1 spaces
  941 | ERROR   | [ ] @return doc comment specified, but function has no return statement
  942 | ERROR   | [x] Return comment indentation must be 3 spaces, found 4 spaces
  964 | ERROR   | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
  977 | WARNING | [ ] Only string literals should be passed to t() where possible
  999 | WARNING | [ ] Only string literals should be passed to t() where possible
 1024 | WARNING | [ ] Only string literals should be passed to t() where possible
 1033 | ERROR   | [x] Parameter comment indentation must be 3 spaces, found 1 spaces
 1035 | ERROR   | [ ] @return doc comment specified, but function has no return statement
 1036 | ERROR   | [x] Return comment indentation must be 3 spaces, found 4 spaces
 1050 | ERROR   | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
 1058 | ERROR   | [x] Expected 1 space before "="; 0 found
 1063 | WARNING | [ ] Only string literals should be passed to t() where possible
 1073 | WARNING | [ ] Only string literals should be passed to t() where possible
 1081 | WARNING | [ ] Only string literals should be passed to t() where possible
 1090 | ERROR   | [x] Parameter comment indentation must be 3 spaces, found 1 spaces
 1092 | ERROR   | [ ] @return doc comment specified, but function has no return statement
 1093 | ERROR   | [x] Return comment indentation must be 3 spaces, found 4 spaces
 1116 | ERROR   | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
 1129 | WARNING | [ ] Only string literals should be passed to t() where possible
 1144 | WARNING | [ ] Only string literals should be passed to t() where possible
 1144 | ERROR   | [ ] The array declaration extends to column 118 (the limit is 80). The array content should be split up over multiple lines
 1158 | WARNING | [ ] Only string literals should be passed to t() where possible
 1174 | WARNING | [ ] Only string literals should be passed to t() where possible
 1174 | ERROR   | [ ] The array declaration extends to column 110 (the limit is 80). The array content should be split up over multiple lines
 1188 | WARNING | [ ] Only string literals should be passed to t() where possible
 1204 | WARNING | [ ] Only string literals should be passed to t() where possible
 1213 | ERROR   | [x] Parameter comment indentation must be 3 spaces, found 1 spaces
 1215 | ERROR   | [ ] @return doc comment specified, but function has no return statement
 1216 | ERROR   | [x] Return comment indentation must be 3 spaces, found 4 spaces
 1274 | ERROR   | [x] Case breaking statements must be followed by a single blank line
 1277 | ERROR   | [x] Case breaking statements must be followed by a single blank line
 1280 | ERROR   | [x] Case breaking statements must be followed by a single blank line
 1283 | ERROR   | [x] Case breaking statements must be followed by a single blank line
 1286 | ERROR   | [x] Case breaking statements must be followed by a single blank line
----------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 27 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------------------------------------------


FILE: /Users/mac/contribution/username/modules/username_phone/username_phone.module
---------------------------------------------------------------------------------------------------------------------------------
FOUND 3 ERRORS AND 4 WARNINGS AFFECTING 7 LINES
---------------------------------------------------------------------------------------------------------------------------------
  11 | ERROR   | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Form\FormStateInterface.
  14 | WARNING | [x] Unused use statement
  20 | ERROR   | [x] Language constructs must be followed by a single space; expected "return [" but found "return["
  82 | ERROR   | [x] Expected "bool" but found "boolean" for function return type
 141 | WARNING | [x] A comma should follow the last multiline array item. Found: ]
 145 | WARNING | [x] A comma should follow the last multiline array item. Found: ]
 149 | WARNING | [x] A comma should follow the last multiline array item. Found: ]
---------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 7 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------------------------------


FILE: /Users/mac/contribution/username/modules/username_phone/src/Form/UsernamePhoneForm.php
--------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 5 WARNINGS AFFECTING 5 LINES
--------------------------------------------------------------------------------------------
 53 | WARNING | [x] A comma should follow the last multiline array item. Found: ]
 57 | WARNING | [x] A comma should follow the last multiline array item. Found: ]
 61 | WARNING | [x] A comma should follow the last multiline array item. Found: ]
 70 | WARNING | [ ] Possible useless method overriding detected
 91 | WARNING | [ ] Possible useless method overriding detected
--------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------------------


FILE: /Users/mac/contribution/username/modules/username_phone/src/Plugin/Validation/Constraint/UsernamePhoneUnique.php
----------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------------------------------------------------------
 17 | ERROR | Missing member variable doc comment
----------------------------------------------------------------------------------------------------------------------


FILE: /Users/mac/contribution/username/modules/username_phone/src/Plugin/Validation/Constraint/UsernamePhoneRequiredValidator.php
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 4 ERRORS AND 1 WARNING AFFECTING 3 LINES
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  6 | ERROR   | [x] Use statements should be sorted alphabetically. The first wrong one is Symfony\Component\Validator\Constraint.
 21 | ERROR   | [x] There must be exactly one blank line before the tags in a doc comment
 21 | ERROR   | [ ] Description for the @return value is missing
 43 | WARNING | [ ] Line exceeds 80 characters; contains 99 characters
 43 | ERROR   | [x] No space found before comment text; expected "// $required = !(!$existing_value && \Drupal::currentUser()->hasPermission('administer users'));" but found
    |         |     "//$required = !(!$existing_value && \Drupal::currentUser()->hasPermission('administer users'));"
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------


FILE: /Users/mac/contribution/username/modules/username_displayname/username_displayname.module
-----------------------------------------------------------------------------------------------
FOUND 3 ERRORS AND 2 WARNINGS AFFECTING 4 LINES
-----------------------------------------------------------------------------------------------
 15 | WARNING | [ ] Hook implementations should not duplicate @return documentation
 16 | ERROR   | [x] Return comment indentation must be 3 spaces, found 5 spaces
 31 | WARNING | [ ] Hook implementations should not duplicate @return documentation
 31 | ERROR   | [ ] @return doc comment specified, but function has no return statement
 32 | ERROR   | [x] Return comment indentation must be 3 spaces, found 5 spaces
-----------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------


FILE: /Users/mac/contribution/username/modules/username_displayname/username_displayname.install
------------------------------------------------------------------------------------------------
FOUND 4 ERRORS AND 2 WARNINGS AFFECTING 6 LINES
------------------------------------------------------------------------------------------------
 10 | ERROR   | [x] Missing function doc comment
 11 | ERROR   | [x] Inline comments must start with a capital letter
 20 | ERROR   | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
 21 | WARNING | [x] A comma should follow the last multiline array item. Found: ''
 23 | WARNING | [x] A comma should follow the last multiline array item. Found: ]
 28 | ERROR   | [x] Missing function doc comment
------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 6 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------


FILE: /Users/mac/contribution/username/src/Form/UsernameSettingsForm.php
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 4 ERRORS AND 4 WARNINGS AFFECTING 7 LINES
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
   7 | WARNING | [x] Unused use statement
  10 | WARNING | [x] Unused use statement
  11 | WARNING | [x] Unused use statement
  30 | ERROR   | [x] Parameter comment indentation must be 3 spaces, found 4 spaces
 625 | WARNING | [ ] Line exceeds 80 characters; contains 174 characters
 625 | ERROR   | [x] No space found before comment text; expected "// $form_state->setErrorByName('restriction', $this->t('To restricts the username field, at least one of
     |         |     uppercase and lowercase letters or numbers must be selected.'));" but found "//$form_state->setErrorByName('restriction', $this->t('To restricts the username
     |         |     field, at least one of uppercase and lowercase letters or numbers must be selected.'));"
 710 | ERROR   | [x] Expected 1 blank line after function; 0 found
 711 | ERROR   | [x] The closing brace for the class must have an empty line before it
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 7 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------


FILE: /Users/mac/contribution/username/src/UsernameGenerator.php
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 33 ERRORS AND 1 WARNING AFFECTING 33 LINES
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 156 | WARNING | [x] There must be no blank line following an inline comment
 156 | ERROR   | [x] No space found before comment text; expected "// $new_name = username_unique_username($new_name, $account->id());" but found "//$new_name =
     |         |     username_unique_username($new_name, $account->id());"
 343 | ERROR   | [ ] The array declaration extends to column 99 (the limit is 80). The array content should be split up over multiple lines
 344 | ERROR   | [ ] The array declaration extends to column 113 (the limit is 80). The array content should be split up over multiple lines
 345 | ERROR   | [ ] The array declaration extends to column 86 (the limit is 80). The array content should be split up over multiple lines
 346 | ERROR   | [ ] The array declaration extends to column 82 (the limit is 80). The array content should be split up over multiple lines
 347 | ERROR   | [ ] The array declaration extends to column 83 (the limit is 80). The array content should be split up over multiple lines
 348 | ERROR   | [ ] The array declaration extends to column 83 (the limit is 80). The array content should be split up over multiple lines
 349 | ERROR   | [ ] The array declaration extends to column 87 (the limit is 80). The array content should be split up over multiple lines
 350 | ERROR   | [ ] The array declaration extends to column 82 (the limit is 80). The array content should be split up over multiple lines
 351 | ERROR   | [ ] The array declaration extends to column 86 (the limit is 80). The array content should be split up over multiple lines
 352 | ERROR   | [ ] The array declaration extends to column 96 (the limit is 80). The array content should be split up over multiple lines
 353 | ERROR   | [ ] The array declaration extends to column 95 (the limit is 80). The array content should be split up over multiple lines
 354 | ERROR   | [ ] The array declaration extends to column 96 (the limit is 80). The array content should be split up over multiple lines
 355 | ERROR   | [ ] The array declaration extends to column 96 (the limit is 80). The array content should be split up over multiple lines
 356 | ERROR   | [ ] The array declaration extends to column 97 (the limit is 80). The array content should be split up over multiple lines
 357 | ERROR   | [ ] The array declaration extends to column 86 (the limit is 80). The array content should be split up over multiple lines
 358 | ERROR   | [ ] The array declaration extends to column 87 (the limit is 80). The array content should be split up over multiple lines
 359 | ERROR   | [ ] The array declaration extends to column 85 (the limit is 80). The array content should be split up over multiple lines
 360 | ERROR   | [ ] The array declaration extends to column 86 (the limit is 80). The array content should be split up over multiple lines
 361 | ERROR   | [ ] The array declaration extends to column 89 (the limit is 80). The array content should be split up over multiple lines
 362 | ERROR   | [ ] The array declaration extends to column 82 (the limit is 80). The array content should be split up over multiple lines
 363 | ERROR   | [ ] The array declaration extends to column 88 (the limit is 80). The array content should be split up over multiple lines
 364 | ERROR   | [ ] The array declaration extends to column 107 (the limit is 80). The array content should be split up over multiple lines
 365 | ERROR   | [ ] The array declaration extends to column 84 (the limit is 80). The array content should be split up over multiple lines
 366 | ERROR   | [ ] The array declaration extends to column 93 (the limit is 80). The array content should be split up over multiple lines
 367 | ERROR   | [ ] The array declaration extends to column 82 (the limit is 80). The array content should be split up over multiple lines
 368 | ERROR   | [ ] The array declaration extends to column 93 (the limit is 80). The array content should be split up over multiple lines
 369 | ERROR   | [ ] The array declaration extends to column 94 (the limit is 80). The array content should be split up over multiple lines
 370 | ERROR   | [ ] The array declaration extends to column 90 (the limit is 80). The array content should be split up over multiple lines
 371 | ERROR   | [ ] The array declaration extends to column 91 (the limit is 80). The array content should be split up over multiple lines
 372 | ERROR   | [ ] The array declaration extends to column 94 (the limit is 80). The array content should be split up over multiple lines
 373 | ERROR   | [ ] The array declaration extends to column 82 (the limit is 80). The array content should be split up over multiple lines
 374 | ERROR   | [ ] The array declaration extends to column 87 (the limit is 80). The array content should be split up over multiple lines
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------


FILE: /Users/mac/contribution/username/src/Plugin/migrate/process/UsernameReplaceToken.php
------------------------------------------------------------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
------------------------------------------------------------------------------------------------------------------------------------
  6 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\migrate\MigrateExecutableInterface.
 23 | ERROR | [x] list(...) is forbidden, use [...] instead.
------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------------------------------


FILE: /Users/mac/contribution/username/src/Controller/UsernameAutocompleteController.php
-----------------------------------------------------------------------------------------------------------------------------------------
โžœ  username git:(1.0.x) โœ— /Users/mac/project/phpcs/vendor/bin/phpcs --standard=Drupal --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml   /Users/mac/contribution/username


FILE: /Users/mac/contribution/username/css/username.style.css
------------------------------------------------------------------------------------------------
FOUND 5 ERRORS AFFECTING 5 LINES
------------------------------------------------------------------------------------------------
   1 | ERROR | [x] Selectors must be on a single line
  45 | ERROR | [x] CSS colours must be defined in lowercase; expected #b3cefb but found #B3CEFB
  64 | ERROR | [x] CSS colours must be defined in lowercase; expected #d9e7fd but found #D9E7FD
 139 | ERROR | [x] CSS colours must be defined in lowercase; expected #d9e7fd but found #D9E7FD
 188 | ERROR | [x] CSS colours must be defined in lowercase; expected #b3cefb but found #B3CEFB
------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 5 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------


FILE: /Users/mac/contribution/username/username.module
----------------------------------------------------------------------------------------------------------------------------------------------
FOUND 31 ERRORS AND 15 WARNINGS AFFECTING 43 LINES
----------------------------------------------------------------------------------------------------------------------------------------------
   18 | WARNING | [x] Unused use statement
   19 | WARNING | [x] Unused use statement
   24 | WARNING | [x] Unused use statement
   27 | ERROR   | [x] Doc comment short description must end with a full stop
  120 | ERROR   | [x] Case breaking statements must be followed by a single blank line
  123 | ERROR   | [x] Case breaking statements must be followed by a single blank line
  279 | ERROR   | [x] Expected 1 space after comma in argument list; 2 found
  279 | ERROR   | [x] Expected one space after the comma, 2 found
  497 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
  856 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
  889 | ERROR   | [ ] The array declaration extends to column 96 (the limit is 80). The array content should be split up over multiple lines
  939 | ERROR   | [x] Parameter comment indentation must be 3 spaces, found 1 spaces
  941 | ERROR   | [ ] @return doc comment specified, but function has no return statement
  942 | ERROR   | [x] Return comment indentation must be 3 spaces, found 4 spaces
  964 | ERROR   | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
  977 | WARNING | [ ] Only string literals should be passed to t() where possible
  999 | WARNING | [ ] Only string literals should be passed to t() where possible
 1024 | WARNING | [ ] Only string literals should be passed to t() where possible
 1033 | ERROR   | [x] Parameter comment indentation must be 3 spaces, found 1 spaces
 1035 | ERROR   | [ ] @return doc comment specified, but function has no return statement
 1036 | ERROR   | [x] Return comment indentation must be 3 spaces, found 4 spaces
 1050 | ERROR   | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
 1058 | ERROR   | [x] Expected 1 space before "="; 0 found
 1063 | WARNING | [ ] Only string literals should be passed to t() where possible
 1073 | WARNING | [ ] Only string literals should be passed to t() where possible
 1081 | WARNING | [ ] Only string literals should be passed to t() where possible
 1090 | ERROR   | [x] Parameter comment indentation must be 3 spaces, found 1 spaces
 1092 | ERROR   | [ ] @return doc comment specified, but function has no return statement
 1093 | ERROR   | [x] Return comment indentation must be 3 spaces, found 4 spaces
 1116 | ERROR   | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
 1129 | WARNING | [ ] Only string literals should be passed to t() where possible
 1144 | WARNING | [ ] Only string literals should be passed to t() where possible
 1144 | ERROR   | [ ] The array declaration extends to column 118 (the limit is 80). The array content should be split up over multiple lines
 1158 | WARNING | [ ] Only string literals should be passed to t() where possible
 1174 | WARNING | [ ] Only string literals should be passed to t() where possible
 1174 | ERROR   | [ ] The array declaration extends to column 110 (the limit is 80). The array content should be split up over multiple lines
 1188 | WARNING | [ ] Only string literals should be passed to t() where possible
 1204 | WARNING | [ ] Only string literals should be passed to t() where possible
 1213 | ERROR   | [x] Parameter comment indentation must be 3 spaces, found 1 spaces
 1215 | ERROR   | [ ] @return doc comment specified, but function has no return statement
 1216 | ERROR   | [x] Return comment indentation must be 3 spaces, found 4 spaces
 1274 | ERROR   | [x] Case breaking statements must be followed by a single blank line
 1277 | ERROR   | [x] Case breaking statements must be followed by a single blank line
 1280 | ERROR   | [x] Case breaking statements must be followed by a single blank line
 1283 | ERROR   | [x] Case breaking statements must be followed by a single blank line
 1286 | ERROR   | [x] Case breaking statements must be followed by a single blank line
----------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 27 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------------------------------------------


FILE: /Users/mac/contribution/username/modules/username_phone/username_phone.module
---------------------------------------------------------------------------------------------------------------------------------
FOUND 3 ERRORS AND 4 WARNINGS AFFECTING 7 LINES
---------------------------------------------------------------------------------------------------------------------------------
  11 | ERROR   | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Form\FormStateInterface.
  14 | WARNING | [x] Unused use statement
  20 | ERROR   | [x] Language constructs must be followed by a single space; expected "return [" but found "return["
  82 | ERROR   | [x] Expected "bool" but found "boolean" for function return type
 141 | WARNING | [x] A comma should follow the last multiline array item. Found: ]
 145 | WARNING | [x] A comma should follow the last multiline array item. Found: ]
 149 | WARNING | [x] A comma should follow the last multiline array item. Found: ]
---------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 7 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------------------------------


FILE: /Users/mac/contribution/username/modules/username_phone/src/Form/UsernamePhoneForm.php
--------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 5 WARNINGS AFFECTING 5 LINES
--------------------------------------------------------------------------------------------
 53 | WARNING | [x] A comma should follow the last multiline array item. Found: ]
 57 | WARNING | [x] A comma should follow the last multiline array item. Found: ]
 61 | WARNING | [x] A comma should follow the last multiline array item. Found: ]
 70 | WARNING | [ ] Possible useless method overriding detected
 91 | WARNING | [ ] Possible useless method overriding detected
--------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------------------


FILE: /Users/mac/contribution/username/modules/username_phone/src/Plugin/Validation/Constraint/UsernamePhoneUnique.php
----------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------------------------------------------------------
 17 | ERROR | Missing member variable doc comment
----------------------------------------------------------------------------------------------------------------------


FILE: /Users/mac/contribution/username/modules/username_phone/src/Plugin/Validation/Constraint/UsernamePhoneRequiredValidator.php
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 4 ERRORS AND 1 WARNING AFFECTING 3 LINES
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  6 | ERROR   | [x] Use statements should be sorted alphabetically. The first wrong one is Symfony\Component\Validator\Constraint.
 21 | ERROR   | [x] There must be exactly one blank line before the tags in a doc comment
 21 | ERROR   | [ ] Description for the @return value is missing
 43 | WARNING | [ ] Line exceeds 80 characters; contains 99 characters
 43 | ERROR   | [x] No space found before comment text; expected "// $required = !(!$existing_value && \Drupal::currentUser()->hasPermission('administer users'));" but found
    |         |     "//$required = !(!$existing_value && \Drupal::currentUser()->hasPermission('administer users'));"
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------


FILE: /Users/mac/contribution/username/modules/username_displayname/username_displayname.module
-----------------------------------------------------------------------------------------------
FOUND 3 ERRORS AND 2 WARNINGS AFFECTING 4 LINES
-----------------------------------------------------------------------------------------------
 15 | WARNING | [ ] Hook implementations should not duplicate @return documentation
 16 | ERROR   | [x] Return comment indentation must be 3 spaces, found 5 spaces
 31 | WARNING | [ ] Hook implementations should not duplicate @return documentation
 31 | ERROR   | [ ] @return doc comment specified, but function has no return statement
 32 | ERROR   | [x] Return comment indentation must be 3 spaces, found 5 spaces
-----------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------


FILE: /Users/mac/contribution/username/modules/username_displayname/username_displayname.install
------------------------------------------------------------------------------------------------
FOUND 4 ERRORS AND 2 WARNINGS AFFECTING 6 LINES
------------------------------------------------------------------------------------------------
 10 | ERROR   | [x] Missing function doc comment
 11 | ERROR   | [x] Inline comments must start with a capital letter
 20 | ERROR   | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
 21 | WARNING | [x] A comma should follow the last multiline array item. Found: ''
 23 | WARNING | [x] A comma should follow the last multiline array item. Found: ]
 28 | ERROR   | [x] Missing function doc comment
------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 6 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------


FILE: /Users/mac/contribution/username/src/Form/UsernameSettingsForm.php
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 4 ERRORS AND 4 WARNINGS AFFECTING 7 LINES
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
   7 | WARNING | [x] Unused use statement
  10 | WARNING | [x] Unused use statement
  11 | WARNING | [x] Unused use statement
  30 | ERROR   | [x] Parameter comment indentation must be 3 spaces, found 4 spaces
 625 | WARNING | [ ] Line exceeds 80 characters; contains 174 characters
 625 | ERROR   | [x] No space found before comment text; expected "// $form_state->setErrorByName('restriction', $this->t('To restricts the username field, at least one of
     |         |     uppercase and lowercase letters or numbers must be selected.'));" but found "//$form_state->setErrorByName('restriction', $this->t('To restricts the username
     |         |     field, at least one of uppercase and lowercase letters or numbers must be selected.'));"
 710 | ERROR   | [x] Expected 1 blank line after function; 0 found
 711 | ERROR   | [x] The closing brace for the class must have an empty line before it
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 7 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------


FILE: /Users/mac/contribution/username/src/UsernameGenerator.php
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 33 ERRORS AND 1 WARNING AFFECTING 33 LINES
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 156 | WARNING | [x] There must be no blank line following an inline comment
 156 | ERROR   | [x] No space found before comment text; expected "// $new_name = username_unique_username($new_name, $account->id());" but found "//$new_name =
     |         |     username_unique_username($new_name, $account->id());"
 343 | ERROR   | [ ] The array declaration extends to column 99 (the limit is 80). The array content should be split up over multiple lines
 344 | ERROR   | [ ] The array declaration extends to column 113 (the limit is 80). The array content should be split up over multiple lines
 345 | ERROR   | [ ] The array declaration extends to column 86 (the limit is 80). The array content should be split up over multiple lines
 346 | ERROR   | [ ] The array declaration extends to column 82 (the limit is 80). The array content should be split up over multiple lines
 347 | ERROR   | [ ] The array declaration extends to column 83 (the limit is 80). The array content should be split up over multiple lines
 348 | ERROR   | [ ] The array declaration extends to column 83 (the limit is 80). The array content should be split up over multiple lines
 349 | ERROR   | [ ] The array declaration extends to column 87 (the limit is 80). The array content should be split up over multiple lines
 350 | ERROR   | [ ] The array declaration extends to column 82 (the limit is 80). The array content should be split up over multiple lines
 351 | ERROR   | [ ] The array declaration extends to column 86 (the limit is 80). The array content should be split up over multiple lines
 352 | ERROR   | [ ] The array declaration extends to column 96 (the limit is 80). The array content should be split up over multiple lines
 353 | ERROR   | [ ] The array declaration extends to column 95 (the limit is 80). The array content should be split up over multiple lines
 354 | ERROR   | [ ] The array declaration extends to column 96 (the limit is 80). The array content should be split up over multiple lines
 355 | ERROR   | [ ] The array declaration extends to column 96 (the limit is 80). The array content should be split up over multiple lines
 356 | ERROR   | [ ] The array declaration extends to column 97 (the limit is 80). The array content should be split up over multiple lines
 357 | ERROR   | [ ] The array declaration extends to column 86 (the limit is 80). The array content should be split up over multiple lines
 358 | ERROR   | [ ] The array declaration extends to column 87 (the limit is 80). The array content should be split up over multiple lines
 359 | ERROR   | [ ] The array declaration extends to column 85 (the limit is 80). The array content should be split up over multiple lines
 360 | ERROR   | [ ] The array declaration extends to column 86 (the limit is 80). The array content should be split up over multiple lines
 361 | ERROR   | [ ] The array declaration extends to column 89 (the limit is 80). The array content should be split up over multiple lines
 362 | ERROR   | [ ] The array declaration extends to column 82 (the limit is 80). The array content should be split up over multiple lines
 363 | ERROR   | [ ] The array declaration extends to column 88 (the limit is 80). The array content should be split up over multiple lines
 364 | ERROR   | [ ] The array declaration extends to column 107 (the limit is 80). The array content should be split up over multiple lines
 365 | ERROR   | [ ] The array declaration extends to column 84 (the limit is 80). The array content should be split up over multiple lines
 366 | ERROR   | [ ] The array declaration extends to column 93 (the limit is 80). The array content should be split up over multiple lines
 367 | ERROR   | [ ] The array declaration extends to column 82 (the limit is 80). The array content should be split up over multiple lines
 368 | ERROR   | [ ] The array declaration extends to column 93 (the limit is 80). The array content should be split up over multiple lines
 369 | ERROR   | [ ] The array declaration extends to column 94 (the limit is 80). The array content should be split up over multiple lines
 370 | ERROR   | [ ] The array declaration extends to column 90 (the limit is 80). The array content should be split up over multiple lines
 371 | ERROR   | [ ] The array declaration extends to column 91 (the limit is 80). The array content should be split up over multiple lines
 372 | ERROR   | [ ] The array declaration extends to column 94 (the limit is 80). The array content should be split up over multiple lines
 373 | ERROR   | [ ] The array declaration extends to column 82 (the limit is 80). The array content should be split up over multiple lines
 374 | ERROR   | [ ] The array declaration extends to column 87 (the limit is 80). The array content should be split up over multiple lines
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------


FILE: /Users/mac/contribution/username/src/Plugin/migrate/process/UsernameReplaceToken.php
------------------------------------------------------------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
------------------------------------------------------------------------------------------------------------------------------------
  6 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\migrate\MigrateExecutableInterface.
 23 | ERROR | [x] list(...) is forbidden, use [...] instead.
------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------------------------------


FILE: /Users/mac/contribution/username/src/Controller/UsernameAutocompleteController.php
-----------------------------------------------------------------------------------------------------------------------------------------
FOUND 3 ERRORS AFFECTING 3 LINES
-----------------------------------------------------------------------------------------------------------------------------------------
  6 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Component\Utility\Crypt.
 24 | ERROR | [ ] The array declaration extends to column 92 (the limit is 80). The array content should be split up over multiple lines
 73 | ERROR | [x] Use null coalesce operator instead of ternary operator.
-----------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------------------------------------------------


FILE: /Users/mac/contribution/username/src/Routing/UsernameRouteSubscriber.php
--------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AND 3 WARNINGS AFFECTING 3 LINES
--------------------------------------------------------------------------------------------------------------------------------------
 11 | WARNING | [x] Unused use statement
 19 | WARNING | [x] Unused use statement
 19 | ERROR   | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\username\Form\UsernameRegisterForm.
 20 | WARNING | [x] Unused use statement
--------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 4 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------------------------------------------------------------

Time: 371ms; Memory: 16MB
๐Ÿ“Œ Task
Status

Needs work

Version

1.0

Component

Code

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

Merge Requests

Comments & Activities

  • Issue created by @sunil_lnwebworks
  • Assigned to richa_porwal
  • Issue was unassigned.
  • gaurav gupta Jaipur, Rajasthsan

    Gaurav Gupta โ†’ made their first commit to this issueโ€™s fork.

  • gaurav gupta Jaipur, Rajasthsan

    Gaurav Gupta โ†’ changed the visibility of the branch 3427813-module-have-some to hidden.

  • gaurav gupta Jaipur, Rajasthsan

    Gaurav Gupta โ†’ changed the visibility of the branch 3427813-module-have-some to active.

  • First commit to issue fork.
  • First commit to issue fork.
  • Status changed to Needs work 8 months ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia pray_12
  • First commit to issue fork.
  • Status changed to Needs review 8 months ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia sakthi_dev

    Please review.

  • Status changed to RTBC 8 months ago
  • ๐Ÿ‡ต๐Ÿ‡ญPhilippines paraderojether

    Hi

    I reviewed MR!1, applied it against Username 1.0.x-dev, confirmed MR was applied successfully, and fixed all the issues reported by phpcs.

    jetherparadero@PrometSources-MacBook-Pro username % curl https://git.drupalcode.org/project/username/-/merge_requests/1.diff | git apply -v
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100 42260    0 42260    0     0   101k      0 --:--:-- --:--:-- --:--:--  103k
    Checking patch css/username.style.css...
    Checking patch modules/username_displayname/username_displayname.install...
    Checking patch modules/username_displayname/username_displayname.module...
    Checking patch modules/username_phone/src/Form/UsernamePhoneForm.php...
    Checking patch modules/username_phone/src/Plugin/Validation/Constraint/UsernamePhoneRequiredValidator.php...
    Checking patch modules/username_phone/src/Plugin/Validation/Constraint/UsernamePhoneUnique.php...
    Checking patch modules/username_phone/username_phone.module...
    Checking patch src/Controller/UsernameAutocompleteController.php...
    Checking patch src/Form/UsernameSettingsForm.php...
    Checking patch src/Plugin/migrate/process/UsernameReplaceToken.php...
    Checking patch src/Routing/UsernameRouteSubscriber.php...
    Checking patch src/UsernameGenerator.php...
    Checking patch username.module...
    Applied patch css/username.style.css cleanly.
    Applied patch modules/username_displayname/username_displayname.install cleanly.
    Applied patch modules/username_displayname/username_displayname.module cleanly.
    Applied patch modules/username_phone/src/Form/UsernamePhoneForm.php cleanly.
    Applied patch modules/username_phone/src/Plugin/Validation/Constraint/UsernamePhoneRequiredValidator.php cleanly.
    Applied patch modules/username_phone/src/Plugin/Validation/Constraint/UsernamePhoneUnique.php cleanly.
    Applied patch modules/username_phone/username_phone.module cleanly.
    Applied patch src/Controller/UsernameAutocompleteController.php cleanly.
    Applied patch src/Form/UsernameSettingsForm.php cleanly.
    Applied patch src/Plugin/migrate/process/UsernameReplaceToken.php cleanly.
    Applied patch src/Routing/UsernameRouteSubscriber.php cleanly.
    Applied patch src/UsernameGenerator.php cleanly.
    Applied patch username.module cleanly.
    jetherparadero@PrometSources-MacBook-Pro username % cd ..
    jetherparadero@PrometSources-MacBook-Pro contrib % phpcs --standard=Drupal --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml username
    jetherparadero@PrometSources-MacBook-Pro contrib %

    Thank you.

  • ๐Ÿ‡ฎ๐Ÿ‡นItaly apaderno Brescia, ๐Ÿ‡ฎ๐Ÿ‡น
  • Pipeline finished with Success
    8 months ago
    Total: 145s
    #126921
  • Pipeline finished with Success
    7 months ago
    Total: 200s
    #161300
  • Pipeline finished with Success
    7 months ago
    #161303
  • Pipeline finished with Canceled
    7 months ago
    Total: 115s
    #161304
  • Pipeline finished with Success
    7 months ago
    Total: 196s
    #161306
  • Pipeline finished with Success
    7 months ago
    Total: 163s
    #161309
  • Pipeline finished with Success
    7 months ago
    #161326
  • Pipeline finished with Success
    7 months ago
    #161340
  • Status changed to Needs work 7 months ago
  • ๐Ÿ‡ฎ๐Ÿ‡นItaly apaderno Brescia, ๐Ÿ‡ฎ๐Ÿ‡น

    The lines that pass a dynamic value to t() must be checked. Using code similar to the following one is not correct, though, since it does not translate the string used instead of the placeholder. (The purpose of placeholders is adding to a string to translate parts that do not need to be translated.)

    $form[$field_name]['#description'] = t('@username_description', ['@username_description' => trim($username_description[$i])]);
    
  • Pipeline finished with Failed
    7 months ago
    Total: 217s
    #161346
  • Pipeline finished with Failed
    7 months ago
    Total: 243s
    #161374
  • Pipeline finished with Success
    7 months ago
    Total: 149s
    #161378
  • Pipeline finished with Success
    7 months ago
    #161385
  • Pipeline finished with Success
    6 months ago
    Total: 146s
    #184719
  • Status changed to Needs review 6 months ago
  • gaurav gupta Jaipur, Rajasthsan

    Fixed all the phpcs issues .
    Please check.

  • Status changed to RTBC 5 months ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia dev16.addweb

    I have checked and it's working fine.

  • Status changed to Needs work 3 months ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia sourav_paul Kolkata

    @Gaurav Gupta Could you please solve the merge conflict...

  • Pipeline finished with Success
    3 months ago
    Total: 250s
    #261022
Production build 0.71.5 2024