Fix the issues reported by phpcs

Created on 5 May 2023, over 1 year ago
Updated 19 May 2023, over 1 year ago

Problem/Motivation

Found coding standard issues.

phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml site_guardian
FILE: /Users/projects/drupal-d10/modules/contrib/site_guardian/tests/src/Unit/SiteGuardianServiceUnitTest.php
------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 2 LINES
------------------------------------------------------------------------------------------
10 | WARNING | Line exceeds 80 characters; contains 96 characters
10 | WARNING | There must be no blank line following an inline comment
101 | WARNING | Unused variable $projects.
------------------------------------------------------------------------------------------

FILE: /Users/projects/drupal-d10/modules/contrib/site_guardian/src/Controller/SiteGuardianController.php
------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 6 WARNINGS AFFECTING 6 LINES
------------------------------------------------------------------------------------------
63 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
65 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
76 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
103 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
105 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
115 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
------------------------------------------------------------------------------------------

FILE: /Users/projects/drupal-d10/modules/contrib/site_guardian/src/Services/SiteGuardianService.php
------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 11 WARNINGS AFFECTING 11 LINES
------------------------------------------------------------------------------------------
60 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
67 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
93 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
99 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
100 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
131 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
136 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
147 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
154 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
182 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
190 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
------------------------------------------------------------------------------------------

Time: 144ms; Memory: 10MB

Steps to reproduce

phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml site_guardian

Proposed resolution

Fix the coding errors

Remaining tasks

Fix the coding errors and commit the fixes

User interface changes

None

API changes

None

Data model changes

None

📌 Task
Status

Fixed

Version

1.0

Component

Code

Created by

🇬🇧United Kingdom the_g_bomb

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