Problem/Motivation

phpstan reports:

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

However, the code already has $this->logger() defined.

Steps to reproduce

phpstan analyse consumers

Proposed resolution

Use the injected dependency instead of calling the static function.

Remaining tasks

Make an MR.

Issue fork consumers-3514510

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

benstallings created an issue. See original summary.

benstallings’s picture

Issue summary: View changes
benstallings’s picture

Title: inject logger dependency into Negotiator » remove \Drupal::logger call in Negotiator.php
Issue summary: View changes

benstallings’s picture

Assigned: benstallings » Unassigned
Category: Task » Bug report
Status: Active » Needs review
deimos’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new1.11 KB

Fix looks and works good!
Also adding a patch file for safer changes applying on site/projects.

eojthebrave made their first commit to this issue’s fork.

eojthebrave’s picture

Status: Reviewed & tested by the community » Fixed

Thank you for cleaning up this bit of code. I've merged the update and it'll be in the next release.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.