Dependency injection should be used instead of \Drupal calls

Created on 30 December 2022, over 1 year ago
Updated 12 April 2023, about 1 year ago

Problem/Motivation

vendor/bin/phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml /var/www/html/drupal_cms/drupal9/web/modules/contrib/ipma_weather/

FILE: /var/www/html/drupal_cms/drupal9/web/modules/contrib/ipma_weather/src/Plugin/Block/IpmaWeather.php
--------------------------------------------------------------------------------------------------------
FOUND 3 ERRORS AND 2 WARNINGS AFFECTING 4 LINES
--------------------------------------------------------------------------------------------------------
 239 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
 249 | ERROR   | [x] Concat operator must be surrounded by a single space
 249 | ERROR   | [x] Concat operator must be surrounded by a single space
 285 | ERROR   | [x] Expected 1 space after IF keyword; 0 found
 286 | WARNING | [ ] Only string literals should be passed to t() where possible
--------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------------------------------

Time: 135ms; Memory: 12MB
📌 Task
Status

Fixed

Version

1.0

Component

Code

Created by

🇮🇳India PrasadDeole

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.

Production build 0.69.0 2024