Problem/Motivation

Track what needs to be for Symfony 7.

Symfony 7 will include types on many methods, which requires that extending classes and interface implementations will need to be updated. There is an issue upstream for collecting feedback, and with compatibility-checking steps.

Steps to reproduce

Proposed resolution

Remaining tasks

#3397522: Fork Symfony's ContainerAwareTrait and ContainerAwareInterface into core
#3407159: [11.x] Add void returns for Symfony 7
#3397519: [META] Reduce use of ContainerAware classes where possible

done

User interface changes

API changes

Data model changes

Release notes snippet

Issue fork drupal-3394694

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

bradjones1 created an issue. See original summary.

bradjones1’s picture

Priority: Normal » Major

I'm going to bump this to major since there is a kinda time-sensitive request in the Symfony IS for dependent frameworks to determine if there are particular types that will be hugely problematic. There are instructions, and I think this should be easy enough to do in GitLab CI.

bradjones1’s picture

Status: Active » Closed (duplicate)

Closing as a duplicate of #3392616: Update to Symfony 6.4

bradjones1’s picture

Status: Closed (duplicate) » Active
Related issues: +#3392616: Update to Symfony 6.4

Not a duplicate.

quietone’s picture

Title: Symfony 7 compatibility » [Meta] Symfony 7 compatibility
Issue summary: View changes
Parent issue: » #3284879: [meta] Requirements for tagging Drupal 11.0.0-beta1
longwave’s picture

The following dependencies need to declare Symfony 7 compatibility:

quietone’s picture

Issue summary: View changes

@longwave, thanks.

I've moved the list of upstream changes to the Issue Summary and added a link for the behat/mink-browserkit-driver issue.

longwave’s picture

Issue summary: View changes
mglaman’s picture

Issue summary: View changes

Merged https://github.com/mglaman/phpstan-drupal/pull/639 – I just want to wait a few days to release phpstan-drupal as I cut 1.2.3 this morning, right before the issue was filed.

longwave’s picture

I have a pipeline running on Symfony 7 over in a test issue, where almost all the tests are passing with a handful of changes to core - need to break those out into separate issues so we can decide what to do with them in 10.x and 11.x but overall it's looking quite good to me: https://git.drupalcode.org/project/drupal/-/pipelines/49497/test_report

andypost’s picture

Issue summary: View changes

Updated IS a bit with current state

andypost’s picture

Issue summary: View changes

https://github.com/asm89/stack-cors/releases/tag/v2.2.0 is out as well as SF 6.4.0/7.0.0

Only behat/mink* is not ready (as always)

andypost’s picture

Issue summary: View changes

ordering to IS points

andypost’s picture

Issue summary: View changes

mink merged changes to master so only tagged releases left

andypost’s picture

asm89/stack-cors will be included in #3404694: Update dependencies for Drupal 10.2

mglaman/phpstan-drupal needs bump constraint s/1.2.1/1.2.4

andypost’s picture

longwave’s picture

Issue summary: View changes
longwave’s picture

Issue summary: View changes
catch’s picture

composer 2.6.6 apparently resolves https://github.com/composer/composer/issues/11741#issuecomment-1847572878 so we might be able to just update to that instead of waiting for 2.7.

andypost’s picture

It resolving conflict st least so let's upgrade

longwave’s picture

Issue summary: View changes
Issue tags: +Needs issue summary update

The list of tasks is incomplete, there are more than those listed.

https://git.drupalcode.org/project/drupal/-/merge_requests/5388 is an old work in progress MR that has some more SF7 fixes in it.

andypost’s picture

andypost’s picture

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

spokje’s picture

Issue summary: View changes
spokje’s picture

Pushed a YOLO! commit to the MR, just with the updated dependencies, now that all external dependencies are SF7 ready.

