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

Created on 10 July 2023, 12 months ago
Updated 10 February 2024, 5 months ago

Problem/Motivation

FILE: /var/www/html/vb/d_cont/sidekick/src/Form/SettingsForm.php
--------------------------------------------------------------------------------
FOUND 3 WARNINGS AFFECTING 3 LINES
--------------------------------------------------------------------------------
59 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency
| | injection instead
61 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency
| | injection instead
72 | WARNING | [ ] \Drupal 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,info,txt,md,yml,twig sidekick/

Remaining tasks

Patch review

📌 Task
Status

Fixed

Version

1.0

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

  • Issue created by @urvashi_vora
  • Status changed to Needs work 6 months ago
  • 🇮🇳India Ashutosh Ahirwal India

    Provided Patch is not getting apply
    Throwing errors.

    sidekick % git apply -v coding-standard-fixes_4.patch
    Checking patch src/Form/SettingsForm.php...
    error: while searching for:

    use Drupal\Core\Form\ConfigFormBase;
    use Drupal\Core\Form\FormStateInterface;

    /**
    * Configure Sidekick settings.
    */
    class SettingsForm extends ConfigFormBase {

    /**
    * {@inheritdoc}
    */

    error: patch failed: src/Form/SettingsForm.php:4
    error: src/Form/SettingsForm.php: patch does not apply

  • First commit to issue fork.
  • Status changed to Fixed 5 months ago
  • 🇦🇹Austria rominronin Vienna

    This has been fixed in 1.0.0-alpha2. Closing

  • 🇦🇹Austria rominronin Vienna

    Forgot to add this before :)

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

Production build 0.69.0 2024