Problem/Motivation
Getting following error/warnings.
FILE: /var/www/html/modules/contrib/mobile_number_login_otp/mobile_number_login_otp.services.yml
------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
------------------------------------------------------------------------------------------------
10 | ERROR | [x] Expected 1 newline at end of file; 0 found
------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------
FILE: /var/www/html/modules/contrib/mobile_number_login_otp/mobile_number_login_otp.install
-------------------------------------------------------------------------------------------
FOUND 5 ERRORS AND 1 WARNING AFFECTING 6 LINES
-------------------------------------------------------------------------------------------
1 | ERROR | [x] Missing file doc comment
54 | WARNING | [x] A comma should follow the last multiline array item. Found: ]
55 | ERROR | [x] Whitespace found at end of line
56 | ERROR | [x] Whitespace found at end of line
57 | ERROR | [x] Whitespace found at end of line
59 | ERROR | [x] Expected 1 newline at end of file; 0 found
-------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 6 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------
FILE: /var/www/html/modules/contrib/mobile_number_login_otp/mobile_number_login_otp.routing.yml
-----------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------
32 | ERROR | [x] Expected 1 newline at end of file; 0 found
-----------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------
FILE: /var/www/html/modules/contrib/mobile_number_login_otp/README.md
----------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
----------------------------------------------------------------------
47 | WARNING | Line exceeds 80 characters; contains 133 characters
----------------------------------------------------------------------
FILE: /var/www/html/modules/contrib/mobile_number_login_otp/mobile_number_login_otp.links.menu.yml
--------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------------------------
5 | ERROR | [x] Expected 1 newline at end of file; 0 found
--------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------------------------
FILE: /var/www/html/modules/contrib/mobile_number_login_otp/mobile_number_login_otp.module
------------------------------------------------------------------------------------------
FOUND 5 ERRORS AFFECTING 5 LINES
------------------------------------------------------------------------------------------
1 | ERROR | [x] Missing file doc comment
5 | ERROR | [x] When importing a class with "use", do not include a leading \
22 | ERROR | [x] There must be no blank lines after the function comment
25 | ERROR | [x] Expected 1 space after closing parenthesis; found 0
29 | ERROR | [x] Whitespace found at end of line
------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 5 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------
FILE: /var/www/html/modules/contrib/mobile_number_login_otp/src/Form/AccountLoginForm.php
----------------------------------------------------------------------------------------------------------------------------------------------
FOUND 19 ERRORS AND 13 WARNINGS AFFECTING 29 LINES
----------------------------------------------------------------------------------------------------------------------------------------------
12 | WARNING | [x] Unused use statement
16 | ERROR | [x] There must be one blank line after the last USE statement; 2 found;
16 | ERROR | [x] When importing a class with "use", do not include a leading \
19 | ERROR | [x] Missing class doc comment
56 | ERROR | [ ] Parameter $account_auth is not described in comment
70 | ERROR | [ ] Type hint "\Drupal\user\UserFloodControlInterface" missing for $user_flood_control
73 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
76 | WARNING | [ ] The url '
https://www.drupal.org/node/3251987 →
.' should not end with a period.
77 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
101 | ERROR | [x] Missing function doc comment
105 | ERROR | [x] Missing function doc comment
108 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
109 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
114 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
115 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
119 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
120 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
123 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
132 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
135 | ERROR | [ ] The array declaration extends to column 86 (the limit is 80). The array content should be split up over multiple lines
137 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
147 | ERROR | [x] Missing function doc comment
188 | ERROR | [ ] The array declaration extends to column 183 (the limit is 80). The array content should be split up over multiple lines
214 | ERROR | [ ] Parameter $extension is not described in comment
214 | ERROR | [ ] Parameter $mobile is not described in comment
217 | ERROR | [ ] Doc comment for parameter $name does not match actual variable name $mobile
223 | ERROR | [ ] Private method name "AccountLoginForm::mobile_is_blocked" is not in lowerCamel format
224 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
257 | WARNING | [ ] Unused variable $query.
259 | ERROR | [ ] The array declaration extends to column 185 (the limit is 80). The array content should be split up over multiple lines
272 | ERROR | [x] Expected 1 newline at end of file; 0 found
272 | ERROR | [x] The closing brace for the class must have an empty line before it
----------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 11 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------------------------------------------
FILE: /var/www/html/modules/contrib/mobile_number_login_otp/src/Form/MobileLoginOtpConfigForm.php
----------------------------------------------------------------------------------------------------------------------------------------------
FOUND 15 ERRORS AND 18 WARNINGS AFFECTING 26 LINES
----------------------------------------------------------------------------------------------------------------------------------------------
55 | WARNING | [ ] Translatable strings must not begin or end with white spaces, use placeholders with t() for variables
96 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
99 | ERROR | [x] Short array syntax must be used to define arrays
99 | ERROR | [ ] The array declaration extends to column 85 (the limit is 80). The array content should be split up over multiple lines
99 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
99 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
99 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
99 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
100 | ERROR | [x] Short array syntax must be used to define arrays
101 | ERROR | [x] Short array syntax must be used to define arrays
128 | WARNING | [x] A comma should follow the last multiline array item. Found: 0
132 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
133 | ERROR | [x] Expected 1 space before "+"; 0 found
133 | ERROR | [x] Expected 1 space after "+"; 0 found
134 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
138 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
139 | WARNING | [x] A comma should follow the last multiline array item. Found: ]
143 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
144 | WARNING | [x] A comma should follow the last multiline array item. Found: ]
148 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
149 | WARNING | [x] A comma should follow the last multiline array item. Found: ]
154 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
161 | WARNING | [x] A comma should follow the last multiline array item. Found: ]
163 | ERROR | [x] Expected newline after closing brace
163 | ERROR | [x] Expected 1 space after ELSE keyword; 0 found
169 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
170 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
175 | WARNING | [x] A comma should follow the last multiline array item. Found: ]
181 | ERROR | [x] Missing function doc comment
185 | ERROR | [x] Missing function doc comment
197 | ERROR | [x] Whitespace found at end of line
222 | WARNING | [x] A comma should follow the last multiline array item. Found: ]
232 | ERROR | [x] Expected 1 newline at end of file; 0 found
----------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 21 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------------------------------------------
FILE: /var/www/html/modules/contrib/mobile_number_login_otp/src/AccountAuth.php
--------------------------------------------------------------------------------------------------------------------------------------------
FOUND 5 ERRORS AND 2 WARNINGS AFFECTING 6 LINES
--------------------------------------------------------------------------------------------------------------------------------------------
5 | WARNING | [x] Unused use statement
10 | ERROR | [x] Missing class doc comment
19 | ERROR | [x] Missing function doc comment
31 | ERROR | [ ] The array declaration extends to column 124 (the limit is 80). The array content should be split up over multiple lines
33 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
54 | ERROR | [x] Expected 1 newline at end of file; 0 found
54 | ERROR | [x] The closing brace for the class must have an empty line before it
--------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 5 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------------------------------------------------------------------
FILE: /var/www/html/modules/contrib/mobile_number_login_otp/src/Controller/MobileLoginOtpController.php
---------------------------------------------------------------------------------------------------------------------------------------------
FOUND 9 ERRORS AND 1 WARNING AFFECTING 7 LINES
---------------------------------------------------------------------------------------------------------------------------------------------
16 | ERROR | [x] Missing class doc comment
38 | ERROR | [x] Missing function doc comment
59 | ERROR | [x] Missing function doc comment
62 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
69 | ERROR | [x] Whitespace found at end of line
114 | ERROR | [ ] The array declaration extends to column 191 (the limit is 80). The array content should be split up over multiple lines
114 | ERROR | [x] Expected 1 space before "/"; 0 found
114 | ERROR | [x] Expected 1 space after "/"; 0 found
125 | ERROR | [x] Expected 1 newline at end of file; 0 found
125 | ERROR | [x] The closing brace for the class must have an empty line before it
---------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 8 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------------------------------------------
FILE: /var/www/html/modules/contrib/mobile_number_login_otp/src/Controller/AccountController.php
---------------------------------------------------------------------------------------------------------------------------------------------
FOUND 10 ERRORS AND 1 WARNING AFFECTING 8 LINES
---------------------------------------------------------------------------------------------------------------------------------------------
97 | ERROR | [ ] Parameter $account_auth is not described in comment
117 | ERROR | [ ] Type hint "\Drupal\user\UserFloodControlInterface" missing for $user_flood_control
120 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
267 | ERROR | [ ] Parameter $mobile is not described in comment
267 | ERROR | [ ] Parameter $extension is not described in comment
272 | ERROR | [ ] Doc comment for parameter $username does not match actual variable name $extension
296 | ERROR | [ ] Parameter $mobile is not described in comment
296 | ERROR | [ ] Parameter $extension is not described in comment
301 | ERROR | [ ] Doc comment for parameter $username does not match actual variable name $extension
309 | ERROR | [ ] The array declaration extends to column 126 (the limit is 80). The array content should be split up over multiple lines
309 | ERROR | [x] Concat operator must be surrounded by a single space
---------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------------------------------------------
FILE: /var/www/html/modules/contrib/mobile_number_login_otp/src/GateWay.php
---------------------------------------------------------------------------------------------------------------------
FOUND 8 ERRORS AND 1 WARNING AFFECTING 6 LINES
---------------------------------------------------------------------------------------------------------------------
8 | ERROR | [x] There must be one blank line after the last USE statement; 2 found;
15 | WARNING | [ ] The class short comment should describe what the class does and not simply repeat the class name
32 | ERROR | [x] Missing function doc comment
37 | ERROR | [x] Missing function doc comment
45 | ERROR | [x] Expected 1 space before "="; 0 found
45 | ERROR | [x] Expected 1 space after "="; 0 found
45 | ERROR | [x] Whitespace found at end of line
74 | ERROR | [x] Expected 1 newline at end of file; 0 found
74 | ERROR | [x] The closing brace for the class must have an empty line before it
---------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 8 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------------------
Time: 1.61 secs; Memory: 6MB
Steps to reproduce
Run following command
phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml modules/contrib/mobile_number_login_otp/
Proposed resolution
Above error/warnings need to be fixed.