Skip to content

Updates the PHP dependency injection packages to 5.4#21905

Merged
thijsoo merged 21 commits intotrunkfrom
feature/update-di-container
Nov 10, 2025
Merged

Updates the PHP dependency injection packages to 5.4#21905
thijsoo merged 21 commits intotrunkfrom
feature/update-di-container

Conversation

@thijsoo
Copy link
Copy Markdown
Contributor

@thijsoo thijsoo commented Dec 9, 2024

Context

  • We want our packages to stay up to date.
  • This pr updates our DI container to the highest version of the Symfony DI package before it requires PHP 8.0.

Important

Take not this PR needs to be merged together with https://github.com/Yoast/wordpress-seo-local/pull/2554
Also take a look at the source issue for linked in this PR for more next steps when we are merging this.

Summary

This PR can be summarized in the following changelog entry:

  • Updates the symfony/dependency-injection package to version 5.4

Relevant technical choices:

To make this work I needed to make a couple of changes. The first change was to also include some new files in our php-scoper which are located in config/php-scoper/service-contracts.inc.php these files are needed for the DI container to compile so we need them to be copied over in our scoper.

The second change made was to mark src/introductions/infrastructure/introductions-seen-repository.php as @makePublic. This is needed because with this update the default behavior for new classes that live in Free and are used in any addon + premium is to be marked as public(false). This means that they are not included in the DI containers public classes. Which in practical terms means that YoastSEO()->classes->get('...') no longer works. We want this since we do not want our entire codebase to be public API.
This has no affect on existing classes which are located in folders that are included in the list in /config/dependency-injection/loader-pass.php in the process_definition method.

Test instructions

Test instructions for the acceptance test before the PR gets merged

This PR can be acceptance tested by following these steps:

  • This change should have no impact. But we need to smoke test premium + all addons to make sure everything still functions as expected. To do this you need to include this feature branch in the addon with the command:
    composer require yoast/wordpress-seo:"dev-feature/update-di-container@dev as dev-release/24.8@dev" --dev
    For premium you just need:
    composer require yoast/wordpress-seo:"dev-feature/update-di-container@dev as dev-release/24.8@dev"

Relevant test scenarios

  • Changes should be tested with the browser console open
  • Changes should be tested on different posts/pages/taxonomies/custom post types/custom taxonomies
  • Changes should be tested on different editors (Default Block/Gutenberg/Classic/Elementor/other)
  • Changes should be tested on different browsers
  • Changes should be tested on multisite

Test instructions for QA when the code is in the RC

  • QA should use the same steps as above.

QA can test this PR by following these steps:

Impact check

This PR affects the following parts of the plugin, which may require extra testing:

UI changes

  • This PR changes the UI in the plugin. I have added the 'UI change' label to this PR.

Other environments

  • This PR also affects Shopify. I have added a changelog entry starting with [shopify-seo], added test instructions for Shopify and attached the Shopify label to this PR.

Documentation

  • I have written documentation for this change. For example, comments in the Relevant technical choices, comments in the code, documentation on Confluence / shared Google Drive / Yoast developer portal, or other.

Quality assurance

  • I have tested this code to the best of my abilities.
  • During testing, I had activated all plugins that Yoast SEO provides integrations for.
  • I have added unit tests to verify the code works as intended.
  • If any part of the code is behind a feature flag, my test instructions also cover cases where the feature flag is switched off.
  • I have written this PR in accordance with my team's definition of done.
  • I have checked that the base branch is correctly set.

Innovation

  • No innovation project is applicable for this PR.
  • This PR falls under an innovation project. I have attached the innovation label.
  • I have added my hours to the WBSO document.

Fixes #

@thijsoo thijsoo added the changelog: non-user-facing Needs to be included in the 'Non-userfacing' category in the changelog label Dec 9, 2024
@private-packagist
Copy link
Copy Markdown

private-packagist Bot commented Dec 9, 2024

composer.lock

Dev Package changes

Package Operation From To About
symfony/polyfill-php81 add - v1.33.0 view code - License: MIT License
psr/container upgrade 1.0.0 1.1.1 diff
symfony/config upgrade v3.4.32 v5.4.46 diff
symfony/dependency-injection upgrade v3.4.47 v5.4.48 diff
symfony/deprecation-contracts upgrade v2.5.2 v2.5.4 diff
symfony/filesystem upgrade v3.4.47 v4.4.42 diff
symfony/polyfill-ctype upgrade v1.31.0 v1.33.0 diff
symfony/polyfill-mbstring upgrade v1.27.0 v1.33.0 diff
symfony/polyfill-php80 upgrade v1.31.0 v1.33.0 diff
symfony/service-contracts upgrade v2.2.0 v2.5.4 diff

Settings · Docs · Powered by Private Packagist

@coveralls
Copy link
Copy Markdown

coveralls commented Dec 9, 2024

Pull Request Test Coverage Report for Build 67755dd3a5a859cd5f83bf0af71fd093a94d0c6b

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.5%) to 52.947%

Totals Coverage Status
Change from base Build c6d263007d8ea06ac20b6f2f6aecf543f699ab5c: -0.5%
Covered Lines: 31678
Relevant Lines: 59960

💛 - Coveralls

@thijsoo thijsoo force-pushed the feature/update-di-container branch from a6de0f5 to a67113f Compare December 10, 2024 10:17
@thijsoo thijsoo marked this pull request as ready for review December 10, 2024 10:18
@github-actions
Copy link
Copy Markdown

A merge conflict has been detected for the proposed code changes in this PR. Please resolve the conflict by either rebasing the PR or merging in changes from the base branch.

…pdate-di-container

# Conflicts:
#	composer.lock
@private-packagist
Copy link
Copy Markdown

The composer.lock diff comment has been updated to reflect new changes in this PR.

@github-actions
Copy link
Copy Markdown

A merge conflict has been detected for the proposed code changes in this PR. Please resolve the conflict by either rebasing the PR or merging in changes from the base branch.

…pdate-di-container

# Conflicts:
#	composer.json
#	composer.lock
@private-packagist
Copy link
Copy Markdown

The composer.lock diff comment has been updated to reflect new changes in this PR.

@private-packagist
Copy link
Copy Markdown

The composer.lock diff comment has been updated to reflect new changes in this PR.

Comment thread composer.json Outdated
@archon810
Copy link
Copy Markdown

archon810 commented Oct 22, 2025

Any chance this will see a release soon @josevarghese? Thank you.

@thijsoo thijsoo changed the title Feature/update di container Updates the PHP dependency injection packages to 5.4 Oct 29, 2025
@private-packagist
Copy link
Copy Markdown

The composer.lock diff comment has been updated to reflect new changes in this PR.

Copy link
Copy Markdown
Contributor

@jrfnl jrfnl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Walked through it together and looks good to me.

We discussed that it would be a good idea as a follow-up to document properly somewhere the how & why of the dependency injection layer, which should make future updates more straight-forward to make.

Other than that, I've verified that if I run the tests locally now on PHP 8.4/8.5, the test runs no longer bork out, but finish (though with deprecation notices, but that is as expected and will be fixed in the near future).

@thijsoo thijsoo added this to the 26.5 milestone Nov 10, 2025
@thijsoo thijsoo merged commit 8bca6c8 into trunk Nov 10, 2025
48 checks passed
@thijsoo thijsoo deleted the feature/update-di-container branch November 10, 2025 09:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog: non-user-facing Needs to be included in the 'Non-userfacing' category in the changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants