Fix the issues reported by phpcs

Created on 2 May 2023, over 1 year ago
Updated 6 March 2024, 9 months ago

Problem/Motivation

Fix the issues reported by PHPCS for Drupal and DrupalPractice standards in 3.0.0 branch.

This will make the project comply with Drupal coding standards and should make it easier to maintain going forward.

Steps to reproduce

Execute the command: phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,js,info,txt,md,yml,twig web/modules/contrib/access_by_ref/

Proposed resolution

Fix all the issues mentioned below:

FILE: /var/www/html/web/modules/contrib/access_by_ref/access_by_ref.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/web/modules/contrib/access_by_ref/access_by_ref.info.yml
----------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------------
6 | ERROR | [x] Expected 1 newline at end of file; 0 found
----------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------

FILE: /var/www/html/web/modules/contrib/access_by_ref/tests/src/Traits/AbrUserTrait.php
---------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 3 LINES
---------------------------------------------------------------------------------------
5 | WARNING | [x] Unused use statement
6 | WARNING | [x] Unused use statement
7 | WARNING | [x] Unused use statement
---------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------

FILE: /var/www/html/web/modules/contrib/access_by_ref/src/AbrconfigInterface.php
--------------------------------------------------------------------------------------------------------
FOUND 43 ERRORS AND 3 WARNINGS AFFECTING 43 LINES
--------------------------------------------------------------------------------------------------------
3 | ERROR | [ ] Namespaced classes, interfaces and traits should not begin with a file doc comment
4 | WARNING | [ ] Line exceeds 80 characters; contains 120 characters
4 | WARNING | [x] There must be no blank line following an inline comment
4 | WARNING | [ ] There must be no blank line following an inline comment
16 | ERROR | [x] Doc comment short description must end with a full stop
18 | ERROR | [ ] Description for the @return value is missing
23 | ERROR | [x] Doc comment short description must end with a full stop
25 | ERROR | [ ] Missing parameter comment
32 | ERROR | [x] Doc comment short description must end with a full stop
34 | ERROR | [ ] Description for the @return value is missing
39 | ERROR | [x] Doc comment short description must end with a full stop
41 | ERROR | [ ] Missing parameter comment
48 | ERROR | [x] Doc comment short description must end with a full stop
50 | ERROR | [ ] Description for the @return value is missing
51 | ERROR | [x] There must be no blank lines after the function comment
56 | ERROR | [x] Doc comment short description must end with a full stop
58 | ERROR | [ ] Missing parameter comment
65 | ERROR | [x] Doc comment short description must end with a full stop
67 | ERROR | [ ] Description for the @return value is missing
68 | ERROR | [x] There must be no blank lines after the function comment
73 | ERROR | [x] Doc comment short description must end with a full stop
75 | ERROR | [ ] Missing parameter comment
82 | ERROR | [x] Doc comment short description must end with a full stop
84 | ERROR | [ ] Missing parameter comment
86 | ERROR | [ ] Description for the @return value is missing
87 | ERROR | [x] There must be no blank lines after the function comment
92 | ERROR | [x] Doc comment short description must end with a full stop
94 | ERROR | [ ] Missing parameter comment
101 | ERROR | [x] Doc comment short description must end with a full stop
103 | ERROR | [ ] Description for the @return value is missing
104 | ERROR | [x] There must be no blank lines after the function comment
109 | ERROR | [x] Doc comment short description must end with a full stop
111 | ERROR | [ ] Missing parameter comment
118 | ERROR | [x] Doc comment short description must end with a full stop
120 | ERROR | [ ] Description for the @return value is missing
121 | ERROR | [x] There must be no blank lines after the function comment
126 | ERROR | [x] Doc comment short description must end with a full stop
128 | ERROR | [ ] Missing parameter comment
135 | ERROR | [x] Doc comment short description must end with a full stop
137 | ERROR | [ ] Description for the @return value is missing
138 | ERROR | [x] There must be no blank lines after the function comment
143 | ERROR | [x] Doc comment short description must end with a full stop
145 | ERROR | [ ] Missing parameter comment
149 | ERROR | [x] Expected 1 blank line after function; 2 found
152 | ERROR | [x] Expected 1 newline at end of file; 0 found
152 | ERROR | [x] The closing brace for the interface must have an empty line before it
--------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 26 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------------------------------

FILE: /var/www/html/web/modules/contrib/access_by_ref/src/Form/AbrconfigForm.php
---------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
---------------------------------------------------------------------------------------------------------------
326 | ERROR | [x] No space found before comment text; expected "// dpm($values);" but found "//dpm($values);"
---------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------------

