Fix the issues reported by phpcs

Created on 3 July 2023, over 1 year ago
Updated 25 September 2023, about 1 year ago

Problem/Motivation

FILE: /var/www/html/vb/d_cont/ab_age_gate/ab_age_gate.routing.yml
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
31 | ERROR | [x] Expected 1 newline at end of file; 0 found
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------

FILE: /var/www/html/vb/d_cont/ab_age_gate/README.md
------------------------------------------------------------------------
FOUND 1 ERROR AND 4 WARNINGS AFFECTING 4 LINES
------------------------------------------------------------------------
23 | WARNING | [ ] Line exceeds 80 characters; contains 98 characters
29 | WARNING | [ ] Line exceeds 80 characters; contains 101 characters
37 | WARNING | [ ] Line exceeds 80 characters; contains 115 characters
40 | WARNING | [ ] Line exceeds 80 characters; contains 120 characters
40 | ERROR | [x] Expected 1 newline at end of file; 4 found
------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------

FILE: /var/www/html/vb/d_cont/ab_age_gate/assets/css/age_gate_style.css
-----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-----------------------------------------------------------------------
85 | ERROR | [x] Multiple selectors should each be on a single line
-----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------

FILE: /var/www/html/vb/d_cont/ab_age_gate/src/AgeGateStatistics.php
--------------------------------------------------------------------------------
FOUND 21 ERRORS AND 2 WARNINGS AFFECTING 17 LINES
--------------------------------------------------------------------------------
5 | ERROR | [x] When importing a class with "use", do not include a leading
| | \
8 | ERROR | [x] Doc comment short description must end with a full stop
11 | WARNING | [ ] The class short comment should describe what the class does
| | and not simply repeat the class name
14 | ERROR | [x] The open comment tag must be the only content on the line
14 | ERROR | [ ] Missing short description in doc comment
14 | ERROR | [x] Expected "\Drupal\Core\Database\Connection" but found
| | "\Drupal\Core\Database\Connection " for @var tag in member
| | variable comment
17 | ERROR | [x] Visibility must be declared on method "__construct"
17 | ERROR | [x] Missing function doc comment
24 | ERROR | [ ] Description for the @return value is missing
37 | ERROR | [x] Doc comment short description must end with a full stop
38 | ERROR | [x] There must be exactly one blank line before the tags in a
| | doc comment
38 | ERROR | [ ] If there is no return value for a function, there must not
| | be a @return tag.
38 | ERROR | [ ] Description for the @return value is missing
39 | ERROR | [x] Separate the @return and @throws sections by a blank line.
41 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE"
| | but found "false"
53 | ERROR | [x] Expected 1 space before "=>"; 0 found
54 | WARNING | [x] A comma should follow the last multiline array item. Found:
| | 0
62 | ERROR | [ ] If there is no return value for a function, there must not
| | be a @return tag.
62 | ERROR | [ ] Description for the @return value is missing
63 | ERROR | [x] Separate the @return and @throws sections by a blank line.
65 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE"
| | but found "false"
79 | ERROR | [x] Expected 1 space before "=>"; 0 found
86 | ERROR | [x] Expected 1 newline at end of file; 0 found
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 16 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

