Problem/Motivation

package_manager needs the symfony/config package, because:

Composer Stager uses automatic service loading, where (almost) the only entry in its services.yml is to point its namespace to its src directory, and all the classes within there automatically get corresponding service definitions. Composer Stager is designed to not know anything about Drupal, and is not a Drupal module, so does not itself register these services in Drupal's service container.

Package Manager is the Drupal module that interfaces with Composer Stager. It needs to use Composer Stager's services, so it brings them in via PackageManagerServiceProvider. However, the code to discover and register services for all classes within a namespace/directory relies on the symfony/config package.

Proposed resolution

composer require symfony/config ^6.2

If for some reason we don't want to add this dependency, we could try to implement the needed functionality in #3021899: Support resource key in services.yml without it, but then that would be more custom code for Drupal to maintain.

Remaining tasks

In #1632930: Add Symfony/Component/Config despite Symfony potentially releasing BC-breaking updates after 2.3. we had rejected adding symfony/config, partly out of performance concerns, but that was a long time ago. Still, if we want to add it now, we should profile/benchmark the impact it would have to the time it takes to do a container rebuild. If we only use it in a few isolated places, like in PackageManagerServiceProvider, it probably wouldn't add much cost. But once it's in core, there might be a temptation to use it in more places.

User interface changes

None.

API changes

symfony/config is now a dependency of Drupal core. (It already was a dev dependency for Drupal core!)

It is required for the experimental Package Manager module, but it will also be used for improved service container/dependency injection DX in #3111008: Use native Symfony YamlLoader + Config.

Data model changes

None.

Release notes snippet

TBD

Comments

Wim Leers created an issue. See original summary.

wim leers’s picture

Issue summary: View changes
Status: Active » Needs review
StatusFileSize
new10.54 KB

#2: That's great news!

Now that the number of remaining core alpha experimental blockers for Package Manager has fewer than 10 issues remaining: time to really get this going! 😄

Attached patch is the result of doing:

composer require symfony/config ^6.2

… and it turns out that symfony/config depends on symfony/filesystem, so that's brought in as a dependency too.

wim leers’s picture

StatusFileSize
new10.84 KB

Aha! ComposerIntegrationTest is failing and points to https://www.drupal.org/about/core/policies/core-dependency-policies/mana..., which is the documentation I spent 20 minutes searching for but not finding 👍

The last submitted patch, 3: symfony-config-3326246-3.patch, failed testing. View results

effulgentsia’s picture

Issue summary: View changes

Updated the issue summary to be more explicit about why Package Manager needs symfony/config.

longwave’s picture

Would #3021899: Support resource key in services.yml solve the issue in PackageManagerServiceProvider without needing symfony/config? (assuming that that issue does not need symfony/config itself...)

Also, it is not already a dev dependency (but symfony/filesystem is)

andypost’s picture

One more reason to add it is #3111008: Use native Symfony YamlLoader + Config because except addition it also starts using it

effulgentsia’s picture

Re #7, yes I think it would, but I don't see why we'd want to write our own custom code for supporting a 'resource' key vs. using symfony/config. Re-reading #1632930: Add Symfony/Component/Config despite Symfony potentially releasing BC-breaking updates after 2.3., I think we rejected using symfony/config at that time, because:

  • In Symfony version 2, it was in the list of components that could still undergo breaking changes within a major version. I believe that hasn't been the case anymore in a long time now, and that all Symfony components respect semver now.
  • There were performance concerns, but I don't know if there still are with Symfony 6. We might need to profile/benchmark it to see how much, if anything, it would add to the time it takes to rebuild the container.
  • There wasn't a clearly compelling use-case (for Symfony v2 and Drupal 8.0, it wouldn't have added enough value to either our container building or our routing), but now we have one.
effulgentsia’s picture

effulgentsia’s picture

Issue summary: View changes

Adding the need to profile/benchmark as a remaining task.

effulgentsia’s picture

phenaproxima’s picture

So I was able to implement #3345039: Remove dependency on symfony/config without much difficulty at all. This means Package Manager no longer needs symfony/config. IMHO we should close this issue.

effulgentsia’s picture

Status: Needs review » Closed (duplicate)

Closing this as a duplicate of #3111008: Use native Symfony YamlLoader + Config. I think that issue is still worth doing if whatever the remaining challenges are there can be resolved.