Problem/Motivation
FILE: ~/projects/drupal-d10/modules/contrib/pwa/pwa.api.php
----------------------------------------
FOUND 7 ERRORS AND 1 WARNING AFFECTING 7 LINES
----------------------------------------
1 | ERROR | [x] Missing file doc comment
32 | ERROR | [ ] Type hint "array" missing for &$cacheUrls
58 | ERROR | [ ] Type hint "array" missing for &$excludeUrls
73 | ERROR | [ ] Type hint "array" missing for &$resources
94 | ERROR | [ ] Type hint "array" missing for &$resources
94 | ERROR | [ ] Type hint "\DOMXPath" missing for $xpath
104 | WARNING | [ ] Line exceeds 80 characters; contains 84 characters
109 | ERROR | [ ] Type hint "array" missing for &$manifestData
----------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------
FILE: ~/projects/drupal-d10/modules/contrib/pwa/README.md
----------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
----------------------------------------
33 | WARNING | Line exceeds 80 characters; contains 81 characters
51 | WARNING | Line exceeds 80 characters; contains 81 characters
----------------------------------------
FILE: ~/projects/drupal-d10/modules/contrib/pwa/pwa.install
----------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------
1 | ERROR | [x] The PHP open tag must be followed by exactly one blank line
----------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------
FILE: ~/projects/drupal-d10/modules/contrib/pwa/modules/pwa_extras/pwa_extras.links.menu.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: ~/projects/drupal-d10/modules/contrib/pwa/modules/pwa_extras/pwa_extras.module
---------------------------------------------------
FOUND 9 ERRORS AFFECTING 9 LINES
---------------------------------------------------
5 | ERROR | [x] Doc comment short description must end with a full stop
23 | ERROR | [x] Inline control structures are not allowed
26 | ERROR | [x] Inline control structures are not allowed
29 | ERROR | [x] Calling class constructors must always include parentheses
47 | ERROR | [ ] The array declaration extends to column 85 (the limit is 80). The array content should be split up over multiple lines
52 | ERROR | [x] Missing function doc comment
59 | ERROR | [x] Missing function doc comment
67 | ERROR | [x] Missing function doc comment
75 | ERROR | [x] Missing function doc comment
---------------------------------------------------
PHPCBF CAN FIX THE 8 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------
FILE: ~/projects/drupal-d10/modules/contrib/pwa/modules/pwa_extras/src/Form/PwaExtrasSettingsForm.php
----------------------------------------
FOUND 8 ERRORS AFFECTING 8 LINES
----------------------------------------
46 | ERROR | [x] Array indentation error, expected 6 spaces but found 8
47 | ERROR | [x] Array indentation error, expected 10 spaces but found 8
49 | ERROR | [x] Array closing indentation error, expected 8 spaces but found 9
50 | ERROR | [x] Array closing indentation error, expected 8 spaces but found 6
111 | ERROR | [ ] Missing short description in doc comment
112 | ERROR | [ ] Description for the @return value must be on the next line
116 | ERROR | [x] Expected 1 blank line after function; 0 found
117 | ERROR | [x] The closing brace for the class must have an empty line before it
----------------------------------------
PHPCBF CAN FIX THE 6 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------
FILE: ~/projects/drupal-d10/modules/contrib/pwa/src/Form/ManifestConfigurationForm.php
-----------------------------------------
FOUND 33 ERRORS AND 5 WARNINGS AFFECTING 32 LINES
-----------------------------------------
5 | WARNING | [x] Unused use statement
71 | ERROR | [ ] Parameter tags must be grouped together in a doc comment
74 | ERROR | [ ] Parameter tags must be grouped together in a doc comment
77 | ERROR | [ ] Parameter tags must be grouped together in a doc comment
80 | ERROR | [ ] Parameter tags must be grouped together in a doc comment
83 | ERROR | [ ] Parameter tags must be grouped together in a doc comment
86 | ERROR | [ ] Parameter tags must be grouped together in a doc comment
89 | ERROR | [ ] Parameter tags must be grouped together in a doc comment
94 | ERROR | [x] Expected 1 space between type hint and argument "$configFactory"; 8 found
95 | ERROR | [x] Expected 1 space between type hint and argument "$fileStorage"; 10 found
96 | ERROR | [x] Expected 1 space between type hint and argument "$fileSystem"; 11 found
97 | ERROR | [x] Expected 1 space between type hint and argument "$fileUsage"; 12 found
98 | ERROR | [x] Expected 1 space between type hint and argument "$manifest"; 13 found
99 | ERROR | [x] Expected 1 space between type hint and argument "$messenger"; 12 found
158 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
172 | WARNING | [ ] Unused variable $wrapper.
175 | WARNING | [ ] Unused variable $realpath.
225 | WARNING | [x] A comma should follow the last multiline array item. Found: 1
363 | ERROR | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
377 | ERROR | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
392 | ERROR | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
412 | ERROR | [x] Inline comments must start with a capital letter
412 | ERROR | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
433 | ERROR | [x] Inline comments must start with a capital letter
433 | ERROR | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
461 | ERROR | [x] Doc comment short description must be on the first line
461 | ERROR | [x] Doc comment short description must start with a capital letter
461 | ERROR | [x] Doc comment short description must end with a full stop
463 | ERROR | [ ] Missing parameter comment
463 | ERROR | [ ] Missing parameter type
464 | ERROR | [ ] Missing parameter comment
464 | ERROR | [x] Expected "bool" but found "boolean" for parameter type
466 | ERROR | [ ] Description for the @return value is missing
474 | ERROR | [x] Case breaking statements must be followed by a single blank line
477 | ERROR | [x] Case breaking statements must be followed by a single blank line
489 | ERROR | [x] Case breaking statements must be followed by a single blank line
492 | ERROR | [x] Case breaking statements must be followed by a single blank line
495 | ERROR | [x] Case breaking statements must be followed by a single blank line
-----------------------------------------
PHPCBF CAN FIX THE 24 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------
FILE: ~/projects/drupal-d10/modules/contrib/pwa/src/Form/ServiceWorkerConfigurationForm.php
--------------------------------------------------------
FOUND 15 ERRORS AND 5 WARNINGS AFFECTING 16 LINES
--------------------------------------------------------
30 | ERROR | [x] Expected 3 space(s) before asterisk; 4 found
40 | WARNING | [x] A comma should follow the last multiline array item. Found: 7
48 | WARNING | [x] A comma should follow the last multiline array item. Found: 7
53 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
56 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
84 | ERROR | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
89 | ERROR | [x] Line indented incorrectly; expected 8 spaces, found 9
90 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 7
90 | ERROR | [x] Closing brace indented incorrectly; expected 6 spaces, found 7
91 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 7
91 | ERROR | [x] Expected 1 space after CATCH keyword; 0 found
92 | ERROR | [x] Line indented incorrectly; expected 8 spaces, found 9
92 | WARNING | [ ] Only string literals should be passed to t() where possible
93 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 7
94 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 7
95 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 7
96 | ERROR | [x] Line indented incorrectly; expected 8 spaces, found 9
96 | ERROR | [ ] Concatenating translatable strings is not allowed, use placeholders instead and only one string literal
97 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 7
111 | ERROR | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
--------------------------------------------------------
PHPCBF CAN FIX THE 16 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------
FILE: ~/projects/drupal-d10/modules/contrib/pwa/src/Form/BasicConfigurationForm.php
-----------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
-----------------------------------------------
29 | ERROR | [x] Expected 3 space(s) before asterisk; 4 found
72 | ERROR | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
-----------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------
FILE: ~/projects/drupal-d10/modules/contrib/pwa/src/Manifest.php
--------------------------------------------------------------------
FOUND 15 ERRORS AND 2 WARNINGS AFFECTING 17 LINES
--------------------------------------------------------------------
10 | WARNING | [x] Unused use statement
59 | ERROR | [ ] Parameter tags must be grouped together in a doc comment
62 | ERROR | [ ] Parameter tags must be grouped together in a doc comment
65 | ERROR | [ ] Parameter tags must be grouped together in a doc comment
68 | ERROR | [ ] Parameter tags must be grouped together in a doc comment
72 | ERROR | [x] Expected 1 space between type hint and argument "$configFactory"; 4 found
73 | ERROR | [x] Expected 1 space between type hint and argument "$languageManager"; 2 found
74 | ERROR | [x] Expected 1 space between type hint and argument "$moduleHandler"; 4 found
75 | ERROR | [x] Expected 1 space between type hint and argument "$requestStack"; 14 found
76 | ERROR | [x] Expected 1 space between type hint and argument "$themeManager"; 5 found
78 | ERROR | [x] Equals sign not aligned with surrounding assignments; expected 3 spaces but found 4 spaces
79 | ERROR | [x] Equals sign not aligned with surrounding assignments; expected 1 space but found 2 spaces
80 | ERROR | [x] Equals sign not aligned with surrounding assignments; expected 3 spaces but found 4 spaces
81 | ERROR | [x] Equals sign not aligned with surrounding assignments; expected 4 spaces but found 5 spaces
82 | ERROR | [x] Equals sign not aligned with surrounding assignments; expected 4 spaces but found 5 spaces
91 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 6
174 | WARNING | [ ] Unused variable $lang.
--------------------------------------------------------------------
PHPCBF CAN FIX THE 12 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------
FILE: ~/projects/drupal-d10/modules/contrib/pwa/src/Controller/PWAController.php
--------------------------------------------------
FOUND 41 ERRORS AND 8 WARNINGS AFFECTING 46 LINES
--------------------------------------------------
1 | ERROR | [x] The PHP open tag must be followed by exactly one blank line
2 | ERROR | [x] Namespaced classes, interfaces and traits should not begin with a file doc comment
4 | ERROR | [x] Doc comment short description must end with a full stop
23 | WARNING | [x] Unused use statement
97 | ERROR | [ ] Parameter tags must be grouped together in a doc comment
100 | ERROR | [ ] Parameter tags must be grouped together in a doc comment
103 | ERROR | [ ] Parameter tags must be grouped together in a doc comment
106 | ERROR | [ ] Parameter tags must be grouped together in a doc comment
109 | ERROR | [ ] Parameter tags must be grouped together in a doc comment
112 | ERROR | [ ] Parameter tags must be grouped together in a doc comment
114 | ERROR | [ ] Parameter tags must be grouped together in a doc comment
118 | ERROR | [x] Expected 1 space between type hint and argument "$configFactory"; 4 found
119 | ERROR | [x] Expected 1 space between type hint and argument "$httpClient"; 20 found
120 | ERROR | [x] Expected 1 space between type hint and argument "$languageManager"; 2 found
121 | ERROR | [x] Expected 1 space between type hint and argument "$manifest"; 9 found
122 | ERROR | [x] Expected 1 space between type hint and argument "$moduleExtensionList"; 7 found
123 | ERROR | [x] Expected 1 space between type hint and argument "$moduleHandler"; 4 found
124 | ERROR | [x] Expected 1 space between type hint and argument "$state"; 12 found
125 | ERROR | [x] Expected 1 space between type hint and argument "$themeManager"; 5 found
127 | ERROR | [x] Equals sign not aligned with surrounding assignments; expected 7 spaces but found 8 spaces
128 | ERROR | [x] Equals sign not aligned with surrounding assignments; expected 10 spaces but found 11 spaces
129 | ERROR | [x] Equals sign not aligned with surrounding assignments; expected 5 spaces but found 6 spaces
130 | ERROR | [x] Equals sign not aligned with surrounding assignments; expected 12 spaces but found 13 spaces
131 | ERROR | [x] Equals sign not aligned with surrounding assignments; expected 1 space but found 2 spaces
132 | ERROR | [x] Equals sign not aligned with surrounding assignments; expected 7 spaces but found 8 spaces
133 | ERROR | [x] Equals sign not aligned with surrounding assignments; expected 15 spaces but found 16 spaces
134 | ERROR | [x] Equals sign not aligned with surrounding assignments; expected 8 spaces but found 9 spaces
162 | ERROR | [ ] Public method name "PWAController::pwa_manifest" is not in lowerCamel format
181 | ERROR | [ ] Public method name "PWAController::_pwa_fetch_offline_page_resources" is not in lowerCamel format
181 | ERROR | [ ] Type hint "array" missing for $pages
183 | WARNING | [ ] Line exceeds 80 characters; contains 81 characters
184 | WARNING | [ ] Line exceeds 80 characters; contains 83 characters
186 | WARNING | [x] There must be no blank line following an inline comment
186 | WARNING | [ ] There must be no blank line following an inline comment
223 | ERROR | [ ] Using the e flag in preg_match_all is a possible security risk. For details see https://www.drupal.org/node/750148
254 | ERROR | [ ] Description for the @return value is missing
256 | ERROR | [ ] Public method name "PWAController::pwa_serviceworker_file_data" is not in lowerCamel format
257 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
270 | ERROR | [x] Calling class constructors must always include parentheses
333 | ERROR | [ ] Public method name "PWAController::pwa_get_cache_version" is not in lowerCamel format
341 | WARNING | [ ] Line exceeds 80 characters; contains 82 characters
342 | WARNING | [ ] Line exceeds 80 characters; contains 82 characters
356 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
356 | ERROR | [ ] Public method name "PWAController::pwa_module_active_page" is not in lowerCamel format
357 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 6
364 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
372 | ERROR | [ ] Public method name "PWAController::pwa_offline_page" is not in lowerCamel format
376 | ERROR | [x] Expected 1 blank line after function; 0 found
377 | ERROR | [x] The closing brace for the class must have an empty line before it
--------------------------------------------------
PHPCBF CAN FIX THE 27 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------
Time: 278ms; Memory: 12MB
Steps to reproduce
phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig pwa
I looked at the code and could not stop the perfectionist in myself,
below patch with alterations: