more dependency injection

Created on 2 May 2025, 17 days ago

Problem/Motivation

I see that there have been several tickets already merged that try to inject dependencies, but even with the most recent dev version, phpstan is still reporting

------ ------------------------------------------------------------------------------
Line src/Feeds/Target/Text.php
------ ------------------------------------------------------------------------------
60 \Drupal calls should be avoided in classes, use dependency injection instead
------ ------------------------------------------------------------------------------

------ ------------------------------------------------------------------------------------------------------------
Line src/Plugin/Type/PluginBase.php
------ ------------------------------------------------------------------------------------------------------------
76 Method Drupal\feeds\Plugin\Type\PluginBase::getConfiguration() should return array but return statement is
missing.
198 \Drupal calls should be avoided in classes, use dependency injection instead
------ ------------------------------------------------------------------------------------------------------------

------ ------------------------------------------------------------------------------
Line src/Plugin/Type/Target/FieldTargetBase.php
------ ------------------------------------------------------------------------------
194 \Drupal calls should be avoided in classes, use dependency injection instead
217 \Drupal calls should be avoided in classes, use dependency injection instead
379 \Drupal calls should be avoided in classes, use dependency injection instead
------ ------------------------------------------------------------------------------

------ ------------------------------------------------------------------------------
Line src/Result/HttpFetcherResult.php
------ ------------------------------------------------------------------------------
45 \Drupal calls should be avoided in classes, use dependency injection instead
62 \Drupal calls should be avoided in classes, use dependency injection instead
------ ------------------------------------------------------------------------------

------ ------------------------------------------------------------------------------
Line src/Result/RawFetcherResult.php
------ ------------------------------------------------------------------------------
42 \Drupal calls should be avoided in classes, use dependency injection instead
------ ------------------------------------------------------------------------------

------ ------------------------------------------------------------------------------
Line src/State.php
------ ------------------------------------------------------------------------------
161 \Drupal calls should be avoided in classes, use dependency injection instead
------ ------------------------------------------------------------------------------

Steps to reproduce

phpstan analyse -l0 feeds

Proposed resolution

inject remaining dependencies using the existing create() pattern.

Remaining tasks

make an MR.

πŸ“Œ Task
Status

Active

Version

3.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States BenStallings

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

Comments & Activities

  • Issue created by @BenStallings
  • πŸ‡ΊπŸ‡ΈUnited States BenStallings

    Never mind, it looks like these have been intentionally left un-injected in a variety of creative ways. It might be nice to silence phpstan, but I'll leave that to someone who knows the module's code better than I do.

Production build 0.71.5 2024