As PHPStan shows (and @longwave already said in #21): The list of tasks is incomplete, there are more than those listed.

A lot of wheels are already in motion to get rid of the "last" SF6.4 issues, for Behat and friends there's an issue somewhere, and there are bound to be more issues floating around.

Spokje changed the visibility of the branch 11.x to hidden.

spokje’s picture

New MR, either me or GitLab couldn't figure out a rebase on the previous one (yeah, prob me...).

Not much to see until #3407159: [11.x] Add void returns for Symfony 7 lands.

gábor hojtsy’s picture

#3407159: [11.x] Add void returns for Symfony 7 is for the 11.x codebase only, so it cannot be committed right now. Are there any other changes to be made on "the 10.3.x branch" for Symfony 7 or none left?

longwave’s picture

Some of the ContainerAware removals will likely also be committed to 10.3.x as they will involve deprecations. It's hard to see the full picture without clearing the void returns and ContainerAware issues first, there may be more we need to do after that that also involve adding deprecations to 10.3.x.

catch’s picture

Rebased the MR.

Before the rebase:

88 errors

After the rebase:
62 errors

spokje’s picture

Rebased and bumped symfony/* to 7.0.4.
After the rebase:
58 errors

spokje’s picture

Rebased and bumped symfony/* to 7.0.5.
After the rebase:
58 errors

spokje’s picture

Rebased.
PHPStan: Found 23 errors

longwave’s picture

Whoops, your push wasn't there when I started my own rebase, and then I repeated and overwrote your work, sorry!

spokje’s picture

No worries, as long as the end result is less errors :)

longwave’s picture

Rebase again following two more commits, down to 10 errors.

andypost’s picture

needs rebase/fixes

spokje’s picture

Down to 7 PHPStan errors

longwave’s picture

Spokje changed the visibility of the branch 3394694-sf7 to hidden.

longwave’s picture

Urgh, that was no fun to figure out. See #3054535-37: Discuss whether to decouple from Symfony Validator for the backstory on 95a33fe4.

longwave’s picture

A green pipeline on Symfony 7!

Only a few BaseFieldDefinition tweaks needed, will open another issue to backport those; was surprised that translated constraint errors didn't break, but it appears we have test coverage and all is good.

longwave’s picture

Raised https://github.com/symfony/symfony/issues/54321 as there is a type error in Symfony that we currently work around here, unsure which way they will fix this.

longwave’s picture

https://github.com/symfony/symfony/issues/54321 was fixed so once Symfony 7.0.6 is out we can revert the change around Request::setFactory().

andypost’s picture

andypost’s picture

Status: Active » Needs work

No blockers, needs work for upgrade issue

mondrake’s picture

Think #3413268: Add PHP 8.3 requirement to Drupal 11.0.x needs to be done first as it will set PHP to 8.3 min.

spokje’s picture

PHP 8.2 is the minimum for SF 7, so not really a hard blocker.

However the release of SF 7.0.6 is, if we want to prevent using workarounds (as said by @longwave in #52)

Spokje changed the visibility of the branch 3394694-sf7-no-containeraware-less-rebases to hidden.

longwave’s picture

Opened #3432860: Update to Symfony 7.0 to actually do the update, we must do #3413268: Add PHP 8.3 requirement to Drupal 11.0.x first (no point going to PHP 8.2 in between as we decided on 8.3 already) and we have a Validator component problem to sort out as well which probably should be its own issue.

mondrake’s picture

Out there in #3417066: Upgrade PHPUnit to 10, drop Symfony PHPUnit-bridge dependency there are still a lot of DebugClassloader deprecations for Symfony 7 typehints, see https://git.drupalcode.org/issue/drupal-3417066/-/pipelines/127550 and its test jobs.

For some reason #3417066: Upgrade PHPUnit to 10, drop Symfony PHPUnit-bridge dependency seems to be stricter than current symfony-bridge in reporting deprecations triggered before the test start.

Example:

 PHPUnit 10.5.14 by Sebastian Bergmann and contributors.
    
    Runtime:       PHP 8.3.4
    Configuration: /builds/issue/drupal-3417066/core/phpunit.xml.dist
    
    D                                                                   1 / 1
    (100%)
    
    Time: 00:00.843, Memory: 16.00 MB
    
    1 test triggered 15 deprecations:
    
    1)
    /builds/issue/drupal-3417066/vendor/symfony/error-handler/DebugClassLoader.php:337
    Method
    "Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface::process()"
    might add "void" as a native return type declaration in the future. Do the
    same in implementation
    "Drupal\Core\DependencyInjection\Compiler\ModifyServiceDefinitionsPass" now
    to avoid errors or add an explicit @return annotation to suppress this
    message.
    
    Triggered by:
    
    *
    Drupal\KernelTests\Core\DrupalKernel\DrupalKernelSiteTest::testServicesYml
     
    /builds/issue/drupal-3417066/core/tests/Drupal/KernelTests/Core/DrupalKernel/DrupalKernelSiteTest.php:18
    
    2)
    /builds/issue/drupal-3417066/vendor/symfony/error-handler/DebugClassLoader.php:337
    Method
    "Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface::process()"
    might add "void" as a native return type declaration in the future. Do the
    same in implementation
    "Drupal\Core\DependencyInjection\Compiler\DevelopmentSettingsPass" now to
    avoid errors or add an explicit @return annotation to suppress this
    message.
    
    Triggered by:
    
    *
    Drupal\KernelTests\Core\DrupalKernel\DrupalKernelSiteTest::testServicesYml
     
    /builds/issue/drupal-3417066/core/tests/Drupal/KernelTests/Core/DrupalKernel/DrupalKernelSiteTest.php:18
    
    3)
    /builds/issue/drupal-3417066/vendor/symfony/error-handler/DebugClassLoader.php:337
    Method
    "Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface::process()"
    might add "void" as a native return type declaration in the future. Do the
    same in implementation
    "Drupal\Core\DependencyInjection\Compiler\CorsCompilerPass" now to avoid
    errors or add an explicit @return annotation to suppress this message.
    
    Triggered by:
    
    *
    Drupal\KernelTests\Core\DrupalKernel\DrupalKernelSiteTest::testServicesYml
     
    /builds/issue/drupal-3417066/core/tests/Drupal/KernelTests/Core/DrupalKernel/DrupalKernelSiteTest.php:18
    
    4)
    /builds/issue/drupal-3417066/vendor/symfony/error-handler/DebugClassLoader.php:337
    Method
    "Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface::process()"
    might add "void" as a native return type declaration in the future. Do the
    same in implementation
    "Drupal\Core\DependencyInjection\Compiler\StackedSessionHandlerPass" now to
    avoid errors or add an explicit @return annotation to suppress this
    message.
    
    Triggered by:
    
    *
Drupal\KernelTests\Core\DrupalKernel\DrupalKernelSiteTest::testServicesYml
 
/builds/issue/drupal-3417066/core/tests/Drupal/KernelTests/Core/DrupalKernel/DrupalKernelSiteTest.php:18
5)
/builds/issue/drupal-3417066/vendor/symfony/error-handler/DebugClassLoader.php:337
Method
"Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface::process()"
might add "void" as a native return type declaration in the future. Do the
same in implementation
"Drupal\Core\Render\MainContent\MainContentRenderersPass" now to avoid
errors or add an explicit @return annotation to suppress this message.
Triggered by:
*
Drupal\KernelTests\Core\DrupalKernel\DrupalKernelSiteTest::testServicesYml
 
/builds/issue/drupal-3417066/core/tests/Drupal/KernelTests/Core/DrupalKernel/DrupalKernelSiteTest.php:18
6)
/builds/issue/drupal-3417066/vendor/symfony/error-handler/DebugClassLoader.php:337
Method
"Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface::process()"
might add "void" as a native return type declaration in the future. Do the
same in implementation
"Drupal\Core\DependencyInjection\Compiler\RegisterStreamWrappersPass" now
to avoid errors or add an explicit @return annotation to suppress this
message.
Triggered by:
*
Drupal\KernelTests\Core\DrupalKernel\DrupalKernelSiteTest::testServicesYml
 
/builds/issue/drupal-3417066/core/tests/Drupal/KernelTests/Core/DrupalKernel/DrupalKernelSiteTest.php:18
7)
/builds/issue/drupal-3417066/vendor/symfony/error-handler/DebugClassLoader.php:337
Method
"Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface::process()"
might add "void" as a native return type declaration in the future. Do the
same in implementation
"Drupal\Core\DependencyInjection\Compiler\TwigExtensionPass" now to avoid
errors or add an explicit @return annotation to suppress this message.
Triggered by:
*
Drupal\KernelTests\Core\DrupalKernel\DrupalKernelSiteTest::testServicesYml
 
/builds/issue/drupal-3417066/core/tests/Drupal/KernelTests/Core/DrupalKernel/DrupalKernelSiteTest.php:18
8)
/builds/issue/drupal-3417066/vendor/symfony/error-handler/DebugClassLoader.php:337
Method
"Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface::process()"
might add "void" as a native return type declaration in the future. Do the
same in implementation
"Drupal\Core\DependencyInjection\Compiler\RegisterEventSubscribersPass" now
to avoid errors or add an explicit @return annotation to suppress this
message.
Triggered by:
*
Drupal\KernelTests\Core\DrupalKernel\DrupalKernelSiteTest::testServicesYml
 
/builds/issue/drupal-3417066/core/tests/Drupal/KernelTests/Core/DrupalKernel/DrupalKernelSiteTest.php:18
9)
/builds/issue/drupal-3417066/vendor/symfony/error-handler/DebugClassLoader.php:337
Method
"Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface::process()"
might add "void" as a native return type declaration in the future. Do the
same in implementation
"Drupal\Core\DependencyInjection\Compiler\RegisterAccessChecksPass" now to
avoid errors or add an explicit @return annotation to suppress this
message.
Triggered by:
*
Drupal\KernelTests\Core\DrupalKernel\DrupalKernelSiteTest::testServicesYml
 
/builds/issue/drupal-3417066/core/tests/Drupal/KernelTests/Core/DrupalKernel/DrupalKernelSiteTest.php:18
10)
/builds/issue/drupal-3417066/vendor/symfony/error-handler/DebugClassLoader.php:337
Method
"Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface::process()"
might add "void" as a native return type declaration in the future. Do the
same in implementation
"Drupal\Core\DependencyInjection\Compiler\RegisterServicesForDestructionPass"
now to avoid errors or add an explicit @return annotation to suppress this
message.
Triggered by:
*
Drupal\KernelTests\Core\DrupalKernel\DrupalKernelSiteTest::testServicesYml
 
/builds/issue/drupal-3417066/core/tests/Drupal/KernelTests/Core/DrupalKernel/DrupalKernelSiteTest.php:18
11)
/builds/issue/drupal-3417066/vendor/symfony/error-handler/DebugClassLoader.php:337
Method
"Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface::process()"
might add "void" as a native return type declaration in the future. Do the
same in implementation "Drupal\Core\Cache\ListCacheBinsPass" now to avoid
errors or add an explicit @return annotation to suppress this message.
Triggered by:
*
Drupal\KernelTests\Core\DrupalKernel\DrupalKernelSiteTest::testServicesYml
 
/builds/issue/drupal-3417066/core/tests/Drupal/KernelTests/Core/DrupalKernel/DrupalKernelSiteTest.php:18
12)
/builds/issue/drupal-3417066/vendor/symfony/error-handler/DebugClassLoader.php:337
Method
"Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface::process()"
might add "void" as a native return type declaration in the future. Do the
same in implementation "Drupal\Core\Cache\Context\CacheContextsPass" now to
avoid errors or add an explicit @return annotation to suppress this
message.
Triggered by:
*
Drupal\KernelTests\Core\DrupalKernel\DrupalKernelSiteTest::testServicesYml
 
/builds/issue/drupal-3417066/core/tests/Drupal/KernelTests/Core/DrupalKernel/DrupalKernelSiteTest.php:18
13)
/builds/issue/drupal-3417066/vendor/symfony/error-handler/DebugClassLoader.php:337
Method
"Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface::process()"
might add "void" as a native return type declaration in the future. Do the
same in implementation "Drupal\Core\Plugin\PluginManagerPass" now to avoid
errors or add an explicit @return annotation to suppress this message.
Triggered by:
*
Drupal\KernelTests\Core\DrupalKernel\DrupalKernelSiteTest::testServicesYml
 
/builds/issue/drupal-3417066/core/tests/Drupal/KernelTests/Core/DrupalKernel/DrupalKernelSiteTest.php:18
14)
/builds/issue/drupal-3417066/vendor/symfony/error-handler/DebugClassLoader.php:337
Method
"Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface::process()"
might add "void" as a native return type declaration in the future. Do the
same in implementation
"Drupal\Core\DependencyInjection\Compiler\DeprecatedServicePass" now to
avoid errors or add an explicit @return annotation to suppress this
message.
Triggered by:
*
Drupal\KernelTests\Core\DrupalKernel\DrupalKernelSiteTest::testServicesYml
 
/builds/issue/drupal-3417066/core/tests/Drupal/KernelTests/Core/DrupalKernel/DrupalKernelSiteTest.php:18
15)
/builds/issue/drupal-3417066/vendor/symfony/error-handler/DebugClassLoader.php:337
Method
"Symfony\Component\EventDispatcher\EventSubscriberInterface::getSubscribedEvents()"
might add "array" as a native return type declaration in the future. Do the
same in implementation "Drupal\Core\Update\UpdateRegistry" now to avoid
errors or add an explicit @return annotation to suppress this message.
Triggered by:
*
Drupal\KernelTests\Core\DrupalKernel\DrupalKernelSiteTest::testServicesYml
 
andypost’s picture

Most of it should be fixed by related rector to prevent manual intervention, the scariest is how contrib will adopt it...

mondrake’s picture

longwave’s picture

Status: Needs work » Fixed
Issue tags: -Needs issue summary update

#3432860: Update to Symfony 7.0 landed, so we are all done here - thanks to everyone who contributed especially @Spokje for keeping on top of this.

Status: Fixed » Closed (fixed)

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

quietone’s picture

Issue tags: +11.0.0 release notes