diff --git a/.doctor-rst.yaml b/.doctor-rst.yaml index f1c54d6cf07..625c5ed4f27 100644 --- a/.doctor-rst.yaml +++ b/.doctor-rst.yaml @@ -69,16 +69,16 @@ rules: # master versionadded_directive_major_version: - major_version: 6 + major_version: 7 versionadded_directive_min_version: - min_version: '6.0' + min_version: '7.0' deprecated_directive_major_version: - major_version: 6 + major_version: 7 deprecated_directive_min_version: - min_version: '6.0' + min_version: '7.0' exclude_rule_for_file: - path: configuration/multiple_kernels.rst diff --git a/_build/redirection_map b/_build/redirection_map index 90303a53d75..3b845d59ffe 100644 --- a/_build/redirection_map +++ b/_build/redirection_map @@ -526,6 +526,7 @@ /components https://symfony.com/components /components/index https://symfony.com/components /serializer/normalizers /components/serializer#normalizers +/components/serializer#component-serializer-attributes-groups-annotations /components/serializer#component-serializer-attributes-groups-attributes /logging/monolog_regex_based_excludes /logging/monolog_exclude_http_codes /security/named_encoders /security/named_hashers /components/inflector /components/string#inflector diff --git a/_includes/_annotation_loader_tip.rst.inc b/_includes/_annotation_loader_tip.rst.inc deleted file mode 100644 index 0f4267b07f5..00000000000 --- a/_includes/_annotation_loader_tip.rst.inc +++ /dev/null @@ -1,19 +0,0 @@ -.. note:: - - In order to use the annotation loader, you should have installed the - ``doctrine/annotations`` and ``doctrine/cache`` packages with Composer. - -.. tip:: - - Annotation classes aren't loaded automatically, so you must load them - using a class loader like this:: - - use Composer\Autoload\ClassLoader; - use Doctrine\Common\Annotations\AnnotationRegistry; - - /** @var ClassLoader $loader */ - $loader = require __DIR__.'/../vendor/autoload.php'; - - AnnotationRegistry::registerLoader([$loader, 'loadClass']); - - return $loader; diff --git a/bundles.rst b/bundles.rst index ed7d57aaf8c..efef039f775 100644 --- a/bundles.rst +++ b/bundles.rst @@ -55,11 +55,6 @@ Start by creating a new class called ``AcmeTestBundle``:: { } -.. versionadded:: 6.1 - - The :class:`Symfony\\Component\\HttpKernel\\Bundle\\AbstractBundle` was - introduced in Symfony 6.1. - .. caution:: If your bundle must be compatible with previous Symfony versions you have to diff --git a/bundles/configuration.rst b/bundles/configuration.rst index 4a2224429ed..a6a21023de6 100644 --- a/bundles/configuration.rst +++ b/bundles/configuration.rst @@ -320,10 +320,6 @@ In your extension, you can load this and dynamically set its arguments:: Using the AbstractBundle Class ------------------------------ -.. versionadded:: 6.1 - - The ``AbstractBundle`` class was introduced in Symfony 6.1. - As an alternative, instead of creating an extension and configuration class as shown in the previous section, you can also extend :class:`Symfony\\Component\\HttpKernel\\Bundle\\AbstractBundle` to add this diff --git a/bundles/extension.rst b/bundles/extension.rst index ff873f2ab14..3c660251403 100644 --- a/bundles/extension.rst +++ b/bundles/extension.rst @@ -111,10 +111,6 @@ To read more about it, see the ":doc:`/bundles/configuration`" article. Loading Services directly in your Bundle class ---------------------------------------------- -.. versionadded:: 6.1 - - The ``AbstractBundle`` class was introduced in Symfony 6.1. - Alternatively, you can define and load services configuration directly in a bundle class instead of creating a specific ``Extension`` class. You can do this by extending from :class:`Symfony\\Component\\HttpKernel\\Bundle\\AbstractBundle` diff --git a/bundles/prepend_extension.rst b/bundles/prepend_extension.rst index fcad249124e..4bd1c7c6a67 100644 --- a/bundles/prepend_extension.rst +++ b/bundles/prepend_extension.rst @@ -154,10 +154,6 @@ registered and the ``entity_manager_name`` setting for ``acme_hello`` is set to Prepending Extension in the Bundle Class ---------------------------------------- -.. versionadded:: 6.1 - - The ``AbstractBundle`` class was introduced in Symfony 6.1. - You can also append or prepend extension configuration directly in your Bundle class if you extend from the :class:`Symfony\\Component\\HttpKernel\\Bundle\\AbstractBundle` class and define the :method:`Symfony\\Component\\HttpKernel\\Bundle\\AbstractBundle::prependExtension` @@ -190,6 +186,34 @@ method:: The ``prependExtension()`` method, like ``prepend()``, is called only at compile time. +Alternatively, you can use the ``prepend`` parameter of the +:method:`Symfony\\Component\\DependencyInjection\\Loader\\ContainerConfigurator::extension` +method:: + + use Symfony\Component\DependencyInjection\ContainerBuilder; + use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; + use Symfony\Component\HttpKernel\Bundle\AbstractBundle; + + class FooBundle extends AbstractBundle + { + public function prependExtension(ContainerConfigurator $containerConfigurator, ContainerBuilder $containerBuilder): void + { + // ... + + $containerConfigurator->extension('framework', [ + 'cache' => ['prefix_seed' => 'foo/bar'], + ], prepend: true); + + // ... + } + } + +.. versionadded:: 7.1 + + The ``prepend`` parameter of the + :method:`Symfony\\Component\\DependencyInjection\\Loader\\ContainerConfigurator::extension` + method was added in Symfony 7.1. + More than one Bundle using PrependExtensionInterface ---------------------------------------------------- diff --git a/cache.rst b/cache.rst index eea4947e630..98ec11123fc 100644 --- a/cache.rst +++ b/cache.rst @@ -745,20 +745,12 @@ Clear all cache pools: $ php bin/console cache:pool:clear --all -.. versionadded:: 6.3 - - The ``--all`` option was introduced in Symfony 6.3. - Clear all cache pools except some: .. code-block:: terminal $ php bin/console cache:pool:clear --all --exclude=my_cache_pool --exclude=another_cache_pool -.. versionadded:: 6.4 - - The ``--exclude`` option was introduced in Symfony 6.4. - Clear all caches everywhere: .. code-block:: terminal @@ -767,10 +759,6 @@ Clear all caches everywhere: Clear cache by tag(s): -.. versionadded:: 6.1 - - The ``cache:pool:invalidate-tags`` command was introduced in Symfony 6.1. - .. code-block:: terminal # invalidate tag1 from all taggable pools diff --git a/components/browser_kit.rst b/components/browser_kit.rst index c744837d7b1..bcb8f7b3c8e 100644 --- a/components/browser_kit.rst +++ b/components/browser_kit.rst @@ -130,10 +130,6 @@ on a link:: // ... and `clickLink()` $crawler = $client->clickLink('Go elsewhere...', ['X-Custom-Header' => 'Some data']); -.. versionadded:: 6.4 - - The ``serverParameters`` parameter was introduced in Symfony 6.4. - Submitting Forms ~~~~~~~~~~~~~~~~ @@ -403,10 +399,6 @@ to call ``json_decode()`` explicitly:: $response = $browser->getResponse()->toArray(); // $response is a PHP array of the decoded JSON contents -.. versionadded:: 6.1 - - The ``toArray()`` method was introduced in Symfony 6.1. - Learn more ---------- diff --git a/components/cache/adapters/couchbasebucket_adapter.rst b/components/cache/adapters/couchbasebucket_adapter.rst index c279e1f8780..8927a8c53f8 100644 --- a/components/cache/adapters/couchbasebucket_adapter.rst +++ b/components/cache/adapters/couchbasebucket_adapter.rst @@ -1,6 +1,12 @@ Couchbase Bucket Cache Adapter ============================== +.. deprecated:: 7.1 + + The ``CouchbaseBucketAdapter`` is deprecated since Symfony 7.1, use the + :doc:`CouchbaseCollectionAdapter ` + instead. + This adapter stores the values in-memory using one (or more) `Couchbase server`_ instances. Unlike the :doc:`APCu adapter `, and similarly to the :doc:`Memcached adapter `, it is not limited to the current server's diff --git a/components/cache/adapters/doctrine_dbal_adapter.rst b/components/cache/adapters/doctrine_dbal_adapter.rst index fc04410bffc..68732ddd3fa 100644 --- a/components/cache/adapters/doctrine_dbal_adapter.rst +++ b/components/cache/adapters/doctrine_dbal_adapter.rst @@ -39,5 +39,22 @@ optional arguments:: necessary to detect the database engine and version without opening the connection. +The adapter uses SQL syntax that is optimized for database server that it is connected to. +The following database servers are known to be compatible: + +* MySQL 5.7 and newer +* MariaDB 10.2 and newer +* Oracle 10g and newer +* SQL Server 2012 and newer +* SQLite 3.24 or later +* PostgreSQL 9.5 or later + +.. note:: + + Newer releases of Doctrine DBAL might increase these minimal versions. Check + the manual page on `Doctrine DBAL Platforms`_ if your database server is + compatible with the installed Doctrine DBAL version. + .. _`Doctrine DBAL Connection`: https://github.com/doctrine/dbal/blob/master/src/Connection.php -.. _`Doctrine DBAL URL`: https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url +.. _`Doctrine DBAL URL`: https://www.doctrine-project.org/projects/doctrine-dbal/en/current/reference/configuration.html#connecting-using-a-url +.. _`Doctrine DBAL Platforms`: https://www.doctrine-project.org/projects/doctrine-dbal/en/current/reference/platforms.html diff --git a/components/cache/adapters/redis_adapter.rst b/components/cache/adapters/redis_adapter.rst index 02523dd283e..1550d419081 100644 --- a/components/cache/adapters/redis_adapter.rst +++ b/components/cache/adapters/redis_adapter.rst @@ -41,10 +41,6 @@ as the second and third parameters:: $defaultLifetime = 0 ); -.. versionadded:: 6.3 - - Support for `Relay`_ was introduced in Symfony 6.3. - Configure the Connection ------------------------ @@ -163,10 +159,6 @@ array of ``key => value`` pairs representing option names and their respective v Available Options ~~~~~~~~~~~~~~~~~ -.. versionadded:: 6.3 - - ``\Relay\Relay`` support was introduced in Symfony 6.3. - ``class`` (type: ``string``, default: ``null``) Specifies the connection library to return, either ``\Redis``, ``\Relay\Relay`` or ``\Predis\Client``. If none is specified, fallback value is in following order, depending which one is available first: @@ -208,6 +200,9 @@ Available Options ``redis_sentinel`` (type: ``string``, default: ``null``) Specifies the master name connected to the sentinels. +``sentinel_master`` (type: ``string``, default: ``null``) + Alias of ``redis_sentinel`` option. + ``dbindex`` (type: ``int``, default: ``0``) Specifies the database index to select. @@ -219,6 +214,11 @@ Available Options ``ssl`` (type: ``array``, default: ``null``) SSL context options. See `php.net/context.ssl`_ for more information. +.. versionadded:: 7.1 + + The option `sentinel_master` as an alias for `redis_sentinel` was introduced + in Symfony 7.1. + .. note:: When using the `Predis`_ library some additional Predis-specific options are available. diff --git a/components/clock.rst b/components/clock.rst index f58124c70af..b803c78e29d 100644 --- a/components/clock.rst +++ b/components/clock.rst @@ -1,10 +1,6 @@ The Clock Component =================== -.. versionadded:: 6.2 - - The Clock component was introduced in Symfony 6.2 - The Clock component decouples applications from the system clock. This allows you to fix time to improve testability of time-sensitive logic. @@ -79,16 +75,6 @@ When using the Clock component, you manipulate :class:`Symfony\\Component\\Clock\\DatePoint` instances. You can learn more about it in :ref:`the dedicated section `. -.. versionadded:: 6.3 - - The :class:`Symfony\\Component\\Clock\\Clock` class and ``now()`` function - were introduced in Symfony 6.3. - -.. versionadded:: 6.4 - - The ``modifier`` argument of the ``now()`` function was introduced in - Symfony 6.4. - Available Clocks Implementations -------------------------------- @@ -208,10 +194,6 @@ you can set the current time arbitrarily without having to change your service c This will help you test every case of your method without the need of actually being in a month or another. -.. versionadded:: 6.3 - - The :class:`Symfony\\Component\\Clock\\ClockAwareTrait` was introduced in Symfony 6.3. - .. _clock_date-point: The ``DatePoint`` Class @@ -253,11 +235,6 @@ The constructor also allows setting a timezone or custom referenced date:: error handling across versions of PHP, thanks to polyfilling `PHP 8.3's behavior`_ on the topic. -.. versionadded:: 6.4 - - The :class:`Symfony\\Component\\Clock\\DatePoint` class was introduced - in Symfony 6.4. - .. _clock_writing-tests: Writing Time-Sensitive Tests @@ -314,10 +291,6 @@ By combining the :class:`Symfony\\Component\\Clock\\ClockAwareTrait` and :class:`Symfony\\Component\\Clock\\Test\\ClockSensitiveTrait`, you have full control on your time-sensitive code's behavior. -.. versionadded:: 6.3 - - The :class:`Symfony\\Component\\Clock\\Test\\ClockSensitiveTrait` was introduced in Symfony 6.3. - Exceptions Management --------------------- @@ -338,11 +311,6 @@ These exceptions are available starting from PHP 8.3. However, thanks to the `symfony/polyfill-php83`_ dependency required by the Clock component, you can use them even if your project doesn't use PHP 8.3 yet. -.. versionadded:: 6.4 - - The support for ``DateMalformedStringException`` and - ``DateInvalidTimeZoneException`` was introduced in Symfony 6.4. - .. _`PSR-20`: https://www.php-fig.org/psr/psr-20/ .. _`accepted by the DateTime constructor`: https://www.php.net/manual/en/datetime.formats.php .. _`PHP DateTime exceptions`: https://wiki.php.net/rfc/datetime-exceptions diff --git a/components/config/definition.rst b/components/config/definition.rst index 9c90304c578..63ebcd7cc72 100644 --- a/components/config/definition.rst +++ b/components/config/definition.rst @@ -171,11 +171,6 @@ The configuration can now be written like this:: ->end() ; -.. versionadded:: 6.3 - - The support of enum values in ``enumNode()`` was introduced - in Symfony 6.3. - Array Nodes ~~~~~~~~~~~ diff --git a/components/console/events.rst b/components/console/events.rst index af1bc86a588..f0edf2205ac 100644 --- a/components/console/events.rst +++ b/components/console/events.rst @@ -156,11 +156,6 @@ Listeners receive a a signal. You can learn more about signals in the :ref:`the dedicated section `. - .. versionadded:: 6.4 - - Dispatching the ``ConsoleEvents::TERMINATE`` event on exit - signal was introduced in Symfony 6.4. - .. _console-events_signal: The ``ConsoleEvents::SIGNAL`` Event @@ -207,11 +202,6 @@ method:: $event->abortExit(); }); -.. versionadded:: 6.3 - - The ``setExitCode()``, ``getExitCode()`` and ``abortExit()`` methods were introduced - in Symfony 6.3. - .. tip:: All the available signals (``SIGINT``, ``SIGQUIT``, etc.) are defined as @@ -263,21 +253,6 @@ handle all signals e.g. to do some tasks before terminating the command. :method:`Symfony\\Component\\Console\\SignalRegistry\\SignalMap::getSignalName` method. - .. versionadded:: 6.4 - - The :class:`Symfony\\Component\\Console\\SignalRegistry\\SignalMap` class was - introduced in Symfony 6.4. - -.. deprecated:: 6.3 - - In Symfony versions previous to 6.3, all signals (except ``SIGUSR1`` and - ``SIGUSR2``) would terminate the script by calling ``exit(0)``. Starting - from Symfony 6.3, no more signal is automatically calling ``exit(0)``. - -.. deprecated:: 6.3 - - Not returning a value in ``handleSignal()`` is deprecated since Symfony 6.3. - .. _`reserved exit codes`: https://www.tldp.org/LDP/abs/html/exitcodes.html .. _`Signals`: https://en.wikipedia.org/wiki/Signal_(IPC) .. _`constants of the PCNTL PHP extension`: https://www.php.net/manual/en/pcntl.constants.php diff --git a/components/console/helpers/formatterhelper.rst b/components/console/helpers/formatterhelper.rst index ae475ac5197..5e4ae0d91fb 100644 --- a/components/console/helpers/formatterhelper.rst +++ b/components/console/helpers/formatterhelper.rst @@ -133,10 +133,6 @@ precision (default ``1``) of the result:: Helper::formatTime(125, 2); // 2 mins, 5 secs Helper::formatTime(172799, 4); // 1 day, 23 hrs, 59 mins, 59 secs -.. versionadded:: 6.4 - - The support for exact times was introduced in Symfony 6.4. - Formatting Memory ----------------- diff --git a/components/console/helpers/progressbar.rst b/components/console/helpers/progressbar.rst index 47288fef1af..4d524a2008e 100644 --- a/components/console/helpers/progressbar.rst +++ b/components/console/helpers/progressbar.rst @@ -69,10 +69,6 @@ that starting point:: // displays the progress bar starting at 25 completed units $progressBar->start(null, 25); -.. versionadded:: 6.2 - - The option to start a progress bar at a certain point was introduced in Symfony 6.2. - .. tip:: If your platform doesn't support ANSI codes, updates to the progress @@ -375,10 +371,6 @@ with the ``setPlaceholderFormatter`` method:: return $progressBar->getMaxSteps() - $progressBar->getProgress(); }); -.. versionadded:: 6.3 - - The ``setPlaceholderFormatter()`` method was introduced in Symfony 6.3. - Custom Messages ~~~~~~~~~~~~~~~ diff --git a/components/console/helpers/table.rst b/components/console/helpers/table.rst index fcc52e0e7a4..6d86cbc6130 100644 --- a/components/console/helpers/table.rst +++ b/components/console/helpers/table.rst @@ -175,10 +175,6 @@ The output of this command will be: | Author: Charles Dickens | +------------------------------+ -.. versionadded:: 6.1 - - Support for vertical rendering was introduced in Symfony 6.1. - The table style can be changed to any built-in styles via :method:`Symfony\\Component\\Console\\Helper\\Table::setStyle`:: diff --git a/components/console/logger.rst b/components/console/logger.rst index 4af0b9a3f2f..c3d5c447a89 100644 --- a/components/console/logger.rst +++ b/components/console/logger.rst @@ -51,7 +51,7 @@ You can rely on the logger to use this dependency inside a command:: $myDependency = new MyDependency($logger); $myDependency->doStuff(); - // ... + return Command::SUCCESS; } } diff --git a/components/css_selector.rst b/components/css_selector.rst index 94561cec9bd..c09f80a3cf4 100644 --- a/components/css_selector.rst +++ b/components/css_selector.rst @@ -94,10 +94,6 @@ Pseudo-classes are partially supported: ``li:first-of-type``) but not with the ``*`` selector). * Supported: ``*:only-of-type``, ``*:scope``. -.. versionadded:: 6.3 - - The support for ``*:scope`` was introduced in Symfony 6.3. - Learn more ---------- diff --git a/components/dependency_injection/compilation.rst b/components/dependency_injection/compilation.rst index 8fe7b0242e5..3787c686982 100644 --- a/components/dependency_injection/compilation.rst +++ b/components/dependency_injection/compilation.rst @@ -278,10 +278,6 @@ The parameter being deprecated must be set before being declared as deprecated. Otherwise a :class:`Symfony\\Component\\DependencyInjection\\Exception\\ParameterNotFoundException` exception will be thrown. -.. versionadded:: 6.3 - - The ``ContainerBuilder::deprecateParameter()`` method was introduced in Symfony 6.3. - .. note:: Just registering an extension with the container is not enough to get diff --git a/components/dom_crawler.rst b/components/dom_crawler.rst index 4440a35f0ea..ac859efac91 100644 --- a/components/dom_crawler.rst +++ b/components/dom_crawler.rst @@ -229,11 +229,6 @@ Access the value of the first node of the current selection:: // but you can get the unchanged text by passing FALSE as argument $text = $crawler->filterXPath('//body/p')->innerText(false); -.. versionadded:: 6.3 - - The removal of whitespace characters by default in ``innerText()`` was - introduced in Symfony 6.3. - Access the attribute value of the first node of the current selection:: $class = $crawler->filterXPath('//body/p')->attr('class'); @@ -245,11 +240,6 @@ Access the attribute value of the first node of the current selection:: $class = $crawler->filterXPath('//body/p')->attr('class', 'my-default-class'); - .. versionadded:: 6.4 - - The possibility to specify a default value to the ``attr()`` method - was introduced in Symfony 6.4. - Extract attribute and/or node values from the list of nodes:: $attributes = $crawler @@ -672,10 +662,6 @@ parser, set its ``useHtml5Parser`` constructor argument to ``true``:: By doing so, the crawler will use the HTML5 parser provided by the `masterminds/html5`_ library to parse the documents. -.. versionadded:: 6.3 - - The ``useHtml5Parser`` argument was introduced in Symfony 6.3. - Learn more ---------- diff --git a/components/expression_language.rst b/components/expression_language.rst index bf7b62f6f81..1feae4bd46b 100644 --- a/components/expression_language.rst +++ b/components/expression_language.rst @@ -92,10 +92,6 @@ can chain multiple coalescing operators. * ``foo[3] ?? 'no'`` * ``foo.baz ?? foo['baz'] ?? 'no'`` -.. versionadded:: 6.2 - - The null-coalescing operator was introduced in Symfony 6.2. - Passing in Variables -------------------- diff --git a/components/finder.rst b/components/finder.rst index 500b8bb5e89..516db7cde4e 100644 --- a/components/finder.rst +++ b/components/finder.rst @@ -337,10 +337,6 @@ using a closure, return ``false`` for the directories which you want to prune. Pruning directories early can improve performance significantly depending on the file/directory hierarchy complexity and the number of excluded directories. -.. versionadded:: 6.4 - - The feature to prune directories was introduced in Symfony 6.4. - Sorting Results --------------- @@ -352,11 +348,6 @@ Sort the results by name, extension, size or type (directories first, then files $finder->sortBySize(); $finder->sortByType(); -.. versionadded:: 6.2 - - The ``sortByCaseInsensitiveName()``, ``sortByExtension()`` and ``sortBySize()`` - methods were introduced in Symfony 6.2. - .. tip:: By default, the ``sortByName()`` method uses the :phpfunction:`strcmp` PHP diff --git a/components/http_foundation.rst b/components/http_foundation.rst index 04a0c2d794d..4e599dfacad 100644 --- a/components/http_foundation.rst +++ b/components/http_foundation.rst @@ -145,20 +145,12 @@ has some methods to filter the input values: :method:`Symfony\\Component\\HttpFoundation\\ParameterBag::getString` Returns the parameter value as a string; -.. versionadded:: 6.3 - - The ``ParameterBag::getEnum()`` and ``ParameterBag::getString()`` methods - were introduced in Symfony 6.3. - :method:`Symfony\\Component\\HttpFoundation\\ParameterBag::filter` Filters the parameter by using the PHP :phpfunction:`filter_var` function. - - .. deprecated:: 6.3 - - Ignoring invalid values when using ``filter()`` is deprecated and will throw - a :class:`Symfony\\Component\\HttpKernel\\Exception\\BadRequestHttpException` - in Symfony 7.0. You can use the ``FILTER_NULL_ON_FAILURE`` flag to keep - ignoring them. + If invalid values are found, a + :class:`Symfony\\Component\\HttpKernel\\Exception\\BadRequestHttpException` + is thrown. The ``FILTER_NULL_ON_FAILURE`` flag can be used to ignore invalid + values. All getters take up to two arguments: the first one is the parameter name and the second one is the default value to return if the parameter does not @@ -223,11 +215,6 @@ wrapping this data:: $data = $request->getPayload(); -.. versionadded:: 6.3 - - The :method:`Symfony\\Component\\HttpFoundation\\Request::getPayload` - method was introduced in Symfony 6.3. - Identifying a Request ~~~~~~~~~~~~~~~~~~~~~ @@ -392,10 +379,6 @@ use the ``isPrivateIp()`` method from the $isPrivate = IpUtils::isPrivateIp($ipv6); // $isPrivate = false -.. versionadded:: 6.3 - - The ``isPrivateIp()`` method was introduced in Symfony 6.3. - Accessing other Data ~~~~~~~~~~~~~~~~~~~~ @@ -495,12 +478,6 @@ your application to see which exceptions are thrown in listeners of the more about it in :ref:`the dedicated section about Kernel events `. -.. versionadded:: 6.4 - - The ``$flush`` parameter of the - :method:`Symfony\\Component\\HttpFoundation\\Response::send` method - was introduced in Symfony 6.4. - Setting Cookies ~~~~~~~~~~~~~~~ @@ -541,11 +518,6 @@ It is possible to define partitioned cookies, also known as `CHIPS`_, by using t // you can also set the partitioned argument to true when using the `create()` factory method $cookie = Cookie::create('name', 'value', partitioned: true); -.. versionadded:: 6.4 - - The :method:`Symfony\\Component\\HttpFoundation\\Cookie::withPartitioned` - method was introduced in Symfony 6.4. - Managing the HTTP Cache ~~~~~~~~~~~~~~~~~~~~~~~ @@ -594,11 +566,6 @@ call:: 'etag' => 'abcdef', ]); -.. versionadded:: 6.1 - - The ``stale_if_error`` and ``stale_while_revalidate`` options were - introduced in Symfony 6.1. - To check if the Response validators (``ETag``, ``Last-Modified``) match a conditional value specified in the client Request, use the :method:`Symfony\\Component\\HttpFoundation\\Response::isNotModified` @@ -661,11 +628,6 @@ represented by a PHP callable instead of a string:: Streaming a JSON Response ~~~~~~~~~~~~~~~~~~~~~~~~~ -.. versionadded:: 6.3 - - The :class:`Symfony\\Component\\HttpFoundation\\StreamedJsonResponse` class was - introduced in Symfony 6.3. - The :class:`Symfony\\Component\\HttpFoundation\\StreamedJsonResponse` allows to stream large JSON responses using PHP generators to keep the used resources low. @@ -678,9 +640,9 @@ containing JSON serializable data:: // any method or function returning a PHP Generator function loadArticles(): \Generator { - yield ['title' => 'Article 1']; - yield ['title' => 'Article 2']; - yield ['title' => 'Article 3']; + yield ['title' => 'Article 1']; + yield ['title' => 'Article 2']; + yield ['title' => 'Article 3']; }; $response = new StreamedJsonResponse( @@ -755,10 +717,6 @@ including generators:: return new StreamedJsonResponse(loadArticles()); } -.. versionadded:: 6.4 - - The ``StreamedJsonResponse`` support of iterables was introduced in Symfony 6.4. - .. _component-http-foundation-serving-files: Serving Files diff --git a/components/http_kernel.rst b/components/http_kernel.rst index 4a945e5f00c..fbc59a85a50 100644 --- a/components/http_kernel.rst +++ b/components/http_kernel.rst @@ -260,18 +260,6 @@ on the request's information. b) A new instance of your controller class is instantiated with no constructor arguments. - c) If the controller implements :class:`Symfony\\Component\\DependencyInjection\\ContainerAwareInterface`, - ``setContainer()`` is called on the controller object and the container - is passed to it. This step is also specific to the :class:`Symfony\\Bundle\\FrameworkBundle\\Controller\\ControllerResolver` - sub-class used by the Symfony Framework. - -.. deprecated:: 6.4 - - :class:`Symfony\\Component\\DependencyInjection\\ContainerAwareInterface` and - :class:`Symfony\\Component\\DependencyInjection\\ContainerAwareTrait` are - deprecated since Symfony 6.4. Dependency injection should be used instead to - access the service container. - .. _component-http-kernel-kernel-controller: 3) The ``kernel.controller`` Event @@ -292,10 +280,6 @@ Another typical use-case for this event is to retrieve the attributes from the controller using the :method:`Symfony\\Component\\HttpKernel\\Event\\ControllerEvent::getAttributes` method. See the Symfony section below for some examples. -.. versionadded:: 6.2 - - The ``ControllerEvent::getAttributes()`` method was introduced in Symfony 6.2. - Listeners to this event can also change the controller callable completely by calling :method:`ControllerEvent::setController ` on the event object that's passed to listeners on this event. @@ -355,13 +339,6 @@ of arguments that should be passed when executing that callable. ``ValueResolverInterface`` yourself and passing this to the ``ArgumentResolver``, you can extend this functionality. - .. versionadded:: 6.2 - - The ``ValueResolverInterface`` was introduced in Symfony 6.2. Prior to - 6.2, you had to use the - :class:`Symfony\\Component\\HttpKernel\\Controller\\ArgumentValueResolverInterface`, - which defines different methods. - .. _component-http-kernel-calling-controller: 5) Calling the Controller @@ -542,6 +519,17 @@ comes with an :class:`Symfony\\Component\\HttpKernel\\EventListener\\ErrorListen which if you choose to use, will do this and more by default (see the sidebar below for more details). +The :class:`Symfony\\Component\\HttpKernel\\Event\\ExceptionEvent` exposes the +:method:`Symfony\\Component\\HttpKernel\\Event\\ExceptionEvent::isKernelTerminating` +method, which you can use to determine if the kernel is currently terminating +at the moment the exception was thrown. + +.. versionadded:: 7.1 + + The + :method:`Symfony\\Component\\HttpKernel\\Event\\ExceptionEvent::isKernelTerminating` + method was introduced in Symfony 7.1. + .. note:: When setting a response for the ``kernel.exception`` event, the propagation diff --git a/components/intl.rst b/components/intl.rst index 3981062f5b7..8dde23105a6 100644 --- a/components/intl.rst +++ b/components/intl.rst @@ -210,10 +210,6 @@ numeric country codes:: $exists = Countries::numericCodeExists('250'); // => true -.. versionadded:: 6.4 - - The support for numeric country codes was introduced in Symfony 6.4. - Locales ~~~~~~~ @@ -397,10 +393,6 @@ to catching the exception, you can also check if a given timezone ID is valid:: Emoji Transliteration ~~~~~~~~~~~~~~~~~~~~~ -.. versionadded:: 6.2 - - The Emoji transliteration feature was introduced in Symfony 6.2. - The ``EmojiTransliterator`` class provides a utility to translate emojis into their textual representation in all languages based on the `Unicode CLDR dataset`_:: @@ -432,6 +424,15 @@ platforms:: $transliterator->transliterate('Menus with 🥗 or 🧆'); // => 'Menus with :green_salad: or :falafel:' +Furthermore the ``EmojiTransliterator`` provides a special ``strip`` locale +that removes all the emojis from a string:: + + use Symfony\Component\Intl\Transliterator\EmojiTransliterator; + + $transliterator = EmojiTransliterator::create('strip'); + $transliterator->transliterate('🎉Hey!🥳 🎁Happy Birthday!🎁'); + // => 'Hey! Happy Birthday!' + .. tip:: Combine this emoji transliterator with the :ref:`Symfony String slugger ` @@ -448,10 +449,6 @@ Symfony emoji data files using the PHP ``zlib`` extension: # adjust the path to the 'compress' binary based on your application installation $ php ./vendor/symfony/intl/Resources/bin/compress -.. versionadded:: 6.3 - - The ``compress`` binary was introduced in Symfony 6.3. - Learn more ---------- diff --git a/components/lock.rst b/components/lock.rst index 523b3a96fe7..e600d68ca59 100644 --- a/components/lock.rst +++ b/components/lock.rst @@ -475,21 +475,15 @@ avoid stalled locks:: The ``MongoDbStore`` takes the following ``$options`` (depending on the first parameter type): -============== ================================================================================================ -Option Description -============== ================================================================================================ -gcProbability Should a TTL Index be created expressed as a probability from 0.0 to 1.0 (Defaults to ``0.001``) -gcProbablity Same as ``gcProbability``, see the deprecation note below -database The name of the database -collection The name of the collection -uriOptions Array of URI options for `MongoDBClient::__construct`_ -driverOptions Array of driver options for `MongoDBClient::__construct`_ -============= ================================================================================================ - -.. deprecated:: 6.3 - - The ``gcProbablity`` option (notice the typo in its name) is deprecated since - Symfony 6.3, use the ``gcProbability`` option instead. +============= ================================================================================================ +Option Description +============= ================================================================================================ +gcProbability Should a TTL Index be created expressed as a probability from 0.0 to 1.0 (Defaults to ``0.001``) +database The name of the database +collection The name of the collection +uriOptions Array of URI options for `MongoDBClient::__construct`_ +driverOptions Array of driver options for `MongoDBClient::__construct`_ +============= ================================================================================================ When the first parameter is a: @@ -563,11 +557,6 @@ the command: $ php bin/console make:migration -.. versionadded:: 6.3 - - The automatic table generation when running the ``make:migration`` command - was introduced in Symfony 6.3. - If you prefer to create the table yourself and it has not already been created, you can create this table explicitly by calling the :method:`Symfony\\Component\\Lock\\Store\\DoctrineDbalStore::createTable` method. @@ -619,10 +608,6 @@ store locks and does not expire. RedisStore ~~~~~~~~~~ -.. versionadded:: 6.3 - - ``\Relay\Relay`` support was introduced in Symfony 6.3. - The RedisStore saves locks on a Redis server, it requires a Redis connection implementing the ``\Redis``, ``\RedisArray``, ``\RedisCluster``, ``\Relay\Relay`` or ``\Predis`` classes. This store does not support blocking, and expects a TTL to diff --git a/components/options_resolver.rst b/components/options_resolver.rst index d48b36de92c..f70bc20a412 100644 --- a/components/options_resolver.rst +++ b/components/options_resolver.rst @@ -869,10 +869,6 @@ if an unknown option is passed. You can ignore not defined options by using the 'version' => '1.2.3' ]); -.. versionadded:: 6.3 - - The ``ignoreUndefined()`` method was introduced in Symfony 6.3. - Chaining Option Configurations ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/components/phpunit_bridge.rst b/components/phpunit_bridge.rst index 69c9993e603..ba37bc0ecda 100644 --- a/components/phpunit_bridge.rst +++ b/components/phpunit_bridge.rst @@ -291,10 +291,6 @@ Here is a summary that should help you pick the right configuration: Ignoring Deprecations ..................... -.. versionadded:: 6.1 - - The ``ignoreFile`` feature was introduced in Symfony 6.1. - If your application has some deprecations that you can't fix for some reasons, you can tell Symfony to ignore them. @@ -435,11 +431,6 @@ configuration file: Finally, if you want to avoid the bridge to force any locale, you can set the ``SYMFONY_PHPUNIT_LOCALE`` environment variable to ``0``. -.. versionadded:: 6.4 - - The support for the ``SYMFONY_PHPUNIT_LOCALE`` environment variable was - introduced in Symfony 6.4. - .. _write-assertions-about-deprecations: Write Assertions about Deprecations @@ -579,10 +570,6 @@ allows you to mock the PHP's built-in time functions ``time()``, ``microtime()`` function ``date()`` is mocked so it uses the mocked time if no timestamp is specified. -.. versionadded:: 6.2 - - Support for mocking the ``hrtime()`` function was introduced in Symfony 6.2. - Other functions with an optional timestamp parameter that defaults to ``time()`` will still use the system time instead of the mocked time. This means that you may need to change some code in your tests. For example, instead of ``new DateTime()``, @@ -779,10 +766,6 @@ reason, this component also provides mocks for these PHP functions: * :phpfunction:`trait_exists` * :phpfunction:`enum_exists` -.. versionadded:: 6.3 - - The ``enum_exists`` function was introduced in Symfony 6.3. - Use Case ~~~~~~~~ @@ -854,10 +837,6 @@ PHP 8.1 and later, calling ``class_exists`` on a enum will return ``true``. That's why calling ``ClassExistsMock::withMockedEnums()`` will also register the enum as a mocked class. -.. versionadded:: 6.3 - - The ``enum_exists`` function was introduced in Symfony 6.3. - Troubleshooting --------------- diff --git a/components/process.rst b/components/process.rst index 814f7644f24..080ddff9d6a 100644 --- a/components/process.rst +++ b/components/process.rst @@ -413,10 +413,6 @@ instead:: Executing a PHP Child Process with the Same Configuration --------------------------------------------------------- -.. versionadded:: 6.4 - - The ``PhpSubprocess`` helper was introduced in Symfony 6.4. - When you start a PHP process, it uses the default configuration defined in your ``php.ini`` file. You can bypass these options with the ``-d`` command line option. For example, if ``memory_limit`` is set to ``256M``, you can disable this diff --git a/components/property_access.rst b/components/property_access.rst index 35d7712b370..052ed38e767 100644 --- a/components/property_access.rst +++ b/components/property_access.rst @@ -89,11 +89,6 @@ You can also use multi dimensional arrays:: Right square brackets ``]`` don't need to be escaped in array keys. - .. versionadded:: 6.3 - - Escaping dots and left square brackets in a property path was - introduced in Symfony 6.3. - Reading from Objects -------------------- @@ -236,10 +231,6 @@ is to mark all nullable properties with the nullsafe operator (``?``):: // no longer evaluated and null is returned immediately without throwing an exception var_dump($propertyAccessor->getValue($comment, 'person?.firstname')); // null -.. versionadded:: 6.2 - - The ``?`` nullsafe operator was introduced in Symfony 6.2. - .. _components-property-access-magic-get: Magic ``__get()`` Method diff --git a/components/property_info.rst b/components/property_info.rst index e9f5853cb51..892cd5345a3 100644 --- a/components/property_info.rst +++ b/components/property_info.rst @@ -183,6 +183,26 @@ for a property:: See :ref:`components-property-info-type` for info about the ``Type`` class. +Documentation Block +~~~~~~~~~~~~~~~~~~~ + +Extractors that implement :class:`Symfony\\Component\\PropertyInfo\\PropertyDocBlockExtractorInterface` +can provide the full documentation block for a property as a string:: + + $docBlock = $propertyInfo->getDocBlock($class, $property); + /* + Example Result + -------------- + string(79): + This is the subsequent paragraph in the DocComment. + It can span multiple lines. + */ + +.. versionadded:: 7.1 + + The :class:`Symfony\\Component\\PropertyInfo\\PropertyDocBlockExtractorInterface` + interface was introduced in Symfony 7.1. + .. _property-info-description: Description Information @@ -229,12 +249,6 @@ works. It assumes camel case style method names following `PSR-1`_. For example, both ``myProperty`` and ``my_property`` properties are readable if there's a ``getMyProperty()`` method and writable if there's a ``setMyProperty()`` method. -.. versionadded:: 6.4 - - In Symfony versions prior to 6.4, snake case properties (e.g. ``my_property``) - were not writable by camel case methods (e.g. ``setMyProperty()``). You had - to define method names with underscores (e.g. ``setMy_property()``). - .. _property-info-initializable: Property Initializable Information @@ -419,6 +433,12 @@ library is present:: // Description information. $phpDocExtractor->getShortDescription($class, $property); $phpDocExtractor->getLongDescription($class, $property); + $phpDocExtractor->getDocBlock($class, $property); + +.. versionadded:: 7.1 + + The :method:`Symfony\\Component\\PropertyInfo\\Extractor\\PhpDocExtractor::getDocBlock` + method was introduced in Symfony 7.1. PhpStanExtractor ~~~~~~~~~~~~~~~~ @@ -474,20 +494,6 @@ with the ``property_info`` service in the Symfony Framework:: // the `serializer_groups` option must be configured (may be set to null) $serializerExtractor->getProperties($class, ['serializer_groups' => ['mygroup']]); -.. versionadded:: 6.4 - - The - :class:`Symfony\\Component\\Serializer\\Mapping\\Loader\\AttributeLoader` - was introduced in Symfony 6.4. Prior to this, the - :class:`Symfony\\Component\\Serializer\\Mapping\\Loader\\AnnotationLoader` - must be used. - -.. deprecated:: 6.4 - - The - :class:`Symfony\\Component\\Serializer\\Mapping\\Loader\\AnnotationLoader` - was deprecated in Symfony 6.4. - If ``serializer_groups`` is set to ``null``, serializer groups metadata won't be checked but you will get only the properties considered by the Serializer Component (notably the ``#[Ignore]`` attribute is taken into account). diff --git a/components/serializer.rst b/components/serializer.rst index 6267f1d874e..17dfeb988d8 100644 --- a/components/serializer.rst +++ b/components/serializer.rst @@ -271,14 +271,6 @@ that will be used by the normalizer must be aware of the format to use. The following code shows how to initialize the :class:`Symfony\\Component\\Serializer\\Mapping\\Factory\\ClassMetadataFactory` for each format: -* Annotations in PHP files:: - - use Doctrine\Common\Annotations\AnnotationReader; - use Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactory; - use Symfony\Component\Serializer\Mapping\Loader\AnnotationLoader; - - $classMetadataFactory = new ClassMetadataFactory(new AnnotationLoader(new AnnotationReader())); - * Attributes in PHP files:: use Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactory; @@ -300,22 +292,6 @@ for each format: $classMetadataFactory = new ClassMetadataFactory(new XmlFileLoader('/path/to/your/definition.xml')); -.. versionadded:: 6.4 - - The - :class:`Symfony\\Component\\Serializer\\Mapping\\Loader\\AttributeLoader` - was introduced in Symfony 6.4. Prior to this, the - :class:`Symfony\\Component\\Serializer\\Mapping\\Loader\\AnnotationLoader` - must be used. - -.. deprecated:: 6.4 - - Reading annotations in PHP files is deprecated since Symfony 6.4. - Also, the - :class:`Symfony\\Component\\Serializer\\Mapping\\Loader\\AnnotationLoader` - was deprecated in Symfony 6.4. - -.. _component-serializer-attributes-groups-annotations: .. _component-serializer-attributes-groups-attributes: Then, create your groups definition: @@ -734,10 +710,6 @@ automatically detect and use it to serialize related attributes. The ``ObjectNormalizer`` also takes care of methods starting with ``has``, ``get``, and ``can``. -.. versionadded:: 6.1 - - The support of canners (methods prefixed by ``can``) was introduced in Symfony 6.1. - Using Callbacks to Serialize Properties with Object Instances ------------------------------------------------------------- @@ -833,11 +805,6 @@ The Serializer component provides several built-in normalizers: combine the following values: ``PropertyNormalizer::NORMALIZE_PUBLIC``, ``PropertyNormalizer::NORMALIZE_PROTECTED`` or ``PropertyNormalizer::NORMALIZE_PRIVATE``. - .. versionadded:: 6.2 - - The ``PropertyNormalizer::NORMALIZE_VISIBILITY`` context option and its - values were introduced in Symfony 6.2. - :class:`Symfony\\Component\\Serializer\\Normalizer\\JsonSerializableNormalizer` This normalizer works with classes that implement :phpclass:`JsonSerializable`. @@ -874,10 +841,6 @@ The Serializer component provides several built-in normalizers: By default, an exception is thrown when data is not a valid backed enumeration. If you want ``null`` instead, you can set the ``BackedEnumNormalizer::ALLOW_INVALID_VALUES`` option. - .. versionadded:: 6.3 - - The ``BackedEnumNormalizer::ALLOW_INVALID_VALUES`` context option was introduced in Symfony 6.3. - :class:`Symfony\\Component\\Serializer\\Normalizer\\FormErrorNormalizer` This normalizer works with classes that implement :class:`Symfony\\Component\\Form\\FormInterface`. @@ -918,11 +881,6 @@ The Serializer component provides several built-in normalizers: setting the ``TranslatableNormalizer::NORMALIZATION_LOCALE_KEY`` serializer context option. - .. versionadded:: 6.4 - - The :class:`Symfony\\Component\\Serializer\\Normalizer\\TranslatableNormalizer` - was introduced in Symfony 6.4. - .. note:: You can also create your own Normalizer to use another structure. Read more at @@ -1052,10 +1010,6 @@ Option Description ``json_decode_recursion_depth`` Sets maximum recursion depth. ``512`` =============================== ========================================================================================================== ================================ -.. versionadded:: 6.4 - - The support of ``json_decode_detailed_errors`` was introduced in Symfony 6.4. - The ``CsvEncoder`` ~~~~~~~~~~~~~~~~~~ @@ -1291,10 +1245,6 @@ you can use "context builders" to define the context using a fluent interface:: $serializer->serialize($something, 'csv', $contextBuilder->toArray()); -.. versionadded:: 6.1 - - Context builders were introduced in Symfony 6.1. - .. note:: The Serializer component provides a context builder @@ -1342,11 +1292,6 @@ to ``true``:: $result = $normalizer->denormalize($data, Dummy::class, 'json', [AbstractNormalizer::REQUIRE_ALL_PROPERTIES => true]); // throws Symfony\Component\Serializer\Exception\MissingConstructorArgumentException -.. versionadded:: 6.3 - - The ``AbstractNormalizer::PREVENT_NULLABLE_FALLBACK`` context option - was introduced in Symfony 6.3. - Skipping Uninitialized Properties --------------------------------- diff --git a/components/string.rst b/components/string.rst index ca289c70ba4..68362ed8654 100644 --- a/components/string.rst +++ b/components/string.rst @@ -203,7 +203,10 @@ Methods to Change Case :: // changes all graphemes/code points to lower case - u('FOO Bar')->lower(); // 'foo bar' + u('FOO Bar Brİan')->lower(); // 'foo bar bri̇an' + // changes all graphemes/code points to lower case according to locale-specific case mappings + u('FOO Bar Brİan')->localeLower('en'); // 'foo bar bri̇an' + u('FOO Bar Brİan')->localeLower('lt'); // 'foo bar bri̇̇an' // when dealing with different languages, uppercase/lowercase is not enough // there are three cases (lower, upper, title), some characters have no case, @@ -213,11 +216,17 @@ Methods to Change Case u('Die O\'Brian Straße')->folded(); // "die o'brian strasse" // changes all graphemes/code points to upper case - u('foo BAR')->upper(); // 'FOO BAR' + u('foo BAR bάz')->upper(); // 'FOO BAR BΆZ' + // changes all graphemes/code points to upper case according to locale-specific case mappings + u('foo BAR bάz')->localeUpper('en'); // 'FOO BAR BΆZ' + u('foo BAR bάz')->localeUpper('el'); // 'FOO BAR BAZ' // changes all graphemes/code points to "title case" - u('foo bar')->title(); // 'Foo bar' - u('foo bar')->title(true); // 'Foo Bar' + u('foo ijssel')->title(); // 'Foo ijssel' + u('foo ijssel')->title(true); // 'Foo Ijssel' + // changes all graphemes/code points to "title case" according to locale-specific case mappings + u('foo ijssel')->localeTitle('en'); // 'Foo ijssel' + u('foo ijssel')->localeTitle('nl'); // 'Foo IJssel' // changes all graphemes/code points to camelCase u('Foo: Bar-baz.')->camel(); // 'fooBarBaz' @@ -226,6 +235,11 @@ Methods to Change Case // other cases can be achieved by chaining methods. E.g. PascalCase: u('Foo: Bar-baz.')->camel()->title(); // 'FooBarBaz' +.. versionadded:: 7.1 + + The ``localeLower()``, ``localeUpper()`` and ``localeTitle()`` methods were + introduced in Symfony 7.1. + The methods of all string classes are case-sensitive by default. You can perform case-insensitive operations with the ``ignoreCase()`` method:: @@ -565,10 +579,6 @@ the injected slugger is the same as the request locale:: Slug Emojis ~~~~~~~~~~~ -.. versionadded:: 6.2 - - The Emoji transliteration feature was introduced in Symfony 6.2. - You can transform any emojis into their textual representation:: use Symfony\Component\String\Slugger\AsciiSlugger; @@ -593,20 +603,6 @@ from GitHub or Slack, use the first argument of ``withEmoji()`` method:: $slug = $slugger->slug('a 😺, 🐈‍⬛, and a 🦁'); // $slug = 'a-smiley-cat-black-cat-and-a-lion'; -If you want to strip emojis from slugs, use the special ``strip`` locale:: - - use Symfony\Component\String\Slugger\AsciiSlugger; - - $slugger = new AsciiSlugger(); - $slugger = $slugger->withEmoji('strip'); - - $slug = $slugger->slug('a 😺, 🐈‍⬛, and a 🦁'); - // $slug = 'a-and-a'; - -.. versionadded:: 6.3 - - The option to strip emojis from slugs was introduced in Symfony 6.3. - .. _string-inflector: Inflector diff --git a/components/uid.rst b/components/uid.rst index f27977a8296..26fd32989a9 100644 --- a/components/uid.rst +++ b/components/uid.rst @@ -70,10 +70,6 @@ to create each type of UUID:: // UUIDv8 uniqueness will be implementation-specific and SHOULD NOT be assumed. $uuid = Uuid::v8(); -.. versionadded:: 6.2 - - UUID versions 7 and 8 were introduced in Symfony 6.2. - If your UUID value is already generated in another format, use any of the following methods to create a ``Uuid`` object from it:: @@ -94,10 +90,10 @@ configure the behavior of the factory using configuration files:: # config/packages/uid.yaml framework: uid: - default_uuid_version: 6 + default_uuid_version: 7 name_based_uuid_version: 5 name_based_uuid_namespace: 6ba7b810-9dad-11d1-80b4-00c04fd430c8 - time_based_uuid_version: 6 + time_based_uuid_version: 7 time_based_uuid_node: 121212121212 .. code-block:: xml @@ -113,10 +109,10 @@ configure the behavior of the factory using configuration files:: @@ -135,10 +131,10 @@ configure the behavior of the factory using configuration files:: $container->extension('framework', [ 'uid' => [ - 'default_uuid_version' => 6, + 'default_uuid_version' => 7, 'name_based_uuid_version' => 5, 'name_based_uuid_namespace' => '6ba7b810-9dad-11d1-80b4-00c04fd430c8', - 'time_based_uuid_version' => 6, + 'time_based_uuid_version' => 7, 'time_based_uuid_node' => 121212121212, ], ]); @@ -160,7 +156,7 @@ on the configuration you defined:: public function generate(): void { - // This creates a UUID of the version given in the configuration file (v6 by default) + // This creates a UUID of the version given in the configuration file (v7 by default) $uuid = $this->uuidFactory->create(); $nameBasedUuid = $this->uuidFactory->nameBased(/** ... */); @@ -184,10 +180,6 @@ Use these methods to transform the UUID object into different bases:: $uuid->toRfc4122(); // string(36) "d9e7a184-5d5b-11ea-a62a-3499710062d0" $uuid->toHex(); // string(34) "0xd9e7a1845d5b11eaa62a3499710062d0" -.. versionadded:: 6.2 - - The ``toHex()`` method was introduced in Symfony 6.2. - Working with UUIDs ~~~~~~~~~~~~~~~~~~ @@ -247,10 +239,6 @@ type, which converts to/from UUID objects automatically:: // ... } -.. versionadded:: 6.2 - - The ``UuidType::NAME`` constant was introduced in Symfony 6.2. - There's also a Doctrine generator to help auto-generate UUID values for the entity primary keys:: @@ -387,10 +375,6 @@ Use these methods to transform the ULID object into different bases:: $ulid->toRfc4122(); // string(36) "0171069d-593d-97d3-8b3e-23d06de5b308" $ulid->toHex(); // string(34) "0x0171069d593d97d38b3e23d06de5b308" -.. versionadded:: 6.2 - - The ``toHex()`` method was introduced in Symfony 6.2. - Working with ULIDs ~~~~~~~~~~~~~~~~~~ @@ -434,10 +418,6 @@ type, which converts to/from ULID objects automatically:: // ... } -.. versionadded:: 6.2 - - The ``UlidType::NAME`` constant was introduced in Symfony 6.2. - There's also a Doctrine generator to help auto-generate ULID values for the entity primary keys:: diff --git a/components/validator/resources.rst b/components/validator/resources.rst index 3d10c28518d..d9b63a147d5 100644 --- a/components/validator/resources.rst +++ b/components/validator/resources.rst @@ -83,70 +83,9 @@ configure the locations of these files:: :method:`Symfony\\Component\\Validator\\ValidatorBuilder::addXmlMappings` to configure an array of file paths. -The AnnotationLoader --------------------- - -.. deprecated:: 6.4 - - The :class:`Symfony\\Component\\Validator\\Mapping\\Loader\\AnnotationLoader` - is deprecated since Symfony 6.4, use the - :class:`Symfony\\Component\\Validator\\Mapping\\Loader\\AttributeLoader` - instead. - -The component provides an -:class:`Symfony\\Component\\Validator\\Mapping\\Loader\\AnnotationLoader` to get -the metadata from the annotations of the class. Annotations are defined as ``@`` -prefixed classes included in doc block comments (``/** ... */``). For example:: - - use Symfony\Component\Validator\Constraints as Assert; - // ... - - class User - { - /** - * @Assert\NotBlank - */ - protected string $name; - } - -To enable the annotation loader, call the -:method:`Symfony\\Component\\Validator\\ValidatorBuilder::enableAnnotationMapping` method. -If you use annotations instead of attributes, it's also required to call -``addDefaultDoctrineAnnotationReader()`` to use Doctrine's annotation reader:: - - use Symfony\Component\Validator\Validation; - - $validator = Validation::createValidatorBuilder() - ->enableAnnotationMapping() - ->addDefaultDoctrineAnnotationReader() // add this only when using annotations - ->getValidator(); - -.. deprecated:: 6.4 - - Annotations are deprecated since Symfony 6.4, use attributes instead. - -To disable the annotation loader after it was enabled, call -:method:`Symfony\\Component\\Validator\\ValidatorBuilder::disableAnnotationMapping`. - -.. deprecated:: 6.4 - - The :method:`Symfony\\Component\\Validator\\ValidatorBuilder::enableAnnotationMapping` - and :method:`Symfony\\Component\\Validator\\ValidatorBuilder::disableAnnotationMapping` - methods are deprecated since Symfony 6.4, use the - :method:`Symfony\\Component\\Validator\\ValidatorBuilder::enableAttributeMapping` - and :method:`Symfony\\Component\\Validator\\ValidatorBuilder::disableAttributeMapping` - methods instead. - -.. include:: /_includes/_annotation_loader_tip.rst.inc - The AttributeLoader ------------------- -.. versionadded:: 6.4 - - The :class:`Symfony\\Component\\Validator\\Mapping\\Loader\\AttributeLoader` - was introduced in Symfony 6.4. - The component provides an :class:`Symfony\\Component\\Validator\\Mapping\\Loader\\AttributeLoader` to get the metadata from the attributes of the class. For example:: diff --git a/components/var_dumper.rst b/components/var_dumper.rst index 6b336ad1d3e..06adc3a0021 100644 --- a/components/var_dumper.rst +++ b/components/var_dumper.rst @@ -485,10 +485,6 @@ then its dump representation:: .. image:: /_images/components/var_dumper/10-uninitialized.png :alt: Dump output where the uninitialized property is represented by a question mark followed by the type definition. -.. versionadded:: 6.4 - - Displaying uninitialized variables information was introduced in Symfony 6.4. - .. _var-dumper-advanced: Advanced Usage diff --git a/components/var_exporter.rst b/components/var_exporter.rst index 20213e05c06..634e4be78cb 100644 --- a/components/var_exporter.rst +++ b/components/var_exporter.rst @@ -177,10 +177,6 @@ populated by using the special ``"\0"`` property name to define their internal v "\0" => [$inputArray], ]); -.. versionadded:: 6.2 - - The :class:`Symfony\\Component\\VarExporter\\Hydrator` was introduced in Symfony 6.2. - Creating Lazy Objects --------------------- @@ -228,12 +224,6 @@ initialized:: } } -.. deprecated:: 6.4 - - Using an array of closures for property-based initialization in the - ``createLazyGhost()`` method is deprecated since Symfony 6.4. Pass - a single closure that initializes the whole object instead. - :class:`Symfony\\Component\\VarExporter\\LazyGhostTrait` also allows to convert non-lazy classes to lazy ones:: @@ -292,10 +282,6 @@ Ghost objects unfortunately can't work with abstract classes or internal PHP classes. Nevertheless, the VarExporter component covers this need with the help of :ref:`Virtual Proxies `. -.. versionadded:: 6.2 - - The :class:`Symfony\\Component\\VarExporter\\LazyGhostTrait` was introduced in Symfony 6.2. - .. _var-exporter_virtual-proxies: LazyProxyTrait @@ -361,10 +347,5 @@ Just like ghost objects, while you never query ``$processor->hash``, its value will not be computed. The main difference with ghost objects is that this time, a proxy of an abstract class was created. This also works with internal PHP class. -.. versionadded:: 6.2 - - The :class:`Symfony\\Component\\VarExporter\\LazyProxyTrait` and - :class:`Symfony\\Component\\VarExporter\\ProxyHelper` were introduced in Symfony 6.2. - .. _`OPcache`: https://www.php.net/opcache .. _`PSR-2`: https://www.php-fig.org/psr/psr-2/ diff --git a/components/yaml.rst b/components/yaml.rst index 1b5bb5e6688..627fc4479e0 100644 --- a/components/yaml.rst +++ b/components/yaml.rst @@ -355,10 +355,6 @@ and the special ``!php/enum`` syntax to parse them as proper PHP enums:: // the value of the 'foo' key is a string because it missed the `!php/enum` syntax // $parameters = ['foo' => 'FooEnum::Foo', 'bar' => 'foo']; -.. versionadded:: 6.2 - - The support for PHP enumerations was introduced in Symfony 6.2. - Parsing and Dumping of Binary Data ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -422,10 +418,6 @@ By default, digit-only array keys are dumped as integers. You can use the $dumped = Yaml::dump([200 => 'foo'], 2, 4, Yaml::DUMP_NUMERIC_KEY_AS_STRING); // '200': foo -.. versionadded:: 6.3 - - The ``DUMP_NUMERIC_KEY_AS_STRING`` flag was introduced in Symfony 6.3. - Syntax Validation ~~~~~~~~~~~~~~~~~ diff --git a/configuration.rst b/configuration.rst index 1c7aceec85c..5362c438947 100644 --- a/configuration.rst +++ b/configuration.rst @@ -81,10 +81,6 @@ readable. These are the main advantages and disadvantages of each format: methods in the ``src/Kernel.php`` file to add support for the ``.xml`` file extension. - .. versionadded:: 6.1 - - The automatic loading of PHP configuration files was introduced in Symfony 6.1. - Importing Configuration Files ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -292,14 +288,6 @@ reusable configuration value. By convention, parameters are defined under the something@example.com -.. versionadded:: 6.2 - - Passing an enum case as a service parameter was introduced in Symfony 6.2. - -.. versionadded:: 6.3 - - The ``trim`` attribute was introduced in Symfony 6.3. - Once defined, you can reference this parameter value from any other configuration file using a special syntax: wrap the parameter name in two ``%`` (e.g. ``%app.admin_email%``): @@ -395,10 +383,6 @@ a new ``locale`` parameter is added to the ``config/services.yaml`` file). They are useful when working with :ref:`Compiler Passes ` to declare some temporary parameters that won't be available later in the application. -.. versionadded:: 6.3 - - Compile-time parameters were introduced in Symfony 6.3. - .. seealso:: Later in this article you can read how to @@ -992,10 +976,6 @@ Use the ``debug:dotenv`` command to understand how Symfony parses the different # look for a specific variable passing its full or partial name as an argument $ php bin/console debug:dotenv foo -.. versionadded:: 6.2 - - The option to pass variable names to ``debug:dotenv`` was introduced in Symfony 6.2. - Additionally, and regardless of how you set environment variables, you can see all environment variables, with their values, referenced in Symfony's container configuration: diff --git a/configuration/env_var_processors.rst b/configuration/env_var_processors.rst index 4f600a5b34b..6953781e187 100644 --- a/configuration/env_var_processors.rst +++ b/configuration/env_var_processors.rst @@ -418,10 +418,6 @@ Symfony provides the following env var processors: ->set(\RedisCluster::class, \RedisCluster::class)->args([null, '%env(shuffle:csv:REDIS_NODES)%']); }; - .. versionadded:: 6.2 - - The ``env(shuffle:...)`` env var processor was introduced in Symfony 6.2. - ``env(file:FOO)`` Returns the contents of a file whose path is the value of the ``FOO`` env var: @@ -782,10 +778,6 @@ Symfony provides the following env var processors: // config/services.php $container->setParameter('typed_env', '%env(enum:App\Enum\Environment:APP_ENV)%'); - .. versionadded:: 6.2 - - The ``env(enum:...)`` env var processor was introduced in Symfony 6.2. - ``env(defined:NO_FOO)`` Evaluates to ``true`` if the env var exists and its value is not ``''`` (an empty string) or ``null``; it returns ``false`` otherwise. @@ -820,9 +812,56 @@ Symfony provides the following env var processors: // config/services.php $container->setParameter('typed_env', '%env(defined:FOO)%'); - .. versionadded:: 6.4 +.. _urlencode_environment_variable_processor: + +``env(urlencode:FOO)`` + Encodes the content of the ``FOO`` env var using the :phpfunction:`urlencode` + PHP function. This is especially useful when ``FOO`` value is not compatible + with DSN syntax. + + .. configuration-block:: + + .. code-block:: yaml + + # config/packages/framework.yaml + parameters: + env(DATABASE_URL): 'mysql://db_user:foo@b$r@127.0.0.1:3306/db_name' + encoded_database_url: '%env(urlencode:DATABASE_URL)%' + + .. code-block:: xml + + + + + + + mysql://db_user:foo@b$r@127.0.0.1:3306/db_name + %env(urlencode:DATABASE_URL)% + + + + .. code-block:: php + + // config/packages/framework.php + namespace Symfony\Component\DependencyInjection\Loader\Configurator; + + use Symfony\Component\DependencyInjection\ContainerBuilder; + use Symfony\Config\FrameworkConfig; + + return static function (ContainerBuilder $container): void { + $container->setParameter('env(DATABASE_URL)', 'mysql://db_user:foo@b$r@127.0.0.1:3306/db_name'); + $container->setParameter('encoded_database_url', '%env(urlencode:DATABASE_URL)%'); + }; + + .. versionadded:: 7.1 - The ``env(defined:...)`` env var processor was introduced in Symfony 6.4. + The ``env(urlencode:...)`` env var processor was introduced in Symfony 7.1. It is also possible to combine any number of processors: diff --git a/configuration/micro_kernel_trait.rst b/configuration/micro_kernel_trait.rst index 890f3fc8b9c..26a332e4fdd 100644 --- a/configuration/micro_kernel_trait.rst +++ b/configuration/micro_kernel_trait.rst @@ -120,10 +120,6 @@ Next, create an ``index.php`` file that defines the kernel class and runs it: $response->send(); $kernel->terminate($request, $response); -.. versionadded:: 6.1 - - The PHP attributes notation has been introduced in Symfony 6.1. - That's it! To test it, start the :doc:`Symfony Local Web Server `: @@ -338,10 +334,6 @@ add a service conditionally based on the ``foo`` value:: } } -.. versionadded:: 6.1 - - The ``AbstractExtension`` class was introduced in Symfony 6.1. - Unlike the previous kernel, this loads an external ``config/framework.yaml`` file, because the configuration started to get bigger: diff --git a/console.rst b/console.rst index ce8d86bef37..700ed536486 100644 --- a/console.rst +++ b/console.rst @@ -67,14 +67,6 @@ command, for instance: Console Completion ~~~~~~~~~~~~~~~~~~ -.. versionadded:: 6.1 - - Console completion for Fish was introduced in Symfony 6.1. - -.. versionadded:: 6.2 - - Console completion for Zsh was introduced in Symfony 6.2. - If you are using the Bash, Zsh or Fish shell, you can install Symfony's completion script to get auto completion when typing commands in the terminal. All commands support name and option completion, and some can @@ -158,13 +150,12 @@ You can optionally define a description, help message and the // ... class CreateUserCommand extends Command { - // the command description shown when running "php bin/console list" - protected static $defaultDescription = 'Creates a new user.'; - // ... protected function configure(): void { $this + // the command description shown when running "php bin/console list" + ->setDescription('Creates a new user.') // the command help shown when running the command with the "--help" option ->setHelp('This command allows you to create a user...') ; @@ -173,20 +164,15 @@ You can optionally define a description, help message and the .. tip:: - Defining the ``$defaultDescription`` static property instead of using the - ``setDescription()`` method allows to get the command description without + Using the ``#[AsCommand]`` attribute to define a description instead of + using the ``setDescription()`` method allows to get the command description without instantiating its class. This makes the ``php bin/console list`` command run much faster. If you want to always run the ``list`` command fast, add the ``--short`` option to it (``php bin/console list --short``). This will avoid instantiating command classes, but it won't show any description for commands that use the - ``setDescription()`` method instead of the static property. - -.. deprecated:: 6.1 - - The static property ``$defaultDescription`` was deprecated in Symfony 6.1. - Instead, use the ``#[AsCommand]`` attribute to define the optional command + ``setDescription()`` method instead of the attribute to define the command description. The ``configure()`` method is called automatically at the end of the command @@ -234,8 +220,6 @@ You can register the command by adding the ``AsCommand`` attribute to it:: use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; - // the "name" and "description" arguments of AsCommand replace the - // static $defaultName and $defaultDescription properties #[AsCommand( name: 'app:create-user', description: 'Creates a new user.', @@ -252,11 +236,6 @@ If you can't use PHP attributes, register the command as a service and :ref:`default services.yaml configuration `, this is already done for you, thanks to :ref:`autoconfiguration `. -.. deprecated:: 6.1 - - The static property ``$defaultName`` was deprecated in Symfony 6.1. - Define your command name with the ``#[AsCommand]`` attribute instead. - Running the Command ~~~~~~~~~~~~~~~~~~~ @@ -373,10 +352,6 @@ method, which returns an instance of A new line is appended automatically when displaying information in a section. -.. versionadded:: 6.2 - - The feature to limit the height of a console section was introduced in Symfony 6.2. - Output sections let you manipulate the Console output in advanced ways, such as :ref:`displaying multiple progress bars ` which are updated independently and :ref:`appending rows to tables ` @@ -599,11 +574,6 @@ even the color mode being used. You have access to such information thanks to th // changes the color mode $colorMode = $terminal->setColorMode(AnsiColorMode::Ansi24); -.. versionadded:: 6.2 - - The support for setting and getting the current color mode was introduced - in Symfony 6.2. - Logging Command Errors ---------------------- @@ -641,10 +611,6 @@ profile is accessible through the web page of the profiler. terminal supports links). If you run it in debug verbosity (``-vvv``) you'll also see the time and memory consumed by the command. -.. versionadded:: 6.4 - - The ``--profile`` option was introduced in Symfony 6.4. - Learn More ---------- diff --git a/console/coloring.rst b/console/coloring.rst index c54045250a8..8b6655d6b71 100644 --- a/console/coloring.rst +++ b/console/coloring.rst @@ -58,10 +58,6 @@ Any hex color is supported for foreground and background colors. Besides that, t the nearest color depending on the terminal capabilities. E.g. ``#c0392b`` is degraded to ``#d75f5f`` in 256-color terminals and to ``red`` in 8-color terminals. - .. versionadded:: 6.2 - - The support for 256-color terminals was introduced in Symfony 6.2. - And available options are: ``bold``, ``underscore``, ``blink``, ``reverse`` (enables the "reverse video" mode where the background and foreground colors are swapped) and ``conceal`` (sets the foreground color to transparent, making diff --git a/console/input.rst b/console/input.rst index ed637bdba74..4d709c18825 100644 --- a/console/input.rst +++ b/console/input.rst @@ -354,12 +354,6 @@ To achieve this, use the 5th argument of ``addArgument()``/``addOption``:: } } -.. versionadded:: 6.1 - - The argument to ``addOption()``/``addArgument()`` was introduced in - Symfony 6.1. Prior to this version, you had to override the - ``complete()`` method of the command. - That's all you need! Assuming users "Fabien" and "Fabrice" exist, pressing tab after typing ``app:greet Fa`` will give you these names as a suggestion. diff --git a/console/style.rst b/console/style.rst index bcc4d982457..0aaaa3f675e 100644 --- a/console/style.rst +++ b/console/style.rst @@ -333,10 +333,6 @@ User Input Methods $io->choice('Select the queue to analyze', ['queue1', 'queue2', 'queue3'], multiSelect: true); -.. versionadded:: 6.2 - - The ``multiSelect`` option of ``choice()`` was introduced in Symfony 6.2. - .. _symfony-style-blocks: Result Methods @@ -445,10 +441,6 @@ If you prefer to wrap all contents, including URLs, use this method:: } } -.. versionadded:: 6.2 - - The ``setAllowCutUrls()`` method was introduced in Symfony 6.2. - Defining your Own Styles ------------------------ diff --git a/contributing/documentation/format.rst b/contributing/documentation/format.rst index ac93483c011..d933f3bcead 100644 --- a/contributing/documentation/format.rst +++ b/contributing/documentation/format.rst @@ -246,39 +246,39 @@ If you are documenting a brand new feature, a change or a deprecation that's been made in Symfony, you should precede your description of the change with the corresponding directive and a short description: -For a new feature or a behavior change use the ``.. versionadded:: 6.x`` +For a new feature or a behavior change use the ``.. versionadded:: 7.x`` directive: .. code-block:: rst - .. versionadded:: 6.2 + .. versionadded:: 7.2 - ... ... ... was introduced in Symfony 6.2. + ... ... ... was introduced in Symfony 7.2. If you are documenting a behavior change, it may be helpful to *briefly* describe how the behavior has changed: .. code-block:: rst - .. versionadded:: 6.2 + .. versionadded:: 7.2 - ... ... ... was introduced in Symfony 6.2. Prior to this, + ... ... ... was introduced in Symfony 7.2. Prior to this, ... ... ... ... ... ... ... ... . -For a deprecation use the ``.. deprecated:: 6.x`` directive: +For a deprecation use the ``.. deprecated:: 7.x`` directive: .. code-block:: rst - .. deprecated:: 6.2 + .. deprecated:: 7.2 - ... ... ... was deprecated in Symfony 6.2. + ... ... ... was deprecated in Symfony 7.2. -Whenever a new major version of Symfony is released (e.g. 6.0, 7.0, etc), a new +Whenever a new major version of Symfony is released (e.g. 8.0, 9.0, etc), a new branch of the documentation is created from the ``x.4`` branch of the previous major version. At this point, all the ``versionadded`` and ``deprecated`` tags for Symfony versions that have a lower major version will be removed. For -example, if Symfony 6.0 were released today, 5.0 to 5.4 ``versionadded`` and -``deprecated`` tags would be removed from the new ``6.0`` branch. +example, if Symfony 8.0 were released today, 7.0 to 7.4 ``versionadded`` and +``deprecated`` tags would be removed from the new ``8.0`` branch. .. _reStructuredText: https://docutils.sourceforge.io/rst.html .. _Sphinx: https://www.sphinx-doc.org/ diff --git a/controller.rst b/controller.rst index fcdd03d7ca3..bb02c1e8723 100644 --- a/controller.rst +++ b/controller.rst @@ -229,10 +229,6 @@ command: You can read more about this attribute in :ref:`autowire-attribute`. - .. versionadded:: 6.1 - - The ``#[Autowire]`` attribute was introduced in Symfony 6.1. - Like with all services, you can also use regular :ref:`constructor injection ` in your controllers. @@ -383,11 +379,6 @@ attribute, arguments of your controller's action can be automatically fulfilled: // ... } -.. versionadded:: 6.3 - - The :class:`Symfony\\Component\\HttpKernel\\Attribute\\MapQueryParameter` attribute - was introduced in Symfony 6.3. - .. _controller-mapping-query-string: Mapping The Whole Query String @@ -451,15 +442,6 @@ HTTP status to return if the validation fails:: The default status code returned if the validation fails is 404. -.. versionadded:: 6.3 - - The :class:`Symfony\\Component\\HttpKernel\\Attribute\\MapQueryString` attribute - was introduced in Symfony 6.3. - -.. versionadded:: 6.4 - - The ``validationFailedStatusCode`` parameter was introduced in Symfony 6.4. - .. _controller-mapping-request-payload: Mapping Request Payload @@ -557,15 +539,6 @@ if you want to map a nested array of specific DTOs:: ) {} } -.. versionadded:: 6.3 - - The :class:`Symfony\\Component\\HttpKernel\\Attribute\\MapRequestPayload` attribute - was introduced in Symfony 6.3. - -.. versionadded:: 6.4 - - The ``validationFailedStatusCode`` parameter was introduced in Symfony 6.4. - Managing the Session -------------------- @@ -739,11 +712,6 @@ The ``file()`` helper provides some arguments to configure its behavior:: Sending Early Hints ~~~~~~~~~~~~~~~~~~~ -.. versionadded:: 6.3 - - The Early Hints helper of the ``AbstractController`` was introduced - in Symfony 6.3. - `Early hints`_ tell the browser to start downloading some assets even before the application sends the response content. This improves perceived performance because the browser can prefetch resources that will be needed once the full diff --git a/controller/upload_file.rst b/controller/upload_file.rst index c05e78997ba..f50432f5ee3 100644 --- a/controller/upload_file.rst +++ b/controller/upload_file.rst @@ -194,13 +194,24 @@ There are some important things to consider in the code of the above controller: users. This also applies to the files uploaded by your visitors. The ``UploadedFile`` class provides methods to get the original file extension (:method:`Symfony\\Component\\HttpFoundation\\File\\UploadedFile::getClientOriginalExtension`), - the original file size (:method:`Symfony\\Component\\HttpFoundation\\File\\UploadedFile::getSize`) - and the original file name (:method:`Symfony\\Component\\HttpFoundation\\File\\UploadedFile::getClientOriginalName`). + the original file size (:method:`Symfony\\Component\\HttpFoundation\\File\\UploadedFile::getSize`), + the original file name (:method:`Symfony\\Component\\HttpFoundation\\File\\UploadedFile::getClientOriginalName`) + and the original file path (:method:`Symfony\\Component\\HttpFoundation\\File\\UploadedFile::getClientOriginalPath`). However, they are considered *not safe* because a malicious user could tamper that information. That's why it's always better to generate a unique name and use the :method:`Symfony\\Component\\HttpFoundation\\File\\UploadedFile::guessExtension` method to let Symfony guess the right extension according to the file MIME type; +.. note:: + + If a directory was uploaded, ``getClientOriginalPath()`` will contain + the **webkitRelativePath** as provided by the browser. Otherwise this + value will be identical to ``getClientOriginalName()``. + +.. versionadded:: 7.1 + + The ``getClientOriginalPath()`` method was introduced in Symfony 7.1. + You can use the following code to link to the PDF brochure of a product: .. code-block:: html+twig diff --git a/controller/value_resolver.rst b/controller/value_resolver.rst index 7509920bc04..811543efe67 100644 --- a/controller/value_resolver.rst +++ b/controller/value_resolver.rst @@ -75,11 +75,6 @@ Symfony ships with the following value resolvers in the The example above allows requesting only ``/cards/D`` and ``/cards/S`` URLs and leads to 404 Not Found response in two other cases. - .. versionadded:: 6.1 - - The ``BackedEnumValueResolver`` and ``EnumRequirement`` were introduced in Symfony 6.1. - - :class:`Symfony\\Component\\HttpKernel\\Controller\\ArgumentResolver\\RequestPayloadValueResolver` Maps the request payload or the query string into the type-hinted object. @@ -88,10 +83,6 @@ Symfony ships with the following value resolvers in the or the :ref:`MapQueryString ` attribute in order to use this resolver. - .. versionadded:: 6.3 - - The ``RequestPayloadValueResolver`` was introduced in Symfony 6.3. - :class:`Symfony\\Component\\HttpKernel\\Controller\\ArgumentResolver\\RequestAttributeValueResolver` Attempts to find a request attribute that matches the name of the argument. @@ -111,16 +102,6 @@ Symfony ships with the following value resolvers in the receives when testing your application and using the :class:`Symfony\\Component\\Clock\\MockClock` implementation. - .. versionadded:: 6.1 - - The ``DateTimeValueResolver`` and the ``MapDateTime`` attribute were - introduced in Symfony 6.1. - - .. versionadded:: 6.3 - - The use of the :doc:`Clock component ` to generate the - ``DateTimeInterface`` object was introduced in Symfony 6.3. - :class:`Symfony\\Component\\HttpKernel\\Controller\\ArgumentResolver\\RequestValueResolver` Injects the current ``Request`` if type-hinted with ``Request`` or a class extending ``Request``. @@ -160,10 +141,6 @@ Symfony ships with the following value resolvers in the } } - .. versionadded:: 6.1 - - The ``UidValueResolver`` was introduced in Symfony 6.1. - :class:`Symfony\\Component\\HttpKernel\\Controller\\ArgumentResolver\\VariadicValueResolver` Verifies if the request data is an array and will add all of them to the argument list. When the action is called, the last (variadic) argument will @@ -189,10 +166,6 @@ In addition, some components, bridges and official bundles provide other value r If the argument is not nullable and there is no logged in token, an ``HttpException`` with status code 401 is thrown by the resolver to prevent access to the controller. - .. versionadded:: 6.3 - - The ``SecurityTokenValueResolver`` was introduced in Symfony 6.3. - :class:`Symfony\\Bridge\\Doctrine\\ArgumentResolver\\EntityValueResolver` Automatically query for an entity and pass it as an argument to your controller. @@ -216,10 +189,6 @@ In addition, some components, bridges and official bundles provide other value r To learn more about the use of the ``EntityValueResolver``, see the dedicated section :ref:`Automatically Fetching Objects `. - .. versionadded:: 6.2 - - The ``EntityValueResolver`` was introduced in Symfony 6.2. - PSR-7 Objects Resolver: Injects a Symfony HttpFoundation ``Request`` object created from a PSR-7 object of type :class:`Psr\\Http\\Message\\ServerRequestInterface`, @@ -265,10 +234,6 @@ lets you do this by "targeting" the resolver you want:: } } -.. versionadded:: 6.3 - - The ``ValueResolver`` attribute was introduced in Symfony 6.3. - In the example above, the ``SessionValueResolver`` will be called first because it is targeted. The ``DefaultValueResolver`` will be called next if no value has been provided; that's why you can assign ``null`` as ``$session``'s default value. @@ -302,13 +267,6 @@ object whenever a controller argument has a type implementing } } -.. versionadded:: 6.2 - - The ``ValueResolverInterface`` was introduced in Symfony 6.2. Prior to - 6.2, you had to use the - :class:`Symfony\\Component\\HttpKernel\\Controller\\ArgumentValueResolverInterface`, - which defines different methods. - Adding a new value resolver requires creating a class that implements :class:`Symfony\\Component\\HttpKernel\\Controller\\ValueResolverInterface` and defining a service for it. @@ -484,8 +442,3 @@ You can then pass this name as ``ValueResolver``'s first argument to target your // ... do something with $id } } - -.. versionadded:: 6.3 - - The ``controller.targeted_value_resolver`` tag and ``AsTargetedValueResolver`` - attribute were introduced in Symfony 6.3. diff --git a/create_framework/http_kernel_httpkernel_class.rst b/create_framework/http_kernel_httpkernel_class.rst index fa673f9ba57..ecf9d4c7879 100644 --- a/create_framework/http_kernel_httpkernel_class.rst +++ b/create_framework/http_kernel_httpkernel_class.rst @@ -114,11 +114,6 @@ client; that's what the ``ResponseListener`` does:: $dispatcher->addSubscriber(new HttpKernel\EventListener\ResponseListener('UTF-8')); -If you want out of the box support for streamed responses, subscribe -to ``StreamedResponseListener``:: - - $dispatcher->addSubscriber(new HttpKernel\EventListener\StreamedResponseListener()); - And in your controller, return a ``StreamedResponse`` instance instead of a ``Response`` instance. diff --git a/doctrine.rst b/doctrine.rst index e1d91969e92..ecd5a54a37e 100644 --- a/doctrine.rst +++ b/doctrine.rst @@ -62,10 +62,11 @@ The database connection information is stored as an environment variable called If the username, password, host or database name contain any character considered special in a URI (such as ``+``, ``@``, ``$``, ``#``, ``/``, ``:``, ``*``, ``!``, ``%``), - you must encode them. See `RFC 3986`_ for the full list of reserved characters or - use the :phpfunction:`urlencode` function to encode them. In this case you need to - remove the ``resolve:`` prefix in ``config/packages/doctrine.yaml`` to avoid errors: - ``url: '%env(DATABASE_URL)%'`` + you must encode them. See `RFC 3986`_ for the full list of reserved characters. + You can use the :phpfunction:`urlencode` function to encode them or + the :ref:`urlencode environment variable processor `. + In this case you need to remove the ``resolve:`` prefix in ``config/packages/doctrine.yaml`` + to avoid errors: ``url: '%env(DATABASE_URL)%'`` Now that your connection parameters are setup, Doctrine can create the ``db_name`` database for you: @@ -609,10 +610,6 @@ the :ref:`doctrine-queries` section. Automatically Fetching Objects (EntityValueResolver) ---------------------------------------------------- -.. versionadded:: 6.2 - - Entity Value Resolver was introduced in Symfony 6.2. - .. versionadded:: 2.7.1 Autowiring of the ``EntityValueResolver`` was introduced in DoctrineBundle 2.7.1. @@ -761,11 +758,6 @@ variable. Let's say you pass the page limit of a list in a query parameter:: ): Response { } -.. versionadded:: 6.4 - - The support for the ``request`` variable in expressions was introduced - in Symfony 6.4. - MapEntity Options ~~~~~~~~~~~~~~~~~ diff --git a/doctrine/events.rst b/doctrine/events.rst index 4046191998a..23373d827f4 100644 --- a/doctrine/events.rst +++ b/doctrine/events.rst @@ -34,7 +34,7 @@ to learn everything about them. .. seealso:: - This article covers listeners and subscribers for Doctrine ORM. If you are + This article covers listeners for Doctrine ORM. If you are using ODM for MongoDB, read the `DoctrineMongoDBBundle documentation`_. Doctrine Lifecycle Callbacks @@ -334,7 +334,7 @@ listener in the Symfony application by creating a new service for it and # this is the only required option for the lifecycle listener tag event: 'postPersist' - # listeners can define their priority in case multiple subscribers or listeners are associated + # listeners can define their priority in case listeners are associated # to the same event (default priority = 0; higher numbers = listener is run earlier) priority: 500 @@ -352,7 +352,7 @@ listener in the Symfony application by creating a new service for it and @@ -381,7 +381,7 @@ listener in the Symfony application by creating a new service for it and // this is the only required option for the lifecycle listener tag 'event' => 'postPersist', - // listeners can define their priority in case multiple subscribers or listeners are associated + // listeners can define their priority in case multiple listeners are associated // to the same event (default priority = 0; higher numbers = listener is run earlier) 'priority' => 500, @@ -395,28 +395,11 @@ listener in the Symfony application by creating a new service for it and The `AsDoctrineListener`_ attribute was introduced in DoctrineBundle 2.7.2. -.. tip:: - - Symfony loads (and instantiates) Doctrine listeners only when the related - Doctrine event is actually fired; whereas Doctrine subscribers are always - loaded (and instantiated) by Symfony, making them less performant. - .. tip:: The value of the ``connection`` option can also be a :ref:`configuration parameter `. -Doctrine Lifecycle Subscribers ------------------------------- - -.. deprecated:: 6.3 - - Lifecycle subscribers are deprecated starting from Symfony 6.3. - -This was another way of listening to events provided by Doctrine. However, they -were deprecated in Symfony 6.3 and it's no longer recommended to use them. -Instead, use any of the other alternatives shown above. - .. _`Doctrine`: https://www.doctrine-project.org/ .. _`lifecycle events`: https://www.doctrine-project.org/projects/doctrine-orm/en/current/reference/events.html#lifecycle-events .. _`official docs about Doctrine events`: https://www.doctrine-project.org/projects/doctrine-orm/en/current/reference/events.html diff --git a/form/unit_testing.rst b/form/unit_testing.rst index e191676215c..fbaa067858e 100644 --- a/form/unit_testing.rst +++ b/form/unit_testing.rst @@ -249,9 +249,4 @@ All you need to do is to implement the :method:`Symfony\\Bridge\\Twig\\Test\\FormLayoutTestCase::getTwigExtensions` and the :method:`Symfony\\Bridge\\Twig\\Test\\FormLayoutTestCase::getThemes` methods. -.. versionadded:: 6.4 - - The :class:`Symfony\\Bridge\\Twig\\Test\\FormLayoutTestCase` class was - introduced in Symfony 6.4. - .. _`PHPUnit data providers`: https://docs.phpunit.de/en/9.6/writing-tests-for-phpunit.html#data-providers diff --git a/forms.rst b/forms.rst index 20073770325..8b040358782 100644 --- a/forms.rst +++ b/forms.rst @@ -298,13 +298,6 @@ Now that the form has been created, the next step is to render it:: Internally, the ``render()`` method calls ``$form->createView()`` to transform the form into a *form view* instance. -.. deprecated:: 6.2 - - Prior to Symfony 6.2, you had to use ``$this->render(..., ['form' => $form->createView()])`` - or the ``renderForm()`` method to render the form. The ``renderForm()`` - method is deprecated in favor of directly passing the ``FormInterface`` - instance to ``render()``. - Then, use some :ref:`form helper functions ` to render the form contents: diff --git a/frontend/asset_mapper.rst b/frontend/asset_mapper.rst index 0ac04f18e14..ae47c9683c7 100644 --- a/frontend/asset_mapper.rst +++ b/frontend/asset_mapper.rst @@ -1,10 +1,6 @@ AssetMapper: Simple, Modern CSS & JS Management =============================================== -.. versionadded:: 6.3 - - The AssetMapper component was introduced in Symfony 6.3. - The AssetMapper component lets you write modern JavaScript and CSS without the complexity of using a bundler. Browsers *already* support many modern JavaScript features like the ``import`` statement and ES6 classes. And the HTTP/2 protocol means that @@ -217,10 +213,6 @@ command to download the files on other computers if some are missing: $ php bin/console importmap:install -.. versionadded:: 6.4 - - The ``importmap:install`` command was introduced in Symfony 6.4. - You can check for available updates for your third-party packages by running: .. code-block:: terminal @@ -231,10 +223,6 @@ You can check for available updates for your third-party packages by running: # check for updates for the given list of packages $ php bin/console importmap:outdated bootstrap lodash -.. versionadded:: 6.4 - - The ``importmap:outdated`` command was introduced in Symfony 6.4. - To update third-party packages in your ``importmap.php`` file, run: .. code-block:: terminal @@ -391,10 +379,6 @@ from inside ``app.js``: Handling CSS ------------ -.. versionadded:: 6.4 - - The ability to import CSS files was introduced in Symfony 6.4. - CSS can be added to your page by importing it from a JavaScript file. The default ``assets/app.js`` already imports ``assets/styles/app.css``: @@ -651,10 +635,6 @@ validate the performance of your site! Performance: Understanding Preloading ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. versionadded:: 6.4 - - Automatic preloading of JavaScript files was introduced in Symfony 6.4. - One issue that LightHouse may report is: Avoid Chaining Critical Requests @@ -687,11 +667,6 @@ even though it hasn't yet seen the ``import`` statement for them. Additionally, if the :doc:`WebLink Component ` is available in your application, Symfony will add a ``Link`` header in the response to preload the CSS files. -.. versionadded:: 6.4 - - Automatic preloading of CSS files when WebLink is available was - introduced in Symfony 6.4. - Frequently Asked Questions -------------------------- @@ -942,10 +917,6 @@ is useful if you want to avoid leaking sensitive files like ``.env`` or This option is enabled by default. -.. versionadded:: 6.4 - - The ``exclude_dotfiles`` option was introduced in Symfony 6.4. - .. _config-importmap-polyfill: ``framework.asset_mapper.importmap_polyfill`` @@ -971,12 +942,6 @@ the polyfill loading. $ php bin/console importmap:require es-module-shims -.. versionadded:: 6.4 - - Passing an importmap name in ``importmap_polyfill`` was - introduced in Symfony 6.4. Prior to this, you could pass ``false`` - or a custom URL to load the polyfill. - ``framework.asset_mapper.importmap_script_attributes`` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -1109,10 +1074,6 @@ command as part of your CI to be warned anytime a new vulnerability is found. The command takes a ``--format`` option to choose the output format between ``txt`` and ``json``. -.. versionadded:: 6.4 - - The ``importmap:audit`` command was introduced in Symfony 6.4. - .. _latest asset-mapper recipe: https://github.com/symfony/recipes/tree/main/symfony/asset-mapper .. _import statement: https://caniuse.com/es6-module-dynamic-import .. _ES6: https://caniuse.com/es6 diff --git a/html_sanitizer.rst b/html_sanitizer.rst index 1f451bfb867..6a5195880c2 100644 --- a/html_sanitizer.rst +++ b/html_sanitizer.rst @@ -1,10 +1,6 @@ HTML Sanitizer ============== -.. versionadded:: 6.1 - - The HTML Sanitizer component was introduced in Symfony 6.1. - The HTML Sanitizer component aims at sanitizing/cleaning untrusted HTML code (e.g. created by a WYSIWYG editor in the browser) into HTML that can be trusted. It is based on the `HTML Sanitizer W3C Standard Proposal`_. @@ -1012,11 +1008,6 @@ increase or decrease this limit: It is possible to disable this length limit by setting the max input length to ``-1``. Beware that it may expose your application to `DoS attacks`_. -.. versionadded:: 6.4 - - The support for disabling the length limit of the HTML sanitizer was - introduced in Symfony 6.4. - Custom Attribute Sanitizers ~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/http_cache.rst b/http_cache.rst index e1f1a57399c..38badf3a5c4 100644 --- a/http_cache.rst +++ b/http_cache.rst @@ -229,10 +229,6 @@ The *easiest* way to cache a response is by caching it for a specific amount of return $response; } -.. versionadded:: 6.2 - - The ``#[Cache()]`` attribute was introduced in Symfony 6.2. - Thanks to this new code, your HTTP response will have the following header: .. code-block:: text diff --git a/http_cache/esi.rst b/http_cache/esi.rst index aaf1de564c1..52a09fb16a7 100644 --- a/http_cache/esi.rst +++ b/http_cache/esi.rst @@ -279,8 +279,4 @@ The ``render_esi`` helper supports three other useful options: ``absolute_uri`` If set to true, an absolute URI will be generated. **default**: ``false`` -.. versionadded:: 6.2 - - The ``absolute_uri`` option was introduced in Symfony 6.2. - .. _`ESI`: https://www.w3.org/TR/esi-lang/ diff --git a/http_client.rst b/http_client.rst index 429be01c32e..1966dfba064 100644 --- a/http_client.rst +++ b/http_client.rst @@ -150,10 +150,18 @@ brings most of the available options with type-hinted getters and setters:: $this->client = $client->withOptions( (new HttpOptions()) ->setBaseUri('https://...') + // replaces *all* headers at once, and deletes the headers you do not provide ->setHeaders(['header-name' => 'header-value']) + // set or replace a single header using addHeader() + ->setHeader('another-header-name', 'another-header-value') ->toArray() ); +.. versionadded:: 7.1 + + The :method:`Symfony\\Component\\HttpClient\\HttpOptions::setHeader` + method was introduced in Symfony 7.1. + Some options are described in this guide: * `Authentication`_ @@ -628,13 +636,6 @@ of the opened file, but you can configure both with the PHP streaming configurat stream_context_set_option($fileHandle, 'http', 'filename', 'the-name.txt'); stream_context_set_option($fileHandle, 'http', 'content_type', 'my/content-type'); -.. versionadded:: 6.3 - - The feature to upload files using handles was introduced in Symfony 6.3. - In previous Symfony versions you had to encode the body contents according - to the ``multipart/form-data`` content-type using the :doc:`Symfony Mime ` - component. - .. tip:: When using multidimensional arrays the :class:`Symfony\\Component\\Mime\\Part\\Multipart\\FormDataPart` @@ -727,10 +728,6 @@ when using any HTTP method and ``500``, ``504``, ``507`` and ``510`` when using an HTTP `idempotent method`_. Use the ``max_retries`` setting to configure the amount of times a request is retried. -.. versionadded:: 6.4 - - The ``max_retries`` options was introduced in Symfony 6.4. - Check out the full list of configurable :ref:`retry_failed options ` to learn how to tweak each of them to fit your application needs. @@ -750,10 +747,6 @@ each retry. Retry Over Several Base URIs ............................ -.. versionadded:: 6.3 - - The multiple ``base_uri`` feature was added in Symfony 6.3. - The ``RetryableHttpClient`` can be configured to use multiple base URIs. This feature provides increased flexibility and reliability for making HTTP requests. Pass an array of base URIs as option ``base_uri`` when making a @@ -972,11 +965,6 @@ If you want to define your own logic to handle variables of URI templates, you can do so by redefining the ``http_client.uri_template_expander`` alias. Your service must be invokable. -.. versionadded:: 6.3 - - The :class:`Symfony\\Component\\HttpClient\\UriTemplateHttpClient` was - introduced in Symfony 6.3. - Performance ----------- @@ -1540,10 +1528,6 @@ to wrap your HTTP client, open a connection to a server that responds with a use the :method:`Symfony\\Component\\HttpClient\\Chunk\\ServerSentEvent::getArrayData` method to directly get the decoded JSON as array. -.. versionadded:: 6.3 - - The ``ServerSentEvent::getArrayData()`` method was introduced in Symfony 6.3. - Interoperability ---------------- @@ -1661,10 +1645,6 @@ You can also pass a set of default options to your client thanks to the // ... -.. versionadded:: 6.2 - - The ``Psr18Client::withOptions()`` method was introduced in Symfony 6.2. - HTTPlug ~~~~~~~ @@ -1766,10 +1746,6 @@ You can also pass a set of default options to your client thanks to the // ... -.. versionadded:: 6.2 - - The ``HttplugClient::withOptions()`` method was introduced in Symfony 6.2. - Native PHP Streams ~~~~~~~~~~~~~~~~~~ @@ -1937,6 +1913,20 @@ in order when requests are made:: $response1 = $client->request('...'); // returns $responses[0] $response2 = $client->request('...'); // returns $responses[1] +It is also possible to create a +:class:`Symfony\\Component\\HttpClient\\Response\\MockResponse` directly +from a file, which is particularly useful when storing your response +snapshots in files:: + + use Symfony\Component\HttpClient\Response\MockResponse; + + $response = MockResponse::fromFile('tests/fixtures/response.xml'); + +.. versionadded:: 7.1 + + The :method:`Symfony\\Component\\HttpClient\\Response\\MockResponse::fromFile` + method was introduced in Symfony 7.1. + Another way of using :class:`Symfony\\Component\\HttpClient\\MockHttpClient` is to pass a callback that generates the responses dynamically when it's called:: @@ -2111,9 +2101,18 @@ You can use :class:`Symfony\\Component\\HttpClient\\Response\\JsonMockResponse` 'foo' => 'bar', ]); -.. versionadded:: 6.3 +Just like :class:`Symfony\\Component\\HttpClient\\Response\\MockResponse`, you can +also create a :class:`Symfony\\Component\\HttpClient\\Response\\JsonMockResponse` +directly from a file:: - The ``JsonMockResponse`` was introduced in Symfony 6.3. + use Symfony\Component\HttpClient\Response\JsonMockResponse; + + $response = JsonMockResponse::fromFile('tests/fixtures/response.json'); + +.. versionadded:: 7.1 + + The :method:`Symfony\\Component\\HttpClient\\Response\\JsonMockResponse::fromFile` + method was introduced in Symfony 7.1. Testing Request Data ~~~~~~~~~~~~~~~~~~~~ @@ -2266,10 +2265,6 @@ will find the associated response based on the request method, URL and body (if Note that **this won't work** if the request body or URI is random / always changing (e.g. if it contains current date or random UUIDs). -.. versionadded:: 6.4 - - The ``HarFileResponseFactory`` was introduced in Symfony 6.4. - Testing Network Transport Exceptions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -2316,12 +2311,6 @@ you to do so, by yielding the exception from its body:: } } -.. versionadded:: 6.1 - - Being allowed to pass an exception directly to the body of a - :class:`Symfony\\Component\\HttpClient\\Response\\MockResponse` was - introduced in Symfony 6.1. - .. _`cURL PHP extension`: https://www.php.net/curl .. _`Zlib PHP extension`: https://www.php.net/zlib .. _`PSR-17`: https://www.php-fig.org/psr/psr-17/ diff --git a/introduction/from_flat_php_to_symfony.rst b/introduction/from_flat_php_to_symfony.rst index 7386f629546..3ae6a16d8a3 100644 --- a/introduction/from_flat_php_to_symfony.rst +++ b/introduction/from_flat_php_to_symfony.rst @@ -240,7 +240,7 @@ the ``templates/layout.php``: You now have a setup that will allow you to reuse the layout. Unfortunately, to accomplish this, you're forced to use a few ugly PHP functions (``ob_start()``, ``ob_get_clean()``) in the template. Symfony -solves this using a `Templating`_ component. You'll see it in action shortly. +solves this using `Twig`_. You'll see it in action shortly. Adding a Blog "show" Page ------------------------- @@ -568,9 +568,8 @@ nice way to group related pages. The controller functions are also sometimes cal The two controllers (or actions) are still lightweight. Each uses the :doc:`Doctrine ORM library ` to retrieve objects from the -database and the Templating component to render a template and return a -``Response`` object. The ``list.html.twig`` template is now quite a bit simpler, -and uses Twig: +database and Twig to render a template and return a ``Response`` object. +The ``list.html.twig`` template is now quite a bit simpler, and uses Twig: .. code-block:: html+twig @@ -677,7 +676,7 @@ migrating the blog from flat PHP to Symfony has improved your life: :doc:`routing `, or rendering :doc:`controllers `; * Symfony gives you **access to open source tools** such as `Doctrine`_ and the - `Templating`_, :doc:`Security `, :doc:`Form `, + `Twig`_, :doc:`Security `, :doc:`Form `, `Validator`_ and `Translation`_ components (to name a few); * The application now enjoys **fully-flexible URLs** thanks to the Routing @@ -694,7 +693,7 @@ A good selection of `Symfony community tools`_ can be found on GitHub. .. _`Model-View-Controller`: https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller .. _`Doctrine`: https://www.doctrine-project.org/ -.. _Templating: https://github.com/symfony/templating +.. _Twig: https://github.com/twigphp/twig .. _Translation: https://github.com/symfony/translation .. _`Composer`: https://getcomposer.org .. _`download Composer`: https://getcomposer.org/download/ diff --git a/lock.rst b/lock.rst index 35c3dc5be3c..d70f1d5535b 100644 --- a/lock.rst +++ b/lock.rst @@ -159,11 +159,6 @@ this behavior by using the ``lock`` key like: ; }; -.. versionadded:: 6.1 - - The CSV support (e.g. ``zookeeper://localhost01,localhost02:2181``) in - ZookeeperStore DSN was introduced in Symfony 6.1. - Locking a Resource ------------------ diff --git a/logging/handlers.rst b/logging/handlers.rst index 61ddafca3ec..14079056ba9 100644 --- a/logging/handlers.rst +++ b/logging/handlers.rst @@ -32,7 +32,7 @@ To use it, declare it as a service: $endpoint: "http://127.0.0.1:9200" $index: "monolog" $client: null - $level: !php/const Monolog\Logger::DEBUG + $level: !php/enum Monolog\Level::Debug $bubble: true $elasticsearchVersion: '1.0.0' @@ -56,7 +56,7 @@ To use it, declare it as a service: http://127.0.0.1:9200 monolog - Monolog\Logger::DEBUG + Monolog\Level::Debug true 1.0.0 @@ -66,7 +66,7 @@ To use it, declare it as a service: .. code-block:: php // config/services.php - use Monolog\Logger; + use Monolog\Level; use Symfony\Bridge\Monolog\Handler\ElasticsearchLogstashHandler; $container->register(ElasticsearchLogstashHandler::class); @@ -77,7 +77,7 @@ To use it, declare it as a service: '$endpoint' => "http://127.0.0.1:9200", '$index' => "monolog", '$client' => null, - '$level' => Logger::DEBUG, + '$level' => Level::Debug, '$bubble' => true, '$elasticsearchVersion' => '1.0.0', ]) diff --git a/logging/monolog_console.rst b/logging/monolog_console.rst index fabccc72e62..e3efc9f0262 100644 --- a/logging/monolog_console.rst +++ b/logging/monolog_console.rst @@ -54,7 +54,7 @@ The example above could then be rewritten as:: $this->logger->debug('Some info'); $this->logger->notice('Some more info'); - // ... + return Command::SUCCESS; } } diff --git a/mailer.rst b/mailer.rst index 395d09e3078..abb5589a1fb 100644 --- a/mailer.rst +++ b/mailer.rst @@ -105,6 +105,7 @@ via a third-party provider: Service Install with Webhook support ===================== =============================================== =============== `Amazon SES`_ ``composer require symfony/amazon-mailer`` +`Azure`_ ``composer require symfony/azure-mailer`` `Brevo`_ ``composer require symfony/brevo-mailer`` yes `Infobip`_ ``composer require symfony/infobip-mailer`` `Mailgun`_ ``composer require symfony/mailgun-mailer`` yes @@ -117,20 +118,9 @@ Service Install with Webhook su `SendGrid`_ ``composer require symfony/sendgrid-mailer`` yes ===================== =============================================== =============== -.. versionadded:: 6.2 +.. versionadded:: 7.1 - The Infobip integration was introduced in Symfony 6.2 and the ``MailPace`` - integration was renamed in Symfony 6.2 (in previous Symfony versions it was - called ``OhMySMTP``). - -.. versionadded:: 6.3 - - The MailerSend integration was introduced in Symfony 6.3. - -.. versionadded:: 6.4 - - The ``Brevo`` (in previous Symfony versions it was called ``Sendinblue``) - and ``Scaleway`` integrations were introduced in Symfony 6.4. + The Azure integration was introduced in Symfony 7.1. .. note:: @@ -184,6 +174,8 @@ party provider: | | - HTTP ses+https://ACCESS_KEY:SECRET_KEY@default | | | - API ses+api://ACCESS_KEY:SECRET_KEY@default | +------------------------+-----------------------------------------------------+ +| `Azure`_ | - API azure+api://ACS_RESOURCE_NAME:KEY@default | ++------------------------+-----------------------------------------------------+ | `Brevo`_ | - SMTP brevo+smtp://USERNAME:PASSWORD@default | | | - HTTP n/a | | | - API brevo+api://KEY@default | @@ -229,10 +221,6 @@ party provider: | | - API sendgrid+api://KEY@default | +------------------------+-----------------------------------------------------+ -.. versionadded:: 6.3 - - The ``sandbox`` option in ``Mailjet`` API was introduced in Symfony 6.3. - .. caution:: If your credentials contain special characters, you must URL-encode them. @@ -352,10 +340,6 @@ may be specified as SHA1 or MD5 hash:: $dsn = 'smtp://user:pass@smtp.example.com?peer_fingerprint=6A1CF3B08D175A284C30BC10DE19162307C7286E'; -.. versionadded:: 6.4 - - The ``peer_fingerprint`` option was introduced in Symfony 6.4. - Overriding default SMTP authenticators ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -381,11 +365,6 @@ This can be done from ``EsmtpTransport`` constructor or using the // Option 2: call a method to redefine the authenticators $transport->setAuthenticators([new XOAuth2Authenticator()]); -.. versionadded:: 6.3 - - The ``$authenticators`` constructor parameter and the ``setAuthenticators()`` - method were introduced in Symfony 6.3. - Other Options ~~~~~~~~~~~~~ @@ -421,10 +400,6 @@ Other Options $dsn = 'smtps://smtp.example.com?max_per_second=2' - .. versionadded:: 6.2 - - The ``max_per_second`` option was introduced in Symfony 6.2. - Creating & Sending Messages --------------------------- @@ -608,12 +583,6 @@ the ``DataPart``:: ->addPart(new DataPart(fopen('/path/to/documents/contract.doc', 'r'))) ; -.. deprecated:: 6.2 - - In Symfony versions previous to 6.2, the method ``attachPart()`` could be - used to add attachments. This method has been deprecated and replaced - with ``addPart()``. - Embedding Images ~~~~~~~~~~~~~~~~ @@ -663,15 +632,6 @@ method to define a custom Content-ID for the image and use it as its ``cid`` ref ->html('... ...') ; -.. versionadded:: 6.1 - - The support of embedded images as HTML backgrounds was introduced in Symfony - 6.1. - -.. versionadded:: 6.3 - - The support of custom ``cid`` for embedded images was introduced in Symfony 6.3. - .. _mailer-configure-email-globally: Configuring Emails Globally @@ -839,11 +799,6 @@ for Twig templates:: ]) ; -.. versionadded:: 6.4 - - The :method:`Symfony\\Bridge\\Twig\\Mime\\TemplatedEmail::locale` method - was introduced in Symfony 6.4. - Then, create the template: .. code-block:: html+twig @@ -1437,11 +1392,6 @@ the "rendering" of the email (computed headers, body rendering, ...) is also deferred and will only happen just before the email is sent by the Messenger handler. -.. versionadded:: 6.2 - - The following example about rendering the email before calling - ``$mailer->send($email)`` works as of Symfony 6.2. - When sending an email asynchronously, its instance must be serializable. This is always the case for :class:`Symfony\\Bridge\\Twig\\Mime\\Email` instances, but when sending a @@ -1515,11 +1465,6 @@ disable asynchronous delivery. an open connection to the SMTP server in between sending emails. You can do so by using the ``stop()`` method. -.. versionadded:: 6.1 - - The :method:`Symfony\\Component\\Mailer\\Transport\\Smtp\\SmtpTransport::stop` - method was made public in Symfony 6.1. - You can also select the transport by adding an ``X-Bus-Transport`` header (which will be removed automatically from the final message):: @@ -1527,10 +1472,6 @@ will be removed automatically from the final message):: $email->getHeaders()->addTextHeader('X-Bus-Transport', 'app.another_bus'); $mailer->send($email); -.. versionadded:: 6.2 - - The ``X-Bus-Transport`` header support was introduced in Symfony 6.2. - Adding Tags and Metadata to Emails ---------------------------------- @@ -1572,17 +1513,9 @@ The following transports only support metadata: * Amazon SES (note that Amazon refers to this feature as "tags", but Symfony calls it "metadata" because it contains a key and a value) -.. versionadded:: 6.1 - - Metadata support for Amazon SES was introduced in Symfony 6.1. - Draft Emails ------------ -.. versionadded:: 6.1 - - ``Symfony\Component\Mime\DraftEmail`` was introduced in 6.1. - :class:`Symfony\\Component\\Mime\\DraftEmail` is a special instance of :class:`Symfony\\Component\\Mime\\Email`. Its purpose is to build up an email (with body, attachments, etc) and make available to download as an ``.eml`` with @@ -1607,7 +1540,7 @@ Here's an example of making one available to download:: { $message = (new DraftEmail()) ->html($this->renderView(/* ... */)) - ->attach(/* ... */) + ->addPart(/* ... */) ; $response = new Response($message->toString()); @@ -1654,10 +1587,6 @@ the email is sent:: $event->addStamp(new SomeMessengerStamp()); } -.. versionadded:: 6.2 - - Methods ``addStamp()`` and ``getStamps()`` were introduced in Symfony 6.2. - If you want to stop the Message from being sent, call ``reject()`` (it will also stop the event propagation):: @@ -1668,10 +1597,6 @@ also stop the event propagation):: $event->reject(); } -.. versionadded:: 6.3 - - The ``reject()`` method was introduced in Symfony 6.3. - Execute this command to find out which listeners are registered for this event and their priorities: @@ -1684,10 +1609,6 @@ SentMessageEvent **Event Class**: :class:`Symfony\\Component\\Mailer\\Event\\SentMessageEvent` -.. versionadded:: 6.2 - - The ``SentMessageEvent`` event was introduced in Symfony 6.2. - ``SentMessageEvent`` allows you to act on the :class:`Symfony\\Component\\\Mailer\\\SentMessage` class to access the original message (``getOriginalMessage()``) and some debugging information (``getDebug()``) such as the HTTP calls made by the HTTP transports, @@ -1719,10 +1640,6 @@ FailedMessageEvent **Event Class**: :class:`Symfony\\Component\\Mailer\\Event\\FailedMessageEvent` -.. versionadded:: 6.2 - - The ``FailedMessageEvent`` event was introduced in Symfony 6.2. - ``FailedMessageEvent`` allows acting on the the initial message in case of a failure:: use Symfony\Component\EventDispatcher\EventSubscriberInterface; @@ -1772,10 +1689,6 @@ to test if sending emails works correctly: This command bypasses the :doc:`Messenger bus `, if configured, to ease testing emails even when the Messenger consumer is not running. -.. versionadded:: 6.2 - - The ``mailer:test`` command was introduced in Symfony 6.2. - Disabling Delivery ~~~~~~~~~~~~~~~~~~ @@ -1917,6 +1830,7 @@ the :class:`Symfony\\Bundle\\FrameworkBundle\\Test\\MailerAssertionsTrait`:: handler. .. _`Amazon SES`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Mailer/Bridge/Amazon/README.md +.. _`Azure`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Mailer/Bridge/Azure/README.md .. _`App Password`: https://support.google.com/accounts/answer/185833 .. _`Brevo`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Mailer/Bridge/Brevo/README.md .. _`default_socket_timeout`: https://www.php.net/manual/en/filesystem.configuration.php#ini.default-socket-timeout diff --git a/messenger.rst b/messenger.rst index 2165480247a..5a032871778 100644 --- a/messenger.rst +++ b/messenger.rst @@ -71,10 +71,6 @@ message class (or a message interface):: methods. You may use the attribute on as many methods in a single class as you like, allowing you to group the handling of multiple related types of messages. -.. versionadded:: 6.1 - - Support for ``#[AsMessageHandler]`` on methods was introduced in Symfony 6.1. - Thanks to :ref:`autoconfiguration ` and the ``SmsNotification`` type-hint, Symfony knows that this handler should be called when an ``SmsNotification`` message is dispatched. Most of the time, this is all you need to do. But you can @@ -349,11 +345,6 @@ to multiple transports: name as its only argument. For more information about stamps, see `Envelopes & Stamps`_. -.. versionadded:: 6.2 - - The :class:`Symfony\\Component\\Messenger\\Stamp\\TransportNamesStamp` - stamp was introduced in Symfony 6.2. - Doctrine Entities in Messages ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -494,6 +485,17 @@ The first argument is the receiver's name (or service id if you routed to a custom service). By default, the command will run forever: looking for new messages on your transport and handling them. This command is called your "worker". +If you want to consume messages from all available receivers, you can use the +command with the ``--all`` option: + +.. code-block:: terminal + + $ php bin/console messenger:consume --all + +.. versionadded:: 7.1 + + The ``--all`` option was introduced in Symfony 7.1. + .. tip:: In a development environment and if you're using the Symfony CLI tool, @@ -691,10 +693,6 @@ of some or all transports: In order for this command to work, the configured transport's receiver must implement :class:`Symfony\\Component\\Messenger\\Transport\\Receiver\\MessageCountAwareInterface`. -.. versionadded:: 6.2 - - The ``messenger:stats`` command was introduced in Symfony 6.2. - .. _messenger-supervisor: Supervisor Configuration @@ -780,10 +778,6 @@ However, you might prefer to use different POSIX signals for graceful shutdown. You can override default ones by setting the ``framework.messenger.stop_worker_on_signals`` configuration option. -.. versionadded:: 6.3 - - The ``framework.messenger.stop_worker_on_signals`` option was introduced in Symfony 6.3. - In some cases the ``SIGTERM`` signal is sent by Supervisor itself (e.g. stopping a Docker container having Supervisor as its entrypoint). In these cases you need to add a ``stopwaitsecs`` key to the program configuration (with a value @@ -903,21 +897,11 @@ properties in the ``reset()`` method. If you don't want to reset the container, add the ``--no-reset`` option when running the ``messenger:consume`` command. -.. deprecated:: 6.1 - - In Symfony versions previous to 6.1, the service container didn't reset - automatically between messages and you had to set the - ``framework.messenger.reset_on_message`` option to ``true``. - .. _messenger-retries-failures: Rate Limited Transport ~~~~~~~~~~~~~~~~~~~~~~ -.. versionadded:: 6.2 - - The ``rate_limiter`` option was introduced in Symfony 6.2. - Sometimes you might need to rate limit your message worker. You can configure a rate limiter on a transport (requires the :doc:`RateLimiter component `) by setting its ``rate_limiter`` option: @@ -1063,10 +1047,6 @@ this is configurable for each transport: the serialized form of the message is saved, which prevents to serialize it again if the message is later retried. - .. versionadded:: 6.1 - - The ``SerializedMessageStamp`` class was introduced in Symfony 6.1. - Avoiding Retrying ~~~~~~~~~~~~~~~~~ @@ -1183,15 +1163,6 @@ to retry them: # remove all messages in the failure transport $ php bin/console messenger:failed:remove --all -.. versionadded:: 6.2 - - The ``--class-filter`` and ``--stats`` options were introduced in Symfony 6.2. - -.. versionadded:: 6.4 - - The ``--all`` option was introduced in Symfony 6.4. - - If the message fails again, it will be re-sent back to the failure transport due to the normal :ref:`retry rules `. Once the max retry has been hit, the message will be discarded permanently. @@ -1467,10 +1438,6 @@ The transport has a number of options: ``exchange[type]`` Type of exchange ``fanout`` ============================================ ================================================= =================================== -.. versionadded:: 6.1 - - The ``connection_name`` option was introduced in Symfony 6.1. - You can also configure AMQP-specific settings on your message by adding :class:`Symfony\\Component\\Messenger\\Bridge\\Amqp\\Transport\\AmqpStamp` to your Envelope:: @@ -1691,13 +1658,13 @@ read_timeout Float, value in seconds ``0`` timeout Connection timeout. Float, value in ``0`` seconds default indicates unlimited sentinel_master String, if null or empty Sentinel null - support is disabled +redis_sentinel support is disabled ======================= ===================================== ================================= -.. versionadded:: 6.1 +.. versionadded:: 7.1 - The ``persistent_id``, ``retry_interval``, ``read_timeout``, ``timeout``, and - ``sentinel_master`` options were introduced in Symfony 6.1. + The option `redis_sentinel` as an alias for `sentinel_master` was introduced + in Symfony 7.1. .. caution:: @@ -1791,12 +1758,6 @@ during a request:: } } -.. versionadded:: 6.3 - - The namespace of the ``InMemoryTransport`` class changed in Symfony 6.3 from - ``Symfony\Component\Messenger\Transport\InMemoryTransport`` to - ``Symfony\Component\Messenger\Transport\InMemory\InMemoryTransport``. - The transport has a number of options: ``serialize`` (boolean, default: ``false``) @@ -1863,10 +1824,6 @@ The transport has a number of options: ``wait_time`` `Long polling`_ duration in seconds 20 ====================== ====================================== =================================== -.. versionadded:: 6.1 - - The ``session_token`` option was introduced in Symfony 6.1. - .. note:: The ``wait_time`` parameter defines the maximum duration Amazon SQS should @@ -1896,14 +1853,6 @@ The transport has a number of options: You can learn more about middlewares in :ref:`the dedicated section `. - .. versionadded:: 6.4 - - The - :class:`Symfony\\Component\\Messenger\\Bridge\\AmazonSqs\\Middleware\\AddFifoStampMiddleware`, - :class:`Symfony\\Component\\Messenger\\Bridge\\AmazonSqs\\MessageDeduplicationAwareInterface` - and :class:`Symfony\\Component\\Messenger\\Bridge\\AmazonSqs\\MessageGroupAwareInterface` - were introduced in Symfony 6.4. - FIFO queues don't support setting a delay per message, a value of ``delay: 0`` is required in the retry strategy settings. @@ -2031,12 +1980,6 @@ contains many useful information such as the exit code or the output of the process. You can refer to the page dedicated on :ref:`handler results ` for more information. -.. versionadded:: 6.4 - - The :class:`Symfony\\Component\\Console\\Messenger\\RunCommandMessage` - and :class:`Symfony\\Component\\Console\\Messenger\\RunCommandContext` - classes were introduced in Symfony 6.4. - Trigger An External Process ~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -2069,12 +2012,6 @@ contains many useful information such as the exit code or the output of the process. You can refer to the page dedicated on :ref:`handler results ` for more information. -.. versionadded:: 6.4 - - The :class:`Symfony\\Component\\Process\\Messenger\\RunProcessMessage` - and :class:`Symfony\\Component\\Process\\Messenger\\RunProcessContext` - classes were introduced in Symfony 6.4. - Pinging A Webservice -------------------- @@ -2115,11 +2052,6 @@ The handler will return a :class:`Symfony\\Contracts\\HttpClient\\ResponseInterface`, allowing you to gather and process information returned by the HTTP request. -.. versionadded:: 6.4 - - The :class:`Symfony\\Component\\HttpClient\\Messenger\\PingWebhookMessage` - class was introduced in Symfony 6.4. - Getting Results from your Handlers ---------------------------------- @@ -2354,12 +2286,6 @@ A single handler class can handle multiple messages. For that add the } } -.. deprecated:: 6.2 - - Implementing the :class:`Symfony\\Component\\Messenger\\Handler\\MessageSubscriberInterface` - is another way to handle multiple messages with one handler class. This - interface was deprecated in Symfony 6.2. - .. _messenger-transactional-messages: Transactional Messages: Handle New Messages After Handling is Done @@ -2478,7 +2404,7 @@ will not be rolled back. If ``WhenUserRegisteredThenSendWelcomeEmail`` throws an exception, that exception will be wrapped into a ``DelayedMessageHandlingException``. Using - ``DelayedMessageHandlingException::getExceptions`` will give you all + ``DelayedMessageHandlingException::getWrappedExceptions`` will give you all exceptions that are thrown while handling a message with the ``DispatchAfterCurrentBusStamp``. @@ -2656,11 +2582,6 @@ provided in order to ease the declaration of these special handlers:: } } -.. versionadded:: 6.3 - - The :method:`Symfony\\Component\\Messenger\\Handler\\BatchHandlerTrait::getBatchSize` - method was introduced in Symfony 6.3. - .. note:: When the ``$ack`` argument of ``__invoke()`` is ``null``, the message is @@ -2988,10 +2909,6 @@ of the process. For each, the event class is the event name: * :class:`Symfony\\Component\\Messenger\\Event\\WorkerStartedEvent` * :class:`Symfony\\Component\\Messenger\\Event\\WorkerStoppedEvent` -.. versionadded:: 6.2 - - The ``WorkerRateLimitedEvent`` was introduced in Symfony 6.2. - Additional Handler Arguments ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -3040,11 +2957,6 @@ Then your handler will look like this:: } } -.. versionadded:: 6.2 - - The :class:`Symfony\\Component\\Messenger\\Stamp\\HandlerArgumentsStamp` - was introduced in Symfony 6.2. - Message Serializer For Custom Data Formats ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -3251,10 +3163,6 @@ an **event bus**. The event bus could have zero or more subscribers. $eventBus->middleware()->id('validation'); }; -.. versionadded:: 6.2 - - The ``allow_no_senders`` option was introduced in Symfony 6.2. - This will create three new services: * ``command.bus``: autowireable with the :class:`Symfony\\Component\\Messenger\\MessageBusInterface` @@ -3279,9 +3187,6 @@ you can restrict each handler to a specific bus using the ``messenger.message_ha services: App\MessageHandler\SomeCommandHandler: tags: [{ name: messenger.message_handler, bus: command.bus }] - # prevent handlers from being registered twice (or you can remove - # the MessageHandlerInterface that autoconfigure uses to find handlers) - autoconfigure: false .. code-block:: xml @@ -3463,12 +3368,6 @@ will take care of this message to redispatch it through the same bus it was dispatched at first. You can also use the second argument of the ``RedispatchMessage`` constructor to provide transports to use when redispatching the message. -.. versionadded:: 6.3 - - The :class:`Symfony\\Component\\Messenger\\Message\\RedispatchMessage` - and :class:`Symfony\\Component\\Messenger\\Handler\\RedispatchMessageHandler` - classes were introduced in Symfony 6.3. - Learn more ---------- diff --git a/notifier.rst b/notifier.rst index 889a5ba5666..663398a5c0c 100644 --- a/notifier.rst +++ b/notifier.rst @@ -87,47 +87,23 @@ Service Package DSN `Redlink`_ ``symfony/redlink-notifier`` ``redlink://API_KEY:APP_KEY@default?from=SENDER_NAME&version=API_VERSION`` `RingCentral`_ ``symfony/ring-central-notifier`` ``ringcentral://API_TOKEN@default?from=FROM`` `Sendberry`_ ``symfony/sendberry-notifier`` ``sendberry://USERNAME:PASSWORD@default?auth_key=AUTH_KEY&from=FROM`` -`Sendinblue`_ ``symfony/sendinblue-notifier`` ``sendinblue://API_KEY@default?sender=PHONE`` `Sms77`_ ``symfony/sms77-notifier`` ``sms77://API_KEY@default?from=FROM`` `SimpleTextin`_ ``symfony/simple-textin-notifier`` ``simpletextin://API_KEY@default?from=FROM`` `Sinch`_ ``symfony/sinch-notifier`` ``sinch://ACCOUNT_ID:AUTH_TOKEN@default?from=FROM`` `Smsapi`_ ``symfony/smsapi-notifier`` ``smsapi://TOKEN@default?from=FROM`` `SmsBiuras`_ ``symfony/sms-biuras-notifier`` ``smsbiuras://UID:API_KEY@default?from=FROM&test_mode=0`` +`Smsbox`_ ``symfony/smsbox-notifier`` ``smsbox://APIKEY@default?mode=MODE&strategy=STRATEGY&sender=SENDER`` `Smsc`_ ``symfony/smsc-notifier`` ``smsc://LOGIN:PASSWORD@default?from=FROM`` `SMSFactor`_ ``symfony/sms-factor-notifier`` ``sms-factor://TOKEN@default?sender=SENDER&push_type=PUSH_TYPE`` `SpotHit`_ ``symfony/spot-hit-notifier`` ``spothit://TOKEN@default?from=FROM`` `Telnyx`_ ``symfony/telnyx-notifier`` ``telnyx://API_KEY@default?from=FROM&messaging_profile_id=MESSAGING_PROFILE_ID`` `TurboSms`_ ``symfony/turbo-sms-notifier`` ``turbosms://AUTH_TOKEN@default?from=FROM`` `Twilio`_ ``symfony/twilio-notifier`` ``twilio://SID:TOKEN@default?from=FROM`` yes +`Unifonic`_ ``symfony/unifonic-notifier`` ``unifonic://APP_SID@default?from=FROM`` `Vonage`_ ``symfony/vonage-notifier`` ``vonage://KEY:SECRET@default?from=FROM`` yes `Yunpian`_ ``symfony/yunpian-notifier`` ``yunpian://APIKEY@default`` ================== ===================================== ========================================================================================================================= =============== -.. versionadded:: 6.1 - - The 46elks, OrangeSms, KazInfoTeh and Sendberry integrations were introduced in Symfony 6.1. - The ``no_stop_clause`` option in ``OvhCloud`` DSN was introduced in Symfony 6.1. - The ``test`` option in ``Smsapi`` DSN was introduced in Symfony 6.1. - -.. versionadded:: 6.2 - - The ContactEveryone and SMSFactor integrations were introduced in Symfony 6.2. - -.. versionadded:: 6.3 - - The Bandwith, iSendPro, Plivo, RingCentral, SimpleTextin and Termii integrations - were introduced in Symfony 6.3. - The ``from`` option in ``Smsapi`` DSN is optional since Symfony 6.3. - -.. versionadded:: 6.4 - - The `Redlink`_ and `Brevo`_ integrations were introduced in Symfony 6.4. - -.. deprecated:: 6.4 - - The `Sendinblue`_ integration is deprecated since - Symfony 6.4, use the `Brevo`_ integration instead. - .. tip:: Some third party transports, when using the API, support status callbacks @@ -223,14 +199,6 @@ send SMS messages:: } } -.. versionadded:: 6.2 - - The 3rd argument of ``SmsMessage`` (``$from``) was introduced in Symfony 6.2. - -.. versionadded:: 6.3 - - The 4th argument of ``SmsMessage`` (``$options``) was introduced in Symfony 6.3. - The ``send()`` method returns a variable of type :class:`Symfony\\Component\\Notifier\\Message\\SentMessage` which provides information such as the message ID and the original message contents. @@ -255,6 +223,7 @@ integration with these chat services: Service Package DSN ======================================= ==================================== ============================================================================= `AmazonSns`_ ``symfony/amazon-sns-notifier`` ``sns://ACCESS_KEY:SECRET_KEY@default?region=REGION`` +`Bluesky`_ ``symfony/bluesky-notifier`` ``bluesky://USERNAME:PASSWORD@default`` `Chatwork`_ ``symfony/chatwork-notifier`` ``chatwork://API_TOKEN@default?room_id=ID`` `Discord`_ ``symfony/discord-notifier`` ``discord://TOKEN@default?webhook_id=ID`` `FakeChat`_ ``symfony/fake-chat-notifier`` ``fakechat+email://default?to=TO&from=FROM`` or ``fakechat+logger://default`` @@ -275,13 +244,10 @@ Service Package D `Zulip`_ ``symfony/zulip-notifier`` ``zulip://EMAIL:TOKEN@HOST?channel=CHANNEL`` ====================================== ==================================== ============================================================================= -.. versionadded:: 6.2 - - The Zendesk and Chatwork integration were introduced in Symfony 6.2. +.. versionadded:: 7.1 -.. versionadded:: 6.3 - - The LINE Notify, Mastodon and Twitter integrations were introduced in Symfony 6.3. + The ``Bluesky``, ``Unifonic`` and ``Smsbox`` integrations + were introduced in Symfony 7.1. Chatters are configured using the ``chatter_transports`` setting: @@ -462,18 +428,6 @@ Service Package DSN `Pushover`_ ``symfony/pushover-notifier`` ``pushover://USER_KEY:APP_TOKEN@default`` =============== ==================================== ============================================================================== -.. versionadded:: 6.1 - - The Engagespot integration was introduced in Symfony 6.1. - -.. versionadded:: 6.3 - - The PagerDuty and Pushover integrations were introduced in Symfony 6.3. - -.. versionadded:: 6.4 - - The Novu, Ntfy and GoIP integrations were introduced in Symfony 6.4. - To enable a texter, add the correct DSN in your ``.env`` file and configure the ``texter_transports``: @@ -835,10 +789,6 @@ also exists to modify messages sent to those channels. Customize Browser Notifications (Flash Messages) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. versionadded:: 6.1 - - Support for customizing importance levels was introduced in Symfony 6.1. - The default behavior for browser channel notifications is to add a :ref:`flash message ` with ``notification`` as its key. @@ -898,11 +848,6 @@ You can benefit from this class by using it directly or extending the See :ref:`testing documentation ` for the list of available assertions. -.. versionadded:: 6.2 - - The :class:`Symfony\\Bundle\\FrameworkBundle\\Test\\NotificationAssertionsTrait` - was introduced in Symfony 6.2. - Disabling Delivery ------------------ @@ -1005,6 +950,7 @@ is dispatched. Listeners receive a .. _`AllMySms`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/AllMySms/README.md .. _`AmazonSns`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/AmazonSns/README.md .. _`Bandwidth`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/Bandwidth/README.md +.. _`Bluesky`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/Bluesky/README.md .. _`Brevo`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/Brevo/README.md .. _`Chatwork`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/Chatwork/README.md .. _`Clickatell`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/Clickatell/README.md @@ -1052,12 +998,12 @@ is dispatched. Listeners receive a .. _`RocketChat`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/RocketChat/README.md .. _`SMSFactor`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/SmsFactor/README.md .. _`Sendberry`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/Sendberry/README.md -.. _`Sendinblue`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/Sendinblue/README.md .. _`SimpleTextin`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/SimpleTextin/README.md .. _`Sinch`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/Sinch/README.md .. _`Slack`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/Slack/README.md .. _`Sms77`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/Sms77/README.md .. _`SmsBiuras`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/SmsBiuras/README.md +.. _`Smsbox`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/Smsbox/README.md .. _`Smsapi`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/Smsapi/README.md .. _`Smsc`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/Smsc/README.md .. _`SpotHit`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/SpotHit/README.md @@ -1066,6 +1012,7 @@ is dispatched. Listeners receive a .. _`TurboSms`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/TurboSms/README.md .. _`Twilio`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/Twilio/README.md .. _`Twitter`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/Twitter/README.md +.. _`Unifonic`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/Unifonic/README.md .. _`Vonage`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/Vonage/README.md .. _`Yunpian`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/Yunpian/README.md .. _`Zendesk`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/Zendesk/README.md diff --git a/performance.rst b/performance.rst index fac10407759..ca34e95ee37 100644 --- a/performance.rst +++ b/performance.rst @@ -263,10 +263,6 @@ in performance, you can stop generating the file as follows: // ... $container->parameters()->set('debug.container.dump', false); -.. versionadded:: 6.3 - - The ``debug.container.dump`` option was introduced in Symfony 6.3. - .. _profiling-applications: Profiling Symfony Applications diff --git a/profiler.rst b/profiler.rst index 869f41698f2..14fe25bf3d4 100644 --- a/profiler.rst +++ b/profiler.rst @@ -35,10 +35,6 @@ Symfony Profiler, which will look like this: in the ``X-Debug-Token-Link`` HTTP response header. Browse the ``/_profiler`` URL to see all profiles. -.. versionadded:: 6.3 - - Profile garbage collection was introduced in Symfony 6.3. - .. note:: To limit the storage used by profiles on disk, they are probabilistically @@ -91,10 +87,6 @@ look for tokens based on some criteria:: // gets the latest 10 tokens for requests that happened between 2 and 4 days ago $tokens = $profiler->find('', '', 10, '', '4 days ago', '2 days ago'); -.. versionadded:: 6.4 - - Prefixing the URL filter with a ``!`` symbol to negate the query was introduced in Symfony 6.4. - Data Collectors --------------- diff --git a/rate_limiter.rst b/rate_limiter.rst index 970d71c8784..e08d4576b95 100644 --- a/rate_limiter.rst +++ b/rate_limiter.rst @@ -215,6 +215,17 @@ at a rate of another 500 requests every 15 minutes. If you don't make that number of requests, the unused ones don't accumulate (the ``limit`` option prevents that number from being higher than 5,000). +.. tip:: + + All rate-limiters are tagged with the ``rate_limiter`` tag, so you can + find them with a :doc:`tagged iterator ` or + :doc:`locator `. + + .. versionadded:: 7.1 + + The automatic addition of the ``rate_limiter`` tag was introduced + in Symfony 7.1. + Rate Limiting in Action ----------------------- @@ -320,11 +331,6 @@ processes by reserving unused tokens. $limit->wait(); } while (!$limit->isAccepted()); -.. versionadded:: 6.4 - - The support for the ``reserve()`` method for the ``SlidingWindow`` strategy - was introduced in Symfony 6.4. - Exposing the Rate Limiter Status ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -370,19 +376,6 @@ the :class:`Symfony\\Component\\RateLimiter\\Reservation` object returned by the } } -.. versionadded:: 6.4 - - The :method:`Symfony\\Component\\RateLimiter\\Policy\\SlidingWindow::calculateTimeForTokens` - method was introduced in Symfony 6.4. - -.. deprecated:: 6.4 - - The :method:`Symfony\\Component\\RateLimiter\\Policy\\SlidingWindow::getRetryAfter` - method is deprecated since Symfony 6.4. Prior to this version, the - ``getRetryAfter()`` method must be used instead of the - :method:`Symfony\\Component\\RateLimiter\\Policy\\SlidingWindow::calculateTimeForTokens` - method. - .. _rate-limiter-storage: Storing Rate Limiter State diff --git a/reference/attributes.rst b/reference/attributes.rst index 9f98ca30d5e..a9d68ff41d9 100644 --- a/reference/attributes.rst +++ b/reference/attributes.rst @@ -5,11 +5,6 @@ Attributes are the successor of annotations since PHP 8. Attributes are native to the language and Symfony takes full advantage of them across the framework and its different components. -.. deprecated:: 6.4 - - Annotations across the framework are deprecated since Symfony 6.4, you must - only use attributes instead. - Doctrine Bridge ~~~~~~~~~~~~~~~ @@ -90,6 +85,7 @@ Security ~~~~~~~~ * :ref:`CurrentUser ` +* :ref:`IsCsrfTokenValid ` * :ref:`IsGranted ` Serializer diff --git a/reference/configuration/debug.rst b/reference/configuration/debug.rst index 482396d2ae2..62cc40675b2 100644 --- a/reference/configuration/debug.rst +++ b/reference/configuration/debug.rst @@ -17,10 +17,6 @@ key in your application configuration. # environment variables with their actual values $ php bin/console debug:config --resolve-env framework -.. versionadded:: 6.2 - - The ``--resolve-env`` option was introduced in Symfony 6.2. - .. note:: When using XML, you must use the ``http://symfony.com/schema/dic/debug`` diff --git a/reference/configuration/doctrine.rst b/reference/configuration/doctrine.rst index b1f2139034a..e28c50978e1 100644 --- a/reference/configuration/doctrine.rst +++ b/reference/configuration/doctrine.rst @@ -270,13 +270,9 @@ you can control. The following configuration options exist for a mapping: ``type`` ........ -One of ``annotation`` (for PHP annotations; it's the default value), -``attribute`` (for PHP attributes), ``xml``, ``yml``, ``php`` or -``staticphp``. This specifies which type of metadata type your mapping uses. - -.. deprecated:: 6.4 - - Annotations are deprecated since Symfony 6.4, use attributes instead. +One of ``attribute`` (for PHP attributes; it's the default value), +``xml``, ``yml``, ``php`` or ``staticphp``. This specifies which +type of metadata type your mapping uses. See `Doctrine Metadata Drivers`_ for more information about this option. diff --git a/reference/configuration/framework.rst b/reference/configuration/framework.rst index c323f05662b..92a8f399478 100644 --- a/reference/configuration/framework.rst +++ b/reference/configuration/framework.rst @@ -60,10 +60,6 @@ thrown by the application and will turn them into HTTP responses. Starting from Symfony 7.0, the default value of this option will be ``true``. -.. versionadded:: 6.2 - - The ``handle_all_throwables`` option was introduced in Symfony 6.2. - .. _configuration-framework-http_cache: http_cache @@ -124,10 +120,6 @@ skip_response_headers Set of response headers that will never be cached even when the response is cacheable and public. -.. versionadded:: 6.3 - - The ``skip_response_headers`` option was introduced in Symfony 6.3. - allow_reload ............ @@ -167,33 +159,12 @@ which the cache can serve a stale response when an error is encountered (default: 60). This setting is overridden by the stale-if-error HTTP Cache-Control extension (see RFC 5861). -terminate_on_cache_hit -...................... - -**type**: ``boolean`` **default**: ``true`` - -If ``true``, the :ref:`kernel.terminate ` -event is dispatched even when the cache is hit. - -Unless your application needs to process events on cache hits, it's recommended -to set this to ``false`` to improve performance, because it avoids having to -bootstrap the Symfony framework on a cache hit. - -.. versionadded:: 6.2 - - The ``terminate_on_cache_hit`` option was introduced in Symfony 6.2. - -.. deprecated:: 6.2 - - Setting the ``terminate_on_cache_hit`` option to ``true`` was deprecated in - Symfony 6.2 and the option will be removed in Symfony 7.0. - .. _configuration-framework-http_method_override: http_method_override ~~~~~~~~~~~~~~~~~~~~ -**type**: ``boolean`` **default**: (see explanation below) +**type**: ``boolean`` **default**: ``false`` This determines whether the ``_method`` request parameter is used as the intended HTTP method on POST requests. If enabled, the @@ -201,18 +172,6 @@ intended HTTP method on POST requests. If enabled, the method gets called automatically. It becomes the service container parameter named ``kernel.http_method_override``. -The **default value** is: - -* ``true``, if you have an existing application that you've upgraded from an older - Symfony version without resyncing the :doc:`Symfony Flex ` recipes; -* ``false``, if you've created a new Symfony application or updated the Symfony - Flex recipes. This is also the default value starting from Symfony 7.0. - -.. deprecated:: 6.1 - - Not setting a value explicitly for this option is deprecated since Symfony 6.1 - because the default value will change to ``false`` in Symfony 7.0. - .. seealso:: :ref:`Changing the Action and HTTP Method ` of @@ -243,10 +202,6 @@ trust_x_sendfile_type_header **type**: ``boolean`` **default**: ``false`` -.. versionadded:: 6.1 - - The ``trust_x_sendfile_type_header`` option was introduced in Symfony 6.1. - ``X-Sendfile`` is a special HTTP header that tells web servers to replace the response contents by the file that is defined in that header. This improves performance because files are no longer served by your application but directly @@ -333,10 +288,6 @@ feature is to configure it on a system level. First, you can define this option in the ``SYMFONY_IDE`` environment variable, which Symfony reads automatically when ``framework.ide`` config is not set. -.. versionadded:: 6.1 - - ``SYMFONY_IDE`` environment variable support was introduced in Symfony 6.1. - Another alternative is to set the ``xdebug.file_link_format`` option in your ``php.ini`` configuration file. The format to use is the same as for the ``framework.ide`` option, but without the need to escape the percent signs @@ -1052,10 +1003,6 @@ crypto_method The minimum version of TLS to accept. The value must be one of the ``STREAM_CRYPTO_METHOD_TLSv*_CLIENT`` constants defined by PHP. -.. versionadded:: 6.3 - - The ``crypto_method`` option was introduced in Symfony 6.3. - delay ..... @@ -1081,10 +1028,6 @@ extra Arbitrary additional data to pass to the HTTP client for further use. This can be particularly useful when :ref:`decorating an existing client `. -.. versionadded:: 6.3 - - The ``extra`` option has been introduced in Symfony 6.3. - .. _http-headers: headers @@ -1299,10 +1242,6 @@ enough to be sure about the server, so you should combine this with the html_sanitizer ~~~~~~~~~~~~~~ -.. versionadded:: 6.1 - - The HTML sanitizer configuration was introduced in Symfony 6.1. - The ``html_sanitizer`` option (and its children) are used to configure custom HTML sanitizers. Read more about the options in the :ref:`HTML sanitizer documentation `. @@ -1393,10 +1332,6 @@ Set this option to ``true`` to enable the serializer data collector and its profiler panel. When this option is ``true``, all normalizers and encoders are decorated by traceable implementations that collect profiling information about them. -.. versionadded:: 6.1 - - The ``collect_serializer_data`` option was introduced in Symfony 6.1. - rate_limiter ~~~~~~~~~~~~ @@ -1578,10 +1513,6 @@ cache_dir The directory where routing information will be cached. Can be set to ``~`` (``null``) to disable route caching. -.. versionadded:: 6.2 - - The ``cache_dir`` setting was introduced in Symfony 6.2. - secrets ~~~~~~~ @@ -2746,18 +2677,6 @@ settings is configured. .. _reference-validation-enable_annotations: -enable_annotations -.................. - -**type**: ``boolean`` **default**: ``true`` - -If this option is enabled, validation constraints can be defined using annotations or `PHP attributes`_. - -.. deprecated:: 6.4 - - This option is deprecated since Symfony 6.4, use the ``enable_attributes`` - option instead. - enable_attributes ................. @@ -2828,12 +2747,7 @@ constraint verifies the submitted string entropy is matching the minimum entropy email_validation_mode ..................... -**type**: ``string`` **default**: ``loose`` - -.. deprecated:: 6.2 - - The ``loose`` default value is deprecated since Symfony 6.2. Starting from - Symfony 7.0, the default value of this option will be ``html5``. +**type**: ``string`` **default**: ``html5`` Sets the default value for the :ref:`"mode" option of the Email validator `. @@ -2949,18 +2863,6 @@ Whether to enable the ``serializer`` service or not in the service container. .. _reference-serializer-enable_annotations: -enable_annotations -.................. - -**type**: ``boolean`` **default**: ``true`` - -If this option is enabled, serialization groups can be defined using annotations or attributes. - -.. deprecated:: 6.4 - - This option is deprecated since Symfony 6.4, use the ``enable_attributes`` - option instead. - enable_attributes ................. @@ -3439,10 +3341,6 @@ Name of the lock you want to create. semaphore ~~~~~~~~~ -.. versionadded:: 6.1 - - The ``semaphore`` option was introduced in Symfony 6.1. - **type**: ``string`` | ``array`` The default semaphore adapter. Store's DSN are also allowed. @@ -3652,10 +3550,6 @@ Adds a `Link HTTP header`_ to the response. webhook ~~~~~~~ -.. versionadded:: 6.3 - - The Webhook configuration was introduced in Symfony 6.3. - The ``webhook`` option (and its children) are used to configure the webhooks defined in your application. Read more about the options in the :ref:`Webhook documentation `. @@ -3899,10 +3793,6 @@ to the ``#[WithHttpStatus]`` attribute on the exception class:: { } -.. versionadded:: 6.3 - - The ``#[WithHttpStatus]`` attribute was introduced in Symfony 6.3. - It is also possible to map a log level on a custom exception class using the ``#[WithLogLevel]`` attribute:: @@ -3916,9 +3806,10 @@ the ``#[WithLogLevel]`` attribute:: { } -.. versionadded:: 6.3 - - The ``#[WithLogLevel]`` attribute was introduced in Symfony 6.3. +``#[WithHttpStatus]`` and ``#[WithLogLevel]`` attributes also work with parent +classes and (since 7.1) interfaces. To find the effective HTTP status and log +level, the framework will look on the parent hierarchy first, starting on the +immediate parent, then it will look on the interfaces. .. _`HTTP Host header attacks`: https://www.skeletonscribe.net/2013/05/practical-http-host-header-attacks.html .. _`Security Advisory Blog post`: https://symfony.com/blog/security-releases-symfony-2-0-24-2-1-12-2-2-5-and-2-3-3-released#cve-2013-4752-request-gethost-poisoning diff --git a/reference/configuration/kernel.rst b/reference/configuration/kernel.rst index dc46ebd8018..813cd41223c 100644 --- a/reference/configuration/kernel.rst +++ b/reference/configuration/kernel.rst @@ -25,11 +25,6 @@ method of the kernel class, which you can override to return a different value. You can also change the build directory by defining an environment variable named ``APP_BUILD_DIR`` whose value is the absolute path of the build folder. -.. versionadded:: 6.4 - - The support of the ``APP_BUILD_DIR`` environment variable was introduced in - Symfony 6.4. - ``kernel.bundles`` ------------------ @@ -319,10 +314,6 @@ the application is running in web mode and ``web=1&worker=1`` when running in a long-running web server. This parameter can be set by using the ``APP_RUNTIME_MODE`` env var. -.. versionadded:: 6.4 - - The ``kernel.runtime_mode`` parameter was introduced in Symfony 6.4. - ``kernel.runtime_mode.web`` --------------------------- @@ -330,10 +321,6 @@ a long-running web server. This parameter can be set by using the Whether the application is running in a web environment. -.. versionadded:: 6.4 - - The ``kernel.runtime_mode.web`` parameter was introduced in Symfony 6.4. - ``kernel.runtime_mode.cli`` --------------------------- @@ -342,10 +329,6 @@ Whether the application is running in a web environment. Whether the application is running in a CLI environment. By default, this value is the opposite of the ``kernel.runtime_mode.web`` parameter. -.. versionadded:: 6.4 - - The ``kernel.runtime_mode.cli`` parameter was introduced in Symfony 6.4. - ``kernel.runtime_mode.worker`` ------------------------------ @@ -354,10 +337,6 @@ this value is the opposite of the ``kernel.runtime_mode.web`` parameter. Whether the application is running in a worker/long-running environment. Not all web servers support it, and you have to use a long-running web server like `FrankenPHP`_. -.. versionadded:: 6.4 - - The ``kernel.runtime_mode.worker`` parameter was introduced in Symfony 6.4. - ``kernel.secret`` ----------------- diff --git a/reference/configuration/security.rst b/reference/configuration/security.rst index cb09bddae91..b84f169c973 100644 --- a/reference/configuration/security.rst +++ b/reference/configuration/security.rst @@ -561,10 +561,6 @@ It's also possible to use ``*`` as a wildcard for all directives: ->clearSiteData(['cookies', 'storage']); }; -.. versionadded:: 6.3 - - The ``clear_site_data`` option was introduced in Symfony 6.3. - invalidate_session .................. @@ -605,10 +601,6 @@ Set this option to ``true`` to enable CSRF protection in the logout process using Symfony's default CSRF token manager. Set also the ``csrf_token_manager`` option if you need to use a custom CSRF token manager. -.. versionadded:: 6.2 - - The ``enable_csrf`` option was introduced in Symfony 6.2. - csrf_parameter .............. @@ -871,10 +863,6 @@ user_identifier **type**: ``string`` **default**: ``emailAddress`` -.. versionadded:: 6.3 - - The ``user_identifier`` option was introduced in Symfony 6.3. - The value of this option tells Symfony which parameter to use to find the user identifier in the "distinguished name". @@ -1079,10 +1067,6 @@ the session must not be used when authenticating users: Routes under this firewall will be :ref:`configured stateless ` when they are not explicitly configured stateless or not. -.. versionadded:: 6.3 - - Stateless firewall marking routes stateless was introduced in Symfony 6.3. - User Checkers ~~~~~~~~~~~~~ diff --git a/reference/configuration/twig.rst b/reference/configuration/twig.rst index efab3adb2d6..883b0b11eb7 100644 --- a/reference/configuration/twig.rst +++ b/reference/configuration/twig.rst @@ -33,37 +33,6 @@ compiled again automatically. .. _config-twig-autoescape: -autoescape -~~~~~~~~~~ - -.. deprecated:: 6.1 - - This option is deprecated since Symfony 6.1. If required, use the - ``autoescape_service`` or ``autoescape_service_method`` option instead. - -**type**: ``boolean`` or ``string`` **default**: ``name`` - -If set to ``false``, automatic escaping is disabled (you can still escape each content -individually in the templates). - -.. danger:: - - Setting this option to ``false`` is dangerous and it will make your - application vulnerable to `XSS attacks`_ because most third-party bundles - assume that auto-escaping is enabled and they don't escape contents - themselves. - -If set to a string, the template contents are escaped using the strategy with -that name. Allowed values are ``html``, ``js``, ``css``, ``url``, ``html_attr`` -and ``name``. The default value is ``name``. This strategy escapes contents -according to the template name extension (e.g. it uses ``html`` for ``*.html.twig`` -templates and ``js`` for ``*.js.twig`` templates). - -.. tip:: - - See `autoescape_service`_ and `autoescape_service_method`_ to define your - own escaping strategy. - autoescape_service ~~~~~~~~~~~~~~~~~~ @@ -88,11 +57,6 @@ called to determine the default escaping applied to the template. If the service defined in ``autoescape_service`` is invocable (i.e. it defines the `__invoke() PHP magic method`_) you can omit this option. -.. versionadded:: 6.4 - - The feature to use invocable services to omit this option was introduced in - Symfony 6.4. - base_template_class ~~~~~~~~~~~~~~~~~~~ @@ -186,10 +150,6 @@ file_name_pattern **type**: ``string`` or ``array`` of ``string`` **default**: ``[]`` -.. versionadded:: 6.1 - - The ``file_name_pattern`` option was introduced in Symfony 6.1. - Some applications store their front-end assets in the same directory as Twig templates. The ``lint:twig`` command filters those files to only lint the ones that match the ``*.twig`` filename pattern. @@ -320,10 +280,6 @@ html_to_text_converter **type**: ``string`` **default**: ```` -.. versionadded:: 6.2 - - The ``html_to_text_converter`` option was introduced in Symfony 6.2. - The service implementing :class:`Symfony\\Component\\Mime\\HtmlToTextConverter\\HtmlToTextConverterInterface` that will be used to automatically create the text part of an email from its @@ -441,5 +397,4 @@ attribute or method doesn't exist. If set to ``false`` these errors are ignored and the non-existing values are replaced by ``null``. .. _`the optimizer extension`: https://twig.symfony.com/doc/3.x/api.html#optimizer-extension -.. _`XSS attacks`: https://en.wikipedia.org/wiki/Cross-site_scripting .. _`__invoke() PHP magic method`: https://www.php.net/manual/en/language.oop5.magic.php#object.invoke diff --git a/reference/constraints/Cascade.rst b/reference/constraints/Cascade.rst index bd6050add0b..3c99f423b0f 100644 --- a/reference/constraints/Cascade.rst +++ b/reference/constraints/Cascade.rst @@ -95,8 +95,4 @@ The ``groups`` option is not available for this constraint. This option can be used to exclude one or more properties from the cascade validation. -.. versionadded:: 6.3 - - The ``exclude`` option was introduced in Symfony 6.3. - .. include:: /reference/constraints/_payload-option.rst.inc diff --git a/reference/constraints/Choice.rst b/reference/constraints/Choice.rst index 70e5814470f..036b8d378df 100644 --- a/reference/constraints/Choice.rst +++ b/reference/constraints/Choice.rst @@ -315,10 +315,6 @@ When this option is ``false``, the constraint checks that the given value is not one of the values defined in the ``choices`` option. In practice, it makes the ``Choice`` constraint behave like a ``NotChoice`` constraint. -.. versionadded:: 6.2 - - The ``match`` option was introduced in Symfony 6.2. - ``message`` ~~~~~~~~~~~ diff --git a/reference/constraints/Email.rst b/reference/constraints/Email.rst index 19b1579b88a..516d6d07dca 100644 --- a/reference/constraints/Email.rst +++ b/reference/constraints/Email.rst @@ -104,13 +104,10 @@ Parameter Description ``mode`` ~~~~~~~~ -**type**: ``string`` **default**: (see below) +**type**: ``string`` **default**: ``html5`` This option defines the pattern used to validate the email address. Valid values are: -* ``loose`` uses a simple regular expression (just checks that at least one ``@`` - character is present, etc.). This validation is too simple and it's recommended - to use one of the other modes instead; * ``html5`` uses the regular expression of the `HTML5 email input element`_, except it enforces a tld to be present. * ``html5-allow-no-tld`` uses exactly the same regular expression as the `HTML5 email input element`_, @@ -119,10 +116,6 @@ This option defines the pattern used to validate the email address. Valid values `egulias/email-validator`_ library (which is already installed when using :doc:`Symfony Mailer `; otherwise, you must install it separately). -.. versionadded:: 6.2 - - The ``html5-allow-no-tld`` mode was introduced in 6.2. - .. tip:: The possible values of this option are also defined as PHP constants of @@ -133,11 +126,6 @@ The default value used by this option is set in the :ref:`framework.validation.email_validation_mode ` configuration option. -.. deprecated:: 6.2 - - The ``loose`` value is deprecated since Symfony 6.2. Starting from - Symfony 7.0, the default value of this option will be ``html5``. - .. include:: /reference/constraints/_normalizer-option.rst.inc .. include:: /reference/constraints/_payload-option.rst.inc diff --git a/reference/constraints/Expression.rst b/reference/constraints/Expression.rst index 1f3b4dcdb7c..bf015d17573 100644 --- a/reference/constraints/Expression.rst +++ b/reference/constraints/Expression.rst @@ -127,10 +127,6 @@ about the :doc:`expression language syntax ` constraint. - -This constraint checks that the value is valid as an `ExpressionLanguage`_ -expression. - -========== =================================================================== -Applies to :ref:`property or method ` -Class :class:`Symfony\\Component\\Validator\\Constraints\\ExpressionLanguageSyntax` -Validator :class:`Symfony\\Component\\Validator\\Constraints\\ExpressionLanguageSyntaxValidator` -========== =================================================================== - -Basic Usage ------------ - -The following constraints ensure that: - -* the ``promotion`` property stores a value which is valid as an - ExpressionLanguage expression; -* the ``shippingOptions`` property also ensures that the expression only uses - certain variables. - -.. configuration-block:: - - .. code-block:: php-attributes - - // src/Entity/Order.php - namespace App\Entity; - - use Symfony\Component\Validator\Constraints as Assert; - - class Order - { - #[Assert\ExpressionLanguageSyntax] - protected string $promotion; - - #[Assert\ExpressionLanguageSyntax( - allowedVariables: ['user', 'shipping_centers'], - )] - protected string $shippingOptions; - } - - .. code-block:: yaml - - # config/validator/validation.yaml - App\Entity\Order: - properties: - promotion: - - ExpressionLanguageSyntax: ~ - shippingOptions: - - ExpressionLanguageSyntax: - allowedVariables: ['user', 'shipping_centers'] - - .. code-block:: xml - - - - - - - - - - - - - - - - - - .. code-block:: php - - // src/Entity/Student.php - namespace App\Entity; - - use Symfony\Component\Validator\Constraints as Assert; - use Symfony\Component\Validator\Mapping\ClassMetadata; - - class Order - { - // ... - - public static function loadValidatorMetadata(ClassMetadata $metadata): void - { - $metadata->addPropertyConstraint('promotion', new Assert\ExpressionLanguageSyntax()); - - $metadata->addPropertyConstraint('shippingOptions', new Assert\ExpressionLanguageSyntax([ - 'allowedVariables' => ['user', 'shipping_centers'], - ])); - } - } - -Options -------- - -allowedVariables -~~~~~~~~~~~~~~~~ - -**type**: ``array`` or ``null`` **default**: ``null`` - -If this option is defined, the expression can only use the variables whose names -are included in this option. Unset this option or set its value to ``null`` to -allow any variables. - -.. include:: /reference/constraints/_groups-option.rst.inc - -message -~~~~~~~ - -**type**: ``string`` **default**: ``This value should be a valid expression.`` - -This is the message displayed when the validation fails. - -.. include:: /reference/constraints/_payload-option.rst.inc - -.. _`ExpressionLanguage`: https://symfony.com/components/ExpressionLanguage diff --git a/reference/constraints/ExpressionSyntax.rst b/reference/constraints/ExpressionSyntax.rst index 2a603eaa616..c1d086790c1 100644 --- a/reference/constraints/ExpressionSyntax.rst +++ b/reference/constraints/ExpressionSyntax.rst @@ -4,12 +4,6 @@ ExpressionSyntax This constraint checks that the value is valid as an `ExpressionLanguage`_ expression. -.. versionadded:: 6.1 - - This constraint was introduced in Symfony 6.1 and deprecates the previous - :doc:`ExpressionLanguageSyntax ` - constraint. - ========== =================================================================== Applies to :ref:`property or method ` Class :class:`Symfony\\Component\\Validator\\Constraints\\ExpressionSyntax` diff --git a/reference/constraints/File.rst b/reference/constraints/File.rst index 1c12ce0f103..13aec13b0d5 100644 --- a/reference/constraints/File.rst +++ b/reference/constraints/File.rst @@ -156,10 +156,6 @@ see `Wikipedia: Binary prefix`_. **type**: ``array`` or ``string`` -.. versionadded:: 6.2 - - The ``extensions`` option was introduced in Symfony 6.2. - If set, the validator will check that the extension and the media type (formerly known as MIME type) of the underlying file are equal to the given extension and associated media type (if a string) or exist in the collection @@ -275,10 +271,6 @@ You can find a list of existing mime types on the `IANA website`_. **type**: ``integer`` **default**: ``null`` -.. versionadded:: 6.3 - - The ``filenameMaxLength`` was introduced in Symfony 6.3. - If set, the validator will check that the filename of the underlying file doesn't exceed a certain length. @@ -287,10 +279,6 @@ doesn't exceed a certain length. **type**: ``string`` **default**: ``The filename is too long. It should have {{ filename_max_length }} character or less.|The filename is too long. It should have {{ filename_max_length }} characters or less.`` -.. versionadded:: 6.3 - - The ``filenameTooLongMessage`` was introduced in Symfony 6.3. - The message displayed if the filename of the file exceeds the limit set with the ``filenameMaxLength`` option. @@ -307,10 +295,6 @@ Parameter Description **type**: ``string`` **default**: ``The extension of the file is invalid ({{ extension }}). Allowed extensions are {{ extensions }}.`` -.. versionadded:: 6.2 - - The ``extensionsMessage`` option was introduced in Symfony 6.2. - The message displayed if the extension of the file is not a valid extension per the `extensions`_ option. diff --git a/reference/constraints/Length.rst b/reference/constraints/Length.rst index 4eed36347c6..5b7cb581db5 100644 --- a/reference/constraints/Length.rst +++ b/reference/constraints/Length.rst @@ -144,10 +144,6 @@ Can be one of the following constants of the * ``COUNT_GRAPHEMES``: Uses :phpfunction:`grapheme_strlen` counting the length of the string in graphemes, i.e. even emojis and ZWJ sequences of composed emojis count as 1 character. -.. versionadded:: 6.3 - - The ``countUnit`` option was introduced in Symfony 6.3. - ``exactly`` ~~~~~~~~~~~ @@ -180,10 +176,6 @@ Parameter Description ``{{ value_length }}`` The current value's length ====================== ============================================================ -.. versionadded:: 6.3 - - The `{{ value_length }}` parameter was introduced in Symfony 6.3. - .. include:: /reference/constraints/_groups-option.rst.inc ``max`` @@ -214,10 +206,6 @@ Parameter Description ``{{ value_length }}`` The current value's length ====================== ============================================================ -.. versionadded:: 6.3 - - The `{{ value_length }}` parameter was introduced in Symfony 6.3. - ``min`` ~~~~~~~ @@ -250,10 +238,6 @@ Parameter Description ``{{ value_length }}`` The current value's length ====================== ============================================================ -.. versionadded:: 6.3 - - The `{{ value_length }}` parameter was introduced in Symfony 6.3. - .. include:: /reference/constraints/_normalizer-option.rst.inc .. include:: /reference/constraints/_payload-option.rst.inc diff --git a/reference/constraints/NoSuspiciousCharacters.rst b/reference/constraints/NoSuspiciousCharacters.rst index cfc23141553..00e28cd6da1 100644 --- a/reference/constraints/NoSuspiciousCharacters.rst +++ b/reference/constraints/NoSuspiciousCharacters.rst @@ -1,10 +1,6 @@ NoSuspiciousCharacters ====================== -.. versionadded:: 6.3 - - The ``NoSuspiciousCharacters`` constraint was introduced in Symfony 6.3. - Validates that the given string does not contain characters used in spoofing security attacks, such as invisible characters such as zero-width spaces or characters that are visually similar. diff --git a/reference/constraints/PasswordStrength.rst b/reference/constraints/PasswordStrength.rst index ddc3fd18043..989ffddd100 100644 --- a/reference/constraints/PasswordStrength.rst +++ b/reference/constraints/PasswordStrength.rst @@ -1,10 +1,6 @@ PasswordStrength ================ -.. versionadded:: 6.3 - - The ``PasswordStrength`` constraint was introduced in Symfony 6.3. - Validates that the given password has reached the minimum strength required by the constraint. The strength of the password is not evaluated with a set of predefined rules (include a number, use lowercase and uppercase characters, diff --git a/reference/constraints/Regex.rst b/reference/constraints/Regex.rst index cd9d8c1ce45..bc042e1eb86 100644 --- a/reference/constraints/Regex.rst +++ b/reference/constraints/Regex.rst @@ -272,10 +272,6 @@ Parameter Description ``{{ pattern }}`` The expected matching pattern ================= ============================================================== -.. versionadded:: 6.3 - - The ``{{ pattern }}`` parameter was introduced in 6.3. - ``pattern`` ~~~~~~~~~~~ diff --git a/reference/constraints/Time.rst b/reference/constraints/Time.rst index 1732fb584f0..6d4de73398f 100644 --- a/reference/constraints/Time.rst +++ b/reference/constraints/Time.rst @@ -115,8 +115,4 @@ Option Pattern Correct value Incorrect value ``false`` ``/^(\d{2}):(\d{2})$/`` ``12:00`` ``12:00:00`` ========= =============================== ============== ================ -.. versionadded:: 6.4 - - The ``withSeconds`` option was introduced in Symfony 6.4. - .. include:: /reference/constraints/_payload-option.rst.inc diff --git a/reference/constraints/Type.rst b/reference/constraints/Type.rst index f10d1423997..b8f41fbd524 100644 --- a/reference/constraints/Type.rst +++ b/reference/constraints/Type.rst @@ -190,6 +190,11 @@ PHP class/interface or a valid PHP datatype (checked by PHP's ``is_()`` function * :phpfunction:`resource ` * :phpfunction:`null ` +If you're dealing with arrays, you can use the following types in the constraint: + +* ``list`` which uses :phpfunction:`array_is_list ` internally +* ``associative_array`` which is true for any **non-empty** array that is not a list + Also, you can use ``ctype_*()`` functions from corresponding `built-in PHP extension`_. Consider `a list of ctype functions`_: @@ -208,15 +213,16 @@ Also, you can use ``ctype_*()`` functions from corresponding Make sure that the proper :phpfunction:`locale ` is set before using one of these. +.. versionadded:: 7.1 + + The ``list`` and ``associative_array`` types were introduced in Symfony + 7.1. + Finally, you can use aggregated functions: * ``number``: ``is_int || is_float && !is_nan`` * ``finite-float``: ``is_float && is_finite`` * ``finite-number``: ``is_int || is_float && is_finite`` -.. versionadded:: 6.4 - - ``number``, ``finite-float`` and ``finite-number`` were introduced in Symfony 6.4. - .. _built-in PHP extension: https://www.php.net/book.ctype .. _a list of ctype functions: https://www.php.net/ref.ctype diff --git a/reference/constraints/Unique.rst b/reference/constraints/Unique.rst index 1f5631abc95..c7ee71329c4 100644 --- a/reference/constraints/Unique.rst +++ b/reference/constraints/Unique.rst @@ -96,10 +96,6 @@ Options **type**: ``array`` | ``string`` -.. versionadded:: 6.1 - - The ``fields`` option was introduced in Symfony 6.1. - This is defines the key or keys in a collection that should be checked for uniqueness. By default, all collection keys are checked for uniqueness. diff --git a/reference/constraints/UniqueEntity.rst b/reference/constraints/UniqueEntity.rst index 3235f1ed4fb..ad7c09f1c31 100644 --- a/reference/constraints/UniqueEntity.rst +++ b/reference/constraints/UniqueEntity.rst @@ -361,11 +361,6 @@ this option to specify one or more fields to only ignore ``null`` values on them database, you might see insertion errors when your application attempts to persist entities that the ``UniqueEntity`` constraint considers valid. -.. versionadded:: 6.3 - - The option to ignore ``null`` values for specific fields was introduced - in Symfony 6.3. - ``message`` ~~~~~~~~~~~ diff --git a/reference/constraints/Uuid.rst b/reference/constraints/Uuid.rst index d8ff5fadb8b..c9f6c9741bf 100644 --- a/reference/constraints/Uuid.rst +++ b/reference/constraints/Uuid.rst @@ -129,15 +129,6 @@ you can also use the following PHP constants to refer to each UUID version: * ``Uuid::V7_MONOTONIC`` * ``Uuid::V8_CUSTOM`` -.. versionadded:: 6.2 - - UUID versions 7 and 8 were introduced in Symfony 6.2. - -.. versionadded:: 6.4 - - Using a single integer instead of an integer array for this option - was introduced in Symfony 6.4. - .. _`Universally unique identifier (UUID)`: https://en.wikipedia.org/wiki/Universally_unique_identifier .. _`RFC 4122`: https://tools.ietf.org/html/rfc4122 .. _`UUID versions`: https://en.wikipedia.org/wiki/Universally_unique_identifier#Versions diff --git a/reference/constraints/When.rst b/reference/constraints/When.rst index 144c1e3904c..e1e8ac895ce 100644 --- a/reference/constraints/When.rst +++ b/reference/constraints/When.rst @@ -1,10 +1,6 @@ When ==== -.. versionadded:: 6.2 - - The ``When`` constraint was introduced in Symfony 6.2. - This constraint allows you to apply constraints validation only if the provided expression returns true. See `Basic Usage`_ for an example. @@ -275,10 +271,6 @@ You can also pass custom variables using the `values`_ option. One or multiple constraints that are applied if the expression returns true. -.. versionadded:: 6.4 - - Passing a single ``Constraint`` instead of an array was introduced in Symfony 6.4. - .. include:: /reference/constraints/_groups-option.rst.inc .. include:: /reference/constraints/_payload-option.rst.inc diff --git a/reference/dic_tags.rst b/reference/dic_tags.rst index fd390d7bd59..27682a6137b 100644 --- a/reference/dic_tags.rst +++ b/reference/dic_tags.rst @@ -337,13 +337,6 @@ Value resolvers implement the and are used to resolve argument values for controllers as described here: :doc:`/controller/argument_value_resolver`. -.. versionadded:: 6.2 - - The ``ValueResolverInterface`` was introduced in Symfony 6.2. Prior to - 6.2, you had to use the - :class:`Symfony\\Component\\HttpKernel\\Controller\\ArgumentValueResolverInterface`, - which defines different methods. - data_collector -------------- @@ -519,12 +512,6 @@ If you don't need to preload anything, return an empty array. If read-only artifacts need to be created, you can store them in a different directory with the ``$buildDir`` parameter of the ``warmUp()`` method. -.. versionadded:: 6.4 - - The ``$buildDir`` parameter of the - :method:`Symfony\\Component\\HttpKernel\\CacheWarmer\\WarmableInterface::warmUp` - method was introduced in Symfony 6.4. - The ``isOptional()`` method should return true if it's possible to use the application without calling this cache warmer. In Symfony, optional warmers are always executed by default (you can change this by using the @@ -1079,23 +1066,16 @@ file When executing the ``translation:extract`` command, it uses extractors to extract translation messages from a file. By default, the Symfony Framework -has a :class:`Symfony\\Bridge\\Twig\\Translation\\TwigExtractor` and a PHP -extractor to find and extract translation keys from Twig templates and PHP files. +has a :class:`Symfony\\Bridge\\Twig\\Translation\\TwigExtractor` to find and +extract translation keys from Twig templates. -Symfony includes two PHP extractors: :class:`Symfony\\Component\\Translation\\Extractor\\PhpExtractor` -and :class:`Symfony\\Component\\Translation\\Extractor\\PhpAstExtractor`. The -first one is simple but doesn't require to install any packages; the second one -is much more advanced, but requires to install this dependency in your project: +If you also want to find and extract translation keys from PHP files, install +the following dependency to activate the :class:`Symfony\\Component\\Translation\\Extractor\\PhpAstExtractor`: .. code-block:: terminal $ composer require nikic/php-parser -.. deprecated:: 6.2 - - The ``PhpExtractor`` class is deprecated since Symfony 6.2. The ``PhpAstExtractor`` - class will be the only PHP extractor available starting from Symfony 7.0. - You can create your own extractor by creating a class that implements :class:`Symfony\\Component\\Translation\\Extractor\\ExtractorInterface` and tagging the service with ``translation.extractor``. The tag has one diff --git a/reference/formats/expression_language.rst b/reference/formats/expression_language.rst index af03b6a07d1..6c9b1bffe42 100644 --- a/reference/formats/expression_language.rst +++ b/reference/formats/expression_language.rst @@ -21,11 +21,6 @@ The component supports: * **null** - ``null`` * **exponential** - also known as scientific (e.g. ``1.99E+3`` or ``1e-2``) -.. versionadded:: 6.1 - - Support for decimals without leading zeros and underscore separators were - introduced in Symfony 6.1. - .. caution:: A backslash (``\``) must be escaped by 3 backslashes (``\\\\``) in a string @@ -114,10 +109,6 @@ operator):: $expressionLanguage->evaluate('fruit?.color', ['fruit' => '...']) $expressionLanguage->evaluate('fruit?.getStock()', ['fruit' => '...']) -.. versionadded:: 6.1 - - The null safe operator was introduced in Symfony 6.1. - .. _component-expression-functions: Working with Functions @@ -176,10 +167,6 @@ This function will return the case of an enumeration:: This will print out ``true``. -.. versionadded:: 6.3 - - The ``enum()`` function was introduced in Symfony 6.3. - .. tip:: To read how to register your own functions to use in an expression, see @@ -255,11 +242,6 @@ Comparison Operators * ``starts with`` * ``ends with`` -.. versionadded:: 6.1 - - The ``contains``, ``starts with`` and ``ends with`` operators were introduced - in Symfony 6.1. - .. tip:: To test if a string does *not* match a regex, use the logical ``not`` @@ -333,7 +315,7 @@ Array Operators * ``in`` (contain) * ``not in`` (does not contain) -For example:: +These operators are using strict comparison. For example:: class User { @@ -352,12 +334,9 @@ For example:: The ``$inGroup`` would evaluate to ``true``. -.. deprecated:: 6.3 +.. note:: - In Symfony versions previous to 6.3, ``in`` and ``not in`` operators - were using loose comparison. Using these operators with variables of - different types is now deprecated, and these operators will be using - strict comparison from Symfony 7.0. + The ``in`` and ``not in`` operators are using strict comparison. Numeric Operators ~~~~~~~~~~~~~~~~~ diff --git a/reference/formats/yaml.rst b/reference/formats/yaml.rst index 3130dd1d87b..64adac599fb 100644 --- a/reference/formats/yaml.rst +++ b/reference/formats/yaml.rst @@ -346,10 +346,6 @@ official YAML specification but are useful in Symfony applications: # ... or you can also use "->value" to directly use the value of a BackedEnum case operator_type: !php/enum App\Operator\Enum\Type::Or->value -.. versionadded:: 6.2 - - The ``!php/enum`` tag was introduced in Symfony 6.2. - Unsupported YAML Features ~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/reference/forms/types/collection.rst b/reference/forms/types/collection.rst index 2950c6d0304..2d91bfd06bd 100644 --- a/reference/forms/types/collection.rst +++ b/reference/forms/types/collection.rst @@ -200,10 +200,6 @@ prototype_options **type**: ``array`` **default**: ``[]`` -.. versionadded:: 6.1 - - The ``prototype_options`` option was introduced in Symfony 6.1. - This is the array that's passed to the form type specified in the `entry_type`_ option when creating its prototype. It allows to have different options depending on whether you are adding a new entry or editing an existing entry:: @@ -233,6 +229,27 @@ you'd use the :doc:`EmailType `. If you want to embed a collection of some other form, pass the form type class as this option (e.g. ``MyFormType::class``). +keep_as_list +~~~~~~~~~~~~ + +**type**: ``boolean`` **default**: ``false`` + +When set to ``true``, the ``keep_as_list`` option affects the reindexing +of nested form names within a collection. This feature is particularly useful +when working with collection types and removing items from the collection +during form submission. + +When this option is set to ``false``, if you have a collection of 3 items and +you remove the second item, the indexes will be ``0`` and ``2`` when validating +the collection. However, by enabling the ``keep_as_list`` option and setting +it to ``true``, the indexes will be reindexed as ``0`` and ``1``. This ensures +that the indexes remain consecutive and do not have gaps, providing a clearer +and more predictable structure for your nested forms. + +.. versionadded:: 7.1 + + The ``keep_as_list`` option was introduced in Symfony 7.1. + prototype ~~~~~~~~~ diff --git a/reference/forms/types/enum.rst b/reference/forms/types/enum.rst index 1a2afbe470c..47416ee6215 100644 --- a/reference/forms/types/enum.rst +++ b/reference/forms/types/enum.rst @@ -80,10 +80,6 @@ implement ``TranslatableInterface`` to translate or display custom labels:: } } -.. versionadded:: 6.4 - - Support for ``TranslatableInterface`` was introduced in Symfony 6.4. - Field Options ------------- diff --git a/reference/forms/types/file.rst b/reference/forms/types/file.rst index 95aab73783a..b4982859b98 100644 --- a/reference/forms/types/file.rst +++ b/reference/forms/types/file.rst @@ -55,6 +55,10 @@ You might calculate the filename in one of the following ways:: // use the original file name $file->move($directory, $file->getClientOriginalName()); + // when "webkitdirectory" upload was used + // otherwise the value will be the same as getClientOriginalName + // $file->move($directory, $file->getClientOriginalPath()); + // compute a random name and try to guess the extension (more secure) $extension = $file->guessExtension(); if (!$extension) { @@ -63,9 +67,9 @@ You might calculate the filename in one of the following ways:: } $file->move($directory, rand(1, 99999).'.'.$extension); -Using the original name via ``getClientOriginalName()`` is not safe as it -could have been manipulated by the end-user. Moreover, it can contain -characters that are not allowed in file names. You should sanitize the name +Using the original name via ``getClientOriginalName()`` or ``getClientOriginalPath`` +is not safe as it could have been manipulated by the end-user. Moreover, it can contain +characters that are not allowed in file names. You should sanitize the value before using it directly. Read :doc:`/controller/upload_file` for an example of how to manage a file diff --git a/reference/forms/types/number.rst b/reference/forms/types/number.rst index f88dc5b97f5..86d8eda3116 100644 --- a/reference/forms/types/number.rst +++ b/reference/forms/types/number.rst @@ -60,10 +60,6 @@ include an `inputmode HTML attribute`_ which depends on the value of this option If the ``scale`` value is ``0``, ``inputmode`` will be ``numeric``; if ``scale`` is set to any value greater than ``0``, ``inputmode`` will be ``decimal``. -.. versionadded:: 6.1 - - The automatic addition of the ``inputmode`` attribute was introduced in Symfony 6.1. - Overridden Options ------------------ diff --git a/reference/forms/types/options/choice_label.rst.inc b/reference/forms/types/options/choice_label.rst.inc index 0071498916f..3d83e44da52 100644 --- a/reference/forms/types/options/choice_label.rst.inc +++ b/reference/forms/types/options/choice_label.rst.inc @@ -29,12 +29,6 @@ more control:: }, ]); -.. versionadded:: 6.2 - - Starting from Symfony 6.2, you can use any object that implements - :class:`Symfony\\Contracts\\Translation\\TranslatableInterface` as the value - of the choice label. - This method is called for *each* choice, passing you the ``$choice`` and ``$key`` from the choices array (additional ``$value`` is related to `choice_value`_). This will give you: diff --git a/reference/forms/types/options/date_widget_description.rst.inc b/reference/forms/types/options/date_widget_description.rst.inc index a60a24a3f83..956ad8c7148 100644 --- a/reference/forms/types/options/date_widget_description.rst.inc +++ b/reference/forms/types/options/date_widget_description.rst.inc @@ -1,4 +1,4 @@ -**type**: ``string`` **default**: ``choice`` +**type**: ``string`` **default**: ``single_text`` The basic way in which this field should be rendered. Can be one of the following: @@ -10,8 +10,3 @@ following: * ``single_text``: renders a single input of type ``date``. User's input is validated based on the `format`_ option. - -.. deprecated:: 6.3 - - Not setting a value explicitly for this option is deprecated since Symfony 6.3 - because the default value will change to ``single_text`` in Symfony 7.0. diff --git a/reference/forms/types/options/duplicate_preferred_choices.rst.inc b/reference/forms/types/options/duplicate_preferred_choices.rst.inc index 72e85067bd3..7569d54a21b 100644 --- a/reference/forms/types/options/duplicate_preferred_choices.rst.inc +++ b/reference/forms/types/options/duplicate_preferred_choices.rst.inc @@ -20,7 +20,3 @@ option to ``false``, to only display preferred choices at the top of the list:: 'preferred_choices' => ['muppets', 'arr'], 'duplicate_preferred_choices' => false, ]); - -.. versionadded:: 6.4 - - The ``duplicate_preferred_choices`` option was introduced in Symfony 6.4. diff --git a/reference/forms/types/options/help.rst.inc b/reference/forms/types/options/help.rst.inc index 8c9bb5ce917..7d8fcdbec6b 100644 --- a/reference/forms/types/options/help.rst.inc +++ b/reference/forms/types/options/help.rst.inc @@ -19,8 +19,3 @@ rendered below the field:: 'help' => new TranslatableMessage('order.status', ['%order_id%' => $order->getId()], 'store'), ]) ; - -.. versionadded:: 6.2 - - The support for ``TranslatableInterface`` objects as help contents was - introduced in Symfony 6.2. diff --git a/reference/forms/types/options/model_timezone.rst.inc b/reference/forms/types/options/model_timezone.rst.inc index 44050e89219..0ef0efe1b56 100644 --- a/reference/forms/types/options/model_timezone.rst.inc +++ b/reference/forms/types/options/model_timezone.rst.inc @@ -6,10 +6,4 @@ Timezone that the input data is stored in. This must be one of the `PHP supported timezones`_. -.. deprecated:: 6.4 - - Starting from Symfony 6.4, it's deprecated to pass ``DateTime`` or ``DateTimeImmutable`` - values to this form field with a different timezone than the one configured with - the ``model_timezone`` option. - .. _`PHP supported timezones`: https://www.php.net/manual/en/timezones.php diff --git a/reference/forms/types/options/placeholder_attr.rst.inc b/reference/forms/types/options/placeholder_attr.rst.inc index 49b656cc6df..e537aae8922 100644 --- a/reference/forms/types/options/placeholder_attr.rst.inc +++ b/reference/forms/types/options/placeholder_attr.rst.inc @@ -15,7 +15,3 @@ Use this to add additional HTML attributes to the placeholder choice:: ['title' => 'Choose an option'], ], ]); - -.. versionadded:: 6.3 - - The ``placeholder_attr`` option was introduced in Symfony 6.3. diff --git a/reference/forms/types/options/sanitize_html.rst.inc b/reference/forms/types/options/sanitize_html.rst.inc index d5525674815..1f906fd1354 100644 --- a/reference/forms/types/options/sanitize_html.rst.inc +++ b/reference/forms/types/options/sanitize_html.rst.inc @@ -3,10 +3,6 @@ sanitize_html **type**: ``boolean`` **default**: ``false`` -.. versionadded:: 6.1 - - The ``sanitize_html`` option was introduced in Symfony 6.1. - When ``true``, the text input will be sanitized using the :doc:`Symfony HTML Sanitizer component ` after the form is submitted. This protects the form input against XSS, clickjacking and CSS diff --git a/reference/forms/types/options/sanitizer.rst.inc b/reference/forms/types/options/sanitizer.rst.inc index 66a76d591e7..39217653b3c 100644 --- a/reference/forms/types/options/sanitizer.rst.inc +++ b/reference/forms/types/options/sanitizer.rst.inc @@ -3,9 +3,5 @@ sanitizer **type**: ``string`` **default**: ``"default"`` -.. versionadded:: 6.1 - - The ``sanitizer`` option was introduced in Symfony 6.1. - When `sanitize_html`_ is enabled, you can specify the name of a :ref:`custom sanitizer ` using this option. diff --git a/reference/forms/types/password.rst b/reference/forms/types/password.rst index 162985262e0..7fb760471ef 100644 --- a/reference/forms/types/password.rst +++ b/reference/forms/types/password.rst @@ -37,10 +37,6 @@ entered into the box, set this to false and submit the form. **type**: ``string`` **default**: ``null`` -.. versionadded:: 6.2 - - The ``hash_property_path`` option was introduced in Symfony 6.2. - If set, the password will be hashed using the :doc:`PasswordHasher component ` and stored in the property defined by the given :doc:`PropertyAccess expression `. diff --git a/reference/forms/types/url.rst b/reference/forms/types/url.rst index 5f97fcb89a4..96984b23226 100644 --- a/reference/forms/types/url.rst +++ b/reference/forms/types/url.rst @@ -31,6 +31,11 @@ If a value is submitted that doesn't begin with some protocol (e.g. ``http://``, ``ftp://``, etc), this protocol will be prepended to the string when the data is submitted to the form. +.. deprecated:: 7.1 + + Not setting the ``default_protocol`` option is deprecated since Symfony 7.1 + and will default to ``null`` in Symfony 8.0. + Overridden Options ------------------ diff --git a/reference/twig_reference.rst b/reference/twig_reference.rst index 7729fec00eb..20c3dc84c37 100644 --- a/reference/twig_reference.rst +++ b/reference/twig_reference.rst @@ -302,10 +302,6 @@ Generates a URL that you can visit to :doc:`impersonate a user `, identified by the ``identifier`` argument. -.. versionadded:: 6.4 - - The ``impersonation_path()`` function was introduced in Symfony 6.4. - impersonation_url ~~~~~~~~~~~~~~~~~ @@ -319,10 +315,6 @@ impersonation_url It's similar to the `impersonation_path`_ function, but it generates absolute URLs instead of relative URLs. -.. versionadded:: 6.4 - - The ``impersonation_url()`` function was introduced in Symfony 6.4. - impersonation_exit_path ~~~~~~~~~~~~~~~~~~~~~~~ @@ -444,10 +436,6 @@ Translates the text into the current language. More information in sanitize_html ~~~~~~~~~~~~~ -.. versionadded:: 6.1 - - The ``sanitize_html()`` filter was introduced in Symfony 6.1. - .. code-block:: twig {{ body|sanitize_html(sanitizer = "default") }} diff --git a/routing.rst b/routing.rst index ea6aedfebeb..941c074cb0d 100644 --- a/routing.rst +++ b/routing.rst @@ -48,10 +48,6 @@ classes declared in the ``App\Controller`` namespace and stored in the act as a controller too, which is especially useful for small applications that use Symfony as a microframework. -.. versionadded:: 6.2 - - The feature to import routes from a PSR-4 namespace root was introduced in Symfony 6.2. - Suppose you want to define a route for the ``/blog`` URL in your application. To do so, create a :doc:`controller class ` like the following: @@ -374,10 +370,6 @@ can use any of these variables created by Symfony: An array of matched :ref:`route parameters ` for the current route. -.. versionadded:: 6.1 - - The ``params`` variable was introduced in Symfony 6.1. - You can also use these functions: ``env(string $name)`` @@ -408,11 +400,6 @@ You can also use these functions: // Or without alias: #[Route(condition: "service('App\\\Service\\\RouteChecker').check(request)")] -.. versionadded:: 6.1 - - The ``service(string $alias)`` function and ``#[AsRoutingConditionService]`` - attribute were introduced in Symfony 6.1. - Behind the scenes, expressions are compiled down to raw PHP. Because of this, using the ``condition`` key causes no extra overhead beyond the time it takes for the underlying PHP to execute. @@ -467,10 +454,6 @@ route details: Use the ``--show-aliases`` option to show all available aliases for a given route. -.. versionadded:: 6.4 - - The ``--show-aliases`` option was introduced in Symfony 6.4. - The other command is called ``router:match`` and it shows which route will match the given URL. It's useful to find out why some URL is not executing the controller action that you expect: @@ -664,10 +647,6 @@ URL Route Parameters contains a collection of commonly used regular-expression constants such as digits, dates and UUIDs which can be used as route parameter requirements. - .. versionadded:: 6.1 - - The ``Requirement`` enum was introduced in Symfony 6.1. - .. tip:: Route requirements (and route paths too) can include @@ -956,12 +935,6 @@ A common routing need is to convert the value stored in some parameter (e.g. an integer acting as the user ID) into another value (e.g. the object that represents the user). This feature is called a "param converter". -.. versionadded:: 6.2 - - Starting from Symfony 6.2, route param conversion is a built-in feature. - In previous Symfony versions you had to install the package - ``sensio/framework-extra-bundle`` before using this feature. - Now, keep the previous route configuration, but change the arguments of the controller action. Instead of ``string $slug``, add ``BlogPost $post``:: @@ -998,10 +971,6 @@ database queries used to fetch the object from the route parameter. Backed Enum Parameters ~~~~~~~~~~~~~~~~~~~~~~ -.. versionadded:: 6.3 - - The support of ``\BackedEnum`` as route parameters was introduced Symfony 6.3. - You can use PHP `backed enumerations`_ as route parameters because Symfony will convert them automatically to their scalar values. @@ -1618,13 +1587,6 @@ In templates, use the :ref:`Twig global app variable ` to get the current route name (``app.current_route``) and its parameters (``app.current_route_parameters``). -.. versionadded:: 6.2 - - The ``app.current_route`` and ``app.current_route_parameters`` variables - were introduced in Symfony 6.2. - Before you had to access ``_route`` and ``_route_params`` request - attributes using ``app.request.attributes.get()``. - Special Routes -------------- @@ -2269,11 +2231,6 @@ that defines only one route. Consider the following class:: Symfony will add a route alias named ``App\Controller\MainController::homepage``. -.. versionadded:: 6.4 - - The automatic declaration of route aliases based on FQCNs was introduced in - Symfony 6.4. - Generating URLs in Controllers ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -2643,7 +2600,7 @@ same URL, but with the HTTPS scheme. If you want to force a group of routes to use HTTPS, you can define the default scheme when importing them. The following example forces HTTPS on all routes -defined as annotations: +defined as attributes: .. configuration-block:: @@ -2728,12 +2685,6 @@ service, which you can inject in your services or controllers:: } } -.. versionadded:: 6.4 - - The namespace of the ``UriSigner`` class changed in Symfony 6.4 from - ``Symfony\Component\HttpKernel\UriSigner`` to - ``Symfony\Component\HttpFoundation\UriSigner``. - Troubleshooting --------------- diff --git a/routing/custom_route_loader.rst b/routing/custom_route_loader.rst index d02e6b31519..0cea7d6b9fd 100644 --- a/routing/custom_route_loader.rst +++ b/routing/custom_route_loader.rst @@ -108,15 +108,6 @@ Symfony provides several route loaders for the most common needs: $routes->import('@AcmeOtherBundle/Resources/config/routing/', 'directory'); }; -.. versionadded:: 6.1 - - The ``attribute`` value of the second argument of ``import()`` was introduced - in Symfony 6.1. - -.. versionadded:: 6.2 - - The feature to import routes from a PSR-4 namespace root was introduced in Symfony 6.2. - .. note:: When importing resources, the key (e.g. ``app_file``) is the name of the collection. diff --git a/security.rst b/security.rst index aaf2f600a21..3aa65d4f80f 100644 --- a/security.rst +++ b/security.rst @@ -468,12 +468,6 @@ You can also manually hash a password by running: Read more about all available hashers and password migration in :doc:`security/passwords`. -.. versionadded:: 6.2 - - In applications using Symfony 6.2 and PHP 8.2 or newer, the - `SensitiveParameter PHP attribute`_ is applied to all plain passwords and - sensitive tokens so they don't appear in stack traces. - .. _firewalls-authentication: .. _a-authentication-firewalls: @@ -612,10 +606,6 @@ don't accidentally block Symfony's dev tools - which live under URLs like This feature is not supported by the XML configuration format. - .. versionadded:: 6.4 - - The feature to use an array of regex was introduced in Symfony 6.4. - All *real* URLs are handled by the ``main`` firewall (no ``pattern`` key means it matches *all* URLs). A firewall can have many modes of authentication, in other words, it enables many ways to ask the question "Who are you?". @@ -680,10 +670,6 @@ use the :class:`Symfony\\Bundle\\SecurityBundle\\Security` service:: } } -.. versionadded:: 6.2 - - The ``getFirewallConfig()`` method was introduced in Symfony 6.2. - .. _security-authenticators: Authenticating Users @@ -1722,17 +1708,6 @@ for more information about this. Login Programmatically ---------------------- -.. versionadded:: 6.2 - - The :class:`Symfony\Bundle\SecurityBundle\Security ` - class was introduced in Symfony 6.2. Prior to 6.2, it was called - ``Symfony\Component\Security\Core\Security``. - -.. versionadded:: 6.2 - - The :method:`Symfony\\Bundle\\SecurityBundle\\Security::login` - method was introduced in Symfony 6.2. - You can log in a user programmatically using the ``login()`` method of the :class:`Symfony\\Bundle\\SecurityBundle\\Security` helper:: @@ -1774,14 +1749,6 @@ You can log in a user programmatically using the ``login()`` method of the } } -.. versionadded:: 6.3 - - The feature to use a custom redirection logic was introduced in Symfony 6.3. - -.. versionadded:: 6.4 - - The feature to add badges was introduced in Symfony 6.4. - .. _security-logging-out: Logging Out @@ -1890,25 +1857,9 @@ you have imported the logout route loader in your routes: $routes->import('security.route_loader.logout', 'service'); }; -.. versionadded:: 6.4 - - The :class:`Symfony\\Bundle\\SecurityBundle\\Routing\\LogoutRouteLoader` was - introduced in Symfony 6.4. - Logout programmatically ~~~~~~~~~~~~~~~~~~~~~~~ -.. versionadded:: 6.2 - - The :class:`Symfony\Bundle\SecurityBundle\Security ` - class was introduced in Symfony 6.2. Prior to 6.2, it was called - ``Symfony\Component\Security\Core\Security``. - -.. versionadded:: 6.2 - - The :method:`Symfony\\Bundle\\SecurityBundle\\Security::logout` - method was introduced in Symfony 6.2. - You can logout user programmatically using the ``logout()`` method of the :class:`Symfony\\Bundle\\SecurityBundle\\Security` helper:: @@ -2142,12 +2093,6 @@ If you need to get the logged in user from a service, use the } } -.. versionadded:: 6.2 - - The :class:`Symfony\\Bundle\\SecurityBundle\\Security` class - was introduced in Symfony 6.2. In previous Symfony versions this class was - defined in ``Symfony\Component\Security\Core\Security``. - Fetch the User in a Template ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -2547,15 +2492,6 @@ that is thrown with the ``exceptionCode`` argument:: // ... } -.. versionadded:: 6.2 - - The ``#[IsGranted()]`` attribute was introduced in Symfony 6.2. - -.. versionadded:: 6.3 - - The ``exceptionCode`` argument of the ``#[IsGranted()]`` attribute was - introduced in Symfony 6.3. - .. _security-template: Access Control in Templates @@ -2771,15 +2707,6 @@ like this: :doc:`impersonating ` another user in this session, this attribute will match. -.. note:: - - All logged in users also have an attribute called ``IS_AUTHENTICATED_REMEMBERED``, - even if the application doesn't use the Remember Me feature. This attribute - exists for backward-compatibility reasons with Symfony versions prior to 6.4. - - This attribute behaves the same as ``IS_AUTHENTICATED``. That's why in modern - Symfony applications it's recommended to no longer use ``IS_AUTHENTICATED_REMEMBERED``. - .. _user_session_refresh: Understanding how Users are Refreshed from the Session @@ -3004,4 +2931,3 @@ Authorization (Denying Access) .. _`HTTP Basic authentication`: https://en.wikipedia.org/wiki/Basic_access_authentication .. _`Login CSRF attacks`: https://en.wikipedia.org/wiki/Cross-site_request_forgery#Forging_login_requests .. _`PHP date relative formats`: https://www.php.net/manual/en/datetime.formats.php#datetime.formats.relative -.. _`SensitiveParameter PHP attribute`: https://www.php.net/manual/en/class.sensitiveparameter.php diff --git a/security/access_control.rst b/security/access_control.rst index ebf2227b42c..a8a0a3e2987 100644 --- a/security/access_control.rst +++ b/security/access_control.rst @@ -19,10 +19,10 @@ things: 1. Matching Options ------------------- -Symfony creates an instance of :class:`Symfony\\Component\\HttpFoundation\\RequestMatcher` -for each ``access_control`` entry, which determines whether or not a given -access control should be used on this request. The following ``access_control`` -options are used for matching: +Symfony uses :class:`Symfony\\Component\\HttpFoundation\\ChainRequestMatcher` for +each ``access_control`` entry, which determines which implementation of +:class:`Symfony\\Component\\HttpFoundation\\RequestMatcherInterface` should be used +on this request. The following ``access_control`` options are used for matching: * ``path``: a regular expression (without delimiters) * ``ip`` or ``ips``: netmasks are also supported (can be a comma-separated string) @@ -33,14 +33,6 @@ options are used for matching: * ``attributes``: an array, which can be used to specify one or more :ref:`request attributes ` that must match exactly * ``route``: a route name -.. versionadded:: 6.1 - - The ``request_matcher`` option was introduced in Symfony 6.1. - -.. versionadded:: 6.2 - - The ``route`` and ``attributes`` options were introduced in Symfony 6.2. - Take the following ``access_control`` entries as an example: .. configuration-block:: diff --git a/security/access_token.rst b/security/access_token.rst index 81a3a9cdabe..29fbfbc8bb6 100644 --- a/security/access_token.rst +++ b/security/access_token.rst @@ -352,10 +352,6 @@ an authorization server. 1) Configure the OidcUserInfoTokenHandler ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. versionadded:: 6.3 - - The ``OidcUserInfoTokenHandler`` class was introduced in Symfony 6.3. - The ``OidcUserInfoTokenHandler`` requires the ``symfony/http-client`` package to make the needed HTTP requests. If you haven't installed it yet, run this command: @@ -539,10 +535,6 @@ claims. To create your own user object from the claims, you must 2) Configure the OidcTokenHandler ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. versionadded:: 6.3 - - The ``OidcTokenHandler`` class was introduced in Symfony 6.3. - The ``OidcTokenHandler`` requires ``web-token/jwt-signature``, ``web-token/jwt-checker`` and ``web-token/jwt-signature-algorithm-ecdsa`` packages. If you haven't installed them yet, run these commands: @@ -708,11 +700,6 @@ create your own User from the claims, you must Creating Users from Token ------------------------- -.. versionadded:: 6.3 - - The possibility to omit the user provider in case of stateless firewalls - was introduced in Symfony 6.3. - Some types of tokens (for instance OIDC) contain all information required to create a user entity (e.g. username and roles). In this case, you don't need a user provider to create a user from the database:: diff --git a/security/csrf.rst b/security/csrf.rst index be7bb909f61..0352d7e6f87 100644 --- a/security/csrf.rst +++ b/security/csrf.rst @@ -164,6 +164,28 @@ method to check its validity:: } } +.. _csrf-controller-attributes: + +Alternatively you can use the +:class:`Symfony\\Component\\Security\\Http\\Attribute\\IsCsrfTokenValid` +attribute on the controller action:: + + use Symfony\Component\HttpFoundation\Request; + use Symfony\Component\HttpFoundation\Response; + use Symfony\Component\Security\Http\Attribute\IsCsrfTokenValid; + // ... + + #[IsCsrfTokenValid('delete-item', tokenKey: 'token')] + public function delete(Request $request): Response + { + // ... do something, like deleting an object + } + +.. versionadded:: 7.1 + + The :class:`Symfony\\Component\\Security\\Http\\Attribute\\IsCsrfTokenValid` + attribute was introduced in Symfony 7.1. + CSRF Tokens and Compression Side-Channel Attacks ------------------------------------------------ diff --git a/security/custom_authenticator.rst b/security/custom_authenticator.rst index 1a744dc1198..5283bd41ad3 100644 --- a/security/custom_authenticator.rst +++ b/security/custom_authenticator.rst @@ -109,7 +109,7 @@ The authenticator can be enabled using the ``custom_authenticators`` setting: http://symfony.com/schema/dic/security https://symfony.com/schema/dic/security/security-1.0.xsd"> - + diff --git a/security/entry_point.rst b/security/entry_point.rst index e99a4039fcb..b23f45db957 100644 --- a/security/entry_point.rst +++ b/security/entry_point.rst @@ -42,7 +42,7 @@ You can configure this using the ``entry_point`` setting: http://symfony.com/schema/dic/security https://symfony.com/schema/dic/security/security-1.0.xsd"> - +