Use DI not \Drupal in src/Plugin/views/filter/AdministrativeArea.php

Created on 11 January 2024, 11 months ago

Problem/Motivation

In πŸ“Œ Fix all code validate jobs running in GitLab CI Fixed , phpstan is complaining about our use of \Drupal in src/Plugin/views/filter/AdministrativeArea.php. However, fixing it properly and safely requires changing the constructor args, deprecation dance, etc. We don't have a 2.x branch yet where we could add a new deprecation for 2.1.x and removal in 3.0.0. I'm just going to punt for now, add another entry to the phpstan-baseline, and handle this later.

Steps to reproduce

Proposed resolution

  1. Add $languageManager and $moduleHandler properties.
  2. Change the constructor to take them as optional params.
  3. If NULL, trigger a deprecation and use \Drupal.
  4. Open a follow-up to remove entirely for Address 3.0.x.
  5. Remove the entries from phpstan-baseline.neon.

Remaining tasks

User interface changes

API changes

Data model changes

πŸ“Œ Task
Status

Postponed

Version

2.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States dww

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

Merge Requests

Comments & Activities

  • Issue created by @dww
  • Status changed to Postponed 11 months ago
  • πŸ‡ΊπŸ‡ΈUnited States dww
  • πŸ‡·πŸ‡ΈSerbia bojanz

    I am honestly fine with just modifying the constructor. It's our own views plugin, if you decide to override that one then you can keep it up to date.

    But I know maintainers have gotten more cautious over the past few years.

  • πŸ‡ΊπŸ‡ΈUnited States dww

    If there were lots of benefit to end users to "rip off the bandaid" I would consider it. But this is basically for a hypothetical improvement in the unit-testability of a class that we're not unit testing directly. I'd rather not introduce possible disruption and pain for this, since it's a "fix" to a non-bug that no one will ever notice we've "improved". πŸ˜‚ Hence my desire to be a bit more cautious and jump through a few more hoops to solve this.

Production build 0.71.5 2024