FILE: /var/www/html/web/modules/contrib/access_by_ref/src/Form/AbrconfigDeleteForm.php
--------------------------------------------------------------------------------------
FOUND 6 ERRORS AND 1 WARNING AFFECTING 7 LINES
--------------------------------------------------------------------------------------
1 | ERROR | [x] The PHP open tag must be followed by exactly one blank line
5 | WARNING | [x] Unused use statement
11 | ERROR | [x] There must be exactly one newline after the class comment
19 | ERROR | [x] Short array syntax must be used to define arrays
41 | ERROR | [x] Short array syntax must be used to define arrays
47 | ERROR | [x] Expected 1 blank line after function; 0 found
48 | 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: /var/www/html/web/modules/contrib/access_by_ref/src/Controller/AbrconfigListBuilder.php
---------------------------------------------------------------------------------------------------------------
FOUND 8 ERRORS AND 6 WARNINGS AFFECTING 12 LINES
---------------------------------------------------------------------------------------------------------------
16 | ERROR | [x] Expected 1 blank line before function; 0 found
40 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
43 | ERROR | [x] Equals sign not aligned with surrounding assignments; expected 1 space but found 2 spaces
43 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
44 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
45 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
47 | WARNING | [x] There must be no blank line following an inline comment
47 | WARNING | [ ] There must be no blank line following an inline comment
67 | WARNING | [ ] Line exceeds 80 characters; contains 190 characters
68 | WARNING | [ ] Line exceeds 80 characters; contains 141 characters
72 | ERROR | [x] Short array syntax must be used to define arrays
74 | WARNING | [x] A comma should follow the last multiline array item. Found: $info
79 | WARNING | [ ] Only string literals should be passed to t() where possible
112 | ERROR | [x] Expected 1 newline at end of file; 0 found
---------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 10 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------------

FILE: /var/www/html/web/modules/contrib/access_by_ref/src/Entity/Abrconfig.php
-------------------------------------------------------------------------------------------------------------------
FOUND 30 ERRORS AFFECTING 24 LINES
-------------------------------------------------------------------------------------------------------------------
53 | ERROR | [x] There must be exactly one newline after the class comment
129 | ERROR | [x] Missing function doc comment
129 | ERROR | [x] Expected 1 blank line before function; 2 found
133 | ERROR | [x] Missing function doc comment
137 | ERROR | [x] Missing function doc comment
141 | ERROR | [x] Missing function doc comment
145 | ERROR | [x] Missing function doc comment
145 | ERROR | [x] Incorrect spacing between argument "$readable" and equals sign; expected 1 but found 0
145 | ERROR | [x] Incorrect spacing between default value and equals sign for argument "$readable"; expected 1
| | but found 0
145 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
147 | ERROR | [x] Expected 1 space after IF keyword; 0 found
147 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
150 | ERROR | [x] Case breaking statements must be followed by a single blank line
152 | ERROR | [x] Case breaking statements must be followed by a single blank line
154 | ERROR | [x] Case breaking statements must be followed by a single blank line
156 | ERROR | [x] Case breaking statements must be followed by a single blank line
161 | ERROR | [x] Expected 1 space after ELSE keyword; 0 found
167 | ERROR | [x] Missing function doc comment
171 | ERROR | [x] Missing function doc comment
175 | ERROR | [x] Missing function doc comment
179 | ERROR | [x] Missing function doc comment
179 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
180 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 6
183 | ERROR | [x] Missing function doc comment
187 | ERROR | [x] Missing function doc comment
191 | ERROR | [x] Missing function doc comment
195 | ERROR | [x] Missing function doc comment
199 | ERROR | [x] Missing function doc comment
203 | ERROR | [x] Missing function doc comment
207 | ERROR | [x] Missing function doc comment
-------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 30 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------------------

