Skip to content

Commit 25e8343

Browse files
Remove all 6.x deprecations on 7.0
1 parent 1cf1f28 commit 25e8343

File tree

14 files changed

+28
-251
lines changed

14 files changed

+28
-251
lines changed

.doctor-rst.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,10 @@ rules:
7272
min_version: '6.0'
7373

7474
deprecated_directive_major_version:
75-
major_version: 6
75+
major_version: 7
7676

7777
deprecated_directive_min_version:
78-
min_version: '6.0'
78+
min_version: '7.0'
7979

8080
exclude_rule_for_file:
8181
- path: configuration/multiple_kernels.rst

components/console/events.rst

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -255,16 +255,6 @@ handle all signals e.g. to do some tasks before terminating the command.
255255
The :class:`Symfony\\Component\\Console\\SignalRegistry\\SignalMap` class was
256256
introduced in Symfony 6.4.
257257

258-
.. deprecated:: 6.3
259-
260-
In Symfony versions previous to 6.3, all signals (except ``SIGUSR1`` and
261-
``SIGUSR2``) would terminate the script by calling ``exit(0)``. Starting
262-
from Symfony 6.3, no more signal is automatically calling ``exit(0)``.
263-
264-
.. deprecated:: 6.3
265-
266-
Not returning a value in ``handleSignal()`` is deprecated since Symfony 6.3.
267-
268258
.. _`reserved exit codes`: https://www.tldp.org/LDP/abs/html/exitcodes.html
269259
.. _`Signals`: https://en.wikipedia.org/wiki/Signal_(IPC)
270260
.. _`constants of the PCNTL PHP extension`: https://www.php.net/manual/en/pcntl.constants.php

components/http_foundation.rst

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -152,13 +152,10 @@ has some methods to filter the input values:
152152

153153
:method:`Symfony\\Component\\HttpFoundation\\ParameterBag::filter`
154154
Filters the parameter by using the PHP :phpfunction:`filter_var` function.
155-
156-
.. deprecated:: 6.3
157-
158-
Ignoring invalid values when using ``filter()`` is deprecated and will throw
159-
a :class:`Symfony\\Component\\HttpKernel\\Exception\\BadRequestHttpException`
160-
in Symfony 7.0. You can use the ``FILTER_NULL_ON_FAILURE`` flag to keep
161-
ignoring them.
155+
If invalid values are found, a
156+
:class:`Symfony\\Component\\HttpKernel\\Exception\\BadRequestHttpException`
157+
is thrown. The ``FILTER_NULL_ON_FAILURE`` flag can be used to ignore invalid
158+
values.
162159

163160
All getters take up to two arguments: the first one is the parameter name
164161
and the second one is the default value to return if the parameter does not

components/validator/resources.rst

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,6 @@ If you use annotations instead of attributes, it's also required to call
114114
->addDefaultDoctrineAnnotationReader() // add this only when using annotations
115115
->getValidator();
116116

117-
.. deprecated:: 6.4
118-
119-
Annotations are deprecated since Symfony 6.4, use attributes instead.
120-
121117
To disable the annotation loader after it was enabled, call
122118
:method:`Symfony\\Component\\Validator\\ValidatorBuilder::disableAnnotationMapping`.
123119

console.rst

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -171,12 +171,6 @@ You can optionally define a description, help message and the
171171
``setDescription()`` method instead of the attribute to define the command
172172
description.
173173

174-
.. deprecated:: 6.1
175-
176-
The static property ``$defaultDescription`` was deprecated in Symfony 6.1.
177-
Instead, use the ``#[AsCommand]`` attribute to define the optional command
178-
description.
179-
180174
The ``configure()`` method is called automatically at the end of the command
181175
constructor. If your command defines its own constructor, set the properties
182176
first and then call to the parent constructor, to make those properties
@@ -238,11 +232,6 @@ If you can't use PHP attributes, register the command as a service and
238232
:ref:`default services.yaml configuration <service-container-services-load-example>`,
239233
this is already done for you, thanks to :ref:`autoconfiguration <services-autoconfigure>`.
240234

241-
.. deprecated:: 6.1
242-
243-
The static property ``$defaultName`` was deprecated in Symfony 6.1.
244-
Define your command name with the ``#[AsCommand]`` attribute instead.
245-
246235
Running the Command
247236
~~~~~~~~~~~~~~~~~~~
248237

contributing/documentation/format.rst

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -216,39 +216,39 @@ If you are documenting a brand new feature, a change or a deprecation that's
216216
been made in Symfony, you should precede your description of the change with
217217
the corresponding directive and a short description:
218218

