\Drupal calls should be avoided in classes

Created on 1 March 2021, almost 4 years ago
Updated 10 September 2024, 3 months ago

Problem/Motivation

These errors were found during Code Sniffing with DrupalPractice:

FILE: ...evp/Ambientes/Drupal 9.2.x/drupal/modules/contrib/social_media_links/modules/social_media_links_field/src/Plugin/Field/FieldFormatter/SocialMediaLinksFieldDefaultFormatter.php
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 215 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 228 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------


FILE: .../guilhermevp/Ambientes/Drupal 9.2.x/drupal/modules/contrib/social_media_links/modules/social_media_links_field/src/Plugin/Field/FieldWidget/SocialMediaLinksFieldBaseWidget.php
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 36 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------


FILE: /home/guilhermevp/Ambientes/Drupal 9.2.x/drupal/modules/contrib/social_media_links/src/IconsetFinderService.php
---------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
---------------------------------------------------------------------------------------------------------------------
 72 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
---------------------------------------------------------------------------------------------------------------------

Proposed resolution

Address the issue.

Update:

Address only dependency injection. Transalatable calls already addressed.

📌 Task
Status

Fixed

Version

2.0

Component

Code

Created by

🇧🇷Brazil guilhermevp Santa Rita do Passa Quatro - SP

Live updates comments and jobs are added and updated live.
  • Coding standards

    It involves compliance with, or the content of coding standards. Requires broad community agreement.

Sign in to follow issues

Merge Requests

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.71.5 2024