FILE: /var/www/html/web/modules/contrib/access_by_ref/access_by_ref.permissions.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: /var/www/html/web/modules/contrib/access_by_ref/access_by_ref.module
-------------------------------------------------------------------------------------------------------------------
FOUND 246 ERRORS AND 19 WARNINGS AFFECTING 134 LINES
-------------------------------------------------------------------------------------------------------------------
1 | ERROR | [x] Missing file doc comment
6 | WARNING | [x] Unused use statement
8 | WARNING | [x] Unused use statement
9 | WARNING | [x] Unused use statement
11 | ERROR | [x] Missing function doc comment
11 | ERROR | [ ] Invalid function name, expected have_node_access but found haveNodeAccess
11 | ERROR | [ ] All functions defined in a module file must be prefixed with the module's name, found
| | "haveNodeAccess" but expected "access_by_ref_haveNodeAccess"
11 | ERROR | [x] Expected 1 space before opening brace; found 0
13 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
15 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
15 | ERROR | [x] Expected 1 space after IF keyword; 0 found
15 | ERROR | [x] Expected 1 space before "=="; 0 found
15 | ERROR | [x] Expected 1 space after "=="; 0 found
15 | ERROR | [x] There should be no white space before a closing ")"
15 | ERROR | [x] Expected 1 space after closing parenthesis; found 0
16 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
17 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
18 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
18 | ERROR | [x] Expected 1 space after ELSE keyword; 0 found
19 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
19 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
20 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
26 | WARNING | [ ] Line exceeds 80 characters; contains 98 characters
26 | ERROR | [x] Doc comment short description must be on the first line
27 | WARNING | [ ] Line exceeds 80 characters; contains 105 characters
27 | ERROR | [ ] Doc comment short description must end with a full stop
27 | ERROR | [ ] Doc comment short description must be on a single line, further text should be a separate
| | paragraph
29 | ERROR | [ ] Wrong function doc comment end; expected "*/", found "******************/"
29 | ERROR | [x] Additional blank lines found at end of doc comment
29 | ERROR | [x] There must be no blank lines after the function comment
33 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
33 | ERROR | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing
| | parentheses
34 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
34 | ERROR | [x] Expected 1 space after IF keyword; 0 found
37 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
38 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
40 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
42 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
44 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
44 | ERROR | [x] Expected 1 space after FOREACH keyword; 0 found
44 | ERROR | [x] Expected 1 space after closing parenthesis; found 0
45 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
45 | WARNING | [x] The variable name should be defined after the type
47 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
47 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
48 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
48 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
49 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
49 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
51 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
52 | WARNING | [ ] Unused variable $node_field.
52 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
53 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
55 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
56 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
57 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
59 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
59 | ERROR | [x] Expected 1 space after SWITCH keyword; 0 found
59 | ERROR | [x] Expected 1 space after closing parenthesis; found 0
61 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 12
61 | WARNING | [ ] There must be no blank line following an inline comment
61 | ERROR | [x] No space found before comment text; expected "// allow if user is in this field" but found
| | "//allow if user is in this field"
61 | ERROR | [x] Inline comments must start with a capital letter
61 | ERROR | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing
| | parentheses
61 | ERROR | [x] Comments may not appear after statements
63 | ERROR | [x] Line indented incorrectly; expected 8 spaces, found 16
65 | ERROR | [x] Line indented incorrectly; expected 8 spaces, found 16
65 | ERROR | [x] Expected 1 space after FOREACH keyword; 0 found
65 | ERROR | [x] Expected 1 space after closing parenthesis; found 0
66 | ERROR | [x] Line indented incorrectly; expected 10 spaces, found 20
66 | ERROR | [x] Expected 1 space after IF keyword; 0 found
66 | ERROR | [x] Expected 1 space after closing parenthesis; found 0
67 | ERROR | [x] Line indented incorrectly; expected 12 spaces, found 24
68 | ERROR | [x] Line indented incorrectly; expected 12 spaces, found 24
68 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
68 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
69 | ERROR | [x] Line indented incorrectly; expected 12 spaces, found 24
69 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
69 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
70 | ERROR | [x] Line indented incorrectly; expected 12 spaces, found 24
70 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
70 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
71 | ERROR | [x] Line indented incorrectly; expected 12 spaces, found 24
72 | ERROR | [x] Line indented incorrectly; expected 10 spaces, found 20
73 | ERROR | [x] Line indented incorrectly; expected 8 spaces, found 16
74 | ERROR | [x] Case breaking statement indented incorrectly; expected 14 spaces, found 16
76 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 12
76 | WARNING | [ ] There must be no blank line following an inline comment
76 | ERROR | [x] No space found before comment text; expected "// allow if user mail is in this field" but
| | found "//allow if user mail is in this field"
76 | ERROR | [x] Inline comments must start with a capital letter
76 | ERROR | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing
| | parentheses
76 | ERROR | [x] Comments may not appear after statements
78 | ERROR | [x] Line indented incorrectly; expected 8 spaces, found 16
80 | ERROR | [x] Line indented incorrectly; expected 8 spaces, found 16
80 | ERROR | [x] Expected 1 space after FOREACH keyword; 0 found
80 | ERROR | [x] Expected 1 space after closing parenthesis; found 0
81 | ERROR | [x] Line indented incorrectly; expected 10 spaces, found 20
81 | ERROR | [x] Expected 1 space after IF keyword; 0 found
81 | ERROR | [x] Expected 1 space after closing parenthesis; found 0
82 | ERROR | [x] Line indented incorrectly; expected 12 spaces, found 24
83 | ERROR | [x] Line indented incorrectly; expected 12 spaces, found 24
83 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
83 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
84 | ERROR | [x] Line indented incorrectly; expected 12 spaces, found 24
84 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
84 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
85 | ERROR | [x] Line indented incorrectly; expected 12 spaces, found 24
85 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
85 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
86 | ERROR | [x] Line indented incorrectly; expected 12 spaces, found 24
87 | ERROR | [x] Line indented incorrectly; expected 10 spaces, found 20
88 | ERROR | [x] Line indented incorrectly; expected 8 spaces, found 16
89 | ERROR | [x] Case breaking statement indented incorrectly; expected 14 spaces, found 16
91 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 12
91 | WARNING | [ ] There must be no blank line following an inline comment
91 | ERROR | [x] No space found before comment text; expected "// allow if user shares a value is in this
| | field" but found "//allow if user shares a value is in this field"
91 | ERROR | [x] Inline comments must start with a capital letter
91 | ERROR | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing
| | parentheses
91 | ERROR | [x] Comments may not appear after statements
93 | ERROR | [x] Line indented incorrectly; expected 8 spaces, found 16
94 | ERROR | [x] Line indented incorrectly; expected 8 spaces, found 16
95 | ERROR | [x] Line indented incorrectly; expected 8 spaces, found 16
95 | ERROR | [x] Expected 1 space after "="; 2 found
97 | ERROR | [x] Line indented incorrectly; expected 8 spaces, found 16
97 | ERROR | [x] Expected 1 space after FOREACH keyword; 0 found
97 | ERROR | [x] Expected 1 space after closing parenthesis; found 0
98 | ERROR | [x] Line indented incorrectly; expected 10 spaces, found 20
98 | ERROR | [x] Expected 1 space after FOREACH keyword; 0 found
98 | ERROR | [x] Expected 1 space after closing parenthesis; found 0
99 | ERROR | [x] Line indented incorrectly; expected 12 spaces, found 24
99 | ERROR | [x] Expected 1 space after IF keyword; 0 found
99 | ERROR | [x] There should be no white space before a closing ")"
99 | ERROR | [x] Expected 1 space after closing parenthesis; found 0
100 | ERROR | [x] Line indented incorrectly; expected 14 spaces, found 28
101 | ERROR | [x] Line indented incorrectly; expected 14 spaces, found 28
101 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
101 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
102 | ERROR | [x] Line indented incorrectly; expected 14 spaces, found 28
102 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
102 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
103 | ERROR | [x] Line indented incorrectly; expected 14 spaces, found 28
103 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
103 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
104 | ERROR | [x] Line indented incorrectly; expected 14 spaces, found 28
105 | ERROR | [x] Line indented incorrectly; expected 12 spaces, found 24
106 | ERROR | [x] Line indented incorrectly; expected 10 spaces, found 20
107 | ERROR | [x] Line indented incorrectly; expected 8 spaces, found 16
108 | ERROR | [x] Case breaking statement indented incorrectly; expected 14 spaces, found 16
110 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 12
110 | WARNING | [ ] Line exceeds 80 characters; contains 82 characters
110 | WARNING | [ ] There must be no blank line following an inline comment
110 | ERROR | [x] No space found before comment text; expected "// inherit the CRUD of the referenced, if more
| | liberal" but found "//inherit the CRUD of the referenced, if more liberal"
110 | ERROR | [x] Inline comments must start with a capital letter
110 | ERROR | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing
| | parentheses
110 | ERROR | [x] Comments may not appear after statements
112 | ERROR | [x] Line indented incorrectly; expected 8 spaces, found 16
112 | WARNING | [ ] Line exceeds 80 characters; contains 117 characters
112 | WARNING | [ ] There must be no blank line following an inline comment
112 | ERROR | [x] Inline comments must start with a capital letter
112 | ERROR | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing
| | parentheses
112 | ERROR | [x] Comments may not appear after statements
114 | ERROR | [x] Line indented incorrectly; expected 8 spaces, found 16
114 | ERROR | [x] Expected 1 space after closing parenthesis; found 0
115 | ERROR | [x] Line indented incorrectly; expected 10 spaces, found 20
116 | ERROR | [x] Line indented incorrectly; expected 10 spaces, found 20
117 | ERROR | [x] Line indented incorrectly; expected 12 spaces, found 24
117 | ERROR | [x] Expected 1 space after FOREACH keyword; 0 found
117 | ERROR | [x] Expected 1 space after closing parenthesis; found 0
118 | ERROR | [x] Line indented incorrectly; expected 14 spaces, found 28
119 | ERROR | [x] Line indented incorrectly; expected 14 spaces, found 28
119 | ERROR | [x] Expected 1 space after closing parenthesis; found 0
120 | ERROR | [x] Line indented incorrectly; expected 16 spaces, found 32
120 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
120 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
121 | ERROR | [x] Line indented incorrectly; expected 16 spaces, found 32
121 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
121 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
122 | ERROR | [x] Line indented incorrectly; expected 16 spaces, found 32
122 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
122 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
123 | ERROR | [x] Line indented incorrectly; expected 16 spaces, found 32
124 | ERROR | [x] Line indented incorrectly; expected 14 spaces, found 28
125 | ERROR | [x] Line indented incorrectly; expected 12 spaces, found 24
126 | ERROR | [x] Case breaking statement indented incorrectly; expected 22 spaces, found 24
128 | WARNING | [x] 'todo: paragraph support needs to be checked' should match the format '@todo Fix problem X
| | here.'
128 | ERROR | [x] Line indented incorrectly; expected 10 spaces, found 20
129 | WARNING | [x] 'todo: At this moment, extra is only used in user field' should match the format '@todo Fix
| | problem X here.'
129 | ERROR | [x] Line indented incorrectly; expected 10 spaces, found 20
130 | WARNING | [x] 'todo: I can't seem to figure out if this ever worked...' should match the format '@todo Fix
| | problem X here.'
130 | ERROR | [x] Line indented incorrectly; expected 10 spaces, found 20
131 | ERROR | [x] Line indented incorrectly; expected 10 spaces, found 20
132 | ERROR | [x] Line indented incorrectly; expected 12 spaces, found 24
132 | ERROR | [x] Expected 1 space after FOREACH keyword; 0 found
132 | ERROR | [x] Expected 1 space after closing parenthesis; found 0
132 | ERROR | [x] There should be no white space after an opening "{"
132 | WARNING | [ ] Line exceeds 80 characters; contains 96 characters
132 | ERROR | [x] Inline comments must start with a capital letter
132 | ERROR | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing
| | parentheses
132 | ERROR | [x] Comments may not appear after statements
133 | ERROR | [x] Line indented incorrectly; expected 14 spaces, found 28
134 | ERROR | [x] Line indented incorrectly; expected 14 spaces, found 28
134 | ERROR | [x] Namespaced classes/interfaces/traits should be referenced with use statements
134 | ERROR | [x] There should be no white space after an opening "("
134 | ERROR | [x] There should be no white space before a closing ")"
135 | ERROR | [x] Line indented incorrectly; expected 14 spaces, found 28
136 | ERROR | [x] Line indented incorrectly; expected 14 spaces, found 28
137 | ERROR | [x] Line indented incorrectly; expected 14 spaces, found 28
137 | ERROR | [x] Expected 1 space after FOREACH keyword; 0 found
137 | ERROR | [x] Expected 1 space after closing parenthesis; found 0
138 | ERROR | [x] Line indented incorrectly; expected 16 spaces, found 32
138 | ERROR | [x] Expected 1 space after closing parenthesis; found 0
139 | ERROR | [x] Line indented incorrectly; expected 18 spaces, found 36
139 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
139 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
140 | ERROR | [x] Line indented incorrectly; expected 18 spaces, found 36
140 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
140 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
141 | ERROR | [x] Line indented incorrectly; expected 18 spaces, found 36
141 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
141 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
142 | ERROR | [x] Line indented incorrectly; expected 18 spaces, found 36
143 | ERROR | [x] Line indented incorrectly; expected 16 spaces, found 32
144 | ERROR | [x] Line indented incorrectly; expected 14 spaces, found 28
145 | ERROR | [x] Line indented incorrectly; expected 12 spaces, found 24
146 | ERROR | [x] Case breaking statement indented incorrectly; expected 22 spaces, found 24
147 | ERROR | [x] Line indented incorrectly; expected 8 spaces, found 16
148 | ERROR | [x] Case breaking statement indented incorrectly; expected 14 spaces, found 16
150 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
150 | WARNING | [ ] There must be no blank line following an inline comment
152 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
152 | ERROR | [x] Expected 1 space after closing parenthesis; found 0
154 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 12
155 | ERROR | [x] Object operator not indented correctly; expected 14 spaces but found 16
158 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 12
158 | ERROR | [x] Inline comments must start with a capital letter
158 | ERROR | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing
| | parentheses
159 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
161 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
161 | ERROR | [x] Use "elseif" in place of "else if"
161 | ERROR | [x] Expected 1 space after closing parenthesis; found 0
162 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 12
163 | ERROR | [x] Object operator not indented correctly; expected 14 spaces but found 16
166 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 12
166 | ERROR | [x] Inline comments must start with a capital letter
166 | ERROR | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing
| | parentheses
167 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
168 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
168 | ERROR | [x] Use "elseif" in place of "else if"
168 | ERROR | [x] Expected 1 space after closing parenthesis; found 0
169 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 12
170 | ERROR | [x] Object operator not indented correctly; expected 14 spaces but found 16
173 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 12
173 | ERROR | [x] Inline comments must start with a capital letter
173 | ERROR | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing
| | parentheses
174 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
176 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
178 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
179 | ERROR | [x] Object operator not indented correctly; expected 6 spaces but found 8
183 | ERROR | [x] Missing function doc comment
183 | ERROR | [x] Expected 1 space before opening brace; found 0
185 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
186 | ERROR | [x] Object operator not indented correctly; expected 6 spaces but found 8
187 | ERROR | [x] Short array syntax must be used to define arrays
189 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
190 | ERROR | [x] Expected 1 newline at end of file; 3 found
-------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 248 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------------------

