use dependency injection

Created on 6 May 2025, about 1 month ago

Problem/Motivation

phpstan reports,

------ ------------------------------------------------------------------------------
Line src/Controller/ServerListBuilder.php
------ ------------------------------------------------------------------------------
43 \Drupal calls should be avoided in classes, use dependency injection instead
51 \Drupal calls should be avoided in classes, use dependency injection instead
59 \Drupal calls should be avoided in classes, use dependency injection instead
------ ------------------------------------------------------------------------------

------ ------------------------------------------------------------------------------
Line src/GraphQL/Execution/Executor.php
------ ------------------------------------------------------------------------------
320 \Drupal calls should be avoided in classes, use dependency injection instead
------ ------------------------------------------------------------------------------

------ ------------------------------------------------------------------------------
Line src/Plugin/GraphQL/DataProducer/Entity/Fields/Image/ImageDerivative.php
------ ------------------------------------------------------------------------------
102 \Drupal calls should be avoided in classes, use dependency injection instead
------ ------------------------------------------------------------------------------

------ ------------------------------------------------------------------------------
Line src/Plugin/GraphQL/DataProducer/EntityDefinition/EntityDefinition.php
------ ------------------------------------------------------------------------------
110 \Drupal calls should be avoided in classes, use dependency injection instead
------ ------------------------------------------------------------------------------

------ ------------------------------------------------------------------------------
Line src/Plugin/GraphQL/DataProducer/User/PasswordReset.php
------ ------------------------------------------------------------------------------
106 \Drupal calls should be avoided in classes, use dependency injection instead
------ ------------------------------------------------------------------------------

Steps to reproduce

phpstan analyse -l0 graphql

Proposed resolution

  • in ServerListBuilder, use the $instance = parent::createInstance() pattern
  • in the other classes, add to the existing create() function

Remaining tasks

make an MR

πŸ“Œ Task
Status

Active

Version

5.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States BenStallings

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

Merge Requests

Comments & Activities

  • Issue created by @BenStallings
  • Pipeline finished with Failed
    about 1 month ago
    Total: 308s
    #490654
  • Pipeline finished with Failed
    about 1 month ago
    Total: 418s
    #490652
  • Pipeline finished with Success
    about 1 month ago
    Total: 344s
    #490660
  • Pipeline finished with Canceled
    about 1 month ago
    Total: 279s
    #492590
  • Pipeline finished with Success
    about 1 month ago
    Total: 204s
    #492595
  • Pipeline finished with Success
    about 1 month ago
    Total: 195s
    #492602
Production build 0.71.5 2024