Problem/Motivation

Calling the Symfony\Component\EventDispatcher\EventDispatcherInterface::dispatch() method with a string event name as the first argument is deprecated in drupal:9.1.0, an Event object will be required instead in drupal:10.0.0. See https://www.drupal.org/node/3154407

Proposed resolution

Swap the EventDispatcherInterface::dispatch() arguments.

Remaining tasks

  1. Write a patch
  2. Review
  3. Commit

User interface changes

None.

API changes

None.

Data model changes

None.

Issue fork facets-3257441

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

idebr created an issue. See original summary.

idebr’s picture

Status: Active » Needs review

The Facets project already requires Drupal 9.2.x, so this deprecation is safe to fix without breaking backwards compatibility.

mkalkbrenner’s picture

Status: Needs review » Needs work

The patch has to be different, using the non class names is also against the PSR.

mkalkbrenner’s picture

Status: Needs work » Needs review
StatusFileSize
new2.03 KB
idebr’s picture

Status: Needs review » Needs work

The patch in #4 makes sense, but introduces new coding standards violations. Let's fix those before commit.

  • mkalkbrenner committed c584df5 on 2.0.x
    Issue #3257441 by idebr, mkalkbrenner: Calling the...
mkalkbrenner’s picture

Status: Needs work » Needs review
StatusFileSize
new642 bytes
idebr’s picture

StatusFileSize
new663 bytes

The patch in #7 also fails the latest drupal/coder Drupal standards:

FILE: d9/modules/contrib/facets/src/Event/QueryStringCreated.php
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 2 LINES
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 20 | WARNING | The deprecation-version '2.0.1' does not match the lower-case machine-name standard: drupal:n.n.n or project:n.x-n.n or project:n.x-n.n-version[n] or project:n.n.n or
    |         | project:n.n.n-version[n]
 20 | WARNING | The removal-version '2.1.0' does not match the lower-case machine-name standard: drupal:n.n.n or project:n.x-n.n or project:n.x-n.n-version[n] or project:n.n.n or
    |         | project:n.n.n-version[n]
 22 | WARNING | The @see url '\Drupal\facets\Event\FacetsEvents' does not match the standard: http(s)://www.drupal.org/node/n or http(s)://www.drupal.org/project/aaa/issues/n
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Attached patch adds the expected syntax.

mkalkbrenner’s picture

Status: Needs review » Fixed

Thanks for your help :-)

Status: Fixed » Closed (fixed)

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