inject dependencies

Created on 15 April 2025, 14 days ago

Problem/Motivation

PHPstan reports:

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

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

------ ---------------------------------------------------------------------------------
Line src/DiffLayoutBase.php
------ ---------------------------------------------------------------------------------
142 \Drupal calls should be avoided in classes, use dependency injection instead
254 Method Drupal\diff\DiffLayoutBase::buildConfigurationForm() should return array
but return statement is missing.
------ ---------------------------------------------------------------------------------

------ ------------------------------------------------------------------------------
Line src/Plugin/views/field/DiffFrom.php
------ ------------------------------------------------------------------------------
78 \Drupal calls should be avoided in classes, use dependency injection instead
------ ------------------------------------------------------------------------------

Steps to reproduce

phpstan -l0 diff

Proposed resolution

  • In NodeRevisionController and DiffFrom, use the $instance = parent::create() pattern.
  • In DiffEntityParser, add the dependency to the services.yml.
  • In DiffLayoutBase, add the dependency to the create() and __construct() methods and add the missing return statement.

Remaining tasks

make a merge request.

πŸ“Œ Task
Status

Active

Version

2.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
  • Merge request !130inject dependencies β†’ (Open) created by BenStallings
  • Pipeline finished with Failed
    14 days ago
    Total: 234s
    #474198
  • πŸ‡ΊπŸ‡ΈUnited States BenStallings
  • Pipeline finished with Failed
    14 days ago
    Total: 223s
    #474212
  • Pipeline finished with Failed
    14 days ago
    Total: 242s
    #474215
  • πŸ‡¦πŸ‡ΊAustralia acbramley

    Tests are failing

  • Pipeline finished with Failed
    6 days ago
    Total: 218s
    #480359
  • Pipeline finished with Canceled
    6 days ago
    #480374
  • Pipeline finished with Canceled
    6 days ago
    #480400
  • Pipeline finished with Canceled
    6 days ago
    #480404
  • Pipeline finished with Failed
    6 days ago
    Total: 337s
    #480414
  • Pipeline finished with Failed
    6 days ago
    Total: 239s
    #480441
  • Pipeline finished with Failed
    6 days ago
    Total: 264s
    #480451
  • Pipeline finished with Failed
    6 days ago
    Total: 224s
    #480456
  • Pipeline finished with Success
    6 days ago
    Total: 221s
    #480463
  • πŸ‡ΊπŸ‡ΈUnited States BenStallings
  • πŸ‡¦πŸ‡ΊAustralia acbramley

    There's many out of scope changes here going from constructor injection to setting class props in ::create. All of that needs to be reverted.

Production build 0.71.5 2024