Drupal calls should be avoided in classes, use dependency injection instead

Created on 28 June 2023, 12 months ago
Updated 30 June 2023, 12 months ago

robert@acer-travelmate-p215-41-g2:~/lando-projects/drupal1.localhost$ lando phpcs web/modules/contrib/google_analytics_counter/

FILE: ...oogle_analytics_counter/src/GoogleAnalyticsCounterAppManager.php
----------------------------------------------------------------------
FOUND 3 ERRORS AND 10 WARNINGS AFFECTING 13 LINES
----------------------------------------------------------------------
5 | WARNING | [x] Unused use statement
17 | WARNING | [x] Unused use statement
187 | ERROR | [x] Parameter comment indentation must be 3 spaces,
| | found 2 spaces
224 | ERROR | [x] Parameter comment indentation must be 3 spaces,
| | found 2 spaces
236 | WARNING | [ ] \Drupal calls should be avoided in classes, use
| | dependency injection instead
249 | WARNING | [ ] Line exceeds 80 characters; contains 81
| | characters
280 | WARNING | [ ] \Drupal calls should be avoided in classes, use
| | dependency injection instead
342 | WARNING | [ ] \Drupal calls should be avoided in classes, use
| | dependency injection instead
357 | WARNING | [ ] \Drupal calls should be avoided in classes, use
| | dependency injection instead
373 | WARNING | [ ] \Drupal calls should be avoided in classes, use
| | dependency injection instead
388 | WARNING | [ ] \Drupal calls should be avoided in classes, use
| | dependency injection instead
436 | ERROR | [x] Parameter comment indentation must be 3 spaces,
| | found 2 spaces
486 | WARNING | [ ] \Drupal calls should be avoided in classes, use
| | dependency injection instead
----------------------------------------------------------------------
PHPCBF CAN FIX THE 5 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------

FILE: ...ib/google_analytics_counter/src/GoogleAnalyticsCounterHelper.php
----------------------------------------------------------------------
FOUND 4 ERRORS AFFECTING 4 LINES
----------------------------------------------------------------------
121 | ERROR | [x] Missing function doc comment
202 | ERROR | [x] Missing function doc comment
232 | ERROR | [x] Missing function doc comment
241 | ERROR | [x] Missing function doc comment
----------------------------------------------------------------------
PHPCBF CAN FIX THE 4 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------

FILE: ...trib/google_analytics_counter/src/GoogleAnalyticsCounterCron.php
----------------------------------------------------------------------
FOUND 0 ERRORS AND 7 WARNINGS AFFECTING 7 LINES
----------------------------------------------------------------------
8 | WARNING | [x] Unused use statement
56 | WARNING | [ ] \Drupal calls should be avoided in classes, use
| | dependency injection instead
75 | WARNING | [ ] \Drupal calls should be avoided in classes, use
| | dependency injection instead
79 | WARNING | [ ] \Drupal calls should be avoided in classes, use
| | dependency injection instead
84 | WARNING | [ ] \Drupal calls should be avoided in classes, use
| | dependency injection instead
97 | WARNING | [ ] Line exceeds 80 characters; contains 82
| | characters
125 | WARNING | [ ] \Drupal calls should be avoided in classes, use
| | dependency injection instead
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------

FILE: ...lytics_counter/src/GoogleAnalyticsCounterAppManagerInterface.php
----------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
----------------------------------------------------------------------
35 | ERROR | [x] Parameter comment indentation must be 3 spaces,
| | found 2 spaces
48 | ERROR | [x] Parameter comment indentation must be 3 spaces,
| | found 2 spaces
----------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------

FILE: ...nalytics_counter/src/Form/GoogleAnalyticsCounterSettingsForm.php
----------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
----------------------------------------------------------------------
189 | WARNING | \Drupal calls should be avoided in classes, use
| | dependency injection instead
372 | WARNING | \Drupal calls should be avoided in classes, use
| | dependency injection instead
----------------------------------------------------------------------

FILE: ...tics_counter/src/Event/GoogleAnalyticsCounterQueryAlterEvent.php
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
85 | ERROR | [x] Parameter comment indentation must be 3 spaces,
| | found 2 spaces
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------

FILE: ...oogleAnalyticsCounterResultProcessor/UrlAliasResultProcessor.php
----------------------------------------------------------------------
FOUND 3 ERRORS AFFECTING 3 LINES
----------------------------------------------------------------------
19 | ERROR | [x] Missing function doc comment
48 | ERROR | [x] Missing function doc comment
86 | ERROR | [x] Missing function doc comment
----------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------

FILE: ...GoogleAnalyticsCounterResultProcessor/DefaultResultProcessor.php
----------------------------------------------------------------------
FOUND 3 ERRORS AFFECTING 3 LINES
----------------------------------------------------------------------
19 | ERROR | [x] Missing function doc comment
35 | ERROR | [x] Missing function doc comment
48 | ERROR | [x] Missing function doc comment
----------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------

FILE: ...unter/src/GoogleAnalyticsCounterResultProcessorPluginManager.php
----------------------------------------------------------------------
FOUND 7 ERRORS AFFECTING 6 LINES
----------------------------------------------------------------------
37 | ERROR | [ ] Missing short description in doc comment
38 | ERROR | [ ] Missing parameter comment
38 | ERROR | [ ] Missing parameter type
40 | ERROR | [ ] Description for the @return value is missing
47 | ERROR | [x] Missing function doc comment
57 | ERROR | [ ] Missing short description in doc comment
58 | ERROR | [ ] Description for the @return value is missing
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------

FILE: ..._counter/src/GoogleAnalyticsCounterResultProcessorPluginBase.php
----------------------------------------------------------------------
FOUND 8 ERRORS AND 1 WARNING AFFECTING 6 LINES
----------------------------------------------------------------------
6 | WARNING | [x] Unused use statement
21 | ERROR | [x] The abstract declaration must precede the
| | visibility declaration
21 | ERROR | [x] Missing function doc comment
23 | ERROR | [x] Missing function doc comment
30 | ERROR | [x] Missing function doc comment
34 | ERROR | [x] Missing function doc comment
38 | ERROR | [x] The abstract declaration must precede the
| | visibility declaration
38 | ERROR | [x] Missing function doc comment
38 | ERROR | [x] Expected 1 blank line after function; 2 found
----------------------------------------------------------------------
PHPCBF CAN FIX THE 9 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------

FILE: ...contrib/google_analytics_counter/google_analytics_counter.module
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
14 | ERROR | [x] Expected 1 space before opening brace; found 0
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------

FILE: ...ontrib/google_analytics_counter/google_analytics_counter.install
----------------------------------------------------------------------
FOUND 2 ERRORS AND 2 WARNINGS AFFECTING 4 LINES
----------------------------------------------------------------------
8 | WARNING | [x] Unused use statement
9 | WARNING | [x] Unused use statement
11 | ERROR | [x] Use statements should be sorted alphabetically.
| | The first wrong one is
| | Drupal\field\Entity\FieldConfig.
124 | ERROR | [x] Inline comments must end in full-stops,
| | exclamation marks, question marks, colons, or
| | closing parentheses
----------------------------------------------------------------------
PHPCBF CAN FIX THE 4 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------

Time: 982ms; Memory: 14MB

📌 Task
Status

Fixed

Version

4.0

Component

Code

Created by

🇮🇳India arti_parmar

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.69.0 2024