Problem/Motivation

New pipeline in 11.x running today hits:

------ ----------------------------------------------------------------------
  Line   core/tests/Drupal/Tests/Core/Controller/TitleResolverTest.php
 ------ ----------------------------------------------------------------------
  295    Class Drupal\Tests\Core\Controller\ArgumentResolverInterface not
         found.
         🪪  class.notFound
         💡  Learn more at https://phpstan.org/user-guide/discovering-symbols
  296    Trying to mock an undefined method getArguments() on class
         Drupal\Tests\Core\Controller\ArgumentResolverInterface.
         🪪  phpunit.mockMethod
 ------ ----------------------------------------------------------------------
 [ERROR] Found 2 errors

I believe this is caused by the cherry-pick of https://www.drupal.org/project/drupal/issues/3607968 to 11.x

Steps to reproduce

See: https://git.drupalcode.org/project/drupal/-/jobs/11286435

Proposed resolution

Add:

use Symfony\Component\HttpKernel\Controller\ArgumentResolverInterface;

...to: core/tests/Drupal/Tests/Core/Controller/TitleResolverTest.php

Remaining tasks

I'll submit an MR for this in a short while unless anyone beats me to it.

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

Issue fork drupal-3614402

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

mcdruid created an issue. See original summary.

mcdruid’s picture

Issue summary: View changes

mcdruid’s picture

Adding the use statement might have addressed a phpstan issue, but it actually looks like the cherry-pick is not compatible with older PHP (8.3 and 8.4) as it uses the newer "closures in constant expressions" feature.

For example:

Drupal test run
--------------------------------------------------------------
Drupal Version.......: 11.4-dev
PHP Version..........: 8.3.33
PHP Binary...........: /usr/local/bin/php
PHPUnit Version......: 11.5.55
PHPUnit configuration: /builds/core
Working directory....: /builds
--------------------------------------------------------------
Test discovery
PHPUnit test suite(s): PHPUnit-Unit
--------------------------------------------------------------
PHP Fatal error:  Constant expression contains invalid operations in /builds/core/tests/Drupal/Tests/Core/Controller/TitleResolverTest.php on line 346
Fatal error: Constant expression contains invalid operations in /builds/core/tests/Drupal/Tests/Core/Controller/TitleResolverTest.php on line 346
longwave’s picture

Oh I didn't realise this was only in 8.5: https://wiki.php.net/rfc/closures_in_const_expr

I think we should revert that other issue, at least from 11.x.

longwave’s picture

Status: Active » Closed (duplicate)

The original issue was reverted from 11.x, nothing more to do here, let's continue over there.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.