FILE: /var/www/html/web/modules/contrib/access_by_ref/access_by_ref.links.action.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/web/modules/contrib/access_by_ref/access_by_ref.install
----------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 1 LINE
----------------------------------------------------------------------------------
1 | ERROR | [x] Missing file doc comment
1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
----------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------

Remaining tasks

Fix issues (phpcbf can do some).
Test.
Review.

User interface changes

None.

API changes

None.

Data model changes

None.

📌 Task
Status

Needs review

Version

3.0

Component

Code

Created by

🇮🇪Ireland lostcarpark

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

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • Issue created by @lostcarpark
  • 🇮🇪Ireland lostcarpark

    Ran phpcbf, and reported the following:

    PHPCBF RESULT SUMMARY
    -------------------------------------------------------------------------------------------------------------------
    FILE FIXED REMAINING
    -------------------------------------------------------------------------------------------------------------------
    ...opment/ddev/accessbyref-3357621/web/modules/contrib/access_by_ref/access_by_ref.links.menu.yml 1 0
    .../Development/ddev/accessbyref-3357621/web/modules/contrib/access_by_ref/access_by_ref.info.yml 1 0
    ...t/ddev/accessbyref-3357621/web/modules/contrib/access_by_ref/tests/src/Traits/AbrUserTrait.php 3 0
    ...elopment/ddev/accessbyref-3357621/web/modules/contrib/access_by_ref/src/AbrconfigInterface.php 26 19
    ...elopment/ddev/accessbyref-3357621/web/modules/contrib/access_by_ref/src/Form/AbrconfigForm.php 30 14
    ...nt/ddev/accessbyref-3357621/web/modules/contrib/access_by_ref/src/Form/AbrconfigDeleteForm.php 7 0
    .../accessbyref-3357621/web/modules/contrib/access_by_ref/src/Controller/AbrconfigListBuilder.php 10 3
    ...evelopment/ddev/accessbyref-3357621/web/modules/contrib/access_by_ref/src/Entity/Abrconfig.php 30 16
    ...es/Development/ddev/accessbyref-3357621/web/modules/contrib/access_by_ref/access_by_ref.module 248 12
    ...ment/ddev/accessbyref-3357621/web/modules/contrib/access_by_ref/access_by_ref.links.action.yml 1 0
    ...s/Development/ddev/accessbyref-3357621/web/modules/contrib/access_by_ref/access_by_ref.install 2 1
    -------------------------------------------------------------------------------------------------------------------
    A TOTAL OF 359 ERRORS WERE FIXED IN 11 FILES
    -------------------------------------------------------------------------------------------------------------------

  • 🇮🇪Ireland lostcarpark

    Results of phpcs after running phpcbf:

    FILE: /home/james/Development/ddev/accessbyref-3357621/web/modules/contrib/access_by_ref/src/AbrconfigInterface.php
    -------------------------------------------------------------------------------------------------------------------
    FOUND 18 ERRORS AND 1 WARNING AFFECTING 19 LINES
    -------------------------------------------------------------------------------------------------------------------
    3 | ERROR | Namespaced classes, interfaces and traits should not begin with a file doc comment
    4 | WARNING | Line exceeds 80 characters; contains 120 characters
    17 | ERROR | Description for the @return value is missing
    24 | ERROR | Missing parameter comment
    33 | ERROR | Description for the @return value is missing
    40 | ERROR | Missing parameter comment
    49 | ERROR | Description for the @return value is missing
    56 | ERROR | Missing parameter comment
    65 | ERROR | Description for the @return value is missing
    72 | ERROR | Missing parameter comment
    81 | ERROR | Missing parameter comment
    83 | ERROR | Description for the @return value is missing
    90 | ERROR | Missing parameter comment
    99 | ERROR | Description for the @return value is missing
    106 | ERROR | Missing parameter comment
    115 | ERROR | Description for the @return value is missing
    122 | ERROR | Missing parameter comment
    131 | ERROR | Description for the @return value is missing
    138 | ERROR | Missing parameter comment
    -------------------------------------------------------------------------------------------------------------------

    FILE: /home/james/Development/ddev/accessbyref-3357621/web/modules/contrib/access_by_ref/src/Form/AbrconfigForm.php
    -------------------------------------------------------------------------------------------------------------------
    FOUND 6 ERRORS AND 8 WARNINGS AFFECTING 14 LINES
    -------------------------------------------------------------------------------------------------------------------
    36 | WARNING | Line exceeds 80 characters; contains 105 characters
    38 | ERROR | Missing parameter comment
    40 | ERROR | Description for the @return value is missing
    44 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
    53 | WARNING | Line exceeds 80 characters; contains 105 characters
    66 | ERROR | Doc comment is empty
    71 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
    117 | ERROR | Doc comment is empty
    133 | ERROR | Doc comment is empty
    144 | ERROR | Doc comment is empty
    237 | WARNING | Do not pass empty strings to t()
    245 | WARNING | Do not pass empty strings to t()
    253 | WARNING | Do not pass empty strings to t()
    285 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
    -------------------------------------------------------------------------------------------------------------------

    FILE: ...evelopment/ddev/accessbyref-3357621/web/modules/contrib/access_by_ref/src/Controller/AbrconfigListBuilder.php
    -------------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 3 LINES
    -------------------------------------------------------------------------------------------------------------------
    67 | WARNING | Line exceeds 80 characters; contains 190 characters
    68 | WARNING | Line exceeds 80 characters; contains 141 characters
    79 | WARNING | Only string literals should be passed to t() where possible
    -------------------------------------------------------------------------------------------------------------------

    FILE: /home/james/Development/ddev/accessbyref-3357621/web/modules/contrib/access_by_ref/src/Entity/Abrconfig.php
    -----------------------------------------------------------------------------------------------------------------
    FOUND 16 ERRORS AFFECTING 16 LINES
    -----------------------------------------------------------------------------------------------------------------
    127 | ERROR | Doc comment is empty
    134 | ERROR | Doc comment is empty
    141 | ERROR | Doc comment is empty
    148 | ERROR | Doc comment is empty
    155 | ERROR | Doc comment is empty
    184 | ERROR | Doc comment is empty
    191 | ERROR | Doc comment is empty
    198 | ERROR | Doc comment is empty
    205 | ERROR | Doc comment is empty
    212 | ERROR | Doc comment is empty
    219 | ERROR | Doc comment is empty
    226 | ERROR | Doc comment is empty
    233 | ERROR | Doc comment is empty
    240 | ERROR | Doc comment is empty
    247 | ERROR | Doc comment is empty
    254 | ERROR | Doc comment is empty
    -----------------------------------------------------------------------------------------------------------------

    FILE: /home/james/Development/ddev/accessbyref-3357621/web/modules/contrib/access_by_ref/access_by_ref.module
    -------------------------------------------------------------------------------------------------------------------
    FOUND 8 ERRORS AND 4 WARNINGS AFFECTING 9 LINES
    -------------------------------------------------------------------------------------------------------------------
    3 | ERROR | Missing short description in doc comment
    13 | ERROR | Doc comment is empty
    16 | ERROR | Invalid function name, expected have_node_access but found haveNodeAccess
    16 | ERROR | All functions defined in a module file must be prefixed with the module's name, found
    | | "haveNodeAccess" but expected "access_by_ref_haveNodeAccess"
    30 | WARNING | Line exceeds 80 characters; contains 98 characters
    31 | WARNING | Line exceeds 80 characters; contains 105 characters
    31 | ERROR | Doc comment short description must end with a full stop
    31 | ERROR | Doc comment short description must be on a single line, further text should be a separate
    | | paragraph
    32 | ERROR | Wrong function doc comment end; expected "*/", found "******************/"
    54 | WARNING | Unused variable $node_field.
    158 | WARNING | There must be no blank line following an inline comment
    191 | ERROR | Doc comment is empty
    -------------------------------------------------------------------------------------------------------------------

    FILE: /home/james/Development/ddev/accessbyref-3357621/web/modules/contrib/access_by_ref/access_by_ref.install
    --------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    --------------------------------------------------------------------------------------------------------------
    3 | ERROR | Missing short description in doc comment
    --------------------------------------------------------------------------------------------------------------

  • 🇮🇹Italy apaderno Brescia, 🇮🇹
  • Merge request !10Fix phpcs issues → (Open) created by lostcarpark
  • Status changed to Needs work over 1 year ago
  • 🇮🇪Ireland lostcarpark

    I have committed the phpcbf fixes and created a merge request.

    I have confirmed automated tests still pass, and carried out some rudimentary manual testing.

    I wanted to separate automated fixes from manual ones.

    It isn't ready for review yet, as I want to make as many manual fixes to phpcs issues as possible before setting to needs review.

    I intend to only make coding standards fixes through this issue, and there should be no functional changes.

    However, I think some of the reported issues may require functional changes. If so I will open separate issues for those.

  • 🇮🇪Ireland lostcarpark

    Only one error now reported by phpcs:

    FILE: /var/www/html/web/modules/contrib/access_by_ref/src/Controller/AbrconfigListBuilder.php
    -------------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    -------------------------------------------------------------------------------------------------------------------
    78 | WARNING | Only string literals should be passed to t() where possible
    | | (Drupal.Semantics.FunctionT.NotLiteralString)
    -------------------------------------------------------------------------------------------------------------------

    This is caused by constructing a large text element as a string, and processing with the $this->t() function.
    I think this is not the intended use of the translation system, and this text would be better moved to a template file.
    However, this would be a functional change, so I will open a separate issue for it.

    Tests are still passing, and initial manual testing hasn't found any issues.

    I want to carry out some more manual testing before moving to "needs review".

  • Status changed to Needs review over 1 year ago
  • 🇮🇳India Ashutosh Ahirwal India

    Providing patch with fixes.
    please review.

  • 🇮🇪Ireland lostcarpark

    Please explain the patch file. Is it just merge request converted to a patch, or have you made changes?

    There should be no need for patches with the "new" merge request system.

  • Issue was unassigned.
  • 🇮🇪Ireland lostcarpark

    I have carried out manual testing and everything appears to work as before.

    I've added some comments to explain some of the changes in the merge request.

    I think this should be ready for review now.

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

    Hi lostcarpark

    I reviewed MR!10, and there are still remaining issues reported by phpcs shown below:

    FILE: /Users/studenttrainees/New/drupalorgsite/docroot/modules/contrib/access_by_ref/access_by_ref.permissions.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: ...udenttrainees/New/drupalorgsite/docroot/modules/contrib/access_by_ref/src/Controller/AbrconfigListBuilder.php
    -------------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    -------------------------------------------------------------------------------------------------------------------
    78 | WARNING | Only string literals should be passed to t() where possible
    -------------------------------------------------------------------------------------------------------------------

    Time: 604ms; Memory: 12MB

    Please check.
    Thank You.

  • 🇮🇪Ireland lostcarpark

    What parameters are you using for phpcs? It is not finding any issues with the .permissions.yml file for me. I've checked the file manually, and it does have the closing newline.

    However, it did find another issue that I'd missed:

    FILE: /home/james/Development/ddev/accessbyref-3357621/web/modules/contrib/access_by_ref/access_by_ref.module
    -------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    -------------------------------------------------------------------------------------------------------------
    24 | ERROR | Type hint "\Drupal\Core\Session\AccountInterface" missing for $account
    -------------------------------------------------------------------------------------------------------------

    I have fixed that and added to the merge request.

    For the final issue:

    FILE: ...udenttrainees/New/drupalorgsite/docroot/modules/contrib/access_by_ref/src/Controller/AbrconfigListBuilder.php
    -------------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    -------------------------------------------------------------------------------------------------------------------
    78 | WARNING | Only string literals should be passed to t() where possible
    -------------------------------------------------------------------------------------------------------------------

    I feel this needs some more thought, as it may require a functional change. I have opened a separate issue to look at that: 📌 Review phpcs reported use of translation for variable Active

  • Status changed to Needs review over 1 year ago
  • 🇮🇪Ireland lostcarpark

    After discussion, I've gone back on #15. I have split the t() into a separate call for each line of the text.

    I'll update 📌 Review phpcs reported use of translation for variable Active with the reasoning for this.

  • First commit to issue fork.
  • 🇮🇳India Yashaswi18

    Hello, I checked out to the branch '3357621-phpcs-fixes' and ran the command phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,js,info,txt,md,yml,twig . Found no errors or warnings.

  • 🇮🇪Ireland lostcarpark

    Is there interest in merging this?

    In hindsight, I tried to fix too much in one issue.

    I think it would have been better to break up issues, and fix all issues of one type, for example, indentation. That would make it easier to review.

    Drupal is moving from DrupalCI to GitLabCI, which has PHPCS and PHPSTAN enabled by default, so it would be good to get issues fixed and move to GitLabCI.

Production build 0.71.5 2024