FILE: /var/www/html/vb/d_cont/ab_age_gate/src/Form/ageGateSettingsForm.php
--------------------------------------------------------------------------------
FOUND 17 ERRORS AND 31 WARNINGS AFFECTING 42 LINES
--------------------------------------------------------------------------------
20 | ERROR | [ ] Class name must begin with a capital letter
57 | ERROR | [ ] Class property $path_resolver should use lowerCamel naming
| | without underscores
57 | ERROR | [ ] Missing member variable doc comment
59 | ERROR | [ ] Missing member variable doc comment
120 | WARNING | [x] A comma should follow the last multiline array item.
| | Found: )
140 | WARNING | [ ] Avoid backslash escaping in translatable strings when
| | possible, use "" quotes instead
142 | WARNING | [ ] Avoid backslash escaping in translatable strings when
| | possible, use "" quotes instead
180 | WARNING | [ ] t() calls should be avoided in classes, use
| | \Drupal\Core\StringTranslation\StringTranslationTrait and
| | $this->t() instead
189 | ERROR | [x] No space found before comment text; expected "//
| | '#progress_indicator' => 'bar'," but found
| | "//'#progress_indicator' => 'bar',"
190 | ERROR | [x] No space found before comment text; expected "//
| | '#progress_message' => $this->t('Please wait...')," but
| | found "//'#progress_message' => $this->t('Please
| | wait...'),"
195 | WARNING | [ ] t() calls should be avoided in classes, use
| | \Drupal\Core\StringTranslation\StringTranslationTrait and
| | $this->t() instead
201 | WARNING | [ ] t() calls should be avoided in classes, use
| | \Drupal\Core\StringTranslation\StringTranslationTrait and
| | $this->t() instead
203 | WARNING | [ ] #options values usually have to run through t() for
| | translation
204 | WARNING | [ ] #options values usually have to run through t() for
| | translation
213 | WARNING | [x] A comma should follow the last multiline array item.
| | Found: ]
214 | WARNING | [x] A comma should follow the last multiline array item.
| | Found: ]
215 | WARNING | [x] A comma should follow the last multiline array item.
| | Found: ]
217 | ERROR | [x] Functions must not contain multiple empty lines in a row;
| | found 2 empty lines
239 | WARNING | [x] A comma should follow the last multiline array item.
| | Found: ]
240 | WARNING | [x] A comma should follow the last multiline array item.
| | Found: ]
241 | WARNING | [x] A comma should follow the last multiline array item.
| | Found: ]
249 | WARNING | [ ] t() calls should be avoided in classes, use
| | \Drupal\Core\StringTranslation\StringTranslationTrait and
| | $this->t() instead
258 | ERROR | [x] Functions must not contain multiple empty lines in a row;
| | found 2 empty lines
267 | WARNING | [x] A comma should follow the last multiline array item.
| | Found: ]
268 | WARNING | [x] A comma should follow the last multiline array item.
| | Found: ]
269 | WARNING | [x] A comma should follow the last multiline array item.
| | Found: ]
277 | WARNING | [ ] t() calls should be avoided in classes, use
| | \Drupal\Core\StringTranslation\StringTranslationTrait and
| | $this->t() instead
286 | ERROR | [x] Functions must not contain multiple empty lines in a row;
| | found 2 empty lines
300 | WARNING | [ ] t() calls should be avoided in classes, use
| | \Drupal\Core\StringTranslation\StringTranslationTrait and
| | $this->t() instead
322 | WARNING | [ ] t() calls should be avoided in classes, use
| | \Drupal\Core\StringTranslation\StringTranslationTrait and
| | $this->t() instead
331 | ERROR | [x] Functions must not contain multiple empty lines in a row;
| | found 2 empty lines
344 | WARNING | [ ] t() calls should be avoided in classes, use
| | \Drupal\Core\StringTranslation\StringTranslationTrait and
| | $this->t() instead
365 | WARNING | [ ] t() calls should be avoided in classes, use
| | \Drupal\Core\StringTranslation\StringTranslationTrait and
| | $this->t() instead
380 | WARNING | [ ] t() calls should be avoided in classes, use
| | \Drupal\Core\StringTranslation\StringTranslationTrait and
| | $this->t() instead
388 | WARNING | [ ] t() calls should be avoided in classes, use
| | \Drupal\Core\StringTranslation\StringTranslationTrait and
| | $this->t() instead
403 | WARNING | [ ] Line exceeds 80 characters; contains 91 characters
405 | ERROR | [x] There should be no white space after an opening "{"
405 | WARNING | [ ] Line exceeds 80 characters; contains 149 characters
405 | ERROR | [x] Comments may not appear after statements
408 | ERROR | [x] There should be no white space after an opening "{"
408 | WARNING | [ ] Line exceeds 80 characters; contains 196 characters
408 | ERROR | [x] Comments may not appear after statements
422 | WARNING | [ ] #description values usually have to run through t() for
| | translation
443 | ERROR | [ ] String concat is not required here; use a single string
| | instead
491 | ERROR | [x] Each PHP statement must be on a line by itself
531 | WARNING | [ ] Line exceeds 80 characters; contains 93 characters
546 | WARNING | [x] 'TODO: save config only for needed languages.' should
| | match the format '@todo Fix problem X here.'
546 | ERROR | [x] No space found before comment text; expected "// TODO:
| | save config only for needed languages." but found "//TODO:
| | save config only for needed languages."
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 23 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

