Dependency Injection

Created on 11 January 2023, almost 2 years ago
Updated 24 January 2023, almost 2 years ago

Problem/Motivation

FILE: /var/www/html/dcontri/age_verification/src/EventSubscriber/PathGate.php
----------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 8 WARNINGS AFFECTING 8 LINES
----------------------------------------------------------------------------------------------
  50 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
  63 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
  71 | 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
 102 | 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
 106 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 110 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
----------------------------------------------------------------------------------------------


FILE: /var/www/html/dcontri/age_verification/src/Form/AgeVerificationForm.php
---------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
---------------------------------------------------------------------------------------------
 99 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
---------------------------------------------------------------------------------------------

Proposed resolution

Inject services through DI

🐛 Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

🇮🇳India akshay.singh Noida

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • Assigned to elber
  • Issue was unassigned.
  • Status changed to RTBC almost 2 years ago
  • Assigned to akshay.singh
  • Status changed to Fixed almost 2 years ago
  • 🇮🇳India akshay.singh Noida

    Thanks for working

    Found some issues and fixed them.

    ----------------------------------------------------------------------------------------------------------------------------------------------
      52 | ERROR   | [x] Expected "\Drupal\Core\Config\ConfigFactoryInterface" but found "\Drupal\Core\Config\ConfigFactoryInterface;" for @var
         |         |     tag in member variable comment
      59 | ERROR   | [x] Expected "Drupal\Core\State\StateInterface" but found "Drupal\Core\State\StateInterface;" for @var tag in member
         |         |     variable comment
      94 | WARNING | [ ] Unused variable $response.
     124 | WARNING | [ ] Unused variable $key.
    ----------------------------------------------------------------------------------------------------------------------------------------------
    

    Thanks

  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024