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

Created on 24 May 2023, over 1 year ago
Updated 27 May 2023, over 1 year ago

Problem/Motivation

FILE: ...les/contrib/gravitas_countdown/src/Plugin/Block/GravitasCountdownBlock.php
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 31 WARNINGS AFFECTING 31 LINES
--------------------------------------------------------------------------------
149 | WARNING | File::load calls should be avoided in classes, use dependency
| | injection instead
156 | WARNING | File::load calls should be avoided in classes, use dependency
| | injection instead
175 | WARNING | File::load calls should be avoided in classes, use dependency
| | injection instead
190 | WARNING | File::load calls should be avoided in classes, use dependency
| | injection instead
219 | WARNING | \Drupal calls should be avoided in classes, use dependency
| | injection instead
224 | WARNING | File::load calls should be avoided in classes, use dependency
| | injection instead
--------------------------------------------------------------------------------

Steps to reproduce

Execute the command: phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,js,info,txt,md,yml,twig gravitas_countdown/

Proposed resolution

Add dependency injections.

๐Ÿ“Œ Task
Status

Fixed

Version

1.1

Component

Code

Created by

๐Ÿ‡ฎ๐Ÿ‡ณIndia urvashi_vora Madhya Pradesh, India

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

Comments & Activities

Production build 0.71.5 2024