219-
For a new feature or a behavior change use the ``.. versionadded:: 6.x``
219+
For a new feature or a behavior change use the ``.. versionadded:: 7.x``
220220
directive:
221221

222222
.. code-block:: rst
223223
224-
.. versionadded:: 6.2
224+
.. versionadded:: 7.2
225225
226-
... ... ... was introduced in Symfony 6.2.
226+
... ... ... was introduced in Symfony 7.2.
227227
228228
If you are documenting a behavior change, it may be helpful to *briefly*
229229
describe how the behavior has changed:
230230

231231
.. code-block:: rst
232232
233-
.. versionadded:: 6.2
233+
.. versionadded:: 7.2
234234
235-
... ... ... was introduced in Symfony 6.2. Prior to this,
235+
... ... ... was introduced in Symfony 7.2. Prior to this,
236236
... ... ... ... ... ... ... ... .
237237
238-
For a deprecation use the ``.. deprecated:: 6.x`` directive:
238+
For a deprecation use the ``.. deprecated:: 7.x`` directive:
239239

240240
.. code-block:: rst
241241
242-
.. deprecated:: 6.2
242+
.. deprecated:: 7.2
243243
244-
... ... ... was deprecated in Symfony 6.2.
244+
... ... ... was deprecated in Symfony 7.2.
245245
246-
Whenever a new major version of Symfony is released (e.g. 6.0, 7.0, etc), a new
246+
Whenever a new major version of Symfony is released (e.g. 7.0, 8.0, etc), a new
247247
branch of the documentation is created from the ``x.4`` branch of the previous
248248
major version. At this point, all the ``versionadded`` and ``deprecated`` tags
249249
for Symfony versions that have a lower major version will be removed. For
250-
example, if Symfony 6.0 were released today, 5.0 to 5.4 ``versionadded`` and
251-
``deprecated`` tags would be removed from the new ``6.0`` branch.
250+
example, if Symfony 7.0 were released today, 6.0 to 6.4 ``versionadded`` and
251+
``deprecated`` tags would be removed from the new ``7.0`` branch.
252252

253253
.. _reStructuredText: https://docutils.sourceforge.io/rst.html
254254
.. _Sphinx: https://www.sphinx-doc.org/

doctrine/events.rst

Lines changed: 6 additions & 159 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ There are different ways to listen to these Doctrine events:
1515

1616
* **Lifecycle callbacks**, they are defined as public methods on the entity classes and
1717
they are called when the events are triggered;
18-
* **Lifecycle listeners and subscribers**, they are classes with callback
18+
* **Lifecycle listeners**, they are classes with callback
1919
methods for one or more events and they are called for all entities;
2020
* **Entity listeners**, they are similar to lifecycle listeners, but they are
2121
called only for the entities of a certain class.
@@ -25,7 +25,7 @@ These are the **drawbacks and advantages** of each one:
2525
* Callbacks have better performance because they only apply to a single entity
2626
class, but you can't reuse the logic for different entities and they don't
2727
have access to :doc:`Symfony services </service_container>`;
28-
* Lifecycle listeners and subscribers can reuse logic among different entities
28+
* Lifecycle listeners can reuse logic among different entities
2929
and can access Symfony services but their performance is worse because they
3030
are called for all entities;
3131
* Entity listeners have the same advantages of lifecycle listeners and they have
@@ -37,7 +37,7 @@ to learn everything about them.
3737

3838
.. seealso::
3939

40-
This article covers listeners and subscribers for Doctrine ORM. If you are
40+
This article covers listeners for Doctrine ORM. If you are
4141
using ODM for MongoDB, read the `DoctrineMongoDBBundle documentation`_.
4242

4343
Doctrine Lifecycle Callbacks
@@ -110,11 +110,6 @@ define a callback for the ``prePersist`` Doctrine event:
110110
Doctrine Lifecycle Listeners
111111
----------------------------
112112

