Fix dependency injection

Created on 2 March 2024, 7 months ago
Updated 6 August 2024, about 2 months ago

Problem/Motivation

When we enabled Drupal.org's GitLab CI support in commit 36847a0, it started running PHPStan on the code.

PHPStan has pointed out some places where we should be using dependency injection ("\Drupal calls should be avoided in classes, use dependency injection instead").

See phpstan-baseline.neon for the list of files that should be using dependency injection.

One way to fix them is demonstrated in part of the changes to src/SitemapBase.php in commit 0208f8a; although there are other ways to fix them as well.

Proposed resolution

Fix these dependency injection problems. Remove them from phpstan-baseline.neon.

Remaining tasks

  1. See 📌 Drupal 11 compatibility fixes for sitemap Fixed

User interface changes

None.

API changes

None.

Data model changes

None.

📌 Task
Status

Closed: duplicate

Version

2.0

Component

Code

Created by

🇨🇦Canada mparker17 UTC-4

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

Comments & Activities

Production build 0.71.5 2024