Problem/Motivation
PHPCS reports the following errors:
C:\xampp\htdocs\backendassignment\web\modules\custom>phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig time_ticker
FILE: C:\xampp\htdocs\backendassignment\web\modules\custom\time_ticker\src\Controller\TimeController.php
--------------------------------------------------------------------------------------------------------
FOUND 38 ERRORS AFFECTING 22 LINES
--------------------------------------------------------------------------------------------------------
1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
8 | ERROR | [x] There must be one blank line after the last USE statement; 2 found;
11 | ERROR | [x] Missing class doc comment
11 | ERROR | [x] Expected 1 space before opening brace; found 0
13 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
13 | ERROR | [ ] Missing member variable doc comment
15 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 6
15 | ERROR | [ ] Missing short description in doc comment
16 | ERROR | [x] Expected 7 space(s) before asterisk; 3 found
16 | ERROR | [ ] Missing parameter comment
16 | ERROR | [ ] Doc comment for parameter $configuration does not match actual variable name $time
17 | ERROR | [x] Expected 7 space(s) before asterisk; 3 found
17 | ERROR | [ ] Missing parameter comment
17 | ERROR | [ ] Doc comment for parameter $plugin_id does not match actual variable name $time
18 | ERROR | [x] Expected 7 space(s) before asterisk; 3 found
18 | ERROR | [ ] Missing parameter comment
18 | ERROR | [ ] Superfluous parameter comment
19 | ERROR | [x] Expected 7 space(s) before asterisk; 3 found
19 | ERROR | [ ] Missing parameter comment
19 | ERROR | [ ] Superfluous parameter comment
20 | ERROR | [x] Expected 7 space(s) before asterisk; 3 found
20 | ERROR | [ ] Superfluous parameter comment
21 | ERROR | [x] Expected 7 space(s) before asterisk; 3 found
21 | ERROR | [x] Parameter comment indentation must be 3 spaces, found 2 spaces
22 | ERROR | [x] Expected 7 space(s) before asterisk; 3 found
22 | ERROR | [x] There must be no blank lines after the function comment
26 | ERROR | [x] Expected 1 blank line after function; 0 found
27 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 3
28 | ERROR | [x] Expected 4 space(s) before asterisk; 3 found
29 | ERROR | [x] Expected 4 space(s) before asterisk; 3 found
31 | ERROR | [x] Whitespace found at end of line
36 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
36 | ERROR | [x] Missing function doc comment
36 | ERROR | [x] Expected 1 space before opening brace; found 0
37 | ERROR | [x] Whitespace found at end of line
38 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
39 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
41 | ERROR | [x] Expected 1 newline at end of file; 0 found
--------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 27 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------------------------------
FILE: C:\xampp\htdocs\backendassignment\web\modules\custom\time_ticker\src\Form\TimeSettingsForm.php
-----------------------------------------------------------------------------------------------------
FOUND 12 ERRORS AFFECTING 11 LINES
-----------------------------------------------------------------------------------------------------
1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
3 | ERROR | [x] Namespaced classes, interfaces and traits should not begin with a file doc comment
5 | ERROR | [x] Doc comment short description must end with a full stop
13 | ERROR | [x] Missing class doc comment
65 | ERROR | [x] Whitespace found at end of line
66 | ERROR | [x] Whitespace found at end of line
68 | ERROR | [x] Whitespace found at end of line
68 | ERROR | [x] Functions must not contain multiple empty lines in a row; found 2 empty lines
69 | ERROR | [x] Whitespace found at end of line
80 | ERROR | [x] Whitespace found at end of line
88 | ERROR | [x] Expected 1 blank line after function; 0 found
89 | ERROR | [x] The closing brace for the class must have an empty line before it
-----------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 12 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------------
FILE: C:\xampp\htdocs\backendassignment\web\modules\custom\time_ticker\src\Plugin\Block\TimeBlock.php
-------------------------------------------------------------------------------------------------------------
FOUND 27 ERRORS AFFECTING 25 LINES
-------------------------------------------------------------------------------------------------------------
1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
3 | ERROR | [x] Namespaced classes, interfaces and traits should not begin with a file doc comment
5 | ERROR | [x] Doc comment short description must end with a full stop
25 | ERROR | [x] Expected 1 space before opening brace; found 0
27 | ERROR | [ ] Missing short description in doc comment
28 | ERROR | [x] Data types in @var tags need to be fully namespaced
28 | ERROR | [x] Do not append variable name "$time" to the type declaration in a member variable comment
32 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
33 | ERROR | [x] Expected 5 space(s) before asterisk; 3 found
34 | ERROR | [x] Expected 5 space(s) before asterisk; 3 found
35 | ERROR | [x] Expected 5 space(s) before asterisk; 3 found
36 | ERROR | [x] Expected 5 space(s) before asterisk; 3 found
47 | ERROR | [ ] Missing short description in doc comment
47 | ERROR | [ ] Parameter $config_factory is not described in comment
48 | ERROR | [ ] Missing parameter comment
49 | ERROR | [ ] Missing parameter comment
50 | ERROR | [ ] Missing parameter comment
51 | ERROR | [ ] Missing parameter comment
53 | ERROR | [x] Parameter comment indentation must be 3 spaces, found 2 spaces
54 | ERROR | [x] There must be no blank lines after the function comment
81 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 0
83 | ERROR | [x] Equals sign not aligned with surrounding assignments; expected 4 spaces but found 3 spaces
84 | ERROR | [x] Equals sign not aligned with surrounding assignments; expected 3 spaces but found 2 spaces
85 | ERROR | [x] Equals sign not aligned with surrounding assignments; expected 6 spaces but found 5 spaces
86 | ERROR | [x] Equals sign not aligned with surrounding assignments; expected 1 space but found 5 spaces
97 | ERROR | [x] Whitespace found at end of line
99 | ERROR | [x] Whitespace found at end of line
-------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 20 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------------
FILE: C:\xampp\htdocs\backendassignment\web\modules\custom\time_ticker\src\TimeService.php
---------------------------------------------------------------------------------------------------------------
FOUND 27 ERRORS AFFECTING 23 LINES
---------------------------------------------------------------------------------------------------------------
1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
3 | ERROR | [x] Namespaced classes, interfaces and traits should not begin with a file doc comment
13 | ERROR | [x] Missing class doc comment
15 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
16 | ERROR | [x] Expected 5 space(s) before asterisk; 3 found
17 | ERROR | [x] Expected 5 space(s) before asterisk; 3 found
18 | ERROR | [x] Expected 5 space(s) before asterisk; 3 found
19 | ERROR | [x] Expected 5 space(s) before asterisk; 3 found
22 | ERROR | [ ] Missing short description in doc comment
22 | ERROR | [ ] Parameter $config_factory is not described in comment
23 | ERROR | [ ] Missing parameter comment
23 | ERROR | [ ] Doc comment for parameter $configuration does not match actual variable name $config_factory
24 | ERROR | [ ] Missing parameter comment
24 | ERROR | [ ] Doc comment for parameter $plugin_id does not match actual variable name $config_factory
25 | ERROR | [ ] Missing parameter comment
25 | ERROR | [ ] Superfluous parameter comment
26 | ERROR | [x] There must be no blank lines after the function comment
35 | ERROR | [x] Additional blank lines found at end of doc comment
36 | ERROR | [x] Whitespace found at end of line
37 | ERROR | [x] Whitespace found at end of line
40 | ERROR | [x] Functions must not contain multiple empty lines in a row; found 2 empty lines
41 | ERROR | [x] Whitespace found at end of line
42 | ERROR | [x] Expected one space after the comma, 0 found
55 | ERROR | [x] Functions must not contain multiple empty lines in a row; found 2 empty lines
56 | ERROR | [x] Whitespace found at end of line
57 | ERROR | [x] Whitespace found at end of line
60 | ERROR | [x] Whitespace found at end of line
---------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 19 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------------
FILE: C:\xampp\htdocs\backendassignment\web\modules\custom\time_ticker\templates\time-ticker-block.html.twig
------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
------------------------------------------------------------------------------------------------------------
7 | ERROR | [x] Expected 1 newline at end of file; 0 found
------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------
FILE: C:\xampp\htdocs\backendassignment\web\modules\custom\time_ticker\time_ticker.info.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: C:\xampp\htdocs\backendassignment\web\modules\custom\time_ticker\time_ticker.libraries.yml
------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
------------------------------------------------------------------------------------------------
9 | ERROR | [x] Expected 1 newline at end of file; 0 found
------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------
FILE: C:\xampp\htdocs\backendassignment\web\modules\custom\time_ticker\time_ticker.module
-----------------------------------------------------------------------------------------
FOUND 8 ERRORS AFFECTING 4 LINES
-----------------------------------------------------------------------------------------
1 | ERROR | [x] Missing file doc comment
1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
7 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
9 | ERROR | [x] Expected one space after the comma, 0 found
9 | ERROR | [x] Expected one space after the comma, 0 found
12 | ERROR | [x] Expected 1 newline at end of file; 0 found
12 | ERROR | [x] Line indented incorrectly; expected 0 spaces, found 2
12 | ERROR | [x] Closing brace indented incorrectly; expected 0 spaces, found 2
-----------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 8 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------
FILE: C:\xampp\htdocs\backendassignment\web\modules\custom\time_ticker\time_ticker.services.yml
-----------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------
4 | ERROR | [x] Expected 1 newline at end of file; 0 found
-----------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------
Time: 1.12 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