use dependency injection

Created on 6 May 2025, 13 days 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

Production build 0.71.5 2024