FILE: C:\xampp\htdocs\drupal95\web\modules\contrib\gantt\src\Form\AddComponentForm.php
----------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 5 WARNINGS AFFECTING 5 LINES
----------------------------------------------------------------------------------------------
81 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
130 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
227 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
230 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
283 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
----------------------------------------------------------------------------------------------

Comments

akshay.kelotra created an issue. See original summary.

akshay.kelotra’s picture

Assigned: akshay.kelotra » Unassigned
Category: Task » Bug report
Status: Active » Needs review
StatusFileSize
new3.6 KB

I have fixed this issue and providing a patch.

alexanderj’s picture

Assigned: Unassigned » alexanderj

I will review it.

alexanderj’s picture

Assigned: alexanderj » Unassigned
Status: Needs review » Needs work

I have reviewed your patch and it fixes all the errors pointed out in the issue summary, but there are still 2 DI warnings in another file gantt/src/Controller/GanttController.php, I believe they can be fixed:

FILE: /home/alexanderj/contrib/contrib-9/web/modules/contrib/gantt/src/Controller/GanttController.php
-------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
-------------------------------------------------------------------------------------------------------
  35 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 123 | WARNING | DateFormat::load calls should be avoided in classes, use dependency injection instead
-------------------------------------------------------------------------------------------------------

  • lazzyvn committed 79199e4 on 1.x
    Issue #3310638 by akshay.kelotra: \Drupal calls should be avoided in...
ramonvasconcelos’s picture

Assigned: Unassigned » ramonvasconcelos

I can fix the last 2 errors.

ramonvasconcelos’s picture

Assigned: ramonvasconcelos » Unassigned
Status: Needs work » Needs review

Just added the dependency injection for these 2 cases. Please, review it.

ramonvasconcelos’s picture

StatusFileSize
new1.97 KB
pflora’s picture

Status: Needs review » Reviewed & tested by the community

Patch from #8 applies and after running phpcs there are no more dependency injection errors in the GanttController.php file.
Moving this to RTBC.

  • lazzyvn committed 66665fa on 1.x
    Issue #3310638 by ramonvasconcelos, akshay.kelotra, lazzyvn: \Drupal...
  • lazzyvn committed b9d98f0 on 1.x
    Issue #3310638 by ramonvasconcelos, akshay.kelotra, lazzyvn: \Drupal...
lazzyvn’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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