Skip to content

chore: document major upgrade with latest versions #19601

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 14 additions & 16 deletions setup/upgrade_major.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Upgrading a Major Version (e.g. 5.4.0 to 6.0.0)
Upgrading a Major Version (e.g. 6.4.0 to 7.0.0)
===============================================

Every two years, Symfony releases a new major version release (the first number
Expand Down Expand Up @@ -27,10 +27,10 @@ backwards incompatible changes. To accomplish this, the "old" (e.g. functions,
classes, etc) code still works, but is marked as *deprecated*, indicating that
it will be removed/changed in the future and that you should stop using it.

When the major version is released (e.g. 6.0.0), all deprecated features and
When the major version is released (e.g. 7.0.0), all deprecated features and
functionality are removed. So, as long as you've updated your code to stop
using these deprecated features in the last version before the major (e.g.
``5.4.*``), you should be able to upgrade without a problem. That means that
``6.4.*``), you should be able to upgrade without a problem. That means that
you should first :doc:`upgrade to the last minor version </setup/upgrade_minor>`
(e.g. 5.4) so that you can see *all* the deprecations.

Expand Down Expand Up @@ -107,7 +107,7 @@ done!
.. sidebar:: Using the Weak Deprecations Mode

Sometimes, you can't fix all deprecations (e.g. something was deprecated
in 5.4 and you still need to support 5.3). In these cases, you can still
in 6.4 and you still need to support 6.3). In these cases, you can still
use the bridge to fix as many deprecations as possible and then allow
more of them to make your tests pass again. You can do this by using the
``SYMFONY_DEPRECATIONS_HELPER`` env variable:
Expand Down Expand Up @@ -144,35 +144,33 @@ starting with ``symfony/`` to the new major version:
"...": "...",

"require": {
- "symfony/cache": "5.4.*",
+ "symfony/cache": "6.0.*",
- "symfony/config": "5.4.*",
+ "symfony/config": "6.0.*",
- "symfony/console": "5.4.*",
+ "symfony/console": "6.0.*",
- "symfony/config": "6.4.*",
+ "symfony/config": "7.0.*",
- "symfony/console": "6.4.*",
+ "symfony/console": "7.0.*",
"...": "...",

"...": "A few libraries starting with symfony/ follow their own
versioning scheme (e.g. symfony/polyfill-[...],
symfony/ux-[...], symfony/[...]-bundle).
You do not need to update these versions: you can
upgrade them independently whenever you want",
"symfony/monolog-bundle": "^3.5",
"symfony/monolog-bundle": "^3.10",
},
"...": "...",
}

At the bottom of your ``composer.json`` file, in the ``extra`` block you can
find a data setting for the Symfony version. Make sure to also upgrade
this one. For instance, update it to ``6.0.*`` to upgrade to Symfony 6.0:
this one. For instance, update it to ``7.0.*`` to upgrade to Symfony 7.0:

.. code-block:: diff

"extra": {
"symfony": {
"allow-contrib": false,
- "require": "5.4.*"
+ "require": "6.0.*"
- "require": "6.4.*"
+ "require": "7.0.*"
}
}

Expand Down Expand Up @@ -215,13 +213,13 @@ included in the Symfony repository for any BC break that you need to be aware of
Upgrading to Symfony 6: Add Native Return Types
-----------------------------------------------

Symfony 6 will come with native PHP return types to (almost all) methods.
Symfony 6 and Symfony 6 have come with native PHP return types to (almost all) methods.
Copy link
Member

Choose a reason for hiding this comment

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

I changed this to "Symfony 6 and Symfony 7" while merging.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

typo my bad ^^


In PHP, if the parent has a return type declaration, any class implementing
or overriding the method must have the return type as well. However, you
can add a return type before the parent adds one. This means that it is
important to add the native PHP return types to your classes before
upgrading to Symfony 6.0. Otherwise, you will get incompatible declaration
upgrading to Symfony 6.0 or 7.0. Otherwise, you will get incompatible declaration
errors.

When debug mode is enabled (typically in the dev and test environment),
Expand Down