113-
.. deprecated:: 6.3
114-
115-
Lifecycle subscribers are deprecated starting from Symfony 6.3 and will be
116-
removed in Symfony 7.0. Use lifecycle listeners instead.
117-
118113
Lifecycle listeners are defined as PHP classes that listen to a single Doctrine
119114
event on all the application entities. For example, suppose that you want to
120115
update some search index whenever a new entity is persisted in the database. To
@@ -201,7 +196,7 @@ listener in the Symfony application by creating a new service for it and
201196
# this is the only required option for the lifecycle listener tag
202197
event: 'postPersist'
203198
204-
# listeners can define their priority in case multiple subscribers or listeners are associated
199+
# listeners can define their priority in case listeners are associated
205200
# to the same event (default priority = 0; higher numbers = listener is run earlier)
206201
priority: 500
207202
@@ -219,7 +214,7 @@ listener in the Symfony application by creating a new service for it and
219214
220215
<!--
221216
* 'event' is the only required option that defines the lifecycle listener
222-
* 'priority': used when multiple subscribers or listeners are associated to the same event
217+
* 'priority': used when multiple listeners are associated to the same event
223218
* (default priority = 0; higher numbers = listener is run earlier)
224219
* 'connection': restricts the listener to a specific Doctrine connection
225220
-->
@@ -248,7 +243,7 @@ listener in the Symfony application by creating a new service for it and
248243
// this is the only required option for the lifecycle listener tag
249244
'event' => 'postPersist',
250245
251-
// listeners can define their priority in case multiple subscribers or listeners are associated
246+
// listeners can define their priority in case multiple listeners are associated
252247
// to the same event (default priority = 0; higher numbers = listener is run earlier)
253248
'priority' => 500,
254249
@@ -262,12 +257,6 @@ listener in the Symfony application by creating a new service for it and
262257

263258
The `AsDoctrineListener`_ attribute was introduced in DoctrineBundle 2.7.2.
264259

265-
.. tip::
266-
267-
Symfony loads (and instantiates) Doctrine listeners only when the related
268-
Doctrine event is actually fired; whereas Doctrine subscribers are always
269-
loaded (and instantiated) by Symfony, making them less performant.
270-
271260
.. tip::
272261

