Problem/Motivation

As discovered in #3394694: [Meta] Symfony 7 compatibility, see PHPUnit test results, we have a few occurrences in unit tests where we use Symfony\Component\HttpFoundation\ParameterBag where we can/should use the more specific bags Symfony\Component\HttpFoundation\InputBag and Symfony\Component\HttpFoundation\HeaderBag.

With the current Symfony 6.x this is all fine, but from Symfony 7.0 we get test-failures similar to

TypeError: Cannot assign Mock_ParameterBag_0d737a6f to property Symfony\Component\HttpFoundation\Request::$query of type Symfony\Component\HttpFoundation\InputBag

Steps to reproduce

Proposed resolution

We can already tighten the used classes and make the MR to jump to Symfony 7 a bit smaller.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Issue fork drupal-3429403

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

Spokje created an issue. See original summary.

spokje’s picture

Status: Active » Needs review
spokje’s picture

Issue summary: View changes
spokje’s picture

Status: Needs review » Active
spokje’s picture

Status: Active » Needs review
longwave’s picture

Status: Needs review » Reviewed & tested by the community

Looks great, thanks for picking this up and sorting it out.

alexpott’s picture

Version: 11.x-dev » 10.2.x-dev
Status: Reviewed & tested by the community » Fixed

Committed and pushed 1feb93274a to 11.x and 5085b5a08f to 10.3.x and cb28194e8e to 10.2.x. Thanks!

Backported to 10.2.x to keep tests aligned.

  • alexpott committed cb28194e on 10.2.x
    Issue #3429403 by Spokje: Tighten ParameterBag classes in PHPUnit tests...

  • alexpott committed 5085b5a0 on 10.3.x
    Issue #3429403 by Spokje: Tighten ParameterBag classes in PHPUnit tests...

  • alexpott committed 1feb9327 on 11.x
    Issue #3429403 by Spokje: Tighten ParameterBag classes in PHPUnit tests
    

Status: Fixed » Closed (fixed)

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