FILE: ...var/www/html/vb/d_cont/ab_age_gate/src/Controller/StatisticsController.php
--------------------------------------------------------------------------------
FOUND 12 ERRORS AFFECTING 8 LINES
--------------------------------------------------------------------------------
9 | ERROR | [x] There must be one blank line after the last USE statement; 2
| | found;
17 | ERROR | [x] The open comment tag must be the only content on the line
17 | ERROR | [ ] Missing short description in doc comment
17 | ERROR | [x] Do not append variable name "$statisticService" to the type
| | declaration in a member variable comment
20 | ERROR | [x] The open comment tag must be the only content on the line
20 | ERROR | [ ] Missing short description in doc comment
20 | ERROR | [x] Do not append variable name "$requestStack" to the type
| | declaration in a member variable comment
44 | ERROR | [ ] Description for the @return value is missing
56 | ERROR | [ ] Description for the @return value is missing
57 | ERROR | [x] Separate the @return and @throws sections by a blank line.
69 | ERROR | [ ] Description for the @return value is missing
70 | ERROR | [x] Separate the @return and @throws sections by a blank line.
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 7 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

FILE: ...r/www/html/vb/d_cont/ab_age_gate/src/EventSubscriber/AgeGateSubscriber.php
--------------------------------------------------------------------------------
FOUND 6 ERRORS AND 2 WARNINGS AFFECTING 7 LINES
--------------------------------------------------------------------------------
13 | ERROR | [x] Missing class doc comment
29 | ERROR | [ ] Missing short description in doc comment
30 | ERROR | [x] Do not append variable name "$statisticsService;" to the
| | type declaration in a member variable comment
34 | ERROR | [ ] Parameter $config_factory is not described in comment
34 | ERROR | [ ] Parameter $statisticsService is not described in comment
53 | ERROR | [x] Missing function doc comment
64 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency
| | injection instead
80 | WARNING | [x] A comma should follow the last multiline array item. Found:
| | 'translations/add'
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 4 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

FILE: /var/www/html/vb/d_cont/ab_age_gate/ab_age_gate.module
--------------------------------------------------------------------------------
FOUND 9 ERRORS AND 1 WARNING AFFECTING 8 LINES
--------------------------------------------------------------------------------
4 | ERROR | [x] The second line in the file doc comment must be "@file"
9 | ERROR | [x] Expected 1 blank line before function; 0 found
9 | ERROR | [ ] ab_age_gate_schema() is an installation hook and must be
| | declared in an install file
10 | ERROR | [x] Equals sign not aligned correctly; expected 1 space but
| | found 2 spaces
78 | ERROR | [ ] ab_age_gate_install() is an installation hook and must be
| | declared in an install file
85 | ERROR | [ ] ab_age_gate_uninstall() is an installation hook and must
| | be declared in an install file
94 | WARNING | [ ] Hook implementations should not duplicate @return
| | documentation
94 | ERROR | [ ] Description for the @return value is missing
112 | ERROR | [x] Functions must not contain multiple empty lines in a row;
| | found 2 empty lines
291 | ERROR | [x] Expected 1 newline at end of file; 0 found
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 5 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

Time: 211ms; Memory: 14MB

Steps to reproduce

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

Remaining tasks

Patch review

📌 Task
Status

Fixed

Version

1.0

Component

Code

Created by

🇮🇳India urvashi_vora Madhya Pradesh, India

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

Comments & Activities

Production build 0.71.5 2024