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

Created on 9 July 2024, 5 months ago

Problem/Motivation

FILE: ....0/web/modules/contrib/block_backup_restore/src/Form/RestoreConfigForm.php
--------------------------------------------------------------------------------
FOUND 1 ERROR AND 3 WARNINGS AFFECTING 4 LINES
--------------------------------------------------------------------------------
   7 | ERROR   | [x] Use statements should be sorted alphabetically. The first
     |         |     wrong one is
     |         |     Drupal\Core\Entity\EntityTypeManagerInterface.
   9 | WARNING | [x] Unused use statement
  15 | WARNING | [ ] The class short comment should describe what the class
     |         |     does and not simply repeat the class name
 137 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency
     |         |     injection instead
--------------------------------------------------------------------------------


FILE: ...ntrib/block_backup_restore/src/Controller/BlockBackupRestoreController.php
--------------------------------------------------------------------------------
FOUND 2 ERRORS AND 6 WARNINGS AFFECTING 7 LINES
--------------------------------------------------------------------------------
   7 | ERROR   | [x] Use statements should be sorted alphabetically. The first
     |         |     wrong one is
     |         |     Symfony\Component\DependencyInjection\ContainerInterface.
  13 | WARNING | [x] Unused use statement
 114 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency
     |         |     injection instead
 131 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 6
 131 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency
     |         |     injection instead
 162 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency
     |         |     injection instead
 178 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency
     |         |     injection instead
 181 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency
     |         |     injection instead
--------------------------------------------------------------------------------
📌 Task
Status

Needs review

Version

2.0

Component

Code

Created by

🇮🇳India Rohit Rana

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

Comments & Activities

Production build 0.71.5 2024