273262
The value of the ``connection`` option can also be a
@@ -414,148 +403,6 @@ with the ``doctrine.orm.entity_listener`` tag as follows:
414403
;
415404
};
416405
417-
Doctrine Lifecycle Subscribers
418-
------------------------------
419-
420-
Lifecycle subscribers are defined as PHP classes that implement the
421-
``Doctrine\Common\EventSubscriber`` interface and which listen to one or more
422-
Doctrine events on all the application entities. For example, suppose that you
423-
want to log all the database activity. To do so, define a subscriber for the
424-
``postPersist``, ``postRemove`` and ``postUpdate`` Doctrine events::
425-
426-
// src/EventListener/DatabaseActivitySubscriber.php
427-
namespace App\EventListener;
428-
429-
use App\Entity\Product;
430-
use Doctrine\Bundle\DoctrineBundle\EventSubscriber\EventSubscriberInterface;
431-
use Doctrine\ORM\Event\PostPersistEventArgs;
432-
use Doctrine\ORM\Event\PostRemoveEventArgs;
433-
use Doctrine\ORM\Event\PostUpdateEventArgs;
434-
use Doctrine\ORM\Events;
435-
436-
class DatabaseActivitySubscriber implements EventSubscriberInterface
437-
{
438-
// this method can only return the event names; you cannot define a
439-
// custom method name to execute when each event triggers
440-
public function getSubscribedEvents(): array
441-
{
442-
return [
443-
Events::postPersist,
444-
Events::postRemove,
445-
Events::postUpdate,
446-
];
447-
}
448-
449-
// callback methods must be called exactly like the events they listen to;
450-
// they receive an argument of type Post*EventArgs, which gives you access
451-
// to both the entity object of the event and the entity manager itself
452-
public function postPersist(PostPersistEventArgs $args): void
453-
{
454-
$this->logActivity('persist', $args->getObject());
455-
}
456-
457-
public function postRemove(PostRemoveEventArgs $args): void
458-
{
459-
$this->logActivity('remove', $args->getObject());
460-
}
461-
462-
public function postUpdate(PostUpdateEventArgs $args): void
463-
{
464-
$this->logActivity('update', $args->getObject());
465-
}
466-
467-
private function logActivity(string $action, mixed $entity): void
468-
{
469-
// if this subscriber only applies to certain entity types,
470-
// add some code to check the entity type as early as possible
471-
if (!$entity instanceof Product) {
472-
return;
473-
}
474-
475-
// ... get the entity information and log it somehow
476-
}
477-
}
478-
479-
.. note::
480-
481-
In previous Doctrine versions, instead of ``Post*EventArgs`` classes, you had
482-
to use ``LifecycleEventArgs``, which was deprecated in Doctrine ORM 2.14.
483-
484-
If you're using the :ref:`default services.yaml configuration <service-container-services-load-example>`
485-
and DoctrineBundle 2.1 (released May 25, 2020) or newer, this example will already
486-
work! Otherwise, :ref:`create a service <service-container-creating-service>` for this
487-
subscriber and :doc:`tag it </service_container/tags>` with ``doctrine.event_subscriber``.
488-
489-
If you need to configure some option of the subscriber (e.g. its priority or
490-
Doctrine connection to use) you must do that in the manual service configuration:
491-
492-
.. configuration-block::
493-
494-
.. code-block:: yaml
495-
496-
# config/services.yaml
497-
services:
498-
# ...
499-
500-
App\EventListener\DatabaseActivitySubscriber:
501-
tags:
502-
- name: 'doctrine.event_subscriber'
503-
504-
# subscribers can define their priority in case multiple subscribers or listeners are associated
505-
# to the same event (default priority = 0; higher numbers = listener is run earlier)
506-
priority: 500
507-
508-
# you can also restrict listeners to a specific Doctrine connection
509-
connection: 'default'
510-
511-
.. code-block:: xml
512-
513-
<!-- config/services.xml -->
514-
<?xml version="1.0" encoding="UTF-8" ?>
515-
<container xmlns="http://symfony.com/schema/dic/services"
516-
xmlns:doctrine="http://symfony.com/schema/dic/doctrine">
517-
<services>
518-
<!-- ... -->
519-
520-
<!--
521-
* 'priority': used when multiple subscribers or listeners are associated to the same event
522-
* (default priority = 0; higher numbers = listener is run earlier)
523-
* 'connection': restricts the listener to a specific Doctrine connection
524-
-->
525-
<service id="App\EventListener\DatabaseActivitySubscriber">
526-
<tag name="doctrine.event_subscriber" priority="500" connection="default"/>
527-
</service>
528-
</services>
529-
</container>
530-
531-
.. code-block:: php
532-
533-
// config/services.php
534-
namespace Symfony\Component\DependencyInjection\Loader\Configurator;
535-
536-
use App\EventListener\DatabaseActivitySubscriber;
537-
538-
return static function (ContainerConfigurator $container): void {
539-
$services = $container->services();
540-
541-
$services->set(DatabaseActivitySubscriber::class)
542-
->tag('doctrine.event_subscriber'[
543-
// subscribers can define their priority in case multiple subscribers or listeners are associated
544-
// to the same event (default priority = 0; higher numbers = listener is run earlier)
545-
'priority' => 500,
546-
547-
// you can also restrict listeners to a specific Doctrine connection
548-
'connection' => 'default',
549-
])
550-
;
551-
};
552-
553-
.. tip::
554-
555-
Symfony loads (and instantiates) Doctrine subscribers whenever the
556-
application executes; whereas Doctrine listeners are only loaded when the
557-
related event is actually fired, making them more performant.
558-
559406
.. _`Doctrine`: https://www.doctrine-project.org/
560407
.. _`lifecycle events`: https://www.doctrine-project.org/projects/doctrine-orm/en/current/reference/events.html#lifecycle-events
561408
.. _`official docs about Doctrine events`: https://www.doctrine-project.org/projects/doctrine-orm/en/current/reference/events.html

mailer.rst

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -581,12 +581,6 @@ Alternatively you can attach contents from a stream by passing it directly to th
581581
->addPart(new DataPart(fopen('/path/to/documents/contract.doc', 'r')))
582582
;
583583

584-
.. deprecated:: 6.2
585-
586-
In Symfony versions previous to 6.2, the methods ``attachFromPath()`` and
587-
``attach()`` could be used to add attachments. These methods have been
588-
deprecated and replaced with ``addPart()``.
589-
590584
Embedding Images
591585
~~~~~~~~~~~~~~~~
592586

@@ -628,12 +622,6 @@ images inside the HTML contents::
628622

629623
The support of embedded images as HTML backgrounds was introduced in Symfony 6.1.
630624

631-
.. deprecated:: 6.2
632-
633-
In Symfony versions previous to 6.2, the methods ``embedFromPath()`` and
634-
``embed()`` could be used to embed images. These methods have been deprecated
635-
and replaced with ``addPart()`` together with inline ``DataPart`` objects.
636-
637625
.. _mailer-configure-email-globally:
638626

639627
Configuring Emails Globally
@@ -1561,7 +1549,7 @@ Here's an example of making one available to download::
15611549
{
15621550
$message = (new DraftEmail())
15631551
->html($this->renderView(/* ... */))
1564-
->attach(/* ... */)
1552+
->addPart(/* ... */)
15651553
;
15661554

15671555
$response = new Response($message->toString());

0 commit comments

Comments
 (0)