From 49239d969d25c25a6945aa297d89d423624998f9 Mon Sep 17 00:00:00 2001
From: Pierre-Jean Leger
Date: Sat, 7 Mar 2020 10:37:29 +0100
Subject: [PATCH 0001/5766] Missing format parameter in a serialize call
---
components/serializer.rst | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/components/serializer.rst b/components/serializer.rst
index 5f150a212b3..e7ed6f12550 100644
--- a/components/serializer.rst
+++ b/components/serializer.rst
@@ -625,7 +625,7 @@ defines a ``Person`` entity with a ``firstName`` property:
This custom mapping is used to convert property names when serializing and
deserializing objects::
- $serialized = $serializer->serialize(new Person("Kévin"));
+ $serialized = $serializer->serialize(new Person("Kévin"), 'json');
// {"customer_name": "Kévin"}
Serializing Boolean Attributes
@@ -1450,7 +1450,7 @@ and ``BitBucketCodeRepository`` classes:
Once configured, the serializer uses the mapping to pick the correct class::
- $serialized = $serializer->serialize(new GitHubCodeRepository());
+ $serialized = $serializer->serialize(new GitHubCodeRepository(), 'json');
// {"type": "github"}
$repository = $serializer->deserialize($serialized, CodeRepository::class, 'json');
From 98574f5233c680e0e0a503355fd22ec3e286b4c7 Mon Sep 17 00:00:00 2001
From: Joe Bennett
Date: Mon, 8 Jun 2020 15:51:01 +1000
Subject: [PATCH 0002/5766] #37139 Updated Lock MongoDbStore note on
readPreference
---
components/lock.rst | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/components/lock.rst b/components/lock.rst
index 6dfeb5518dc..257aa2d1cd8 100644
--- a/components/lock.rst
+++ b/components/lock.rst
@@ -647,9 +647,10 @@ about `Expire Data from Collections by Setting TTL`_ in MongoDB.
locks don't expire prematurely; the lock TTL should be set with enough extra
time in ``expireAfterSeconds`` to account for any clock drift between nodes.
-``writeConcern``, ``readConcern`` and ``readPreference`` are not specified by
-MongoDbStore meaning the collection's settings will take effect. Read more
-about `Replica Set Read and Write Semantics`_ in MongoDB.
+``writeConcern`` and ``readConcern`` are not specified by MongoDbStore meaning
+the collection's settings will take effect.
+``readPreference`` is ``primary`` for all queries.
+Read more about `Replica Set Read and Write Semantics`_ in MongoDB.
PdoStore
~~~~~~~~~~
From 9b704d57e20072b9f5bcfbe474c99d6eb1b3a771 Mon Sep 17 00:00:00 2001
From: Carlos Pereira De Amorim
Date: Fri, 26 Jun 2020 16:09:43 +0200
Subject: [PATCH 0003/5766] Added function to get a specific transition
---
workflow.rst | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/workflow.rst b/workflow.rst
index 376996534ba..7521705980d 100644
--- a/workflow.rst
+++ b/workflow.rst
@@ -229,6 +229,8 @@ what actions are allowed on a blog post::
// See all the available transitions for the post in the current state
$transitions = $workflow->getEnabledTransitions($post);
+ // See a specific available transition for the post in the current state
+ $transition = $workflow->getEnabledTransition($post, 'publish');
Accessing the Workflow in a Class
---------------------------------
@@ -649,6 +651,9 @@ of domain logic in your templates:
``workflow_transitions()``
Returns an array with all the transitions enabled for the given object.
+``workflow_transition()``
+ Returns a specific transitions enabled for the given object and transition name.
+
``workflow_marked_places()``
Returns an array with the place names of the given marking.
@@ -883,6 +888,15 @@ In Twig templates, metadata is available via the ``workflow_metadata()`` functio
{% endfor %}
+
Learn more
----------
From af5401a38a622e0cc55b42eca361ae7061852f9b Mon Sep 17 00:00:00 2001
From: Laurent VOULLEMIER
Date: Tue, 18 Aug 2020 17:44:19 +0200
Subject: [PATCH 0004/5766] Remove manual enabling of validation and validator
annotations
---
validation.rst | 72 +-------------------------------------------------
1 file changed, 1 insertion(+), 71 deletions(-)
diff --git a/validation.rst b/validation.rst
index fd18f003d56..de6cfb755a3 100644
--- a/validation.rst
+++ b/validation.rst
@@ -207,77 +207,7 @@ Inside the template, you can output the list of errors exactly as needed:
Configuration
-------------
-Before using the Symfony validator, make sure it's enabled in the main config
-file:
-
-.. configuration-block::
-
- .. code-block:: yaml
-
- # config/packages/framework.yaml
- framework:
- validation: { enabled: true }
-
- .. code-block:: xml
-
-
-
-
-
-
-
-
-
-
- .. code-block:: php
-
- // config/packages/framework.php
- $container->loadFromExtension('framework', [
- 'validation' => [
- 'enabled' => true,
- ],
- ]);
-
-Besides, if you plan to use annotations to configure validation, replace the
-previous configuration by the following:
-
-.. configuration-block::
-
- .. code-block:: yaml
-
- # config/packages/framework.yaml
- framework:
- validation: { enable_annotations: true }
-
- .. code-block:: xml
-
-
-
-
-
-
-
-
-
-
- .. code-block:: php
-
- // config/packages/framework.php
- $container->loadFromExtension('framework', [
- 'validation' => [
- 'enable_annotations' => true,
- ],
- ]);
+In the previous Symfony versions, enabling the validator in configuration was a requirement. It's not the case anymore, the validation is enabled by default as long as the Validator component is installed. In the same way, annotations are enabled by default if ``doctrine/annotations`` is installed.
.. tip::
From c3b9b2b731336ff22edb83e7f2586545da6d9862 Mon Sep 17 00:00:00 2001
From: Laurent VOULLEMIER
Date: Thu, 27 Aug 2020 11:55:52 +0200
Subject: [PATCH 0005/5766] Replace overriding twig.paths by twig.default_path
---
configuration/override_dir_structure.rst | 12 +++++-------
reference/configuration/twig.rst | 2 ++
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/configuration/override_dir_structure.rst b/configuration/override_dir_structure.rst
index 16c9a93ef98..38b3a0ab821 100644
--- a/configuration/override_dir_structure.rst
+++ b/configuration/override_dir_structure.rst
@@ -94,8 +94,8 @@ Override the Templates Directory
--------------------------------
If your templates are not stored in the default ``app/Resources/views/``
-directory, use the :ref:`twig.paths ` configuration option to
-define your own templates directory (or directories):
+directory, use the :ref:`twig.default_path ` configuration option to
+define your own templates directory (use :ref:`twig.paths ` for multiple directories):
.. configuration-block::
@@ -104,7 +104,7 @@ define your own templates directory (or directories):
# app/config/config.yml
twig:
# ...
- paths: ["%kernel.project_dir%/templates"]
+ default_path: "%kernel.project_dir%/templates"
.. code-block:: xml
@@ -119,7 +119,7 @@ define your own templates directory (or directories):
https://symfony.com/schema/dic/twig/twig-1.0.xsd">
- %kernel.project_dir%/templates
+ %kernel.project_dir%/templates
@@ -128,9 +128,7 @@ define your own templates directory (or directories):
// app/config/config.php
$container->loadFromExtension('twig', [
- 'paths' => [
- '%kernel.project_dir%/templates',
- ],
+ 'default_path' => '%kernel.project_dir%/templates',
]);
.. _override-web-dir:
diff --git a/reference/configuration/twig.rst b/reference/configuration/twig.rst
index 88229859230..0c115fbd154 100644
--- a/reference/configuration/twig.rst
+++ b/reference/configuration/twig.rst
@@ -243,6 +243,8 @@ on. Set it to ``0`` to disable all the optimizations. You can even enable or
disable these optimizations selectively, as explained in the Twig documentation
about `the optimizer extension`_.
+.. _config-twig-default-path:
+
``default_path``
~~~~~~~~~~~~~~~~
From b65212f9ed1d3f56e77b4af6e0ac7224dca8e899 Mon Sep 17 00:00:00 2001
From: Laurent VOULLEMIER
Date: Fri, 28 Aug 2020 22:22:20 +0200
Subject: [PATCH 0006/5766] Some fixes in structure overriding:
* Use `default_path` instead of `paths` to change translation directory (default_path is anyway added to paths)
* Replace `var` by `vendor` in the public directory section
---
configuration/override_dir_structure.rst | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/configuration/override_dir_structure.rst b/configuration/override_dir_structure.rst
index fbfa119cc14..54788bb4964 100644
--- a/configuration/override_dir_structure.rst
+++ b/configuration/override_dir_structure.rst
@@ -141,8 +141,8 @@ Override the Translations Directory
-----------------------------------
If your translation files are not stored in the default ``translations/``
-directory, use the :ref:`framework.translator.paths `
-configuration option to define your own translations directory (or directories):
+directory, use the :ref:`framework.translator.default_path `
+configuration option to define your own translations directory (use :ref:`framework.translator.paths ` for multiple directories):
.. configuration-block::
@@ -152,7 +152,7 @@ configuration option to define your own translations directory (or directories):
framework:
translator:
# ...
- paths: ["%kernel.project_dir%/i18n"]
+ default_path: "%kernel.project_dir%/i18n"
.. code-block:: xml
@@ -168,7 +168,7 @@ configuration option to define your own translations directory (or directories):
- %kernel.project_dir%/i18n
+ %kernel.project_dir%/i18n
@@ -179,9 +179,7 @@ configuration option to define your own translations directory (or directories):
// config/packages/translation.php
$container->loadFromExtension('framework', [
'translator' => [
- 'paths' => [
- '%kernel.project_dir%/i18n',
- ],
+ 'default_path' => '%kernel.project_dir%/i18n',
],
]);
@@ -192,7 +190,7 @@ Override the Public Directory
-----------------------------
If you need to rename or move your ``public/`` directory, the only thing you
-need to guarantee is that the path to the ``var/`` directory is still correct in
+need to guarantee is that the path to the ``vendor/`` directory is still correct in
your ``index.php`` front controller. If you renamed the directory, you're fine.
But if you moved it in some way, you may need to modify these paths inside those
files::
From c8e5dd6aa9d2f1688dbc81af4072bd909b908ed0 Mon Sep 17 00:00:00 2001
From: Thomas Landauer
Date: Sun, 13 Sep 2020 17:02:25 +0200
Subject: [PATCH 0007/5766] Update http_client.rst
Integrating the findings of https://github.com/symfony/symfony/issues/38082#issuecomment-690529165
---
http_client.rst | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/http_client.rst b/http_client.rst
index 0d8648643b7..14c73d4eb82 100644
--- a/http_client.rst
+++ b/http_client.rst
@@ -642,6 +642,11 @@ when the streams are large)::
'body' => $formData->bodyToString(),
]);
+If you need to add a custom HTTP header to the upload, you can do::
+
+ $headers = $formData->getPreparedHeaders()->toArray();
+ $headers[] = 'X-Foo: bar';
+
Cookies
~~~~~~~
From f41ef122c26ec0bb532dab399d2ba4c9f93af8eb Mon Sep 17 00:00:00 2001
From: Nicolas Grekas
Date: Sat, 30 May 2020 15:42:21 +0200
Subject: [PATCH 0008/5766] [HttpClient] add doc about extending and
AsyncDecoratorTrait
---
http_client.rst | 104 ++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 104 insertions(+)
diff --git a/http_client.rst b/http_client.rst
index 42a4b0388da..7c4c50932ae 100644
--- a/http_client.rst
+++ b/http_client.rst
@@ -1322,6 +1322,110 @@ This allows using them where native PHP streams are needed::
// later on if you need to, you can access the response from the stream
$response = stream_get_meta_data($streamResource)['wrapper_data']->getResponse();
+Extensibility
+-------------
+
+In order to extend the behavior of a base HTTP client, decoration is the way to go::
+
+ class MyExtendedHttpClient implements HttpClientInterface
+ {
+ private $decoratedClient;
+
+ public function __construct(HttpClientInterface $decoratedClient = null)
+ {
+ $this->decoratedClient = $decoratedClient ?? HttpClient::create();
+ }
+
+ public function request(string $method, string $url, array $options = []): ResponseInterface
+ {
+ // do what you want here with $method, $url and/or $options
+
+ $response = $this->decoratedClient->request();
+
+ //!\ calling any method on $response here would break async, see below for a better way
+
+ return $response;
+ }
+
+ public function stream($responses, float $timeout = null): ResponseStreamInterface
+ {
+ return $this->decoratedClient->stream($responses, $timeout);
+ }
+ }
+
+A decorator like this one is suited for use cases where processing the
+requests' arguments is enough.
+
+By decorating the ``on_progress`` option, one can
+even implement basic monitoring of the response. But since calling responses'
+methods forces synchronous operations, doing so in ``request()`` breaks async.
+The solution then is to also decorate the response object itself.
+:class:`Symfony\\Component\\HttpClient\\TraceableHttpClient` and
+:class:`Symfony\\Component\\HttpClient\\Response\\TraceableResponse` are good
+examples as a starting point.
+
+.. versionadded:: 5.2
+
+ ``AsyncDecoratorTrait`` was introduced in Symfony 5.2.
+
+In order to help writing more advanced response processors, the component provides
+an :class:`Symfony\\Component\\HttpClient\\AsyncDecoratorTrait`. This trait allows
+processing the stream of chunks as they come back from the network::
+
+ class MyExtendedHttpClient implements HttpClientInterface
+ {
+ use AsyncDecoratorTrait;
+
+ public function request(string $method, string $url, array $options = []): ResponseInterface
+ {
+ // do what you want here with $method, $url and/or $options
+
+ $passthru = function (ChunkInterface $chunk, AsyncContext $context) {
+
+ // do what you want with chunks, e.g. split them
+ // in smaller chunks, group them, skip some, etc.
+
+ yield $chunk;
+ };
+
+ return new AsyncResponse($this->client, $method, $url, $options, $passthru);
+ }
+ }
+
+Because the trait already implements a constructor and the ``stream()`` method,
+you don't need to add them. The ``request()`` method should still be defined;
+it shall return an
+:class:`Symfony\\Component\\HttpClient\\Response\\AsyncResponse`.
+
+The custom processing of chunks should happen in ``$passthru``: this generator
+is where you need to write your logic. It will be called for each chunk yielded by
+the underlying client. A ``$passthru`` that does nothing would just ``yield $chunk;``.
+Of course, you could also yield a modified chunk, split the chunk into many
+ones by yielding several times, or even skip a chunk altogether by issuing a
+``return;`` instead of yielding.
+
+In order to control the stream, the chunk passthru receives an
+:class:`Symfony\\Component\\HttpClient\\Response\\AsyncContext` as second
+argument. This context object has methods to read the current state of the
+response. It also allows altering the response stream with methods to create new
+chunks of content, pause the stream, cancel the stream, change the info of the
+response, replace the current request by another one or change the chunk passthru
+itself.
+
+Checking the test cases implemented in
+:class:`Symfony\\Component\\HttpClient\\Response\\Tests\\AsyncDecoratorTraitTest`
+might be a good start to get various working examples for a better understanding.
+Here are the use cases that it simulates:
+
+* retry a failed request;
+* send a preflight request, e.g. for authentication needs;
+* issue subrequests and include their content in the main response's body.
+
+The logic in :class:`Symfony\\Component\\HttpClient\\Response\\AsyncResponse` has
+many safety checks that will throw a ``LogicException`` if the chunk passthru
+doesn't behave correctly; e.g. if a chunk is yielded after an ``isLast()`` one,
+or if a content chunk is yielded before an ``isFirst()`` one, etc.
+
Testing HTTP Clients and Responses
----------------------------------
From 7a89d40780f775277a188aded3dc6c2afc88a4ec Mon Sep 17 00:00:00 2001
From: Simon Rolland
Date: Tue, 13 Oct 2020 15:01:05 +0200
Subject: [PATCH 0009/5766] Update ICU project doc website
---
reference/forms/types/datetime.rst | 2 +-
reference/forms/types/options/date_format.rst.inc | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/reference/forms/types/datetime.rst b/reference/forms/types/datetime.rst
index 3bafb96c57f..f5424d49cd0 100644
--- a/reference/forms/types/datetime.rst
+++ b/reference/forms/types/datetime.rst
@@ -222,4 +222,4 @@ Field Variables
+--------------+------------+----------------------------------------------------------------------+
.. _`datetime local`: http://w3c.github.io/html-reference/datatypes.html#form.data.datetime-local
-.. _`Date/Time Format Syntax`: http://userguide.icu-project.org/formatparse/datetime#TOC-Date-Time-Format-Syntax
+.. _`Date/Time Format Syntax`: https://unicode-org.github.io/icu/userguide/format_parse/datetime/#datetime-format-syntax
diff --git a/reference/forms/types/options/date_format.rst.inc b/reference/forms/types/options/date_format.rst.inc
index c7874b505bd..7a6501a6fd9 100644
--- a/reference/forms/types/options/date_format.rst.inc
+++ b/reference/forms/types/options/date_format.rst.inc
@@ -29,6 +29,6 @@ For more information on valid formats, see `Date/Time Format Syntax`_::
(the `RFC 3339`_ format) which is the default value if you use the
``single_text`` widget.
-.. _`Date/Time Format Syntax`: http://userguide.icu-project.org/formatparse/datetime#TOC-Date-Time-Format-Syntax
+.. _`Date/Time Format Syntax`: https://unicode-org.github.io/icu/userguide/format_parse/datetime/#datetime-format-syntax
.. _`IntlDateFormatter::MEDIUM`: https://php.net/manual/en/class.intldateformatter.php#intl.intldateformatter-constants
.. _`RFC 3339`: https://tools.ietf.org/html/rfc3339
From 3892e26df91cd69892c9564571073a58b0a94a41 Mon Sep 17 00:00:00 2001
From: Wouter de Jong
Date: Sun, 9 Aug 2020 16:20:30 +0200
Subject: [PATCH 0010/5766] Clarify authentication entry point and access
denied handler
---
security/access_denied_handler.rst | 181 ++++++++++++++++++++++++++---
1 file changed, 166 insertions(+), 15 deletions(-)
diff --git a/security/access_denied_handler.rst b/security/access_denied_handler.rst
index e9e780e75ef..eed7589bee2 100644
--- a/security/access_denied_handler.rst
+++ b/security/access_denied_handler.rst
@@ -1,17 +1,116 @@
.. index::
single: Security; Creating a Custom Access Denied Handler
-How to Create a Custom Access Denied Handler
-============================================
+How to Customize Access Denied Responses
+========================================
-When your application throws an ``AccessDeniedException``, you can handle this exception
-with a service to return a custom response.
+In Symfony, you can throw an
+:class:`Symfony\\Component\\Security\\Core\\Exception\\AccessDeniedException`
+to disallow access to the user. Symfony will handle this exception and
+generates a response based on the authentication state:
-First, create a class that implements
+* **If the user is not authenticated** (or authenticated anonymously), an
+ authentication entry point is used to generated a response (typically
+ a redirect to the login page or an *401 Unauthorized* response);
+* **If the user is authenticated, but does not have the required
+ permissions**, a *403 Forbidden* response is generated.
+
+Customize the Unauthorized Response
+-----------------------------------
+
+You need to create a class that implements
+:class:`Symfony\\Component\\Security\\Http\\EntryPoint\\AuthenticationEntryPointInterface`.
+This interface has one method (``start()``) that is called whenever an
+unauthenticated user tries to access a protected resource::
+
+ // src/Security/AuthenticationEntryPoint.php
+ namespace App\Security;
+
+ use Symfony\Component\HttpFoundation\RedirectResponse;
+ use Symfony\Component\HttpFoundation\Request;
+ use Symfony\Component\HttpFoundation\Session\SessionInterface;
+ use Symfony\Component\Security\Core\Exception\AuthenticationException;
+ use Symfony\Component\Security\Http\EntryPoint\AuthenticationEntryPointInterface;
+
+ class AuthenticationEntryPoint implements AuthenticationEntryPointInterface
+ {
+ private $urlGenerator;
+ private $session;
+
+ public function __construct(UrlGeneratorInterface $urlGenerator, SessionInterface $session)
+ {
+ $this->urlGenerator = $urlGenerator;
+ $this->session = $session;
+ }
+
+ public function start(Request $request, AuthenticationException $authException = null): RedirectResponse
+ {
+ // add a custom flash message and redirect to the login page
+ $this->session->getFlashBag()->add('note', 'You have to login in order to access this page.');
+
+ return new RedirectResponse($this->urlGenerator->generate('security_login'));
+ }
+ }
+
+That's it if you're using the :ref:`default services.yaml configuration `.
+Otherwise, you have to register this service in the container.
+
+Now, configure this service ID as the entry point for the firewall:
+
+.. configuration-block::
+
+ .. code-block:: yaml
+
+ # config/packages/security.yaml
+ firewalls:
+ # ...
+
+ main:
+ # ...
+ entry_point: App\Security\AuthenticationEntryPoint
+
+ .. code-block:: xml
+
+
+
+
+
+
+
+
+
+
+
+
+ .. code-block:: php
+
+ // config/packages/security.php
+ use App\Security\AuthenticationEntryPoint;
+
+ $container->loadFromExtension('security', [
+ 'firewalls' => [
+ 'main' => [
+ // ...
+ 'entry_point' => AuthenticationEntryPoint::class,
+ ],
+ ],
+ ]);
+
+Customize the Forbidden Response
+--------------------------------
+
+Create a class that implements
:class:`Symfony\\Component\\Security\\Http\\Authorization\\AccessDeniedHandlerInterface`.
-This interface defines one method called ``handle()`` where you can implement whatever
-logic that should run when access is denied for the current user (e.g. send a
-mail, log a message, or generally return a custom response)::
+This interface defines one method called ``handle()`` where you can
+implement whatever logic that should execute when access is denied for the
+current user (e.g. send a mail, log a message, or generally return a custom
+response)::
namespace App\Security;
@@ -49,11 +148,21 @@ configure it under your firewall:
.. code-block:: xml
-
-
- App\Security\AccessDeniedHandler
-
-
+
+
+
+
+
+
+
+
+
.. code-block:: php
@@ -69,5 +178,47 @@ configure it under your firewall:
],
]);
-That's it! Any ``AccessDeniedException`` thrown by code under the ``main`` firewall
-will now be handled by your service.
+Customizing All Access Denied Responses
+---------------------------------------
+
+In some cases, you might want to customize both responses or do a specific
+action (e.g. logging) for each ``AccessDeniedException``. In this case,
+configure a :ref:`kernel.exception listener `::
+
+ // src/EventListener/AccessDeniedListener.php
+ namespace App\EventListener;
+
+ use Symfony\Component\EventDispatcher\EventSubscriberInterface;
+ use Symfony\Component\HttpFoundation\Response;
+ use Symfony\Component\HttpKernel\Event\ExceptionEvent;
+ use Symfony\Component\HttpKernel\KernelEvents;
+ use Symfony\Component\Security\Core\Exception\AccessDeniedException;
+
+ class AccessDeniedListener implements EventSubscriberInterface
+ {
+ public static function getSubscribedEvents(): array
+ {
+ return [
+ // the priority must be greater than the Security HTTP
+ // ExceptionListener, to make sure it's called before
+ // the default exception listener
+ KernelEvents::EXCEPTION => ['onKernelException', 2],
+ ];
+ }
+
+ public function onKernelException(ExceptionEvent $event): void
+ {
+ $exception = $event->getException();
+ if (!$exception instanceof AccessDeniedException) {
+ return;
+ }
+
+ // ... perform some action (e.g. logging)
+
+ // optionally set the custom response
+ $event->setResponse(new Response(null, 403));
+
+ // or stop propagation (prevents the next exception listeners from being called)
+ //$event->stopPropagation();
+ }
+ }
From 8e1af9d7303d2c8e7fc7e84686df7c6f782f33fc Mon Sep 17 00:00:00 2001
From: Matthew Smeets
Date: Thu, 15 Oct 2020 20:16:16 +0200
Subject: [PATCH 0011/5766] Adding more information about default translation
domain 'messages'
---
translation.rst | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/translation.rst b/translation.rst
index 9a9effd3527..db50e05cb07 100644
--- a/translation.rst
+++ b/translation.rst
@@ -655,9 +655,12 @@ priority message files.
The filename of the translation files is also important: each message file
must be named according to the following path: ``domain.locale.loader``:
-* **domain**: An optional way to organize messages into groups. Unless
+* **domain**: Domains are a way to organize messages into groups. Unless
parts of the application are explicitly separated from each other, it is
- recommended to only use default ``messages`` domain;
+ recommended to only use default ``messages`` domain.
+
+ If no domains are explicitly defined while using the translator, Symfony
+ will default to the ``messages`` domain (e.g. ``messages.en.yaml``)
* **locale**: The locale that the translations are for (e.g. ``en_GB``, ``en``, etc);
From feea39804413ee607973e2bed12f433929945744 Mon Sep 17 00:00:00 2001
From: Matthew Smeets
Date: Thu, 15 Oct 2020 20:30:28 +0200
Subject: [PATCH 0012/5766] Adding information to the monolog autowire
documentation that specifies that the channel must be defined
---
logging/channels_handlers.rst | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/logging/channels_handlers.rst b/logging/channels_handlers.rst
index b206c1c5137..bac0be76012 100644
--- a/logging/channels_handlers.rst
+++ b/logging/channels_handlers.rst
@@ -182,8 +182,10 @@ How to Autowire Logger Channels
Starting from `MonologBundle`_ 3.5 you can autowire different Monolog channels
by type-hinting your service arguments with the following syntax:
-``Psr\Log\LoggerInterface $Logger``. For example, to inject the service
-related to the ``app`` logger channel use this:
+``Psr\Log\LoggerInterface $Logger``. The ```` must have been
+predefined in your Monolog configuration.
+
+An example to inject the service related to the ``app`` logger channel:
.. code-block:: diff
From 19521c3a25b4d1afb3b4b8e9fe02014ac9312972 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Deruss=C3=A9?=
Date: Tue, 20 Oct 2020 09:53:08 +0200
Subject: [PATCH 0013/5766] Fix documentation about RetryStrategy
---
http_client.rst | 7 ++--
reference/configuration/framework.rst | 55 +++++++++------------------
2 files changed, 22 insertions(+), 40 deletions(-)
diff --git a/http_client.rst b/http_client.rst
index a54e9b125a8..e0a9d6808e3 100644
--- a/http_client.rst
+++ b/http_client.rst
@@ -710,10 +710,9 @@ original HTTP client::
$client = new RetryableHttpClient(HttpClient::create());
The ``RetryableHttpClient`` uses a
-:class:`Symfony\\Component\\HttpClient\\Retry\\RetryDeciderInterface` to
-decide if the request should be retried, and a
-:class:`Symfony\\Component\\HttpClient\\Retry\\RetryBackOffInterface` to
-define the waiting time between each retry.
+:class:`Symfony\\Component\\HttpClient\\Retry\\RetryStrategyInterface` to
+decide if the request should be retried, and to define the waiting time between
+each retry.
HTTP Proxies
~~~~~~~~~~~~
diff --git a/reference/configuration/framework.rst b/reference/configuration/framework.rst
index cdf5451d94a..a3d6e9fd95a 100644
--- a/reference/configuration/framework.rst
+++ b/reference/configuration/framework.rst
@@ -140,8 +140,7 @@ Configuration
* :ref:`retry_failed `
- * `backoff_service`_
- * `decider_service`_
+ * `retry_strategy`_
* :ref:`enabled `
* `delay`_
* `http_codes`_
@@ -157,8 +156,7 @@ Configuration
* :ref:`retry_failed `
- * `backoff_service`_
- * `decider_service`_
+ * `retry_strategy`_
* :ref:`enabled `
* `delay`_
* `http_codes`_
@@ -780,8 +778,7 @@ will automatically retry failed HTTP requests.
http_client:
# ...
retry_failed:
- # backoff_service: app.custom_backoff
- # decider_service: app.custom_decider
+ # retry_strategy: app.custom_strategy
http_codes: [429, 500]
max_retries: 2
delay: 1000
@@ -826,21 +823,6 @@ in the `Microsoft NTLM authentication protocol`_. The value of this option must
follow the format ``username:password``. This authentication mechanism requires
using the cURL-based transport.
-backoff_service
-...............
-
-**type**: ``string``
-
-.. versionadded:: 5.2
-
- The ``backoff_service`` option was introduced in Symfony 5.2.
-
-The service id used to compute the time to wait between retries. By default, it
-uses an instance of
-:class:`Symfony\\Component\\HttpClient\\Retry\\ExponentialBackOff` configured
-with ``delay``, ``max_delay``, ``multiplier`` and ``jitter`` options. This
-class has to implement :class:`Symfony\\Component\\HttpClient\\Retry\\RetryBackOffInterface`.
-
base_uri
........
@@ -909,21 +891,6 @@ ciphers
A list of the names of the ciphers allowed for the SSL/TLS connections. They
can be separated by colons, commas or spaces (e.g. ``'RC4-SHA:TLS13-AES-128-GCM-SHA256'``).
-decider_service
-...............
-
-**type**: ``string``
-
-.. versionadded:: 5.2
-
- The ``decider_service`` option was introduced in Symfony 5.2.
-
-The service id used to decide if a request should be retried. By default, it
-uses an instance of
-:class:`Symfony\\Component\\HttpClient\\Retry\\HttpStatusCodeDecider` configured
-with the ``http_codes`` option. This class has to implement
-:class:`Symfony\\Component\\HttpClient\\Retry\\RetryDeciderInterface`.
-
delay
.....
@@ -1124,6 +1091,22 @@ client and to make your tests easier.
The value of this option is an associative array of ``domain => IP address``
(e.g ``['symfony.com' => '46.137.106.254', ...]``).
+retry_strategy
+...............
+
+**type**: ``string``
+
+.. versionadded:: 5.2
+
+ The ``retry_strategy`` option was introduced in Symfony 5.2.
+
+The service is used to decide if a request should be retried and to compute the
+time to wait between retries. By default, it uses an instance of
+:class:`Symfony\\Component\\HttpClient\\Retry\\GenericRetryStrategy` configured
+with ``http_codes``, ``delay``, ``max_delay``, ``multiplier`` and ``jitter``
+options. This class has to implement
+:class:`Symfony\\Component\\HttpClient\\Retry\\RetryStrategyInterface`.
+
scope
.....
From 4155cc270069850a6281c5cb4566aa3d03d94bbd Mon Sep 17 00:00:00 2001
From: michel v
Date: Tue, 20 Oct 2020 10:43:45 +0200
Subject: [PATCH 0014/5766] use the right method when dealing with promises
sendRequest() returns a response, not a promise, and we can't use then() on a response
---
http_client.rst | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/http_client.rst b/http_client.rst
index 4db3784f853..7591152da85 100644
--- a/http_client.rst
+++ b/http_client.rst
@@ -1291,7 +1291,7 @@ Then you're ready to go::
$httpClient = new HttplugClient();
$request = $httpClient->createRequest('GET', 'https://my.api.com/');
- $promise = $httpClient->sendRequest($request)
+ $promise = $httpClient->sendAsyncRequest($request)
->then(
function (ResponseInterface $response) {
echo 'Got status '.$response->getStatusCode();
From 09a9aa0d903f154e4c62654e2c652c7750a72c58 Mon Sep 17 00:00:00 2001
From: Ahmed TAILOULOUTE
Date: Mon, 30 Dec 2019 08:44:27 +0100
Subject: [PATCH 0015/5766] Update typehints
---
components/asset.rst | 4 ++--
configuration/env_var_processors.rst | 2 +-
form/data_mappers.rst | 4 ++--
form/type_guesser.rst | 12 ++++++------
forms.rst | 2 +-
frontend/custom_version_strategy.rst | 6 +++---
reference/dic_tags.rst | 4 ++--
security/access_control.rst | 2 +-
security/custom_authentication_provider.rst | 2 +-
security/user_provider.rst | 6 +++---
serializer/custom_encoders.rst | 8 ++++----
session/locale_sticky_session.rst | 2 +-
12 files changed, 27 insertions(+), 27 deletions(-)
diff --git a/components/asset.rst b/components/asset.rst
index 20b5ce20b2d..48e51754449 100644
--- a/components/asset.rst
+++ b/components/asset.rst
@@ -200,12 +200,12 @@ every day::
$this->version = date('Ymd');
}
- public function getVersion($path)
+ public function getVersion(string $path)
{
return $this->version;
}
- public function applyVersion($path)
+ public function applyVersion(string $path)
{
return sprintf('%s?v=%s', $path, $this->getVersion($path));
}
diff --git a/configuration/env_var_processors.rst b/configuration/env_var_processors.rst
index b9782d270cd..464bf7af984 100644
--- a/configuration/env_var_processors.rst
+++ b/configuration/env_var_processors.rst
@@ -631,7 +631,7 @@ create a class that implements
class LowercasingEnvVarProcessor implements EnvVarProcessorInterface
{
- public function getEnv($prefix, $name, \Closure $getEnv)
+ public function getEnv(string $prefix, string $name, \Closure $getEnv)
{
$env = $getEnv($name);
diff --git a/form/data_mappers.rst b/form/data_mappers.rst
index 15e66ce54b3..54081c09e47 100644
--- a/form/data_mappers.rst
+++ b/form/data_mappers.rst
@@ -98,7 +98,7 @@ in your form type::
/**
* @param Color|null $viewData
*/
- public function mapDataToForms($viewData, $forms)
+ public function mapDataToForms($viewData, iterable $forms)
{
// there is no data yet, so nothing to prepopulate
if (null === $viewData) {
@@ -119,7 +119,7 @@ in your form type::
$forms['blue']->setData($viewData->getBlue());
}
- public function mapFormsToData($forms, &$viewData)
+ public function mapFormsToData(iterable $forms, &$viewData)
{
/** @var FormInterface[] $forms */
$forms = iterator_to_array($forms);
diff --git a/form/type_guesser.rst b/form/type_guesser.rst
index f990aad4115..13f54999692 100644
--- a/form/type_guesser.rst
+++ b/form/type_guesser.rst
@@ -43,19 +43,19 @@ Start by creating the class and these methods. Next, you'll learn how to fill ea
class PHPDocTypeGuesser implements FormTypeGuesserInterface
{
- public function guessType($class, $property)
+ public function guessType(string $class, string $property)
{
}
- public function guessRequired($class, $property)
+ public function guessRequired(string $class, string $property)
{
}
- public function guessMaxLength($class, $property)
+ public function guessMaxLength(string $class, string $property)
{
}
- public function guessPattern($class, $property)
+ public function guessPattern(string $class, string $property)
{
}
}
@@ -94,7 +94,7 @@ With this knowledge, you can implement the ``guessType()`` method of the
class PHPDocTypeGuesser implements FormTypeGuesserInterface
{
- public function guessType($class, $property)
+ public function guessType(string $class, string $property)
{
$annotations = $this->readPhpDocAnnotations($class, $property);
@@ -129,7 +129,7 @@ With this knowledge, you can implement the ``guessType()`` method of the
}
}
- protected function readPhpDocAnnotations($class, $property)
+ protected function readPhpDocAnnotations(string $class, string $property)
{
$reflectionProperty = new \ReflectionProperty($class, $property);
$phpdoc = $reflectionProperty->getDocComment();
diff --git a/forms.rst b/forms.rst
index 5867d2f07d1..ec5a04fcfc1 100644
--- a/forms.rst
+++ b/forms.rst
@@ -672,7 +672,7 @@ Set the ``label`` option on fields to define their labels explicitly::
->add('dueDate', DateType::class, [
// set it to FALSE to not display the label for this field
- 'label' => 'To Be Completed Before',
+ 'label' => 'To Be Completed Before',
])
.. tip::
diff --git a/frontend/custom_version_strategy.rst b/frontend/custom_version_strategy.rst
index 6361ba632c0..0fe3f5ff987 100644
--- a/frontend/custom_version_strategy.rst
+++ b/frontend/custom_version_strategy.rst
@@ -71,13 +71,13 @@ version string::
* @param string $manifestPath
* @param string|null $format
*/
- public function __construct($manifestPath, $format = null)
+ public function __construct(string $manifestPath, string $format = null)
{
$this->manifestPath = $manifestPath;
$this->format = $format ?: '%s?%s';
}
- public function getVersion($path)
+ public function getVersion(string $path)
{
if (!is_array($this->hashes)) {
$this->hashes = $this->loadManifest();
@@ -86,7 +86,7 @@ version string::
return isset($this->hashes[$path]) ? $this->hashes[$path] : '';
}
- public function applyVersion($path)
+ public function applyVersion(string $path)
{
$version = $this->getVersion($path);
diff --git a/reference/dic_tags.rst b/reference/dic_tags.rst
index f7f43dca376..0aca3c91777 100644
--- a/reference/dic_tags.rst
+++ b/reference/dic_tags.rst
@@ -410,7 +410,7 @@ service class::
class MyClearer implements CacheClearerInterface
{
- public function clear($cacheDirectory)
+ public function clear(string $cacheDirectory)
{
// clear your cache
}
@@ -1062,7 +1062,7 @@ required option: ``alias``, which defines the name of the extractor::
/**
* Sets the prefix that should be used for new found messages.
*/
- public function setPrefix($prefix)
+ public function setPrefix(string $prefix)
{
$this->prefix = $prefix;
}
diff --git a/security/access_control.rst b/security/access_control.rst
index 9b345b87a24..b02b9057424 100644
--- a/security/access_control.rst
+++ b/security/access_control.rst
@@ -92,7 +92,7 @@ Take the following ``access_control`` entries as an example:
'path' => '^/admin',
'roles' => 'ROLE_USER_METHOD',
'methods' => 'POST, PUT',
- ]
+ ],
],
]);
diff --git a/security/custom_authentication_provider.rst b/security/custom_authentication_provider.rst
index 3199128b26a..4a0a5be4407 100644
--- a/security/custom_authentication_provider.rst
+++ b/security/custom_authentication_provider.rst
@@ -410,7 +410,7 @@ to service ids that may not exist yet: ``App\Security\Authentication\Provider\Ws
-
+
diff --git a/security/user_provider.rst b/security/user_provider.rst
index 000a7a49a38..5fcf19f3bf2 100644
--- a/security/user_provider.rst
+++ b/security/user_provider.rst
@@ -135,7 +135,7 @@ interface only requires one method: ``loadUserByUsername($username)``::
{
// ...
- public function loadUserByUsername($usernameOrEmail)
+ public function loadUserByUsername(string $usernameOrEmail)
{
$entityManager = $this->getEntityManager();
@@ -376,7 +376,7 @@ command will generate a nice skeleton to get you started::
*
* @throws UsernameNotFoundException if the user is not found
*/
- public function loadUserByUsername($username)
+ public function loadUserByUsername(string $username)
{
// Load a User object from your data source or throw UsernameNotFoundException.
// The $username argument may not actually be a username:
@@ -412,7 +412,7 @@ command will generate a nice skeleton to get you started::
/**
* Tells Symfony to use this provider for this User class.
*/
- public function supportsClass($class)
+ public function supportsClass(string $class)
{
return User::class === $class || is_subclass_of($class, User::class);
}
diff --git a/serializer/custom_encoders.rst b/serializer/custom_encoders.rst
index 5bb78def4e4..e6bae859336 100644
--- a/serializer/custom_encoders.rst
+++ b/serializer/custom_encoders.rst
@@ -27,22 +27,22 @@ create your own encoder that uses the
class YamlEncoder implements EncoderInterface, DecoderInterface
{
- public function encode($data, $format, array $context = [])
+ public function encode($data, string $format, array $context = [])
{
return Yaml::dump($data);
}
- public function supportsEncoding($format)
+ public function supportsEncoding(string $format)
{
return 'yaml' === $format;
}
- public function decode($data, $format, array $context = [])
+ public function decode(string $data, string $format, array $context = [])
{
return Yaml::parse($data);
}
- public function supportsDecoding($format)
+ public function supportsDecoding(string $format)
{
return 'yaml' === $format;
}
diff --git a/session/locale_sticky_session.rst b/session/locale_sticky_session.rst
index f8caef23370..056f2a674cb 100644
--- a/session/locale_sticky_session.rst
+++ b/session/locale_sticky_session.rst
@@ -28,7 +28,7 @@ correct locale however you want::
{
private $defaultLocale;
- public function __construct($defaultLocale = 'en')
+ public function __construct(string $defaultLocale = 'en')
{
$this->defaultLocale = $defaultLocale;
}
From b905b571fa8368f1b01600aaf337ae750a4d4956 Mon Sep 17 00:00:00 2001
From: Cristi Contiu
Date: Sat, 8 Feb 2020 21:47:34 +0200
Subject: [PATCH 0016/5766] Update deployment docs with new .env loading
---
deployment.rst | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)
diff --git a/deployment.rst b/deployment.rst
index 85b772b3a55..5d02bae0e58 100644
--- a/deployment.rst
+++ b/deployment.rst
@@ -126,21 +126,29 @@ While developing locally, you'll usually store these in ``.env`` and ``.env.loca
1. Create "real" environment variables. How you set environment variables, depends
on your setup: they can be set at the command line, in your Nginx configuration,
- or via other methods provided by your hosting service.
+ or via other methods provided by your hosting service;
-2. Or, create a ``.env.local`` file like your local development (see note below)
+2. Or, create a ``.env.local`` file like your local development.
There is no significant advantage to either of the two options: use whatever is
most natural in your hosting environment.
-.. note::
+.. tip::
+
+ You might not want your application to process the ``.env.*`` files on
+ every request. You can generate an optimized ``.env.local.php`` which
+ overrides all other configuration files:
+
+ .. code-block:: terminal
+
+ $ composer dump-env prod
- If you use the ``.env.*`` files on production, you may need to move your
- ``symfony/dotenv`` dependency from ``require-dev`` to ``require`` in ``composer.json``:
+ The generated file will contain all the configuration stored in ``.env``. If you
+ want to rely only on environment variables, generate one without any values using:
.. code-block:: terminal
- $ composer require symfony/dotenv
+ $ composer dump-env prod --empty
C) Install/Update your Vendors
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From e1277a5d37ab10e5b86c2260ea62af0e231b5a60 Mon Sep 17 00:00:00 2001
From: Wouter de Jong
Date: Sat, 18 Apr 2020 23:55:41 +0200
Subject: [PATCH 0017/5766] Added PHP typehints to getting started guides
---
configuration.rst | 3 +-
controller.rst | 41 ++++++++++++++------
page_creation.rst | 4 +-
routing.rst | 95 ++++++++++++++++++++++++++++++-----------------
templates.rst | 13 ++++---
5 files changed, 102 insertions(+), 54 deletions(-)
diff --git a/configuration.rst b/configuration.rst
index 6efd3283733..e25e18efd5b 100644
--- a/configuration.rst
+++ b/configuration.rst
@@ -765,12 +765,13 @@ use the ``getParameter()`` helper::
namespace App\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
+ use Symfony\Component\HttpFoundation\Response;
class UserController extends AbstractController
{
// ...
- public function index()
+ public function index(): Response
{
$projectDir = $this->getParameter('kernel.project_dir');
$adminEmail = $this->getParameter('app.admin_email');
diff --git a/controller.rst b/controller.rst
index d29608e6128..212d0a2b509 100644
--- a/controller.rst
+++ b/controller.rst
@@ -36,7 +36,7 @@ class::
/**
* @Route("/lucky/number/{max}", name="app_lucky_number")
*/
- public function number($max)
+ public function number(int $max): Response
{
$number = random_int(0, $max);
@@ -134,7 +134,7 @@ and ``redirect()`` methods::
use Symfony\Component\HttpFoundation\RedirectResponse;
// ...
- public function index()
+ public function index(): RedirectResponse
{
// redirects to the "homepage" route
return $this->redirectToRoute('homepage');
@@ -196,12 +196,13 @@ If you need a service in a controller, type-hint an argument with its class
(or interface) name. Symfony will automatically pass you the service you need::
use Psr\Log\LoggerInterface;
+ use Symfony\Component\HttpFoundation\Response;
// ...
/**
* @Route("/lucky/number/{max}")
*/
- public function number($max, LoggerInterface $logger)
+ public function number(int $max, LoggerInterface $logger): Response
{
$logger->info('We are logging!');
// ...
@@ -322,10 +323,11 @@ Managing Errors and 404 Pages
When things are not found, you should return a 404 response. To do this, throw a
special type of exception::
+ use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
// ...
- public function index()
+ public function index(): Response
{
// retrieve the object from database
$product = ...;
@@ -370,8 +372,10 @@ object. To access it in your controller, add it as an argument and
**type-hint it with the Request class**::
use Symfony\Component\HttpFoundation\Request;
+ use Symfony\Component\HttpFoundation\Response;
+ // ...
- public function index(Request $request, $firstName, $lastName)
+ public function index(Request $request, string $firstName, string $lastName): Response
{
$page = $request->query->get('page', 1);
@@ -401,9 +405,11 @@ Session storage and other configuration can be controlled under the
To get the session, add an argument and type-hint it with
:class:`Symfony\\Component\\HttpFoundation\\Session\\SessionInterface`::
+ use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\Session\SessionInterface;
+ // ...
- public function index(SessionInterface $session)
+ public function index(SessionInterface $session): Response
{
// stores an attribute for reuse during a later user request
$session->set('foo', 'bar');
@@ -413,6 +419,8 @@ To get the session, add an argument and type-hint it with
// uses a default value if the attribute doesn't exist
$filters = $session->get('filters', []);
+
+ // ...
}
Stored attributes remain in the session for the remainder of that user's session.
@@ -435,8 +443,10 @@ from the session automatically as soon as you retrieve them. This feature makes
For example, imagine you're processing a :doc:`form ` submission::
use Symfony\Component\HttpFoundation\Request;
+ use Symfony\Component\HttpFoundation\Response;
+ // ...
- public function update(Request $request)
+ public function update(Request $request): Response
{
// ...
@@ -515,8 +525,9 @@ pass the ``Request`` object to any controller argument that is type-hinted with
the ``Request`` class::
use Symfony\Component\HttpFoundation\Request;
+ use Symfony\Component\HttpFoundation\Response;
- public function index(Request $request)
+ public function index(Request $request): Response
{
$request->isXmlHttpRequest(); // is it an Ajax request?
@@ -572,7 +583,7 @@ To get the value of any :ref:`configuration parameter
from a controller, use the ``getParameter()`` helper method::
// ...
- public function index()
+ public function index(): Response
{
$contentsDir = $this->getParameter('kernel.project_dir').'/contents';
// ...
@@ -584,8 +595,10 @@ Returning JSON Response
To return JSON from a controller, use the ``json()`` helper method. This returns a
``JsonResponse`` object that encodes the data automatically::
+ use Symfony\Component\HttpFoundation\Response;
// ...
- public function index()
+
+ public function index(): Response
{
// returns '{"username":"jane.doe"}' and sets the proper Content-Type header
return $this->json(['username' => 'jane.doe']);
@@ -604,7 +617,10 @@ Streaming File Responses
You can use the :method:`Symfony\\Bundle\\FrameworkBundle\\Controller\\AbstractController::file`
helper to serve a file from inside a controller::
- public function download()
+ use Symfony\Component\HttpFoundation\Response;
+ // ...
+
+ public function download(): Response
{
// send the file contents and force the browser to download it
return $this->file('/path/to/some_file.pdf');
@@ -614,8 +630,9 @@ The ``file()`` helper provides some arguments to configure its behavior::
use Symfony\Component\HttpFoundation\File\File;
use Symfony\Component\HttpFoundation\ResponseHeaderBag;
+ // ...
- public function download()
+ public function download(): Response
{
// load the file from the filesystem
$file = new File('/path/to/some_file.pdf');
diff --git a/page_creation.rst b/page_creation.rst
index 1835308804e..90096beb4d4 100644
--- a/page_creation.rst
+++ b/page_creation.rst
@@ -226,13 +226,15 @@ variable so you can use it in Twig::
// src/Controller/LuckyController.php
namespace App\Controller;
+ use Symfony\Component\HttpFoundation\Response;
// ...
+
class LuckyController extends AbstractController
{
/**
* @Route("/lucky/number")
*/
- public function number()
+ public function number(): Response
{
$number = random_int(0, 100);
diff --git a/routing.rst b/routing.rst
index 75755c31d40..5aaebf659cd 100644
--- a/routing.rst
+++ b/routing.rst
@@ -53,6 +53,7 @@ do so, create a :doc:`controller class ` like the following::
namespace App\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
+ use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
class BlogController extends AbstractController
@@ -60,7 +61,7 @@ do so, create a :doc:`controller class ` like the following::
/**
* @Route("/blog", name="blog_list")
*/
- public function list()
+ public function list(): Response
{
// ...
}
@@ -161,14 +162,16 @@ Use the ``methods`` option to restrict the verbs each route should respond to:
// src/Controller/BlogApiController.php
namespace App\Controller;
- // ...
+ use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
+ use Symfony\Component\HttpFoundation\Response;
+ use Symfony\Component\Routing\Annotation\Route;
class BlogApiController extends AbstractController
{
/**
* @Route("/api/posts/{id}", methods={"GET","HEAD"})
*/
- public function show(int $id)
+ public function show(int $id): Response
{
// ... return a JSON response with the post
}
@@ -176,7 +179,7 @@ Use the ``methods`` option to restrict the verbs each route should respond to:
/**
* @Route("/api/posts/{id}", methods={"PUT"})
*/
- public function edit(int $id)
+ public function edit(int $id): Response
{
// ... edit a post
}
@@ -254,6 +257,7 @@ arbitrary matching logic:
namespace App\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
+ use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
class DefaultController extends AbstractController
@@ -268,7 +272,7 @@ arbitrary matching logic:
* expressions can also include config parameters:
* condition: "request.headers.get('User-Agent') matches '%app.allowed_browsers%'"
*/
- public function contact()
+ public function contact(): Response
{
// ...
}
@@ -406,6 +410,7 @@ defined as ``/blog/{slug}``:
namespace App\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
+ use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
class BlogController extends AbstractController
@@ -415,7 +420,7 @@ defined as ``/blog/{slug}``:
/**
* @Route("/blog/{slug}", name="blog_show")
*/
- public function show(string $slug)
+ public function show(string $slug): Response
{
// $slug will equal the dynamic part of the URL
// e.g. at /blog/yay-routing, then $slug='yay-routing'
@@ -486,6 +491,7 @@ the ``{page}`` parameter using the ``requirements`` option:
namespace App\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
+ use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
class BlogController extends AbstractController
@@ -493,7 +499,7 @@ the ``{page}`` parameter using the ``requirements`` option:
/**
* @Route("/blog/{page}", name="blog_list", requirements={"page"="\d+"})
*/
- public function list(int $page)
+ public function list(int $page): Response
{
// ...
}
@@ -501,7 +507,7 @@ the ``{page}`` parameter using the ``requirements`` option:
/**
* @Route("/blog/{slug}", name="blog_show")
*/
- public function show($slug)
+ public function show(string $slug): Response
{
// ...
}
@@ -597,6 +603,7 @@ concise, but it can decrease route readability when requirements are complex:
namespace App\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
+ use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
class BlogController extends AbstractController
@@ -604,7 +611,7 @@ concise, but it can decrease route readability when requirements are complex:
/**
* @Route("/blog/{page<\d+>}", name="blog_list")
*/
- public function list(int $page)
+ public function list(int $page): Response
{
// ...
}
@@ -665,6 +672,7 @@ other configuration formats they are defined with the ``defaults`` option:
namespace App\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
+ use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
class BlogController extends AbstractController
@@ -672,7 +680,7 @@ other configuration formats they are defined with the ``defaults`` option:
/**
* @Route("/blog/{page}", name="blog_list", requirements={"page"="\d+"})
*/
- public function list(int $page = 1)
+ public function list(int $page = 1): Response
{
// ...
}
@@ -756,6 +764,7 @@ parameter:
namespace App\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
+ use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
class BlogController extends AbstractController
@@ -763,7 +772,7 @@ parameter:
/**
* @Route("/blog/{page<\d+>?1}", name="blog_list")
*/
- public function list(int $page)
+ public function list(int $page): Response
{
// ...
}
@@ -831,6 +840,7 @@ controller action. Instead of ``string $slug``, add ``BlogPost $post``::
use App\Entity\BlogPost;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
+ use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
class BlogController extends AbstractController
@@ -840,7 +850,7 @@ controller action. Instead of ``string $slug``, add ``BlogPost $post``::
/**
* @Route("/blog/{slug}", name="blog_show")
*/
- public function show(BlogPost $post)
+ public function show(BlogPost $post): Response
{
// $post is the object whose slug matches the routing parameter
@@ -893,7 +903,10 @@ and in route imports. Symfony defines some special attributes with the same name
// src/Controller/ArticleController.php
namespace App\Controller;
- // ...
+ use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
+ use Symfony\Component\HttpFoundation\Response;
+ use Symfony\Component\Routing\Annotation\Route;
+
class ArticleController extends AbstractController
{
/**
@@ -907,7 +920,7 @@ and in route imports. Symfony defines some special attributes with the same name
* }
* )
*/
- public function search()
+ public function search(): Response
{
}
}
@@ -982,14 +995,16 @@ the controllers of the routes:
// src/Controller/BlogController.php
namespace App\Controller;
+ use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
+ use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
- class BlogController
+ class BlogController extends AbstractController
{
/**
* @Route("/blog/{page}", name="blog_index", defaults={"page": 1, "title": "Hello world!"})
*/
- public function index(int $page, string $title)
+ public function index(int $page, string $title): Response
{
// ...
}
@@ -1055,14 +1070,16 @@ A possible solution is to change the parameter requirements to be more permissiv
// src/Controller/DefaultController.php
namespace App\Controller;
+ use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
+ use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
- class DefaultController
+ class DefaultController extends AbstractController
{
/**
* @Route("/share/{token}", name="share", requirements={"token"=".+"})
*/
- public function share($token)
+ public function share($token): Response
{
// ...
}
@@ -1143,17 +1160,19 @@ the common configuration using options when importing the routes.
// src/Controller/BlogController.php
namespace App\Controller;
+ use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
+ use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
/**
* @Route("/blog", requirements={"_locale": "en|es|fr"}, name="blog_")
*/
- class BlogController
+ class BlogController extends AbstractController
{
/**
* @Route("/{_locale}", name="index")
*/
- public function index()
+ public function index(): Response
{
// ...
}
@@ -1161,7 +1180,7 @@ the common configuration using options when importing the routes.
/**
* @Route("/{_locale}/posts/{slug}", name="show")
*/
- public function show(Post $post)
+ public function show(Post $post): Response
{
// ...
}
@@ -1267,6 +1286,7 @@ information in a controller via the ``Request`` object::
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
+ use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
class BlogController extends AbstractController
@@ -1274,15 +1294,15 @@ information in a controller via the ``Request`` object::
/**
* @Route("/blog", name="blog_list")
*/
- public function list(Request $request)
+ public function list(Request $request): Response
{
- // ...
-
$routeName = $request->attributes->get('_route');
$routeParameters = $request->attributes->get('_route_params');
// use this to get all the available attributes (not only routing ones):
$allAttributes = $request->attributes->all();
+
+ // ...
}
}
@@ -1467,6 +1487,7 @@ host name:
namespace App\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
+ use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
class MainController extends AbstractController
@@ -1474,7 +1495,7 @@ host name:
/**
* @Route("/", name="mobile_homepage", host="m.example.com")
*/
- public function mobileHomepage()
+ public function mobileHomepage(): Response
{
// ...
}
@@ -1482,7 +1503,7 @@ host name:
/**
* @Route("/", name="homepage")
*/
- public function homepage()
+ public function homepage(): Response
{
// ...
}
@@ -1546,6 +1567,7 @@ multi-tenant applications) and these parameters can be validated too with
namespace App\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
+ use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
class MainController extends AbstractController
@@ -1559,7 +1581,7 @@ multi-tenant applications) and these parameters can be validated too with
* requirements={"subdomain"="m|mobile"}
* )
*/
- public function mobileHomepage()
+ public function mobileHomepage(): Response
{
// ...
}
@@ -1567,7 +1589,7 @@ multi-tenant applications) and these parameters can be validated too with
/**
* @Route("/", name="homepage")
*/
- public function homepage()
+ public function homepage(): Response
{
// ...
}
@@ -1676,6 +1698,7 @@ avoids the need for duplicating routes, which also reduces the potential bugs:
namespace App\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
+ use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
class CompanyController extends AbstractController
@@ -1686,7 +1709,7 @@ avoids the need for duplicating routes, which also reduces the potential bugs:
* "nl": "/over-ons"
* }, name="about_us")
*/
- public function about()
+ public function about(): Response
{
// ...
}
@@ -1816,6 +1839,7 @@ use the ``generateUrl()`` helper::
namespace App\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
+ use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
@@ -1824,10 +1848,8 @@ use the ``generateUrl()`` helper::
/**
* @Route("/blog", name="blog_list")
*/
- public function list()
+ public function list(): Response
{
- // ...
-
// generate a URL with no route arguments
$signUpPage = $this->generateUrl('sign_up');
@@ -1843,6 +1865,8 @@ use the ``generateUrl()`` helper::
// when a route is localized, Symfony uses by default the current request locale
// pass a different '_locale' value if you want to set the locale explicitly
$signUpPageInDutch = $this->generateUrl('sign_up', ['_locale' => 'nl']);
+
+ // ...
}
}
@@ -2000,7 +2024,7 @@ This information can be configured per command too::
$this->router = $router;
}
- protected function execute(InputInterface $input, OutputInterface $output)
+ protected function execute(InputInterface $input, OutputInterface $output): int
{
// these values override any global configuration
$context = $this->router->getContext();
@@ -2101,6 +2125,7 @@ each route explicitly:
namespace App\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
+ use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
class SecurityController extends AbstractController
@@ -2108,7 +2133,7 @@ each route explicitly:
/**
* @Route("/login", name="login", schemes={"https"})
*/
- public function login()
+ public function login(): Response
{
// ...
}
@@ -2222,7 +2247,7 @@ Here are some common errors you might see while working with routing:
This happens when your controller method has an argument (e.g. ``$slug``)::
- public function show($slug)
+ public function show(string $slug): Response
{
// ...
}
diff --git a/templates.rst b/templates.rst
index fb30f9a7c03..f415eaa82e3 100644
--- a/templates.rst
+++ b/templates.rst
@@ -90,12 +90,13 @@ passes to it the needed variables::
namespace App\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
+ use Symfony\Component\HttpFoundation\Response;
class UserController extends AbstractController
{
// ...
- public function notifications()
+ public function notifications(): Response
{
// get the user information and notifications somehow
$userFirstName = '...';
@@ -191,6 +192,7 @@ Consider the following routing configuration:
namespace App\Controller;
// ...
+ use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
class BlogController extends AbstractController
@@ -198,7 +200,7 @@ Consider the following routing configuration:
/**
* @Route("/", name="blog_index")
*/
- public function index()
+ public function index(): Response
{
// ...
}
@@ -206,7 +208,7 @@ Consider the following routing configuration:
/**
* @Route("/article/{slug}", name="blog_post")
*/
- public function show(string $slug)
+ public function show(string $slug): Response
{
// ...
}
@@ -399,7 +401,7 @@ use the ``render()`` helper::
class ProductController extends AbstractController
{
- public function index()
+ public function index(): Response
{
// ...
@@ -723,11 +725,12 @@ First, create the controller that renders a certain number of recent articles::
// src/Controller/BlogController.php
namespace App\Controller;
+ use Symfony\Component\HttpFoundation\Response;
// ...
class BlogController extends AbstractController
{
- public function recentArticles($max = 3)
+ public function recentArticles(int $max = 3): Response
{
// get the recent articles somehow (e.g. making a database query)
$articles = ['...', '...', '...'];
From a4023d6e51d66745d1120a42ce26bc6cca63418c Mon Sep 17 00:00:00 2001
From: Martin Hujer
Date: Wed, 11 Dec 2019 13:18:09 +0100
Subject: [PATCH 0018/5766] Security: How to Build a Login Form: sync with
recent Maker Bundle changes
---
security/form_login_setup.rst | 25 ++++++++++++++++---------
1 file changed, 16 insertions(+), 9 deletions(-)
diff --git a/security/form_login_setup.rst b/security/form_login_setup.rst
index c52847f0dcc..2213e949fe8 100644
--- a/security/form_login_setup.rst
+++ b/security/form_login_setup.rst
@@ -74,10 +74,15 @@ class that processes the login submit and 4) updates the main security config fi
// last username entered by the user
$lastUsername = $authenticationUtils->getLastUsername();
- return $this->render('security/login.html.twig', [
- 'last_username' => $lastUsername,
- 'error' => $error
- ]);
+ return $this->render('security/login.html.twig', ['last_username' => $lastUsername, 'error' => $error]);
+ }
+
+ /**
+ * @Route("/logout", name="app_logout")
+ */
+ public function logout()
+ {
+ throw new \Exception('This method can be blank - it will be intercepted by the logout key on your firewall');
}
/**
@@ -165,10 +170,10 @@ a traditional HTML form that submits to ``/login``:
{% endif %}
Please sign in
-
-
-
-
+
+
+
+
Date: Wed, 21 Oct 2020 15:14:45 +0200
Subject: [PATCH 0019/5766] [#12802] Updated XML and PHP examples
---
security/form_login_setup.rst | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/security/form_login_setup.rst b/security/form_login_setup.rst
index 2213e949fe8..4d9bb9265c8 100644
--- a/security/form_login_setup.rst
+++ b/security/form_login_setup.rst
@@ -341,6 +341,7 @@ a traditional HTML form that submits to ``/login``:
+
@@ -360,6 +361,9 @@ a traditional HTML form that submits to ``/login``:
LoginFormAuthenticator::class,
]
],
+ 'logout' => [
+ 'path' => 'app_logout',
+ ],
],
],
]);
From 010f62fc460e49461c5d3fb98f2aaceb636c813d Mon Sep 17 00:00:00 2001
From: "Alexander M. Turek"
Date: Wed, 21 Oct 2020 15:49:46 +0200
Subject: [PATCH 0020/5766] Fix markup of configuration-block.
---
routing.rst | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/routing.rst b/routing.rst
index 53088f53a32..4588ba61cd2 100644
--- a/routing.rst
+++ b/routing.rst
@@ -58,7 +58,7 @@ This configuration tells Symfony to look for routes defined as annotations in
any PHP class stored in the ``src/Controller/`` directory.
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::
+do so, create a :doc:`controller class ` like the following:
.. configuration-block::
From 526012ed7a9a1c1aac7c829fcb6f68e2aea67d93 Mon Sep 17 00:00:00 2001
From: Andrii Popov
Date: Mon, 21 Oct 2019 21:00:22 +0300
Subject: [PATCH 0021/5766] [Cache] Custom pool namespaces
---
cache.rst | 47 +++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 47 insertions(+)
diff --git a/cache.rst b/cache.rst
index 4fc6a4faa87..42a22ca55e3 100644
--- a/cache.rst
+++ b/cache.rst
@@ -329,6 +329,53 @@ with either :class:`Symfony\\Contracts\\Cache\\CacheInterface` or
// ...
}
+.. tip::
+
+ If you need the namespace to be interoperable with a third-party app,
+ you can take control over auto-generation by setting the ``namespace``
+ attribute of the ``cache.pool`` service tag. For example, you can
+ override the service definition of the adapter:
+
+ .. configuration-block::
+
+ .. code-block:: yaml
+
+ # config/services.yaml
+ services:
+ app.cache.adapter.redis:
+ parent: 'cache.adapter.redis'
+ tags:
+ - { name: 'cache.pool', namespace: 'my_custom_namespace' }
+
+ .. code-block:: xml
+
+
+
+
+
+
+
+
+
+
+
+
+ .. code-block:: php
+
+ // config/services.php
+ namespace Symfony\Component\DependencyInjection\Loader\Configurator;
+
+ return function(ContainerConfigurator $configurator) {
+ $services = $configurator->services();
+
+ $services->set('app.cace.adapter.redis')
+ ->parent('cache.adapter.redis')
+ ->tag('cache.pool', ['namespace' => 'my_custom_namespace'])
+ };
+
Custom Provider Options
-----------------------
From 1b64a6e791b765e6eb29f9ce91597b85a4ac6911 Mon Sep 17 00:00:00 2001
From: Wouter de Jong
Date: Wed, 21 Oct 2020 16:01:48 +0200
Subject: [PATCH 0022/5766] Fixed DOCtor
---
security/form_login_setup.rst | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/security/form_login_setup.rst b/security/form_login_setup.rst
index 4d9bb9265c8..abbbb6eb1f2 100644
--- a/security/form_login_setup.rst
+++ b/security/form_login_setup.rst
@@ -341,7 +341,7 @@ a traditional HTML form that submits to ``/login``:
-
+
From b9a47effa7ceb176e64bec5e59c20141337f469a Mon Sep 17 00:00:00 2001
From: BETARI
Date: Thu, 28 Nov 2019 00:03:25 +0100
Subject: [PATCH 0023/5766] Update multiple_kernels.rst
---
configuration/multiple_kernels.rst | 43 +++++++++++++++++++++---------
1 file changed, 31 insertions(+), 12 deletions(-)
diff --git a/configuration/multiple_kernels.rst b/configuration/multiple_kernels.rst
index e6110bb69c2..a0069b9be4b 100644
--- a/configuration/multiple_kernels.rst
+++ b/configuration/multiple_kernels.rst
@@ -88,31 +88,50 @@ files so they don't collide with the files from ``src/Kernel.php``::
class ApiKernel extends Kernel
{
- // ...
+ use MicroKernelTrait;
public function registerBundles()
{
- // load only the bundles strictly needed for the API...
+ // load only the bundles strictly needed for the API
+ $contents = require $this->getProjectDir().'/config/api_bundles.php';
+ foreach ($contents as $class => $envs) {
+ if ($envs[$this->environment] ?? $envs['all'] ?? false) {
+ yield new $class();
+ }
+ }
+ }
+
+ public function getProjectDir(): string
+ {
+ return \dirname(__DIR__);
}
- public function getCacheDir()
+ public function getCacheDir(): string
{
- return dirname(__DIR__).'/var/cache/api/'.$this->getEnvironment();
+ return $this->getProjectDir().'/var/cache/api/'.$this->getEnvironment();
}
- public function getLogDir()
+ public function getLogDir(): string
{
- return dirname(__DIR__).'/var/log/api';
+ return $this->getProjectDir().'/var/log/api';
}
public function configureContainer(ContainerBuilder $container, LoaderInterface $loader)
{
- // load only the config files strictly needed for the API
- $confDir = $this->getProjectDir().'/config';
- $loader->load($confDir.'/api/*'.self::CONFIG_EXTS, 'glob');
- if (is_dir($confDir.'/api/'.$this->environment)) {
- $loader->load($confDir.'/api/'.$this->environment.'/**/*'.self::CONFIG_EXTS, 'glob');
- }
+ $container->addResource(new FileResource($this->getProjectDir().'/config/api_bundles.php'));
+ $container->setParameter('container.dumper.inline_factories', true);
+ $confDir = $this->getProjectDir().'/config/api';
+
+ $loader->load($confDir.'/{packages}/*'.self::CONFIG_EXTS, 'glob');
+ $loader->load($confDir.'/{packages}/'.$this->environment.'/*'.self::CONFIG_EXTS, 'glob');
+ $loader->load($confDir.'/{services}'.self::CONFIG_EXTS, 'glob');
+ $loader->load($confDir.'/{services}_'.$this->environment.self::CONFIG_EXTS, 'glob');
+ }
+
+ protected function configureRoutes(RouteCollectionBuilder $routes): void
+ {
+ $confDir = $this->getProjectDir().'/config/api';
+ // ... load only the config routes strictly needed for the API
}
}
From 0f91cc9f74a656da845b6a46b225a8351a83ccae Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Deruss=C3=A9?=
Date: Tue, 20 Oct 2020 09:42:57 +0200
Subject: [PATCH 0024/5766] Add documentation for retry on idempotent methods
---
http_client.rst | 8 +++++---
reference/configuration/framework.rst | 7 +++++--
2 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/http_client.rst b/http_client.rst
index e0a9d6808e3..5c899660b62 100644
--- a/http_client.rst
+++ b/http_client.rst
@@ -694,9 +694,10 @@ Retry Failed Requests
Sometimes, requests fail because of network issues or temporary server errors.
Symfony's HttpClient allows to retry failed requests automatically using the
:ref:`retry_failed option `. When enabled,
-each failed request with an HTTP status of ``423``, ``425``, ``429``, ``500``,
-``502``, ``503``, ``504``, ``507``, or ``510`` is retried up to 3 times, with an
-exponential delay between retries (first retry = 1 second; third retry: 4 seconds).
+each failed request with an HTTP status of ``423``, ``425``, ``429``, ``502``,
+``503`` or with an `idempotent method`_ and a HTTP status of ``500``, ``504``,
+``507`` or ``510`` is retried up to 3 times, with an exponential delay between
+retries (first retry = 1 second; third retry: 4 seconds).
Check out the full list of configurable :ref:`retry_failed options `
to learn how to tweak each of them to fit your application needs.
@@ -1609,3 +1610,4 @@ Then configure Symfony to use your callback:
.. _`cURL options`: https://www.php.net/manual/en/function.curl-setopt.php
.. _`Server-sent events`: https://html.spec.whatwg.org/multipage/server-sent-events.html
.. _`EventSource`: https://www.w3.org/TR/eventsource/#eventsource
+.. _`idempotent method`: https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Idempotent_methods_and_web_applications
diff --git a/reference/configuration/framework.rst b/reference/configuration/framework.rst
index a3d6e9fd95a..b8b0a7887d6 100644
--- a/reference/configuration/framework.rst
+++ b/reference/configuration/framework.rst
@@ -779,7 +779,10 @@ will automatically retry failed HTTP requests.
# ...
retry_failed:
# retry_strategy: app.custom_strategy
- http_codes: [429, 500]
+ http_codes:
+ 0: ['GET', 'HEAD'] # retry network errors if request method is GET or HEAD
+ 429: true # retry all responses with 429 status code
+ 500: ['GET', 'HEAD']
max_retries: 2
delay: 1000
multiplier: 3
@@ -923,7 +926,7 @@ value must use the format ``['header-name' => 'value0, value1, ...']``.
http_codes
..........
-**type**: ``array`` **default**: ``[423, 425, 429, 500, 502, 503, 504, 507, 510]``
+**type**: ``array`` **default**: :method:`Symfony\\Component\\HttpClient\\Retry\\GenericRetryStrategy::DEFAULT_RETRY_STATUS_CODES`
.. versionadded:: 5.2
From 689614433c04d186640f563d619c36adc43184c9 Mon Sep 17 00:00:00 2001
From: Javier Eguiluz
Date: Wed, 21 Oct 2020 20:14:08 +0200
Subject: [PATCH 0025/5766] Tweak
---
http_client.rst | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/http_client.rst b/http_client.rst
index 5c899660b62..efc5a14e799 100644
--- a/http_client.rst
+++ b/http_client.rst
@@ -693,11 +693,13 @@ Retry Failed Requests
Sometimes, requests fail because of network issues or temporary server errors.
Symfony's HttpClient allows to retry failed requests automatically using the
-:ref:`retry_failed option `. When enabled,
-each failed request with an HTTP status of ``423``, ``425``, ``429``, ``502``,
-``503`` or with an `idempotent method`_ and a HTTP status of ``500``, ``504``,
-``507`` or ``510`` is retried up to 3 times, with an exponential delay between
-retries (first retry = 1 second; third retry: 4 seconds).
+:ref:`retry_failed option `.
+
+By default, failed requests are retried up to 3 times, with an exponential delay
+between retries (first retry = 1 second; third retry: 4 seconds) and only for
+the following HTTP status codes: ``423``, ``425``, ``429``, ``502`` and ``503``
+when using any HTTP method and ``500``, ``504``, ``507`` and ``510`` when using
+an HTTP `idempotent method`_.
Check out the full list of configurable :ref:`retry_failed options `
to learn how to tweak each of them to fit your application needs.
From b56568416ffc59993c83007343c0750de519e935 Mon Sep 17 00:00:00 2001
From: Matthias Gutjahr
Date: Wed, 21 Oct 2020 11:59:21 +0200
Subject: [PATCH 0026/5766] Update doctrine.rst
Correct link to StofDoctrineExtensionsBundle
---
doctrine.rst | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/doctrine.rst b/doctrine.rst
index bb27ad91bfa..eab24ae8f13 100644
--- a/doctrine.rst
+++ b/doctrine.rst
@@ -879,4 +879,4 @@ Learn more
.. _`API Platform`: https://api-platform.com/docs/core/validation/
.. _`PDO`: https://www.php.net/pdo
.. _`available Doctrine extensions`: https://github.com/Atlantic18/DoctrineExtensions
-.. _`StofDoctrineExtensionsBundle`: https://github.com/antishov/StofDoctrineExtensionsBundle
+.. _`StofDoctrineExtensionsBundle`: https://github.com/stof/StofDoctrineExtensionsBundle
From 9994e7b0dca329678cb7db549bbae7d256d9c7b2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Deruss=C3=A9?=
Date: Wed, 21 Oct 2020 20:24:19 +0200
Subject: [PATCH 0027/5766] Use APP_RUNTIME_ENV to define secrets
---
configuration/secrets.rst | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/configuration/secrets.rst b/configuration/secrets.rst
index 696ce519682..ab49c052dff 100644
--- a/configuration/secrets.rst
+++ b/configuration/secrets.rst
@@ -48,7 +48,7 @@ running:
.. code-block:: terminal
- $ php bin/console secrets:generate-keys --env=prod
+ $ APP_RUNTIME_ENV=prod php bin/console secrets:generate-keys
This will generate ``config/secrets/prod/prod.encrypt.public.php`` and
``config/secrets/prod/prod.decrypt.private.php``.
@@ -78,7 +78,7 @@ Suppose you want to store your database password as a secret. By using the
$ php bin/console secrets:set DATABASE_PASSWORD
# set your production value
- $ php bin/console secrets:set DATABASE_PASSWORD --env=prod
+ $ APP_RUNTIME_ENV=prod php bin/console secrets:set DATABASE_PASSWORD
This will create a new file for the secret in ``config/secrets/dev`` and another
in ``config/secrets/prod``. You can also set the secret in a few other ways:
@@ -253,7 +253,7 @@ your secrets during deployment to the "local" vault:
.. code-block:: terminal
- $ php bin/console secrets:decrypt-to-local --force --env=prod
+ $ APP_RUNTIME_ENV=prod php bin/console secrets:decrypt-to-local --force
This will write all the decrypted secrets into the ``.env.prod.local`` file.
After doing this, the decryption key does *not* need to remain on the server(s).
From ded882526e23c22d14455d2e6c191c93e979f5a6 Mon Sep 17 00:00:00 2001
From: Wouter de Jong
Date: Wed, 21 Oct 2020 23:36:00 +0200
Subject: [PATCH 0028/5766] [#14421] Merged the new description into the
current sentence
---
translation.rst | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/translation.rst b/translation.rst
index db50e05cb07..672518d8f8e 100644
--- a/translation.rst
+++ b/translation.rst
@@ -657,10 +657,8 @@ must be named according to the following path: ``domain.locale.loader``:
* **domain**: Domains are a way to organize messages into groups. Unless
parts of the application are explicitly separated from each other, it is
- recommended to only use default ``messages`` domain.
-
- If no domains are explicitly defined while using the translator, Symfony
- will default to the ``messages`` domain (e.g. ``messages.en.yaml``)
+ recommended to only use the default ``messages`` domain (e.g.
+ ``messages.en.yaml``).
* **locale**: The locale that the translations are for (e.g. ``en_GB``, ``en``, etc);
From 300da7ba340b6759d6e58614ec0feca9ef460ea6 Mon Sep 17 00:00:00 2001
From: Oskar Stark
Date: Thu, 22 Oct 2020 08:58:19 +0200
Subject: [PATCH 0029/5766] Enhancement: New rules for DOCtor-RST.
---
.doctor-rst.yaml | 2 ++
1 file changed, 2 insertions(+)
diff --git a/.doctor-rst.yaml b/.doctor-rst.yaml
index 6711c75c8f2..a243e6266b6 100644
--- a/.doctor-rst.yaml
+++ b/.doctor-rst.yaml
@@ -24,6 +24,8 @@ rules:
no_namespace_after_use_statements: ~
no_php_open_tag_in_code_block_php_directive: ~
no_space_before_self_xml_closing_tag: ~
+ only_backslashes_in_namespace_in_php_code_block: ~
+ only_backslashes_in_use_statements_in_php_code_block: ~
ordered_use_statements: ~
php_prefix_before_bin_console: ~
replace_code_block_types: ~
From 3781df649e39522eddbb612d452c661eb33f33d1 Mon Sep 17 00:00:00 2001
From: Guilhem Niot
Date: Fri, 12 Jun 2020 13:46:50 +0200
Subject: [PATCH 0030/5766] [PropertyInfo] Document setting serializer_groups
to null in the SerializerExtractor
---
components/property_info.rst | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/components/property_info.rst b/components/property_info.rst
index d67034b04fa..16aac3299e2 100644
--- a/components/property_info.rst
+++ b/components/property_info.rst
@@ -435,7 +435,18 @@ with the ``property_info`` service in the Symfony Framework::
$serializerExtractor = new SerializerExtractor($serializerClassMetadataFactory);
// List information.
- $serializerExtractor->getProperties($class);
+ $serializerExtractor->getProperties($class, ['serializer_groups' => ['mygroup']]);
+
+.. note::
+
+ The ``serializer_groups`` option must be provided in order to have a value different than ``null`` returned.
+
+ 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`` annotation is taken into account).
+
+.. versionadded:: 5.2
+
+ Support for the ``null`` value in ``serializer_groups`` was introduced in Symfony 5.2.
DoctrineExtractor
~~~~~~~~~~~~~~~~~
From d0abaf04aa169560fa7e791debbc82299991be0e Mon Sep 17 00:00:00 2001
From: Javier Eguiluz
Date: Thu, 22 Oct 2020 09:19:42 +0200
Subject: [PATCH 0031/5766] Tweaks
---
components/property_info.rst | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/components/property_info.rst b/components/property_info.rst
index 16aac3299e2..b6684d948d8 100644
--- a/components/property_info.rst
+++ b/components/property_info.rst
@@ -434,15 +434,12 @@ with the ``property_info`` service in the Symfony Framework::
);
$serializerExtractor = new SerializerExtractor($serializerClassMetadataFactory);
- // List information.
+ // the `serializer_groups` option must be configured (may be set to null)
$serializerExtractor->getProperties($class, ['serializer_groups' => ['mygroup']]);
-
-.. note::
-
- The ``serializer_groups`` option must be provided in order to have a value different than ``null`` returned.
- 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`` annotation is taken into account).
+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`` annotation is taken into account).
.. versionadded:: 5.2
From f40ec08e5f39763dc62d8035fc228210605970c5 Mon Sep 17 00:00:00 2001
From: Oskar Stark
Date: Thu, 22 Oct 2020 09:29:38 +0200
Subject: [PATCH 0032/5766] Fix: DOCtor-RST
---
service_container/tags.rst | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/service_container/tags.rst b/service_container/tags.rst
index db0501182bc..7aee0061c0c 100644
--- a/service_container/tags.rst
+++ b/service_container/tags.rst
@@ -645,7 +645,7 @@ tags, is to implement the static ``getDefaultPriority()`` method on the
service itself::
// src/Handler/One.php
- namespace App/Handler;
+ namespace App\Handler;
class One
{
From d084e993a4a6e321c4a8eeb132e273d33e2c408a Mon Sep 17 00:00:00 2001
From: "heddi.nabbisen"
Date: Wed, 17 Jun 2020 20:44:36 +0900
Subject: [PATCH 0033/5766] add a note about npm commands equivalent to yarn's
---
frontend/encore/simple-example.rst | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/frontend/encore/simple-example.rst b/frontend/encore/simple-example.rst
index 65b96370059..50dec19e46a 100644
--- a/frontend/encore/simple-example.rst
+++ b/frontend/encore/simple-example.rst
@@ -74,6 +74,21 @@ To build the assets, run:
Stop and restart ``encore`` each time you update your ``webpack.config.js`` file.
+.. note::
+
+ If you prefer npm, run these commands instead:
+
+ .. code-block:: terminal
+
+ # compile assets once
+ $ npm run dev
+
+ # or, recompile assets automatically when files change
+ $ npm run watch
+
+ # on deploy, create a production build
+ $ npm run build
+
Congrats! You now have three new files:
* ``public/build/app.js`` (holds all the JavaScript for your "app" entry)
From f3c629e836118404480e71653b759da1ee5f6ab4 Mon Sep 17 00:00:00 2001
From: Javier Eguiluz
Date: Thu, 22 Oct 2020 10:33:32 +0200
Subject: [PATCH 0034/5766] Tweak
---
frontend/encore/simple-example.rst | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/frontend/encore/simple-example.rst b/frontend/encore/simple-example.rst
index 50dec19e46a..6ddcd5bdbd8 100644
--- a/frontend/encore/simple-example.rst
+++ b/frontend/encore/simple-example.rst
@@ -63,32 +63,23 @@ To build the assets, run:
# compile assets once
$ yarn encore dev
+ # if you prefer npm, run:
+ $ npm run dev
# or, recompile assets automatically when files change
$ yarn encore dev --watch
+ # if you prefer npm, run:
+ $ npm run watch
# on deploy, create a production build
$ yarn encore production
+ # if you prefer npm, run:
+ $ npm run build
.. note::
Stop and restart ``encore`` each time you update your ``webpack.config.js`` file.
-.. note::
-
- If you prefer npm, run these commands instead:
-
- .. code-block:: terminal
-
- # compile assets once
- $ npm run dev
-
- # or, recompile assets automatically when files change
- $ npm run watch
-
- # on deploy, create a production build
- $ npm run build
-
Congrats! You now have three new files:
* ``public/build/app.js`` (holds all the JavaScript for your "app" entry)
From 2a863fb883d82568bcdbbfc80cd73b0d1fa564f2 Mon Sep 17 00:00:00 2001
From: Rezende
Date: Thu, 23 Jul 2020 12:06:51 -0300
Subject: [PATCH 0035/5766] =?UTF-8?q?Recommending=20symfony/apache-pack=20?=
=?UTF-8?q?when=20installing=20the=20project=20on=20a=20sha=E2=80=A6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
deployment.rst | 1 +
1 file changed, 1 insertion(+)
diff --git a/deployment.rst b/deployment.rst
index 5d02bae0e58..18fd4ec6fa8 100644
--- a/deployment.rst
+++ b/deployment.rst
@@ -195,6 +195,7 @@ setup:
* Add/edit CRON jobs
* :ref:`Building and minifying your assets ` with Webpack Encore
* Pushing assets to a CDN
+* On a shared hosting platform using the Apache web server, you may need to install the :ref:`symfony/apache-pack package `
* ...
Application Lifecycle: Continuous Integration, QA, etc.
From 060773ef8ce9338c421688a146b316595b557ae1 Mon Sep 17 00:00:00 2001
From: Wouter de Jong
Date: Thu, 22 Oct 2020 10:40:32 +0200
Subject: [PATCH 0036/5766] [#14422] Minor change in sentence
---
logging/channels_handlers.rst | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/logging/channels_handlers.rst b/logging/channels_handlers.rst
index bac0be76012..8f6e9aed98a 100644
--- a/logging/channels_handlers.rst
+++ b/logging/channels_handlers.rst
@@ -182,10 +182,11 @@ How to Autowire Logger Channels
Starting from `MonologBundle`_ 3.5 you can autowire different Monolog channels
by type-hinting your service arguments with the following syntax:
-``Psr\Log\LoggerInterface $Logger``. The ```` must have been
-predefined in your Monolog configuration.
+``Psr\Log\LoggerInterface $Logger``. The ```` must have been
+:ref:`predefined in your Monolog configuration `.
-An example to inject the service related to the ``app`` logger channel:
+For example to inject the service related to the ``app`` logger channel,
+change your constructor like this:
.. code-block:: diff
From feef663fa650ebc2acaa4b40b2c5660cc3b2d874 Mon Sep 17 00:00:00 2001
From: Javier Eguiluz
Date: Thu, 22 Oct 2020 10:40:48 +0200
Subject: [PATCH 0037/5766] Wrap long lines
---
deployment.rst | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/deployment.rst b/deployment.rst
index 18fd4ec6fa8..36854742dcc 100644
--- a/deployment.rst
+++ b/deployment.rst
@@ -195,7 +195,8 @@ setup:
* Add/edit CRON jobs
* :ref:`Building and minifying your assets ` with Webpack Encore
* Pushing assets to a CDN
-* On a shared hosting platform using the Apache web server, you may need to install the :ref:`symfony/apache-pack package `
+* On a shared hosting platform using the Apache web server, you may need to
+ install the :ref:`symfony/apache-pack package `
* ...
Application Lifecycle: Continuous Integration, QA, etc.
From 369ea13ea891df848615e629bd35e3f539b3eb94 Mon Sep 17 00:00:00 2001
From: Gauthier Gilles
Date: Tue, 17 Dec 2019 09:27:31 +0100
Subject: [PATCH 0038/5766] add caution for datetime object
---
serializer.rst | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/serializer.rst b/serializer.rst
index b1e64881831..31c47e607dc 100644
--- a/serializer.rst
+++ b/serializer.rst
@@ -115,6 +115,12 @@ Custom normalizers and/or encoders can also be loaded by tagging them as
:ref:`serializer.encoder `. It's also
possible to set the priority of the tag in order to decide the matching order.
+.. caution::
+
+ Always make sure to load the ``DateTimeNormalizer`` when serializing the
+ ``DateTime`` or ``DateTimeImmutable`` classes to avoid excessive memory
+ usage and exposing internal details.
+
Here is an example on how to load the
:class:`Symfony\\Component\\Serializer\\Normalizer\\GetSetMethodNormalizer`, a
faster alternative to the `ObjectNormalizer` when data objects always use
From 269379fa5c6af4982f2f704c97d91f8eb8d2b8be Mon Sep 17 00:00:00 2001
From: Zairig Imad
Date: Sun, 19 Apr 2020 14:11:38 +0200
Subject: [PATCH 0039/5766] replace ExceptionListener by EventListener
Deprecated ExceptionListener is replaced by EventListener in Symfony 5.0
---
reference/events.rst | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/reference/events.rst b/reference/events.rst
index b7eec4d8dbd..900d40eb12c 100644
--- a/reference/events.rst
+++ b/reference/events.rst
@@ -251,7 +251,7 @@ sent as response::
.. note::
- The TwigBundle registers an :class:`Symfony\\Component\\HttpKernel\\EventListener\\ExceptionListener`
+ The TwigBundle registers an :class:`Symfony\\Component\\HttpKernel\\EventListener\\ErrorListener`
that forwards the ``Request`` to a given controller defined by the
``exception_listener.controller`` parameter.
From 3bc914cc2043612bfc97e1e9e7c78c95ef695e52 Mon Sep 17 00:00:00 2001
From: Rachid Hammaoui <37940572+makmaoui@users.noreply.github.com>
Date: Fri, 14 Aug 2020 18:41:43 +0200
Subject: [PATCH 0040/5766] Fix wrong properties class
Fix classname for query and cookies properties
---
components/http_foundation.rst | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/components/http_foundation.rst b/components/http_foundation.rst
index dad9990dd64..3a90611edbe 100644
--- a/components/http_foundation.rst
+++ b/components/http_foundation.rst
@@ -83,17 +83,19 @@ can be accessed via several public properties:
Each property is a :class:`Symfony\\Component\\HttpFoundation\\ParameterBag`
instance (or a sub-class of), which is a data holder class:
-* ``request``: :class:`Symfony\\Component\\HttpFoundation\\ParameterBag`;
+* ``request``: :class:`Symfony\\Component\\HttpFoundation\\ParameterBag` or
+ :class:`Symfony\\Component\\HttpFoundation\\InputBag` if the data is
+ coming from ``$_POST`` parameters;
-* ``query``: :class:`Symfony\\Component\\HttpFoundation\\ParameterBag`;
+* ``query``: :class:`Symfony\\Component\\HttpFoundation\\InputBag`;
-* ``cookies``: :class:`Symfony\\Component\\HttpFoundation\\ParameterBag`;
+* ``cookies``: :class:`Symfony\\Component\\HttpFoundation\\InputBag`;
* ``attributes``: :class:`Symfony\\Component\\HttpFoundation\\ParameterBag`;
-* ``files``: :class:`Symfony\\Component\\HttpFoundation\\FileBag`;
+* ``files``: :class:`Symfony\\Component\\HttpFoundation\\FileBag`;
-* ``server``: :class:`Symfony\\Component\\HttpFoundation\\ServerBag`;
+* ``server``: :class:`Symfony\\Component\\HttpFoundation\\ServerBag`;
* ``headers``: :class:`Symfony\\Component\\HttpFoundation\\HeaderBag`.
From 9d189ef6b5e1c381923ac894ec3237ed45e620de Mon Sep 17 00:00:00 2001
From: Javier Eguiluz
Date: Thu, 22 Oct 2020 11:23:38 +0200
Subject: [PATCH 0041/5766] [RateLimiter] Document the RateLimit object
---
rate_limiter.rst | 44 ++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 44 insertions(+)
diff --git a/rate_limiter.rst b/rate_limiter.rst
index 6fa7192945f..527357cc011 100644
--- a/rate_limiter.rst
+++ b/rate_limiter.rst
@@ -212,6 +212,50 @@ processes by reserving unused tokens.
$limit->wait();
} while (!$limit->isAccepted());
+Exposing the Rate Limiter Status
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+When using a rate limiter in APIs, it's common to include some standard HTTP
+headers in the response to expose the limit status (e.g. remaining tokens, when
+new tokens will be available, etc.)
+
+Use the :class:`Symfony\\Component\\RateLimiter\\RateLimit` object returned by
+the ``consume()`` method (also available via the ``getRateLimit()`` method of
+the :class:`Symfony\\Component\\RateLimiter\\Reservation` object returned by the
+``reserve()`` method) to get the value of those HTTP headers::
+
+ // src/Controller/ApiController.php
+ namespace App\Controller;
+
+ use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
+ use Symfony\Component\HttpFoundation\Response;
+ use Symfony\Component\RateLimiter\RateLimiter;
+
+ class ApiController extends AbstractController
+ {
+ public function index(RateLimiter $anonymousApiLimiter)
+ {
+ $limiter = $anonymousApiLimiter->create($request->getClientIp());
+ $limit = $limiter->consume();
+ $headers = [
+ 'X-RateLimit-Remaining' => $limit->getRemainingTokens(),
+ 'X-RateLimit-Retry-After' => $limit->getRetryAfter()->getTimestamp(),
+ 'X-RateLimit-Limit' => $limit->getLimit(),
+ ];
+
+ if (false === $limit->isAccepted()) {
+ return new Response(null, Response::HTTP_TOO_MANY_REQUESTS, $headers);
+ }
+
+ // ...
+
+ $reponse = new Response('...');
+ $response->headers->add($headers);
+
+ return $response;
+ }
+ }
+
Rate Limiter Storage and Locking
--------------------------------
From 809b7a0e63d9dfb743c6aaea9f6bda485bb3de2a Mon Sep 17 00:00:00 2001
From: Javier Eguiluz
Date: Thu, 22 Oct 2020 09:56:38 +0200
Subject: [PATCH 0042/5766] [Lock] Mention the priority policy of shared locks
---
components/lock.rst | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/components/lock.rst b/components/lock.rst
index 518a01c9375..3a92184c85e 100644
--- a/components/lock.rst
+++ b/components/lock.rst
@@ -237,6 +237,11 @@ to acquire the lock in a blocking mode::
$lock = $factory->createLock('user'.$user->id);
$lock->acquireRead(true);
+.. note::
+
+ The `priority policy`_ of Symfony's shared locks depends on the underlying
+ store (e.g. Redis store prioritizes readers vs writers).
+
When a read-only lock is acquired with the method ``acquireRead()``, it's
possible to **promote** the lock, and change it to write lock, by calling the
``acquire()`` method::
@@ -915,3 +920,4 @@ are still running.
.. _`Replica Set Read and Write Semantics`: https://docs.mongodb.com/manual/applications/replication/
.. _`ZooKeeper`: https://zookeeper.apache.org/
.. _`readers–writer lock`: https://en.wikipedia.org/wiki/Readers%E2%80%93writer_lock
+.. _`priority policy`: https://en.wikipedia.org/wiki/Readers%E2%80%93writer_lock#Priority_policies
From 864cefbc7a34d3b313019f2c415e2a27d81ff4bd Mon Sep 17 00:00:00 2001
From: Zairig Imad
Date: Tue, 9 Jun 2020 22:46:45 +0200
Subject: [PATCH 0043/5766] Update the Snippet with the UserUpgraderInterface
---
security/user_provider.rst | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/security/user_provider.rst b/security/user_provider.rst
index 13e6a8dfb49..07227868afe 100644
--- a/security/user_provider.rst
+++ b/security/user_provider.rst
@@ -356,10 +356,11 @@ command will generate a nice skeleton to get you started::
use Symfony\Component\Security\Core\Exception\UnsupportedUserException;
use Symfony\Component\Security\Core\Exception\UsernameNotFoundException;
+ use Symfony\Component\Security\Core\User\PasswordUpgraderInterface;
use Symfony\Component\Security\Core\User\UserInterface;
use Symfony\Component\Security\Core\User\UserProviderInterface;
- class UserProvider implements UserProviderInterface
+ class UserProvider implements UserProviderInterface, PasswordUpgraderInterface
{
/**
* Symfony calls this method if you use features like switch_user
@@ -412,6 +413,16 @@ command will generate a nice skeleton to get you started::
{
return User::class === $class || is_subclass_of($class, User::class);
}
+
+ /**
+ * Upgrades the encoded password of a user, typically for using a better hash algorithm.
+ */
+ public function upgradePassword(UserInterface $user, string $newEncodedPassword): void
+ {
+ // TODO: when encoded passwords are in use, this method should:
+ // 1. persist the new password in the user storage
+ // 2. update the $user object with $user->setPassword($newEncodedPassword);
+ }
}
Most of the work is already done! Read the comments in the code and update the
From 17af86e24d25421f43d61fc019b263739218a7ca Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dalibor=20Karlovi=C4=87?=
Date: Thu, 22 Oct 2020 15:45:29 +0200
Subject: [PATCH 0044/5766] Correct English word order
---
mercure.rst | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mercure.rst b/mercure.rst
index 921a45f7226..9dd6fe205b9 100644
--- a/mercure.rst
+++ b/mercure.rst
@@ -443,7 +443,7 @@ And here is the controller::
To use the cookie authentication method, the Symfony app and the Hub
must be served from the same domain (can be different sub-domains).
-Generating Programmatically The JWT Used to Publish
+Programmatically Generating The JWT Used to Publish
---------------------------------------------------
Instead of directly storing a JWT in the configuration,
From 22345e0b151835cbd86c4de6bc8be7fccdd1fe22 Mon Sep 17 00:00:00 2001
From: gary houbre
Date: Mon, 5 Oct 2020 21:24:25 +0200
Subject: [PATCH 0045/5766] Fix missing namespace and other wrong wording from
Security and Serializer context
---
security/access_denied_handler.rst | 1 +
security/csrf.rst | 3 +++
security/custom_authentication_provider.rst | 8 ++++++++
security/form_login.rst | 1 +
security/form_login_setup.rst | 1 +
security/guard_authentication.rst | 7 ++++++-
security/impersonating_user.rst | 4 ++++
security/json_login_setup.rst | 1 +
security/named_encoders.rst | 4 ++--
serializer/custom_encoders.rst | 1 +
serializer/custom_normalizer.rst | 1 +
11 files changed, 29 insertions(+), 3 deletions(-)
diff --git a/security/access_denied_handler.rst b/security/access_denied_handler.rst
index e9e780e75ef..e9fd7cb15f5 100644
--- a/security/access_denied_handler.rst
+++ b/security/access_denied_handler.rst
@@ -13,6 +13,7 @@ This interface defines one method called ``handle()`` where you can implement wh
logic that should run when access is denied for the current user (e.g. send a
mail, log a message, or generally return a custom response)::
+ // src/Security/AccessDeniedHandler.php
namespace App\Security;
use Symfony\Component\HttpFoundation\Request;
diff --git a/security/csrf.rst b/security/csrf.rst
index d54bfc43770..9da64168379 100644
--- a/security/csrf.rst
+++ b/security/csrf.rst
@@ -83,6 +83,9 @@ protected against CSRF attacks.
By default Symfony adds the CSRF token in a hidden field called ``_token``, but
this can be customized on a form-by-form basis::
+ // src/Form/TaskType.php
+ namespace App\Form;
+
// ...
use App\Entity\Task;
use Symfony\Component\OptionsResolver\OptionsResolver;
diff --git a/security/custom_authentication_provider.rst b/security/custom_authentication_provider.rst
index d0db9c91168..920c8315f05 100644
--- a/security/custom_authentication_provider.rst
+++ b/security/custom_authentication_provider.rst
@@ -538,6 +538,11 @@ can have different timeout lengths.
You will first need to edit ``WsseFactory`` and define the new option in
the ``addConfiguration()`` method::
+ // src/DependencyInjection/Security/Factory/WsseFactory.php
+ namespace App\DependencyInjection\Security\Factory;
+
+ // ...
+
class WsseFactory implements SecurityFactoryInterface
{
// ...
@@ -556,6 +561,9 @@ contain a ``lifetime`` key, set to 5 minutes (300 seconds) unless otherwise
set in the configuration. Pass this argument to your authentication provider
in order to put it to use::
+ // src/DependencyInjection/Security/Factory/WsseFactory.php
+ namespace App\DependencyInjection\Security\Factory;
+
use App\Security\Authentication\Provider\WsseProvider;
class WsseFactory implements SecurityFactoryInterface
diff --git a/security/form_login.rst b/security/form_login.rst
index cd53d277c88..374e21a78b7 100644
--- a/security/form_login.rst
+++ b/security/form_login.rst
@@ -93,6 +93,7 @@ configuration (``login``):
.. code-block:: php-annotations
// src/Controller/SecurityController.php
+ namespace App\Controller;
// ...
use Symfony\Component\Routing\Annotation\Route;
diff --git a/security/form_login_setup.rst b/security/form_login_setup.rst
index abbbb6eb1f2..f1f646fad47 100644
--- a/security/form_login_setup.rst
+++ b/security/form_login_setup.rst
@@ -477,6 +477,7 @@ If you also want to apply this behavior to public pages, you can create an
:doc:`event subscriber ` to set the target path manually
whenever the user browses a page::
+ // src/EventSubscriber/RequestSubscriber.php
namespace App\EventSubscriber;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
diff --git a/security/guard_authentication.rst b/security/guard_authentication.rst
index edbd6f122ee..7a6a25b9618 100644
--- a/security/guard_authentication.rst
+++ b/security/guard_authentication.rst
@@ -28,6 +28,8 @@ your ``User`` class (the ``make:entity`` command is a good way to do this):
.. code-block:: diff
// src/Entity/User.php
+ namespace App\Entity;
+
// ...
class User implements UserInterface
@@ -411,6 +413,8 @@ You can throw this from ``getCredentials()``, ``getUser()`` or ``checkCredential
to cause a failure::
// src/Security/TokenAuthenticator.php
+ namespace App\Security;
+
// ...
use Symfony\Component\Security\Core\Exception\CustomUserMessageAuthenticationException;
@@ -453,8 +457,9 @@ completes registration. To do that, use your authenticator and a service called
``GuardAuthenticatorHandler``::
// src/Controller/RegistrationController.php
+ namespace App\Controller;
+
// ...
-
use App\Security\LoginFormAuthenticator;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Security\Guard\GuardAuthenticatorHandler;
diff --git a/security/impersonating_user.rst b/security/impersonating_user.rst
index 308ed5b1e58..5f44a7fad23 100644
--- a/security/impersonating_user.rst
+++ b/security/impersonating_user.rst
@@ -113,6 +113,9 @@ stored in the token storage will be a ``SwitchUserToken`` instance. Use the
following snippet to obtain the original token which gives you access to
the impersonator user::
+ // src/Service/SomeService.php
+ namespace App\Service;
+
use Symfony\Component\Security\Core\Authentication\Token\SwitchUserToken;
use Symfony\Component\Security\Core\Security;
// ...
@@ -256,6 +259,7 @@ be called):
Then, create a voter class that responds to this role and includes whatever custom
logic you want::
+ // src/Service/Voter/SwitchToCustomerVoter.php
namespace App\Security\Voter;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
diff --git a/security/json_login_setup.rst b/security/json_login_setup.rst
index e1ec17e8587..a4be5dac0e7 100644
--- a/security/json_login_setup.rst
+++ b/security/json_login_setup.rst
@@ -65,6 +65,7 @@ The next step is to configure a route in your app matching this path:
.. code-block:: php-annotations
// src/Controller/SecurityController.php
+ namespace App\Controller;
// ...
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
diff --git a/security/named_encoders.rst b/security/named_encoders.rst
index aad4d740fb1..22bc333dec4 100644
--- a/security/named_encoders.rst
+++ b/security/named_encoders.rst
@@ -117,8 +117,8 @@ to use it, the class must implement
The interface requires one method - ``getEncoderName()`` - which should return
the name of the encoder to use::
- // src/Acme/UserBundle/Entity/User.php
- namespace Acme\UserBundle\Entity;
+ // src/Entity/User.php
+ namespace App\Entity;
use Symfony\Component\Security\Core\Encoder\EncoderAwareInterface;
use Symfony\Component\Security\Core\User\UserInterface;
diff --git a/serializer/custom_encoders.rst b/serializer/custom_encoders.rst
index 5bb78def4e4..4c08b410dbd 100644
--- a/serializer/custom_encoders.rst
+++ b/serializer/custom_encoders.rst
@@ -19,6 +19,7 @@ Imagine you want to serialize and deserialize YAML. For that you'll have to
create your own encoder that uses the
:doc:`Yaml Component `::
+ // src/Serializer/YamlEncoder.php
namespace App\Serializer;
use Symfony\Component\Serializer\Encoder\DecoderInterface;
diff --git a/serializer/custom_normalizer.rst b/serializer/custom_normalizer.rst
index 9f2e50fdcf1..6ee7d870ed5 100644
--- a/serializer/custom_normalizer.rst
+++ b/serializer/custom_normalizer.rst
@@ -17,6 +17,7 @@ process. For that you'll have to create your own normalizer. But it's usually
preferable to let Symfony normalize the object, then hook into the normalization
to customize the normalized data. To do that, leverage the ``ObjectNormalizer``::
+ // src/Serializer/TopicNormalizer.php
namespace App\Serializer;
use App\Entity\Topic;
From 269f500c45bf4ae3654d5edb92825c9d4e0c66ae Mon Sep 17 00:00:00 2001
From: Javier Eguiluz
Date: Thu, 22 Oct 2020 17:41:24 +0200
Subject: [PATCH 0046/5766] Added missing namespace
---
security/experimental_authenticators.rst | 3 +++
1 file changed, 3 insertions(+)
diff --git a/security/experimental_authenticators.rst b/security/experimental_authenticators.rst
index 83b3199d9ef..8a1b6081d84 100644
--- a/security/experimental_authenticators.rst
+++ b/security/experimental_authenticators.rst
@@ -472,6 +472,9 @@ the following badges are supported:
For instance, if you want to add CSRF and password migration to your custom
authenticator, you would initialize the passport like this::
+ // src/Service/LoginAuthenticator.php
+ namespace App\Service;
+
// ...
use Symfony\Component\Security\Http\Authenticator\AbstractAuthenticator;
use Symfony\Component\Security\Http\Authenticator\Passport\Badge\CsrfTokenBadge;
From e912f23b557bd56ed1c7c296f12b178f48e6dfb5 Mon Sep 17 00:00:00 2001
From: TavoNiievez <64917965+TavoNiievez@users.noreply.github.com>
Date: Thu, 22 Oct 2020 13:54:00 -0500
Subject: [PATCH 0047/5766] Typo in impersonator role
The correct role is 'IS_IMPERSONATOR'.
---
components/security/authorization.rst | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/components/security/authorization.rst b/components/security/authorization.rst
index c074cf14b75..b884ce97ac0 100644
--- a/components/security/authorization.rst
+++ b/components/security/authorization.rst
@@ -114,12 +114,12 @@ user fully authenticated, or only based on a "remember-me" cookie, or even
authenticated anonymously?
It also supports the attributes ``IS_ANONYMOUS``, ``IS_REMEMBERED``,
-``IS_IMPERSONATED`` to grant access based on a specific state of
+``IS_IMPERSONATOR`` to grant access based on a specific state of
authentication.
.. versionadded:: 5.1
- The ``IS_ANONYMOUS``, ``IS_REMEMBERED`` and ``IS_IMPERSONATED``
+ The ``IS_ANONYMOUS``, ``IS_REMEMBERED`` and ``IS_IMPERSONATOR``
attributes were introduced in Symfony 5.1.
::
From 745af3cc386fa7efd71a95f6d605138f692f8c21 Mon Sep 17 00:00:00 2001
From: Przemek Maszczynski
Date: Thu, 22 Oct 2020 22:46:13 +0200
Subject: [PATCH 0048/5766] Removed duplicate method
---
security/form_login_setup.rst | 8 --------
1 file changed, 8 deletions(-)
diff --git a/security/form_login_setup.rst b/security/form_login_setup.rst
index f1f646fad47..768ce725a72 100644
--- a/security/form_login_setup.rst
+++ b/security/form_login_setup.rst
@@ -77,14 +77,6 @@ class that processes the login submit and 4) updates the main security config fi
return $this->render('security/login.html.twig', ['last_username' => $lastUsername, 'error' => $error]);
}
- /**
- * @Route("/logout", name="app_logout")
- */
- public function logout()
- {
- throw new \Exception('This method can be blank - it will be intercepted by the logout key on your firewall');
- }
-
/**
* @Route("/logout", name="app_logout")
*/
From c630bcb1739638120d1fc7bf2c62c0f14bc7ee1e Mon Sep 17 00:00:00 2001
From: Mathieu Piot
Date: Fri, 17 Apr 2020 13:51:19 +0200
Subject: [PATCH 0049/5766] Add Discord notifier
---
notifier.rst | 3 ++-
notifier/chatters.rst | 53 +++++++++++++++++++++++++++++++++++++++++++
2 files changed, 55 insertions(+), 1 deletion(-)
diff --git a/notifier.rst b/notifier.rst
index 9d0b5148553..d79933b7188 100644
--- a/notifier.rst
+++ b/notifier.rst
@@ -139,6 +139,7 @@ integration with these chat services:
========== ================================ ===========================================================================
Service Package DSN
========== ================================ ===========================================================================
+Discord ``symfony/discord-notifier`` ``discord://TOKEN@default?webhook_id=ID``
GoogleChat ``symfony/google-chat-notifier`` ``googlechat://ACCESS_KEY:ACCESS_TOKEN@default/SPACE?threadKey=THREAD_KEY``
LinkedIn ``symfony/linked-in-notifier`` ``linkedin://TOKEN:USER_ID@default``
Mattermost ``symfony/mattermost-notifier`` ``mattermost://TOKEN@ENDPOINT?channel=CHANNEL``
@@ -156,7 +157,7 @@ Zulip ``symfony/zulip-notifier`` ``zulip://EMAIL:APIKEY@ENDPOINT?ch
.. versionadded:: 5.2
- The GoogleChat, LinkedIn and Zulip integrations were introduced in Symfony 5.2.
+ The GoogleChat, LinkedIn, Zulip and Discord integrations were introduced in Symfony 5.2.
Chatters are configured using the ``chatter_transports`` setting:
diff --git a/notifier/chatters.rst b/notifier/chatters.rst
index efbd040593e..b37d17c2040 100644
--- a/notifier/chatters.rst
+++ b/notifier/chatters.rst
@@ -99,3 +99,56 @@ some interactive options called `Block elements`_::
$chatter->send($chatMessage);
.. _`Block elements`: https://api.slack.com/reference/block-kit/block-elements
+
+Adding Interactions to a Discord Message
+--------------------------------------
+
+With a Discord message, you can use the
+:class:`Symfony\\Component\\Notifier\\Bridge\\Discord\\DiscordOptions` to add
+some interactive options called `Embed elements`_::
+
+ use Symfony\Component\Notifier\Bridge\Discord\Block\DiscordEmbed;
+ use Symfony\Component\Notifier\Bridge\Discord\Block\DiscordFieldEmbedObject;
+ use Symfony\Component\Notifier\Bridge\Discord\Block\DiscordFooterEmbedObject;
+ use Symfony\Component\Notifier\Bridge\Discord\Block\DiscordMediaEmbedObject;
+ use Symfony\Component\Notifier\Bridge\Discord\DiscordOptions;
+ use Symfony\Component\Notifier\Message\ChatMessage;
+
+ $chatMessage = new ChatMessage('');
+
+ // Create Discord Embed
+ $discordOptions = (new DiscordOptions())
+ ->username('connor bot')
+ ->addEmbed((new DiscordEmbed())
+ ->color(2021216)
+ ->title('New song added!')
+ ->thumbnail((new DiscordMediaEmbedObject())
+ ->url('https://i.scdn.co/image/ab67616d0000b2735eb27502aa5cb1b4c9db426b'))
+ ->addField((new DiscordFieldEmbedObject())
+ ->name('Track')
+ ->value('[Common Ground](https://open.spotify.com/track/36TYfGWUhIRlVjM8TxGUK6)')
+ ->inline(true)
+ )
+ ->addField((new DiscordFieldEmbedObject())
+ ->name('Artist')
+ ->value('Alasdair Fraser')
+ ->inline(true)
+ )
+ ->addField((new DiscordFieldEmbedObject())
+ ->name('Album')
+ ->value('Dawn Dance')
+ ->inline(true)
+ )
+ ->footer((new DiscordFooterEmbedObject())
+ ->text('Added ...')
+ ->iconUrl('https://upload.wikimedia.org/wikipedia/commons/thumb/1/19/Spotify_logo_without_text.svg/200px-Spotify_logo_without_text.svg.png')
+ )
+ )
+ ;
+
+ // Add the custom options to the chat message and send the message
+ $chatMessage->options($discordOptions);
+
+ $chatter->send($chatMessage);
+
+.. _`Embed elements`: https://discord.com/developers/docs/resources/webhook
From bf6cca937f6c2e96a0e9a2deeeae0fc768b8a764 Mon Sep 17 00:00:00 2001
From: Baptiste Leduc
Date: Fri, 23 Oct 2020 13:45:06 +0200
Subject: [PATCH 0050/5766] Non-standard adder/remover methods
---
components/property_access.rst | 39 ++++++++++++++++++++++++++++++++++
1 file changed, 39 insertions(+)
diff --git a/components/property_access.rst b/components/property_access.rst
index df0f3d99b51..741d3023ad5 100644
--- a/components/property_access.rst
+++ b/components/property_access.rst
@@ -394,6 +394,45 @@ and ``removeChild()`` methods to access to the ``children`` property.
If available, *adder* and *remover* methods have priority over a *setter* method.
+Using non-standard adder/remover methods
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Sometimes, adder and remover methods don't use the standard ``add`` or ``remove`` prefix, like in this example::
+
+ // ...
+ class PeopleList
+ {
+ // ...
+
+ public function joinPeople(string $people): void
+ {
+ $this->peoples[] = $people;
+ }
+
+ public function leavePeople(string $people): void
+ {
+ foreach ($this->peoples as $id => $item) {
+ if ($people === $item) {
+ unset($this->peoples[$id]);
+ break;
+ }
+ }
+ }
+ }
+
+ use Symfony\Component\PropertyInfo\Extractor\ReflectionExtractor;
+ use Symfony\Component\PropertyAccess\PropertyAccessor;
+
+ $list = new PeopleList();
+ $reflectionExtractor = new ReflectionExtractor(null, null, ['join', 'leave']);
+ $propertyAccessor = new PropertyAccessor(false, false, null, true, $reflectionExtractor, $reflectionExtractor);
+ $propertyAccessor->setValue($person, 'peoples', ['kevin', 'wouter']);
+
+ var_dump($person->getPeoples()); // ['kevin', 'wouter']
+
+Instead of calling ``add()`` and ``remove()``, the PropertyAccess
+component will call ``join()`` and ``leave()`` methods.
+
Checking Property Paths
-----------------------
From 3194c224966f6764057d166f7bf9997e689d77b5 Mon Sep 17 00:00:00 2001
From: Robin Chalas
Date: Fri, 23 Oct 2020 13:51:30 +0200
Subject: [PATCH 0051/5766] [Security] Remove extra argument from call to
EntityManager#flush()
---
security/password_migration.rst | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/security/password_migration.rst b/security/password_migration.rst
index 9553d46de5a..bb77a0504ab 100644
--- a/security/password_migration.rst
+++ b/security/password_migration.rst
@@ -190,7 +190,7 @@ storing the newly created password hash::
$user->setPassword($newEncodedPassword);
// execute the queries on the database
- $this->getEntityManager()->flush($user);
+ $this->getEntityManager()->flush();
}
}
From 8fe20c33a49ba1bd21de5eb78477752e5c6fdd1b Mon Sep 17 00:00:00 2001
From: Toni Rudolf
Date: Mon, 3 Feb 2020 17:24:10 +0100
Subject: [PATCH 0052/5766] Added redeliver_timeout and claim_interval options
---
messenger.rst | 24 ++++++++++++++++++++----
1 file changed, 20 insertions(+), 4 deletions(-)
diff --git a/messenger.rst b/messenger.rst
index 54c7fb200a5..9917e5d7c28 100644
--- a/messenger.rst
+++ b/messenger.rst
@@ -1038,9 +1038,9 @@ a running Redis server (^5.0).
A number of options can be configured via the DSN or via the ``options`` key
under the transport in ``messenger.yaml``:
-================== ===================================== =========================
- Option Description Default
-================== ===================================== =========================
+=================== ===================================== =================================
+ Option Description Default
+=================== ===================================== =================================
stream The Redis stream name messages
group The Redis consumer group name symfony
consumer Consumer name used in Redis consumer
@@ -1056,7 +1056,23 @@ stream_max_entries The maximum number of entries which ``0`` (which means "n
it to a large enough number to
avoid losing pending messages
tls Enable TLS support for the connection false
-================== ===================================== =========================
+redeliver_timeout Timeout before retrying a pending ``3600``
+ message which is owned by an
+ abandoned consumer (if a worker died
+ for some reason, this will occur,
+ eventually you should retry the
+ message) - in seconds.
+claim_interval Interval on which pending/abandoned ``60000`` (1 Minute)
+ messages should be checked for to
+ claim - in milliseconds
+=================== ===================================== =================================
+
+.. caution::
+
+ There should never be more than one `messenger:consume` command running with the same
+ config (stream, group and consumer name) to avoid having a message handled more than once.
+ Using the ``HOSTNAME`` as the consumer might often be a good idea. In case you are using
+ Kubernetes to orchestrate your containers, consider using a ``StatefulSet``.
.. tip::
From d6988a76ee403c23382fd420dd60dcc69fb083f3 Mon Sep 17 00:00:00 2001
From: Wouter de Jong
Date: Fri, 23 Oct 2020 15:05:47 +0200
Subject: [PATCH 0053/5766] [#12976] Minor syntax fix
---
messenger.rst | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/messenger.rst b/messenger.rst
index 9917e5d7c28..78d09d50e9a 100644
--- a/messenger.rst
+++ b/messenger.rst
@@ -1069,7 +1069,7 @@ claim_interval Interval on which pending/abandoned ``60000`` (1 Minute)
.. caution::
- There should never be more than one `messenger:consume` command running with the same
+ There should never be more than one ``messenger:consume`` command running with the same
config (stream, group and consumer name) to avoid having a message handled more than once.
Using the ``HOSTNAME`` as the consumer might often be a good idea. In case you are using
Kubernetes to orchestrate your containers, consider using a ``StatefulSet``.
From 08496685d725a48630e0a019e11188cd1c7c1c91 Mon Sep 17 00:00:00 2001
From: Wouter de Jong
Date: Fri, 23 Oct 2020 15:08:55 +0200
Subject: [PATCH 0054/5766] [#12976] Added the new options to the versionadded
directive
---
messenger.rst | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/messenger.rst b/messenger.rst
index 78d09d50e9a..3dce638cd70 100644
--- a/messenger.rst
+++ b/messenger.rst
@@ -1083,7 +1083,8 @@ claim_interval Interval on which pending/abandoned ``60000`` (1 Minute)
.. versionadded:: 5.1
- The ``delete_after_ack`` option was introduced in Symfony 5.1.
+ The ``delete_after_ack``, ``redeliver_timeout`` and ``claim_interval``
+ options were introduced in Symfony 5.1.
In Memory Transport
~~~~~~~~~~~~~~~~~~~
From f79b26828e2bed575c0fbecf3860b9893103efe4 Mon Sep 17 00:00:00 2001
From: Nyholm
Date: Fri, 23 Oct 2020 15:14:37 +0200
Subject: [PATCH 0055/5766] Syntax fix
---
notifier/chatters.rst | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/notifier/chatters.rst b/notifier/chatters.rst
index b37d17c2040..9d03f83987c 100644
--- a/notifier/chatters.rst
+++ b/notifier/chatters.rst
@@ -101,7 +101,7 @@ some interactive options called `Block elements`_::
.. _`Block elements`: https://api.slack.com/reference/block-kit/block-elements
Adding Interactions to a Discord Message
---------------------------------------
+----------------------------------------
With a Discord message, you can use the
:class:`Symfony\\Component\\Notifier\\Bridge\\Discord\\DiscordOptions` to add
From 55a6ad049d3c17b4a9c651aa5ecdf4dab5bec5c2 Mon Sep 17 00:00:00 2001
From: Javier Eguiluz
Date: Fri, 23 Oct 2020 15:24:54 +0200
Subject: [PATCH 0056/5766] Fixed a syntax issue
---
messenger.rst | 30 +++++++++++++++---------------
1 file changed, 15 insertions(+), 15 deletions(-)
diff --git a/messenger.rst b/messenger.rst
index f2c2a8b65be..7f74be71dd6 100644
--- a/messenger.rst
+++ b/messenger.rst
@@ -1160,21 +1160,21 @@ under the transport in ``messenger.yaml``:
=================== ===================================== =================================
Option Description Default
=================== ===================================== =================================
-stream The Redis stream name messages
-group The Redis consumer group name symfony
-consumer Consumer name used in Redis consumer
-auto_setup Create the Redis group automatically? true
-auth The Redis password
-delete_after_ack If ``true``, messages are deleted false
- automatically after processing them
-serializer How to serialize the final payload ``Redis::SERIALIZER_PHP``
- in Redis (the
- ``Redis::OPT_SERIALIZER`` option)
-stream_max_entries The maximum number of entries which ``0`` (which means "no trimming")
- the stream will be trimmed to. Set
- it to a large enough number to
- avoid losing pending messages
-tls Enable TLS support for the connection false
+stream The Redis stream name messages
+group The Redis consumer group name symfony
+consumer Consumer name used in Redis consumer
+auto_setup Create the Redis group automatically? true
+auth The Redis password
+delete_after_ack If ``true``, messages are deleted false
+ automatically after processing them
+serializer How to serialize the final payload ``Redis::SERIALIZER_PHP``
+ in Redis (the
+ ``Redis::OPT_SERIALIZER`` option)
+stream_max_entries The maximum number of entries which ``0`` (which means "no trimming")
+ the stream will be trimmed to. Set
+ it to a large enough number to
+ avoid losing pending messages
+tls Enable TLS support for the connection false
redeliver_timeout Timeout before retrying a pending ``3600``
message which is owned by an
abandoned consumer (if a worker died
From 436e2fc6183b80a5f39300d329b654f607ad25d0 Mon Sep 17 00:00:00 2001
From: Javier Eguiluz
Date: Fri, 14 Aug 2020 15:06:43 +0200
Subject: [PATCH 0057/5766] [Testing] Updated the contents about getting the
container in tests
---
testing.rst | 91 ++++++++++++++++++++---------------------------------
1 file changed, 34 insertions(+), 57 deletions(-)
diff --git a/testing.rst b/testing.rst
index 4b64d504631..d5d0941b1ea 100644
--- a/testing.rst
+++ b/testing.rst
@@ -544,74 +544,51 @@ You can also get the objects related to the latest request::
Accessing the Container
~~~~~~~~~~~~~~~~~~~~~~~
-It's highly recommended that a functional test only tests the response. But
-under certain very rare circumstances, you might want to access some services
-to write assertions. Given that services are private by default, test classes
-define a property that stores a special container created by Symfony which
-allows fetching both public and all non-removed private services::
-
- // gives access to the same services used in your test, unless you're using
- // $client->insulate() or using real HTTP requests to test your application
- // don't forget to call self::bootKernel() before, otherwise, the container
- // will be empty
- $container = self::$container;
-
-For a list of services available in your application, use the ``debug:container``
-command.
-
-If a private service is *never* used in your application (outside of your test),
-it is *removed* from the container and cannot be accessed as described above. In
-that case, you can create a public alias in the ``test`` environment and access
-it via that alias:
+Functional tests should only test the response (e.g. its contents or its HTTP
+status code). However, in some rare circumstances you may need to access the
+container to use some service.
-.. configuration-block::
-
- .. code-block:: yaml
-
- # config/services_test.yaml
- services:
- # access the service in your test via
- # self::$container->get('test.App\Test\SomeTestHelper')
- test.App\Test\SomeTestHelper:
- # the id of the private service
- alias: 'App\Test\SomeTestHelper'
- public: true
+First, you can get the same container used in the application, which only
+includes the public services::
- .. code-block:: xml
-
-
-
-
+ public function testSomething()
+ {
+ $client = self::createClient();
+ $container = $client->getContainer();
+ // $someService = $container->get('the-service-ID');
-
-
+ // ...
+ }
-
-
-
+Symfony tests also have access to a special container that includes both the
+public services and the non-removed :ref:`private services `
+services::
- .. code-block:: php
+ public function testSomething()
+ {
+ // this call is needed; otherwise the container will be empty
+ self::bootKernel();
- // config/services_test.php
- namespace Symfony\Component\DependencyInjection\Loader\Configurator;
+ $container = self::$container;
+ // $someService = $container->get('the-service-ID');
- use App\Service\MessageGenerator;
- use App\Service\SiteUpdateManager;
+ // ...
+ }
- return function(ContainerConfigurator $configurator) {
- // ...
+Finally, for the most rare edge-cases, Symfony includes a special container
+which provides access to all services, public and private. This special
+container is a service that can be get via the normal container::
- $services->alias('test.App\Test\SomeTestHelper', 'App\Test\SomeTestHelper')->public();
- };
+ public function testSomething()
+ {
+ $client = self::createClient();
+ $normalContainer = $client->getContainer();
+ $specialContainer = $normalContainer->get('test.service_container');
-.. tip::
+ // $somePrivateService = $specialContainer->get('the-service-ID');
- The special container that gives access to private services exists only in
- the ``test`` environment and is itself a service that you can get from the
- real container using the ``test.service_container`` id.
+ // ...
+ }
.. tip::
From 85b27e554a7e9b6a26e3358f51ca933eee90fec3 Mon Sep 17 00:00:00 2001
From: Nyholm
Date: Fri, 23 Oct 2020 13:46:16 +0200
Subject: [PATCH 0058/5766] [Messenger] Added Lazy option to redis
---
messenger.rst | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/messenger.rst b/messenger.rst
index 7f74be71dd6..6c2f2e35794 100644
--- a/messenger.rst
+++ b/messenger.rst
@@ -1167,6 +1167,10 @@ auto_setup Create the Redis group automatically? true
auth The Redis password
delete_after_ack If ``true``, messages are deleted false
automatically after processing them
+delete_after_reject If ``true``, messages are deleted true
+ automatically if they are rejected
+lazy Connect only when a connection is false
+ really needed
serializer How to serialize the final payload ``Redis::SERIALIZER_PHP``
in Redis (the
``Redis::OPT_SERIALIZER`` option)
@@ -1207,7 +1211,7 @@ claim_interval Interval on which pending/abandoned ``60000`` (1 Minute)
.. versionadded:: 5.2
- The ``delete_after_reject`` option was introduced in Symfony 5.2.
+ The ``delete_after_reject`` and ``lazy`` options were introduced in Symfony 5.2.
In Memory Transport
~~~~~~~~~~~~~~~~~~~
From 38da641b42976ddeef37903c4a0ddd64226f1bab Mon Sep 17 00:00:00 2001
From: Takashi Kanemoto
Date: Sat, 24 Oct 2020 18:50:56 +0900
Subject: [PATCH 0059/5766] Fix typo
---
testing.rst | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/testing.rst b/testing.rst
index d028fc2e713..371b986496c 100644
--- a/testing.rst
+++ b/testing.rst
@@ -757,7 +757,7 @@ their type::
$form['photo']->upload('/path/to/lucas.jpg');
// In the case of a multiple file upload
- $form['my_form[field][O]']->upload('/path/to/lucas.jpg');
+ $form['my_form[field][0]']->upload('/path/to/lucas.jpg');
$form['my_form[field][1]']->upload('/path/to/lisa.jpg');
.. tip::
From 87fe4cc0cc5ae0b0c30c254ba5ee38cc51e4f538 Mon Sep 17 00:00:00 2001
From: Laurent VOULLEMIER
Date: Sun, 25 Oct 2020 07:58:38 +0100
Subject: [PATCH 0060/5766] Remove paragraph about .htaccess files
Htaccess files aren't in SF repository anymore (since sf4 and Flex, it's in the apache-pack optional recipe)
---
setup/web_server_configuration.rst | 7 -------
1 file changed, 7 deletions(-)
diff --git a/setup/web_server_configuration.rst b/setup/web_server_configuration.rst
index 2fc2c74e648..e4fef9b3d99 100644
--- a/setup/web_server_configuration.rst
+++ b/setup/web_server_configuration.rst
@@ -374,13 +374,6 @@ The **minimum configuration** to get your application running under Nginx is:
After you deploy to production, make sure that you **cannot** access the ``index.php``
script (i.e. ``http://example.com/index.php``).
-.. note::
-
- By default, Symfony applications include several ``.htaccess`` files to
- configure redirections and to prevent unauthorized access to some sensitive
- directories. Those files are only useful when using Apache, so you can
- safely remove them when using Nginx.
-
For advanced Nginx configuration options, read the official `Nginx documentation`_.
.. _`Apache documentation`: https://httpd.apache.org/docs/
From 2fcc6fe060af8fcdb7d7010130e535e548a6d919 Mon Sep 17 00:00:00 2001
From: Nyholm
Date: Sun, 25 Oct 2020 16:37:19 +0100
Subject: [PATCH 0061/5766] [RateLimit] Make sure we mention policy instead of
limit
---
rate_limiter.rst | 26 +++++++++++++-------------
1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/rate_limiter.rst b/rate_limiter.rst
index 527357cc011..22a56168498 100644
--- a/rate_limiter.rst
+++ b/rate_limiter.rst
@@ -16,11 +16,11 @@ Symfony uses these rate limiters in built-in features like "login throttling",
which limits how many failed login attempts a user can make in a given period of
time, but you can use them for your own features too.
-Rate Limiting Strategies
-------------------------
+Rate Limiting Policies
+----------------------
-Symfony's rate limiter implements some of the most common strategies to enforce
-rate limits: **fixed window**, **sliding window** and **token bucket**.
+Symfony's rate limiter implements some of the most common policies to enforce
+rate limits: **fixed window**, **sliding window**, **token bucket**.
Fixed Window Rate Limiter
~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -86,12 +86,12 @@ enforce different levels of service (free or paid):
framework:
rate_limiter:
anonymous_api:
- # use 'sliding_window' if you prefer that strategy
- strategy: 'fixed_window'
+ # use 'sliding_window' if you prefer that policy
+ policy: 'fixed_window'
limit: 100
interval: '60 minutes'
authenticated_api:
- strategy: 'token_bucket'
+ policy: 'token_bucket'
limit: 5000
rate: { interval: '15 minutes', amount: 500 }
@@ -124,13 +124,13 @@ the number of requests to the API::
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpKernel\Exception\TooManyRequestsHttpException;
- use Symfony\Component\RateLimiter\RateLimiter;
+ use Symfony\Component\RateLimiter\RateLimiterFactory;
class ApiController extends AbstractController
{
// if you're using service autowiring, the variable name must be:
// "rate limiter name" (in camelCase) + "limiter" suffix
- public function index(RateLimiter $anonymousApiLimiter)
+ public function index(RateLimiterFactory $anonymousApiLimiter)
{
// create a limiter based on a unique identifier of the client
// (e.g. the client's IP address, a username/email, an API key, etc.)
@@ -171,11 +171,11 @@ using the ``reserve()`` method::
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
- use Symfony\Component\RateLimiter\RateLimiter;
+ use Symfony\Component\RateLimiter\RateLimiterFactory;
class ApiController extends AbstractController
{
- public function registerUser(Request $request, RateLimiter $authenticatedApiLimiter)
+ public function registerUser(Request $request, RateLimiterFactory $authenticatedApiLimiter)
{
$apiKey = $request->headers->get('apikey');
$limiter = $authenticatedApiLimiter->create($apiKey);
@@ -229,11 +229,11 @@ the :class:`Symfony\\Component\\RateLimiter\\Reservation` object returned by the
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
- use Symfony\Component\RateLimiter\RateLimiter;
+ use Symfony\Component\RateLimiter\RateLimiterFactory;
class ApiController extends AbstractController
{
- public function index(RateLimiter $anonymousApiLimiter)
+ public function index(RateLimiterFactory $anonymousApiLimiter)
{
$limiter = $anonymousApiLimiter->create($request->getClientIp());
$limit = $limiter->consume();
From 3e0c21cc3eb8b8ed493b982a2c0c3cc77afb76aa Mon Sep 17 00:00:00 2001
From: Nyholm
Date: Sun, 25 Oct 2020 16:39:18 +0100
Subject: [PATCH 0062/5766] Update wrong use statement
---
translation.rst | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/translation.rst b/translation.rst
index cb774e70f7a..4c4b4b9a07b 100644
--- a/translation.rst
+++ b/translation.rst
@@ -307,16 +307,16 @@ parts of your application and mocking it in your tests.
Instead of translating a string at the time of creation, you can use a
"translatable object", which is an instance of the
-:class:`Symfony\\Component\\Translation\\Translatable` class. This object stores
+:class:`Symfony\\Component\\Translation\\TranslatableMessage` class. This object stores
all the information needed to fully translate its contents when needed::
- use Symfony\Component\Translation\Translatable;
+ use Symfony\Component\Translation\TranslatableMessage;
// the first argument is required and it's the original message
- $message = new Translatable('Symfony is great!');
+ $message = new TranslatableMessage('Symfony is great!');
// the optional second argument defines the translation parameters and
// the optional third argument is the translation domain
- $status = new Translatable('order.status', ['%status%' => $order->getStatus()], 'store');
+ $status = new TranslatableMessage('order.status', ['%status%' => $order->getStatus()], 'store');
Templates are now much simpler because you can pass translatable objects to the
``trans`` filter:
From 08ded89b8f12598e8a65b694d2c208545cdd884a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20K=C3=A4fer?=
Date: Sun, 25 Oct 2020 11:46:38 +0100
Subject: [PATCH 0063/5766] Change "-t" to "--track" to be more explicit
---
contributing/code/pull_requests.rst | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/contributing/code/pull_requests.rst b/contributing/code/pull_requests.rst
index 1060e0d80a8..c0cd2259250 100644
--- a/contributing/code/pull_requests.rst
+++ b/contributing/code/pull_requests.rst
@@ -159,7 +159,7 @@ Or, if you want to provide a bug fix for the ``3.4`` branch, first track the rem
.. code-block:: terminal
- $ git checkout -t origin/3.4
+ $ git checkout --track origin/3.4
Then create a new branch off the ``3.4`` branch to work on the bug fix:
From 42f4d233dc1269f94bce774879506fba76e30420 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20K=C3=A4fer?=
Date: Sun, 25 Oct 2020 11:27:09 +0100
Subject: [PATCH 0064/5766] Change branch "master" to "5.x"
Not sure if this is correct but I'm sure that I cannot find "master" anymore.
---
contributing/code/pull_requests.rst | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/contributing/code/pull_requests.rst b/contributing/code/pull_requests.rst
index c0cd2259250..816130b1168 100644
--- a/contributing/code/pull_requests.rst
+++ b/contributing/code/pull_requests.rst
@@ -129,7 +129,7 @@ work:
` (you may have to choose a higher branch if
the feature you are fixing was introduced in a later version);
-* ``master``, if you are adding a new feature.
+* ``5.x``, if you are adding a new feature.
The only exception is when a new :doc:`major Symfony version `
(4.0, 5.0, etc.) comes out every two years. Because of the
@@ -142,7 +142,7 @@ work:
All bug fixes merged into maintenance branches are also merged into more
recent branches on a regular basis. For instance, if you submit a PR
for the ``3.4`` branch, the PR will also be applied by the core team on
- the ``master`` branch.
+ the ``5.x`` branch.
Create a Topic Branch
~~~~~~~~~~~~~~~~~~~~~
@@ -152,7 +152,7 @@ topic branch:
.. code-block:: terminal
- $ git checkout -b BRANCH_NAME master
+ $ git checkout -b BRANCH_NAME 5.x
Or, if you want to provide a bug fix for the ``3.4`` branch, first track the remote
``3.4`` branch locally:
@@ -277,15 +277,15 @@ while to finish your changes):
.. code-block:: terminal
- $ git checkout master
+ $ git checkout 5.x
$ git fetch upstream
- $ git merge upstream/master
+ $ git merge upstream/5.x
$ git checkout BRANCH_NAME
- $ git rebase master
+ $ git rebase 5.x
.. tip::
- Replace ``master`` with the branch you selected previously (e.g. ``3.4``)
+ Replace ``5.x`` with the branch you selected previously (e.g. ``3.4``)
if you are working on a bug fix.
When doing the ``rebase`` command, you might have to fix merge conflicts.
@@ -402,12 +402,12 @@ Rework your Pull Request
~~~~~~~~~~~~~~~~~~~~~~~~
Based on the feedback on the pull request, you might need to rework your
-PR. Before re-submitting the PR, rebase with ``upstream/master`` or
+PR. Before re-submitting the PR, rebase with ``upstream/5.x`` or
``upstream/3.4``, don't merge; and force the push to the origin:
.. code-block:: terminal
- $ git rebase -f upstream/master
+ $ git rebase -f upstream/5.x
$ git push --force origin BRANCH_NAME
.. note::
From 464904fa2d95fca3f3759e9c61162d1d5d2579ef Mon Sep 17 00:00:00 2001
From: Francois CONTE
Date: Sat, 24 Oct 2020 22:20:51 +0200
Subject: [PATCH 0065/5766] [Security] Update examples of Login Link
---
security/login_link.rst | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/security/login_link.rst b/security/login_link.rst
index 3db4f34f8eb..b92dd694178 100644
--- a/security/login_link.rst
+++ b/security/login_link.rst
@@ -253,7 +253,7 @@ number::
'Welcome to MY WEBSITE!' // email subject
);
// create a recipient for this user
- $recipient = (new Recipient())->email($user->getEmail());
+ $recipient = new Recipient($user->getEmail());
// send the notification to the user
$notifier->send($notification, $recipient);
@@ -620,7 +620,7 @@ user create this POST request (e.g. by clicking a button)::
/**
* @Route("/login_check", name="login_check")
*/
- public function check()
+ public function check(Request $request)
{
// get the login link query parameters
$expires = $request->query->get('expires');
From 1776c69a192042c6999fafc629a88f3c5d646ad0 Mon Sep 17 00:00:00 2001
From: "Alexander M. Turek"
Date: Sun, 25 Oct 2020 23:53:32 +0100
Subject: [PATCH 0066/5766] [DependencyInjection] Fix markup of
configuration-block
---
service_container/autowiring.rst | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/service_container/autowiring.rst b/service_container/autowiring.rst
index 4a2b606c538..e62f75f7513 100644
--- a/service_container/autowiring.rst
+++ b/service_container/autowiring.rst
@@ -609,7 +609,7 @@ you can use the ``@required`` annotation instead.
Despite property injection has some :ref:`drawbacks `,
autowiring with ``#[Required]`` or ``@required`` can also be applied to public
-typed properties::
+typed properties:
.. configuration-block::
From 5094d7f5e59a75b48279925822d58e16d538cb7d Mon Sep 17 00:00:00 2001
From: Wouter de Jong
Date: Mon, 26 Oct 2020 11:50:23 +0100
Subject: [PATCH 0067/5766] Fixed table margin
---
messenger.rst | 30 +++++++++++++++---------------
1 file changed, 15 insertions(+), 15 deletions(-)
diff --git a/messenger.rst b/messenger.rst
index 3dce638cd70..e9253431bd4 100644
--- a/messenger.rst
+++ b/messenger.rst
@@ -1041,21 +1041,21 @@ under the transport in ``messenger.yaml``:
=================== ===================================== =================================
Option Description Default
=================== ===================================== =================================
-stream The Redis stream name messages
-group The Redis consumer group name symfony
-consumer Consumer name used in Redis consumer
-auto_setup Create the Redis group automatically? true
-auth The Redis password
-delete_after_ack If ``true``, messages are deleted false
- automatically after processing them
-serializer How to serialize the final payload ``Redis::SERIALIZER_PHP``
- in Redis (the
- ``Redis::OPT_SERIALIZER`` option)
-stream_max_entries The maximum number of entries which ``0`` (which means "no trimming")
- the stream will be trimmed to. Set
- it to a large enough number to
- avoid losing pending messages
-tls Enable TLS support for the connection false
+stream The Redis stream name messages
+group The Redis consumer group name symfony
+consumer Consumer name used in Redis consumer
+auto_setup Create the Redis group automatically? true
+auth The Redis password
+delete_after_ack If ``true``, messages are deleted false
+ automatically after processing them
+serializer How to serialize the final payload ``Redis::SERIALIZER_PHP``
+ in Redis (the
+ ``Redis::OPT_SERIALIZER`` option)
+stream_max_entries The maximum number of entries which ``0`` (which means "no trimming")
+ the stream will be trimmed to. Set
+ it to a large enough number to
+ avoid losing pending messages
+tls Enable TLS support for the connection false
redeliver_timeout Timeout before retrying a pending ``3600``
message which is owned by an
abandoned consumer (if a worker died
From 792968b78e2257368c6fb1dc3346d931a85c95fb Mon Sep 17 00:00:00 2001
From: Javier Eguiluz
Date: Thu, 22 Oct 2020 13:02:02 +0200
Subject: [PATCH 0068/5766] Add the new doc build system
---
.gitignore | 3 +
_build/build.php | 44 +
_build/composer.json | 21 +
_build/composer.lock | 2197 ++++++++++++++++++++++++++++++++++++++++++
docs.json | 3 +
5 files changed, 2268 insertions(+)
create mode 100755 _build/build.php
create mode 100644 _build/composer.json
create mode 100644 _build/composer.lock
create mode 100644 docs.json
diff --git a/.gitignore b/.gitignore
index 6a20088680a..1d25940e5c8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,7 @@
/_build/doctrees
/_build/spelling
/_build/html
+/_build/logs.txt
+/_build/vendor
+/_build/output
*.pyc
diff --git a/_build/build.php b/_build/build.php
new file mode 100755
index 00000000000..5a2fd660bda
--- /dev/null
+++ b/_build/build.php
@@ -0,0 +1,44 @@
+#!/usr/bin/env php
+register('build-docs')
+ ->addOption('generate-fjson-files', null, InputOption::VALUE_NONE, 'Use this option to generate docs both in HTML and JSON formats')
+ ->addOption('disable-cache', null, InputOption::VALUE_NONE, 'Use this option to force a full regeneration of all doc contents')
+ ->setCode(function(InputInterface $input, OutputInterface $output) {
+ $command = [
+ 'php',
+ 'vendor/symfony/docs-builder/bin/console',
+ 'build:docs',
+ sprintf('--save-errors=%s', __DIR__.'/logs.txt'),
+ __DIR__.'/../',
+ __DIR__.'/output/',
+ ];
+
+ if ($input->getOption('generate-fjson-files')) {
+ $command[] = '--output-json';
+ }
+
+ if ($input->getOption('disable-cache')) {
+ $command[] = '--disable-cache';
+ }
+
+ $process = new Process($command);
+ $process->setTimeout(3600);
+ $process->run();
+
+ if (!$process->isSuccessful()) {
+ throw new ProcessFailedException($process);
+ }
+ })
+ ->getApplication()
+ ->setDefaultCommand('build-docs', true)
+ ->run();
diff --git a/_build/composer.json b/_build/composer.json
new file mode 100644
index 00000000000..30de6365ecb
--- /dev/null
+++ b/_build/composer.json
@@ -0,0 +1,21 @@
+{
+ "minimum-stability": "dev",
+ "repositories": [
+ { "type": "git", "url": "https://github.com/weaverryan/docs-builder" }
+ ],
+ "config": {
+ "platform": {
+ "php": "7.2.9"
+ },
+ "preferred-install": {
+ "*": "dist"
+ },
+ "sort-packages": true
+ },
+ "require": {
+ "php": ">=7.2.9",
+ "symfony/console": "^4.1",
+ "symfony/docs-builder": "dev-master",
+ "symfony/process": "9999999-dev"
+ }
+}
diff --git a/_build/composer.lock b/_build/composer.lock
new file mode 100644
index 00000000000..101c85b4165
--- /dev/null
+++ b/_build/composer.lock
@@ -0,0 +1,2197 @@
+{
+ "_readme": [
+ "This file locks the dependencies of your project to a known state",
+ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
+ "This file is @generated automatically"
+ ],
+ "content-hash": "6ee53de4a5225f7f273333a94e84fdd1",
+ "packages": [
+ {
+ "name": "doctrine/event-manager",
+ "version": "1.1.x-dev",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/doctrine/event-manager.git",
+ "reference": "348f72ec92c7e0b1f5462f6616af2b448ba3cbb1"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/doctrine/event-manager/zipball/348f72ec92c7e0b1f5462f6616af2b448ba3cbb1",
+ "reference": "348f72ec92c7e0b1f5462f6616af2b448ba3cbb1",
+ "shasum": ""
+ },
+ "require": {
+ "php": "^7.1 || ^8.0"
+ },
+ "conflict": {
+ "doctrine/common": "<2.9@dev"
+ },
+ "require-dev": {
+ "doctrine/coding-standard": "^6.0",
+ "phpunit/phpunit": "^7.0"
+ },
+ "default-branch": true,
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.0.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Doctrine\\Common\\": "lib/Doctrine/Common"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Guilherme Blanco",
+ "email": "guilhermeblanco@gmail.com"
+ },
+ {
+ "name": "Roman Borschel",
+ "email": "roman@code-factory.org"
+ },
+ {
+ "name": "Benjamin Eberlei",
+ "email": "kontakt@beberlei.de"
+ },
+ {
+ "name": "Jonathan Wage",
+ "email": "jonwage@gmail.com"
+ },
+ {
+ "name": "Johannes Schmitt",
+ "email": "schmittjoh@gmail.com"
+ },
+ {
+ "name": "Marco Pivetta",
+ "email": "ocramius@gmail.com"
+ }
+ ],
+ "description": "The Doctrine Event Manager is a simple PHP event system that was built to be used with the various Doctrine projects.",
+ "homepage": "https://www.doctrine-project.org/projects/event-manager.html",
+ "keywords": [
+ "event",
+ "event dispatcher",
+ "event manager",
+ "event system",
+ "events"
+ ],
+ "support": {
+ "issues": "https://github.com/doctrine/event-manager/issues",
+ "source": "https://github.com/doctrine/event-manager/tree/1.1.x"
+ },
+ "funding": [
+ {
+ "url": "https://www.doctrine-project.org/sponsorship.html",
+ "type": "custom"
+ },
+ {
+ "url": "https://www.patreon.com/phpdoctrine",
+ "type": "patreon"
+ },
+ {
+ "url": "https://tidelift.com/funding/github/packagist/doctrine%2Fevent-manager",
+ "type": "tidelift"
+ }
+ ],
+ "time": "2020-10-05T12:08:55+00:00"
+ },
+ {
+ "name": "doctrine/rst-parser",
+ "version": "dev-master",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/doctrine/rst-parser.git",
+ "reference": "1873475b3791954f1ca1539d4063cfcbd1c9e351"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/doctrine/rst-parser/zipball/1873475b3791954f1ca1539d4063cfcbd1c9e351",
+ "reference": "1873475b3791954f1ca1539d4063cfcbd1c9e351",
+ "shasum": ""
+ },
+ "require": {
+ "doctrine/event-manager": "^1.0",
+ "php": "^7.1",
+ "symfony/filesystem": "^4.1|^5.0",
+ "twig/twig": "^2.9.0"
+ },
+ "require-dev": {
+ "doctrine/coding-standard": "^6.0",
+ "gajus/dindent": "^2.0.2",
+ "phpstan/phpstan": "^0.10",
+ "phpstan/phpstan-deprecation-rules": "^0.10",
+ "phpstan/phpstan-phpunit": "^0.10",
+ "phpstan/phpstan-strict-rules": "^0.10",
+ "phpunit/phpunit": "^7.0"
+ },
+ "default-branch": true,
+ "type": "library",
+ "autoload": {
+ "psr-4": {
+ "Doctrine\\RST\\": "lib/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Grégoire Passault",
+ "email": "g.passault@gmail.com",
+ "homepage": "http://www.gregwar.com/"
+ },
+ {
+ "name": "Jonathan H. Wage",
+ "email": "jonwage@gmail.com",
+ "homepage": "https://jwage.com"
+ }
+ ],
+ "description": "PHP library to parse reStructuredText documents and generate HTML or LaTeX documents.",
+ "homepage": "https://github.com/doctrine/rst-parser",
+ "keywords": [
+ "html",
+ "latex",
+ "markup",
+ "parser",
+ "reStructuredText",
+ "rst"
+ ],
+ "support": {
+ "issues": "https://github.com/doctrine/rst-parser/issues",
+ "source": "https://github.com/doctrine/rst-parser/tree/master"
+ },
+ "time": "2020-10-23T00:13:24+00:00"
+ },
+ {
+ "name": "guzzlehttp/guzzle",
+ "version": "6.5.x-dev",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/guzzle/guzzle.git",
+ "reference": "e8ed4dbf49b260ff129ff0e0400718c3269971bf"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/guzzle/guzzle/zipball/e8ed4dbf49b260ff129ff0e0400718c3269971bf",
+ "reference": "e8ed4dbf49b260ff129ff0e0400718c3269971bf",
+ "shasum": ""
+ },
+ "require": {
+ "ext-json": "*",
+ "guzzlehttp/promises": "^1.0",
+ "guzzlehttp/psr7": "^1.6.1",
+ "php": ">=5.5",
+ "symfony/polyfill-intl-idn": "^1.17.0"
+ },
+ "require-dev": {
+ "ext-curl": "*",
+ "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.4 || ^7.0",
+ "psr/log": "^1.1"
+ },
+ "suggest": {
+ "psr/log": "Required for using the Log middleware"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "6.5-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "GuzzleHttp\\": "src/"
+ },
+ "files": [
+ "src/functions_include.php"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Michael Dowling",
+ "email": "mtdowling@gmail.com",
+ "homepage": "https://github.com/mtdowling"
+ }
+ ],
+ "description": "Guzzle is a PHP HTTP client library",
+ "homepage": "http://guzzlephp.org/",
+ "keywords": [
+ "client",
+ "curl",
+ "framework",
+ "http",
+ "http client",
+ "rest",
+ "web service"
+ ],
+ "support": {
+ "issues": "https://github.com/guzzle/guzzle/issues",
+ "source": "https://github.com/guzzle/guzzle/tree/6.5"
+ },
+ "funding": [
+ {
+ "url": "https://github.com/GrahamCampbell",
+ "type": "github"
+ },
+ {
+ "url": "https://github.com/Nyholm",
+ "type": "github"
+ },
+ {
+ "url": "https://github.com/alexeyshockov",
+ "type": "github"
+ },
+ {
+ "url": "https://github.com/gmponos",
+ "type": "github"
+ },
+ {
+ "url": "https://github.com/sagikazarmark",
+ "type": "github"
+ }
+ ],
+ "time": "2020-07-02T06:52:04+00:00"
+ },
+ {
+ "name": "guzzlehttp/promises",
+ "version": "dev-master",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/guzzle/promises.git",
+ "reference": "ddfeedfff2a52661429437da0702979f708e6ac6"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/guzzle/promises/zipball/ddfeedfff2a52661429437da0702979f708e6ac6",
+ "reference": "ddfeedfff2a52661429437da0702979f708e6ac6",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.5"
+ },
+ "require-dev": {
+ "symfony/phpunit-bridge": "^4.4 || ^5.1"
+ },
+ "default-branch": true,
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.4-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "GuzzleHttp\\Promise\\": "src/"
+ },
+ "files": [
+ "src/functions_include.php"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Michael Dowling",
+ "email": "mtdowling@gmail.com",
+ "homepage": "https://github.com/mtdowling"
+ }
+ ],
+ "description": "Guzzle promises library",
+ "keywords": [
+ "promise"
+ ],
+ "support": {
+ "issues": "https://github.com/guzzle/promises/issues",
+ "source": "https://github.com/guzzle/promises/tree/master"
+ },
+ "time": "2020-10-19T16:50:15+00:00"
+ },
+ {
+ "name": "guzzlehttp/psr7",
+ "version": "1.x-dev",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/guzzle/psr7.git",
+ "reference": "25f7f893f0b52b7b14e244a16679d72b1f0088de"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/guzzle/psr7/zipball/25f7f893f0b52b7b14e244a16679d72b1f0088de",
+ "reference": "25f7f893f0b52b7b14e244a16679d72b1f0088de",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.4.0",
+ "psr/http-message": "~1.0",
+ "ralouphie/getallheaders": "^2.0.5 || ^3.0.0"
+ },
+ "provide": {
+ "psr/http-message-implementation": "1.0"
+ },
+ "require-dev": {
+ "ext-zlib": "*",
+ "phpunit/phpunit": "~4.8.36 || ^5.7.27 || ^6.5.14 || ^7.5.20 || ^8.5.8 || ^9.3.10"
+ },
+ "suggest": {
+ "laminas/laminas-httphandlerrunner": "Emit PSR-7 responses"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.7-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "GuzzleHttp\\Psr7\\": "src/"
+ },
+ "files": [
+ "src/functions_include.php"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Michael Dowling",
+ "email": "mtdowling@gmail.com",
+ "homepage": "https://github.com/mtdowling"
+ },
+ {
+ "name": "Tobias Schultze",
+ "homepage": "https://github.com/Tobion"
+ }
+ ],
+ "description": "PSR-7 message implementation that also provides common utility methods",
+ "keywords": [
+ "http",
+ "message",
+ "psr-7",
+ "request",
+ "response",
+ "stream",
+ "uri",
+ "url"
+ ],
+ "support": {
+ "issues": "https://github.com/guzzle/psr7/issues",
+ "source": "https://github.com/guzzle/psr7/tree/1.x"
+ },
+ "time": "2020-10-22T07:42:05+00:00"
+ },
+ {
+ "name": "paragonie/random_compat",
+ "version": "v9.99.100",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/paragonie/random_compat.git",
+ "reference": "996434e5492cb4c3edcb9168db6fbb1359ef965a"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/paragonie/random_compat/zipball/996434e5492cb4c3edcb9168db6fbb1359ef965a",
+ "reference": "996434e5492cb4c3edcb9168db6fbb1359ef965a",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">= 7"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "4.*|5.*",
+ "vimeo/psalm": "^1"
+ },
+ "suggest": {
+ "ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes."
+ },
+ "type": "library",
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Paragon Initiative Enterprises",
+ "email": "security@paragonie.com",
+ "homepage": "https://paragonie.com"
+ }
+ ],
+ "description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7",
+ "keywords": [
+ "csprng",
+ "polyfill",
+ "pseudorandom",
+ "random"
+ ],
+ "support": {
+ "email": "info@paragonie.com",
+ "issues": "https://github.com/paragonie/random_compat/issues",
+ "source": "https://github.com/paragonie/random_compat"
+ },
+ "time": "2020-10-15T08:29:30+00:00"
+ },
+ {
+ "name": "psr/container",
+ "version": "dev-master",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/php-fig/container.git",
+ "reference": "381524e8568e07f31d504a945b88556548c8c42e"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/php-fig/container/zipball/381524e8568e07f31d504a945b88556548c8c42e",
+ "reference": "381524e8568e07f31d504a945b88556548c8c42e",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=7.2.0"
+ },
+ "default-branch": true,
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.1.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Psr\\Container\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "PHP-FIG",
+ "homepage": "https://www.php-fig.org/"
+ }
+ ],
+ "description": "Common Container Interface (PHP FIG PSR-11)",
+ "homepage": "https://github.com/php-fig/container",
+ "keywords": [
+ "PSR-11",
+ "container",
+ "container-interface",
+ "container-interop",
+ "psr"
+ ],
+ "support": {
+ "issues": "https://github.com/php-fig/container/issues",
+ "source": "https://github.com/php-fig/container/tree/master"
+ },
+ "time": "2020-10-13T07:07:53+00:00"
+ },
+ {
+ "name": "psr/http-message",
+ "version": "dev-master",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/php-fig/http-message.git",
+ "reference": "efd67d1dc14a7ef4fc4e518e7dee91c271d524e4"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/php-fig/http-message/zipball/efd67d1dc14a7ef4fc4e518e7dee91c271d524e4",
+ "reference": "efd67d1dc14a7ef4fc4e518e7dee91c271d524e4",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.0"
+ },
+ "default-branch": true,
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.0.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Psr\\Http\\Message\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "PHP-FIG",
+ "homepage": "http://www.php-fig.org/"
+ }
+ ],
+ "description": "Common interface for HTTP messages",
+ "homepage": "https://github.com/php-fig/http-message",
+ "keywords": [
+ "http",
+ "http-message",
+ "psr",
+ "psr-7",
+ "request",
+ "response"
+ ],
+ "support": {
+ "source": "https://github.com/php-fig/http-message/tree/master"
+ },
+ "time": "2019-08-29T13:16:46+00:00"
+ },
+ {
+ "name": "psr/log",
+ "version": "dev-master",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/php-fig/log.git",
+ "reference": "dd738d0b4491f32725492cf345f6b501f5922fec"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/php-fig/log/zipball/dd738d0b4491f32725492cf345f6b501f5922fec",
+ "reference": "dd738d0b4491f32725492cf345f6b501f5922fec",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.0"
+ },
+ "default-branch": true,
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.1.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Psr\\Log\\": "Psr/Log/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "PHP-FIG",
+ "homepage": "https://www.php-fig.org/"
+ }
+ ],
+ "description": "Common interface for logging libraries",
+ "homepage": "https://github.com/php-fig/log",
+ "keywords": [
+ "log",
+ "psr",
+ "psr-3"
+ ],
+ "support": {
+ "source": "https://github.com/php-fig/log/tree/master"
+ },
+ "time": "2020-09-18T06:44:51+00:00"
+ },
+ {
+ "name": "ralouphie/getallheaders",
+ "version": "3.0.3",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/ralouphie/getallheaders.git",
+ "reference": "120b605dfeb996808c31b6477290a714d356e822"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/ralouphie/getallheaders/zipball/120b605dfeb996808c31b6477290a714d356e822",
+ "reference": "120b605dfeb996808c31b6477290a714d356e822",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.6"
+ },
+ "require-dev": {
+ "php-coveralls/php-coveralls": "^2.1",
+ "phpunit/phpunit": "^5 || ^6.5"
+ },
+ "type": "library",
+ "autoload": {
+ "files": [
+ "src/getallheaders.php"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Ralph Khattar",
+ "email": "ralph.khattar@gmail.com"
+ }
+ ],
+ "description": "A polyfill for getallheaders.",
+ "support": {
+ "issues": "https://github.com/ralouphie/getallheaders/issues",
+ "source": "https://github.com/ralouphie/getallheaders/tree/develop"
+ },
+ "time": "2019-03-08T08:55:37+00:00"
+ },
+ {
+ "name": "scrivo/highlight.php",
+ "version": "9.18.x-dev",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/scrivo/highlight.php.git",
+ "reference": "006e334dbf8e0a30573174e2cb6e11682b224f15"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/scrivo/highlight.php/zipball/006e334dbf8e0a30573174e2cb6e11682b224f15",
+ "reference": "006e334dbf8e0a30573174e2cb6e11682b224f15",
+ "shasum": ""
+ },
+ "require": {
+ "ext-json": "*",
+ "ext-mbstring": "*",
+ "php": ">=5.4"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^4.8|^5.7",
+ "sabberworm/php-css-parser": "^8.3",
+ "symfony/finder": "^2.8|^3.4",
+ "symfony/var-dumper": "^2.8|^3.4"
+ },
+ "suggest": {
+ "ext-dom": "Needed to make use of the features in the utilities namespace"
+ },
+ "type": "library",
+ "autoload": {
+ "psr-0": {
+ "Highlight\\": "",
+ "HighlightUtilities\\": ""
+ },
+ "files": [
+ "HighlightUtilities/functions.php"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Geert Bergman",
+ "homepage": "http://www.scrivo.org/",
+ "role": "Project Author"
+ },
+ {
+ "name": "Vladimir Jimenez",
+ "homepage": "https://allejo.io",
+ "role": "Maintainer"
+ },
+ {
+ "name": "Martin Folkers",
+ "homepage": "https://twobrain.io",
+ "role": "Contributor"
+ }
+ ],
+ "description": "Server side syntax highlighter that supports 185 languages. It's a PHP port of highlight.js",
+ "keywords": [
+ "code",
+ "highlight",
+ "highlight.js",
+ "highlight.php",
+ "syntax"
+ ],
+ "support": {
+ "issues": "https://github.com/scrivo/highlight.php/issues",
+ "source": "https://github.com/scrivo/highlight.php"
+ },
+ "funding": [
+ {
+ "url": "https://github.com/allejo",
+ "type": "github"
+ }
+ ],
+ "time": "2020-10-17T21:12:39+00:00"
+ },
+ {
+ "name": "symfony/console",
+ "version": "4.4.x-dev",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/symfony/console.git",
+ "reference": "a30dd52eb2129e90e2e15bf107f91eab2219b52c"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/symfony/console/zipball/a30dd52eb2129e90e2e15bf107f91eab2219b52c",
+ "reference": "a30dd52eb2129e90e2e15bf107f91eab2219b52c",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=7.1.3",
+ "symfony/polyfill-mbstring": "~1.0",
+ "symfony/polyfill-php73": "^1.8",
+ "symfony/polyfill-php80": "^1.15",
+ "symfony/service-contracts": "^1.1|^2"
+ },
+ "conflict": {
+ "symfony/dependency-injection": "<3.4",
+ "symfony/event-dispatcher": "<4.3|>=5",
+ "symfony/lock": "<4.4",
+ "symfony/process": "<3.3"
+ },
+ "provide": {
+ "psr/log-implementation": "1.0"
+ },
+ "require-dev": {
+ "psr/log": "~1.0",
+ "symfony/config": "^3.4|^4.0|^5.0",
+ "symfony/dependency-injection": "^3.4|^4.0|^5.0",
+ "symfony/event-dispatcher": "^4.3",
+ "symfony/lock": "^4.4|^5.0",
+ "symfony/process": "^3.4|^4.0|^5.0",
+ "symfony/var-dumper": "^4.3|^5.0"
+ },
+ "suggest": {
+ "psr/log": "For using the console logger",
+ "symfony/event-dispatcher": "",
+ "symfony/lock": "",
+ "symfony/process": ""
+ },
+ "type": "library",
+ "extra": {
+ "branch-version": "4.4"
+ },
+ "autoload": {
+ "psr-4": {
+ "Symfony\\Component\\Console\\": ""
+ },
+ "exclude-from-classmap": [
+ "/Tests/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Fabien Potencier",
+ "email": "fabien@symfony.com"
+ },
+ {
+ "name": "Symfony Community",
+ "homepage": "https://symfony.com/contributors"
+ }
+ ],
+ "description": "Symfony Console Component",
+ "homepage": "https://symfony.com",
+ "support": {
+ "source": "https://github.com/symfony/console/tree/4.4"
+ },
+ "funding": [
+ {
+ "url": "https://symfony.com/sponsor",
+ "type": "custom"
+ },
+ {
+ "url": "https://github.com/fabpot",
+ "type": "github"
+ },
+ {
+ "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
+ "type": "tidelift"
+ }
+ ],
+ "time": "2020-10-13T13:20:53+00:00"
+ },
+ {
+ "name": "symfony/css-selector",
+ "version": "4.4.x-dev",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/symfony/css-selector.git",
+ "reference": "e529efc81e4b3f06932e6ac4e0dab9d536e6afd1"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/symfony/css-selector/zipball/e529efc81e4b3f06932e6ac4e0dab9d536e6afd1",
+ "reference": "e529efc81e4b3f06932e6ac4e0dab9d536e6afd1",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=7.1.3"
+ },
+ "type": "library",
+ "extra": {
+ "branch-version": "4.4"
+ },
+ "autoload": {
+ "psr-4": {
+ "Symfony\\Component\\CssSelector\\": ""
+ },
+ "exclude-from-classmap": [
+ "/Tests/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Fabien Potencier",
+ "email": "fabien@symfony.com"
+ },
+ {
+ "name": "Jean-François Simon",
+ "email": "jeanfrancois.simon@sensiolabs.com"
+ },
+ {
+ "name": "Symfony Community",
+ "homepage": "https://symfony.com/contributors"
+ }
+ ],
+ "description": "Symfony CssSelector Component",
+ "homepage": "https://symfony.com",
+ "support": {
+ "source": "https://github.com/symfony/css-selector/tree/4.4"
+ },
+ "funding": [
+ {
+ "url": "https://symfony.com/sponsor",
+ "type": "custom"
+ },
+ {
+ "url": "https://github.com/fabpot",
+ "type": "github"
+ },
+ {
+ "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
+ "type": "tidelift"
+ }
+ ],
+ "time": "2020-10-13T13:20:53+00:00"
+ },
+ {
+ "name": "symfony/docs-builder",
+ "version": "dev-master",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/weaverryan/docs-builder",
+ "reference": "5def2fef2e7c8acade040d74d55b9b96fb8ed262"
+ },
+ "require": {
+ "doctrine/rst-parser": "dev-master",
+ "ext-curl": "*",
+ "ext-json": "*",
+ "guzzlehttp/guzzle": "~6.0",
+ "scrivo/highlight.php": "^9.12.0",
+ "symfony/console": "^4.1",
+ "symfony/css-selector": "^4.1",
+ "symfony/dom-crawler": "^4.1",
+ "symfony/filesystem": "^4.1",
+ "symfony/finder": "^4.1",
+ "symfony/http-client": "^4.3",
+ "twig/twig": "^2.7.3"
+ },
+ "require-dev": {
+ "gajus/dindent": "^2.0",
+ "symfony/phpunit-bridge": "^4.1",
+ "symfony/process": "^4.2"
+ },
+ "default-branch": true,
+ "type": "project",
+ "autoload": {
+ "psr-4": {
+ "SymfonyDocsBuilder\\": "src"
+ }
+ },
+ "license": [
+ "MIT"
+ ],
+ "description": "The build system for Symfony's documentation",
+ "time": "2020-10-23T00:22:44+00:00"
+ },
+ {
+ "name": "symfony/dom-crawler",
+ "version": "4.4.x-dev",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/symfony/dom-crawler.git",
+ "reference": "0e6f7848438ec672ce9230f774d5272ec02e47dc"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/0e6f7848438ec672ce9230f774d5272ec02e47dc",
+ "reference": "0e6f7848438ec672ce9230f774d5272ec02e47dc",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=7.1.3",
+ "symfony/polyfill-ctype": "~1.8",
+ "symfony/polyfill-mbstring": "~1.0"
+ },
+ "conflict": {
+ "masterminds/html5": "<2.6"
+ },
+ "require-dev": {
+ "masterminds/html5": "^2.6",
+ "symfony/css-selector": "^3.4|^4.0|^5.0"
+ },
+ "suggest": {
+ "symfony/css-selector": ""
+ },
+ "type": "library",
+ "extra": {
+ "branch-version": "4.4"
+ },
+ "autoload": {
+ "psr-4": {
+ "Symfony\\Component\\DomCrawler\\": ""
+ },
+ "exclude-from-classmap": [
+ "/Tests/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Fabien Potencier",
+ "email": "fabien@symfony.com"
+ },
+ {
+ "name": "Symfony Community",
+ "homepage": "https://symfony.com/contributors"
+ }
+ ],
+ "description": "Symfony DomCrawler Component",
+ "homepage": "https://symfony.com",
+ "support": {
+ "source": "https://github.com/symfony/dom-crawler/tree/4.4"
+ },
+ "funding": [
+ {
+ "url": "https://symfony.com/sponsor",
+ "type": "custom"
+ },
+ {
+ "url": "https://github.com/fabpot",
+ "type": "github"
+ },
+ {
+ "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
+ "type": "tidelift"
+ }
+ ],
+ "time": "2020-10-13T13:20:53+00:00"
+ },
+ {
+ "name": "symfony/filesystem",
+ "version": "4.4.x-dev",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/symfony/filesystem.git",
+ "reference": "0921fda04596119d1bcbe6a17cf9989fadd71095"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/symfony/filesystem/zipball/0921fda04596119d1bcbe6a17cf9989fadd71095",
+ "reference": "0921fda04596119d1bcbe6a17cf9989fadd71095",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=7.1.3",
+ "symfony/polyfill-ctype": "~1.8"
+ },
+ "type": "library",
+ "extra": {
+ "branch-version": "4.4"
+ },
+ "autoload": {
+ "psr-4": {
+ "Symfony\\Component\\Filesystem\\": ""
+ },
+ "exclude-from-classmap": [
+ "/Tests/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Fabien Potencier",
+ "email": "fabien@symfony.com"
+ },
+ {
+ "name": "Symfony Community",
+ "homepage": "https://symfony.com/contributors"
+ }
+ ],
+ "description": "Symfony Filesystem Component",
+ "homepage": "https://symfony.com",
+ "support": {
+ "source": "https://github.com/symfony/filesystem/tree/4.4"
+ },
+ "funding": [
+ {
+ "url": "https://symfony.com/sponsor",
+ "type": "custom"
+ },
+ {
+ "url": "https://github.com/fabpot",
+ "type": "github"
+ },
+ {
+ "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
+ "type": "tidelift"
+ }
+ ],
+ "time": "2020-10-21T04:38:54+00:00"
+ },
+ {
+ "name": "symfony/finder",
+ "version": "4.4.x-dev",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/symfony/finder.git",
+ "reference": "591f0fa22eaf3ad819332ac3de1d4ea67cca5932"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/symfony/finder/zipball/591f0fa22eaf3ad819332ac3de1d4ea67cca5932",
+ "reference": "591f0fa22eaf3ad819332ac3de1d4ea67cca5932",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=7.1.3"
+ },
+ "type": "library",
+ "extra": {
+ "branch-version": "4.4"
+ },
+ "autoload": {
+ "psr-4": {
+ "Symfony\\Component\\Finder\\": ""
+ },
+ "exclude-from-classmap": [
+ "/Tests/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Fabien Potencier",
+ "email": "fabien@symfony.com"
+ },
+ {
+ "name": "Symfony Community",
+ "homepage": "https://symfony.com/contributors"
+ }
+ ],
+ "description": "Symfony Finder Component",
+ "homepage": "https://symfony.com",
+ "support": {
+ "source": "https://github.com/symfony/finder/tree/4.4"
+ },
+ "funding": [
+ {
+ "url": "https://symfony.com/sponsor",
+ "type": "custom"
+ },
+ {
+ "url": "https://github.com/fabpot",
+ "type": "github"
+ },
+ {
+ "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
+ "type": "tidelift"
+ }
+ ],
+ "time": "2020-10-13T13:20:53+00:00"
+ },
+ {
+ "name": "symfony/http-client",
+ "version": "4.4.x-dev",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/symfony/http-client.git",
+ "reference": "64db2909fb9311545a118bc46ed620d110cd2e25"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/symfony/http-client/zipball/64db2909fb9311545a118bc46ed620d110cd2e25",
+ "reference": "64db2909fb9311545a118bc46ed620d110cd2e25",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=7.1.3",
+ "psr/log": "^1.0",
+ "symfony/http-client-contracts": "^1.1.10|^2",
+ "symfony/polyfill-php73": "^1.11",
+ "symfony/service-contracts": "^1.0|^2"
+ },
+ "provide": {
+ "php-http/async-client-implementation": "*",
+ "php-http/client-implementation": "*",
+ "psr/http-client-implementation": "1.0",
+ "symfony/http-client-implementation": "1.1"
+ },
+ "require-dev": {
+ "guzzlehttp/promises": "^1.3.1",
+ "nyholm/psr7": "^1.0",
+ "php-http/httplug": "^1.0|^2.0",
+ "psr/http-client": "^1.0",
+ "symfony/dependency-injection": "^4.3|^5.0",
+ "symfony/http-kernel": "^4.4.13",
+ "symfony/process": "^4.2|^5.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-version": "4.4"
+ },
+ "autoload": {
+ "psr-4": {
+ "Symfony\\Component\\HttpClient\\": ""
+ },
+ "exclude-from-classmap": [
+ "/Tests/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Nicolas Grekas",
+ "email": "p@tchwork.com"
+ },
+ {
+ "name": "Symfony Community",
+ "homepage": "https://symfony.com/contributors"
+ }
+ ],
+ "description": "Symfony HttpClient component",
+ "homepage": "https://symfony.com",
+ "support": {
+ "source": "https://github.com/symfony/http-client/tree/4.4"
+ },
+ "funding": [
+ {
+ "url": "https://symfony.com/sponsor",
+ "type": "custom"
+ },
+ {
+ "url": "https://github.com/fabpot",
+ "type": "github"
+ },
+ {
+ "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
+ "type": "tidelift"
+ }
+ ],
+ "time": "2020-10-20T13:38:40+00:00"
+ },
+ {
+ "name": "symfony/http-client-contracts",
+ "version": "dev-main",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/symfony/http-client-contracts.git",
+ "reference": "41db680a15018f9c1d4b23516059633ce280ca33"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/symfony/http-client-contracts/zipball/41db680a15018f9c1d4b23516059633ce280ca33",
+ "reference": "41db680a15018f9c1d4b23516059633ce280ca33",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=7.2.5"
+ },
+ "suggest": {
+ "symfony/http-client-implementation": ""
+ },
+ "default-branch": true,
+ "type": "library",
+ "extra": {
+ "branch-version": "2.3",
+ "branch-alias": {
+ "dev-main": "2.3-dev"
+ },
+ "thanks": {
+ "name": "symfony/contracts",
+ "url": "https://github.com/symfony/contracts"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Symfony\\Contracts\\HttpClient\\": ""
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Nicolas Grekas",
+ "email": "p@tchwork.com"
+ },
+ {
+ "name": "Symfony Community",
+ "homepage": "https://symfony.com/contributors"
+ }
+ ],
+ "description": "Generic abstractions related to HTTP clients",
+ "homepage": "https://symfony.com",
+ "keywords": [
+ "abstractions",
+ "contracts",
+ "decoupling",
+ "interfaces",
+ "interoperability",
+ "standards"
+ ],
+ "support": {
+ "source": "https://github.com/symfony/http-client-contracts/tree/v2.3.1"
+ },
+ "funding": [
+ {
+ "url": "https://symfony.com/sponsor",
+ "type": "custom"
+ },
+ {
+ "url": "https://github.com/fabpot",
+ "type": "github"
+ },
+ {
+ "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
+ "type": "tidelift"
+ }
+ ],
+ "time": "2020-10-14T17:08:19+00:00"
+ },
+ {
+ "name": "symfony/polyfill-ctype",
+ "version": "dev-main",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/symfony/polyfill-ctype.git",
+ "reference": "aed596913b70fae57be53d86faa2e9ef85a2297b"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/aed596913b70fae57be53d86faa2e9ef85a2297b",
+ "reference": "aed596913b70fae57be53d86faa2e9ef85a2297b",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.3"
+ },
+ "suggest": {
+ "ext-ctype": "For best performance"
+ },
+ "default-branch": true,
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-main": "1.19-dev"
+ },
+ "thanks": {
+ "name": "symfony/polyfill",
+ "url": "https://github.com/symfony/polyfill"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Symfony\\Polyfill\\Ctype\\": ""
+ },
+ "files": [
+ "bootstrap.php"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Gert de Pagter",
+ "email": "BackEndTea@gmail.com"
+ },
+ {
+ "name": "Symfony Community",
+ "homepage": "https://symfony.com/contributors"
+ }
+ ],
+ "description": "Symfony polyfill for ctype functions",
+ "homepage": "https://symfony.com",
+ "keywords": [
+ "compatibility",
+ "ctype",
+ "polyfill",
+ "portable"
+ ],
+ "support": {
+ "source": "https://github.com/symfony/polyfill-ctype/tree/v1.19.0"
+ },
+ "funding": [
+ {
+ "url": "https://symfony.com/sponsor",
+ "type": "custom"
+ },
+ {
+ "url": "https://github.com/fabpot",
+ "type": "github"
+ },
+ {
+ "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
+ "type": "tidelift"
+ }
+ ],
+ "time": "2020-10-23T09:01:57+00:00"
+ },
+ {
+ "name": "symfony/polyfill-intl-idn",
+ "version": "dev-main",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/symfony/polyfill-intl-idn.git",
+ "reference": "fd17ae0603e76ae99d041f567e8611a97d899b03"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/fd17ae0603e76ae99d041f567e8611a97d899b03",
+ "reference": "fd17ae0603e76ae99d041f567e8611a97d899b03",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.3",
+ "symfony/polyfill-intl-normalizer": "^1.10",
+ "symfony/polyfill-php70": "^1.10",
+ "symfony/polyfill-php72": "^1.10"
+ },
+ "suggest": {
+ "ext-intl": "For best performance"
+ },
+ "default-branch": true,
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-main": "1.19-dev"
+ },
+ "thanks": {
+ "name": "symfony/polyfill",
+ "url": "https://github.com/symfony/polyfill"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Symfony\\Polyfill\\Intl\\Idn\\": ""
+ },
+ "files": [
+ "bootstrap.php"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Laurent Bassin",
+ "email": "laurent@bassin.info"
+ },
+ {
+ "name": "Trevor Rowbotham",
+ "email": "trevor.rowbotham@pm.me"
+ },
+ {
+ "name": "Symfony Community",
+ "homepage": "https://symfony.com/contributors"
+ }
+ ],
+ "description": "Symfony polyfill for intl's idn_to_ascii and idn_to_utf8 functions",
+ "homepage": "https://symfony.com",
+ "keywords": [
+ "compatibility",
+ "idn",
+ "intl",
+ "polyfill",
+ "portable",
+ "shim"
+ ],
+ "support": {
+ "source": "https://github.com/symfony/polyfill-intl-idn/tree/main"
+ },
+ "funding": [
+ {
+ "url": "https://symfony.com/sponsor",
+ "type": "custom"
+ },
+ {
+ "url": "https://github.com/fabpot",
+ "type": "github"
+ },
+ {
+ "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
+ "type": "tidelift"
+ }
+ ],
+ "time": "2020-10-23T09:34:17+00:00"
+ },
+ {
+ "name": "symfony/polyfill-intl-normalizer",
+ "version": "dev-main",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/symfony/polyfill-intl-normalizer.git",
+ "reference": "8db0ae7936b42feb370840cf24de1a144fb0ef27"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/8db0ae7936b42feb370840cf24de1a144fb0ef27",
+ "reference": "8db0ae7936b42feb370840cf24de1a144fb0ef27",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.3"
+ },
+ "suggest": {
+ "ext-intl": "For best performance"
+ },
+ "default-branch": true,
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-main": "1.19-dev"
+ },
+ "thanks": {
+ "name": "symfony/polyfill",
+ "url": "https://github.com/symfony/polyfill"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Symfony\\Polyfill\\Intl\\Normalizer\\": ""
+ },
+ "files": [
+ "bootstrap.php"
+ ],
+ "classmap": [
+ "Resources/stubs"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Nicolas Grekas",
+ "email": "p@tchwork.com"
+ },
+ {
+ "name": "Symfony Community",
+ "homepage": "https://symfony.com/contributors"
+ }
+ ],
+ "description": "Symfony polyfill for intl's Normalizer class and related functions",
+ "homepage": "https://symfony.com",
+ "keywords": [
+ "compatibility",
+ "intl",
+ "normalizer",
+ "polyfill",
+ "portable",
+ "shim"
+ ],
+ "support": {
+ "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.19.0"
+ },
+ "funding": [
+ {
+ "url": "https://symfony.com/sponsor",
+ "type": "custom"
+ },
+ {
+ "url": "https://github.com/fabpot",
+ "type": "github"
+ },
+ {
+ "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
+ "type": "tidelift"
+ }
+ ],
+ "time": "2020-10-23T09:01:57+00:00"
+ },
+ {
+ "name": "symfony/polyfill-mbstring",
+ "version": "dev-main",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/symfony/polyfill-mbstring.git",
+ "reference": "b5f7b932ee6fa802fc792eabd77c4c88084517ce"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/b5f7b932ee6fa802fc792eabd77c4c88084517ce",
+ "reference": "b5f7b932ee6fa802fc792eabd77c4c88084517ce",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.3"
+ },
+ "suggest": {
+ "ext-mbstring": "For best performance"
+ },
+ "default-branch": true,
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-main": "1.19-dev"
+ },
+ "thanks": {
+ "name": "symfony/polyfill",
+ "url": "https://github.com/symfony/polyfill"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Symfony\\Polyfill\\Mbstring\\": ""
+ },
+ "files": [
+ "bootstrap.php"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Nicolas Grekas",
+ "email": "p@tchwork.com"
+ },
+ {
+ "name": "Symfony Community",
+ "homepage": "https://symfony.com/contributors"
+ }
+ ],
+ "description": "Symfony polyfill for the Mbstring extension",
+ "homepage": "https://symfony.com",
+ "keywords": [
+ "compatibility",
+ "mbstring",
+ "polyfill",
+ "portable",
+ "shim"
+ ],
+ "support": {
+ "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.19.0"
+ },
+ "funding": [
+ {
+ "url": "https://symfony.com/sponsor",
+ "type": "custom"
+ },
+ {
+ "url": "https://github.com/fabpot",
+ "type": "github"
+ },
+ {
+ "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
+ "type": "tidelift"
+ }
+ ],
+ "time": "2020-10-23T09:01:57+00:00"
+ },
+ {
+ "name": "symfony/polyfill-php70",
+ "version": "dev-main",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/symfony/polyfill-php70.git",
+ "reference": "3fe414077251a81a1b15b1c709faf5c2fbae3d4e"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/3fe414077251a81a1b15b1c709faf5c2fbae3d4e",
+ "reference": "3fe414077251a81a1b15b1c709faf5c2fbae3d4e",
+ "shasum": ""
+ },
+ "require": {
+ "paragonie/random_compat": "~1.0|~2.0|~9.99",
+ "php": ">=5.3.3"
+ },
+ "default-branch": true,
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-main": "1.19-dev"
+ },
+ "thanks": {
+ "name": "symfony/polyfill",
+ "url": "https://github.com/symfony/polyfill"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Symfony\\Polyfill\\Php70\\": ""
+ },
+ "files": [
+ "bootstrap.php"
+ ],
+ "classmap": [
+ "Resources/stubs"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Nicolas Grekas",
+ "email": "p@tchwork.com"
+ },
+ {
+ "name": "Symfony Community",
+ "homepage": "https://symfony.com/contributors"
+ }
+ ],
+ "description": "Symfony polyfill backporting some PHP 7.0+ features to lower PHP versions",
+ "homepage": "https://symfony.com",
+ "keywords": [
+ "compatibility",
+ "polyfill",
+ "portable",
+ "shim"
+ ],
+ "support": {
+ "source": "https://github.com/symfony/polyfill-php70/tree/v1.19.0"
+ },
+ "funding": [
+ {
+ "url": "https://symfony.com/sponsor",
+ "type": "custom"
+ },
+ {
+ "url": "https://github.com/fabpot",
+ "type": "github"
+ },
+ {
+ "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
+ "type": "tidelift"
+ }
+ ],
+ "time": "2020-10-23T09:01:57+00:00"
+ },
+ {
+ "name": "symfony/polyfill-php72",
+ "version": "dev-main",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/symfony/polyfill-php72.git",
+ "reference": "beecef6b463b06954638f02378f52496cb84bacc"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/beecef6b463b06954638f02378f52496cb84bacc",
+ "reference": "beecef6b463b06954638f02378f52496cb84bacc",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.3"
+ },
+ "default-branch": true,
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-main": "1.19-dev"
+ },
+ "thanks": {
+ "name": "symfony/polyfill",
+ "url": "https://github.com/symfony/polyfill"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Symfony\\Polyfill\\Php72\\": ""
+ },
+ "files": [
+ "bootstrap.php"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Nicolas Grekas",
+ "email": "p@tchwork.com"
+ },
+ {
+ "name": "Symfony Community",
+ "homepage": "https://symfony.com/contributors"
+ }
+ ],
+ "description": "Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions",
+ "homepage": "https://symfony.com",
+ "keywords": [
+ "compatibility",
+ "polyfill",
+ "portable",
+ "shim"
+ ],
+ "support": {
+ "source": "https://github.com/symfony/polyfill-php72/tree/v1.19.0"
+ },
+ "funding": [
+ {
+ "url": "https://symfony.com/sponsor",
+ "type": "custom"
+ },
+ {
+ "url": "https://github.com/fabpot",
+ "type": "github"
+ },
+ {
+ "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
+ "type": "tidelift"
+ }
+ ],
+ "time": "2020-10-23T09:01:57+00:00"
+ },
+ {
+ "name": "symfony/polyfill-php73",
+ "version": "dev-main",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/symfony/polyfill-php73.git",
+ "reference": "9d920e3218205554171b2503bb3e4a1366824a16"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/9d920e3218205554171b2503bb3e4a1366824a16",
+ "reference": "9d920e3218205554171b2503bb3e4a1366824a16",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.3"
+ },
+ "default-branch": true,
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-main": "1.19-dev"
+ },
+ "thanks": {
+ "name": "symfony/polyfill",
+ "url": "https://github.com/symfony/polyfill"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Symfony\\Polyfill\\Php73\\": ""
+ },
+ "files": [
+ "bootstrap.php"
+ ],
+ "classmap": [
+ "Resources/stubs"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Nicolas Grekas",
+ "email": "p@tchwork.com"
+ },
+ {
+ "name": "Symfony Community",
+ "homepage": "https://symfony.com/contributors"
+ }
+ ],
+ "description": "Symfony polyfill backporting some PHP 7.3+ features to lower PHP versions",
+ "homepage": "https://symfony.com",
+ "keywords": [
+ "compatibility",
+ "polyfill",
+ "portable",
+ "shim"
+ ],
+ "support": {
+ "source": "https://github.com/symfony/polyfill-php73/tree/v1.19.0"
+ },
+ "funding": [
+ {
+ "url": "https://symfony.com/sponsor",
+ "type": "custom"
+ },
+ {
+ "url": "https://github.com/fabpot",
+ "type": "github"
+ },
+ {
+ "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
+ "type": "tidelift"
+ }
+ ],
+ "time": "2020-10-23T09:01:57+00:00"
+ },
+ {
+ "name": "symfony/polyfill-php80",
+ "version": "dev-main",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/symfony/polyfill-php80.git",
+ "reference": "f54ef00f4678f348f133097fa8c3701d197ff44d"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/f54ef00f4678f348f133097fa8c3701d197ff44d",
+ "reference": "f54ef00f4678f348f133097fa8c3701d197ff44d",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=7.0.8"
+ },
+ "default-branch": true,
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-main": "1.19-dev"
+ },
+ "thanks": {
+ "name": "symfony/polyfill",
+ "url": "https://github.com/symfony/polyfill"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Symfony\\Polyfill\\Php80\\": ""
+ },
+ "files": [
+ "bootstrap.php"
+ ],
+ "classmap": [
+ "Resources/stubs"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Ion Bazan",
+ "email": "ion.bazan@gmail.com"
+ },
+ {
+ "name": "Nicolas Grekas",
+ "email": "p@tchwork.com"
+ },
+ {
+ "name": "Symfony Community",
+ "homepage": "https://symfony.com/contributors"
+ }
+ ],
+ "description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions",
+ "homepage": "https://symfony.com",
+ "keywords": [
+ "compatibility",
+ "polyfill",
+ "portable",
+ "shim"
+ ],
+ "support": {
+ "source": "https://github.com/symfony/polyfill-php80/tree/v1.19.0"
+ },
+ "funding": [
+ {
+ "url": "https://symfony.com/sponsor",
+ "type": "custom"
+ },
+ {
+ "url": "https://github.com/fabpot",
+ "type": "github"
+ },
+ {
+ "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
+ "type": "tidelift"
+ }
+ ],
+ "time": "2020-10-23T09:01:57+00:00"
+ },
+ {
+ "name": "symfony/process",
+ "version": "5.x-dev",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/symfony/process.git",
+ "reference": "f3957bcc7ec492baf22812c48e7cccf152491770"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/symfony/process/zipball/f3957bcc7ec492baf22812c48e7cccf152491770",
+ "reference": "f3957bcc7ec492baf22812c48e7cccf152491770",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=7.2.5",
+ "symfony/polyfill-php80": "^1.15"
+ },
+ "default-branch": true,
+ "type": "library",
+ "extra": {
+ "branch-version": "5.2"
+ },
+ "autoload": {
+ "psr-4": {
+ "Symfony\\Component\\Process\\": ""
+ },
+ "exclude-from-classmap": [
+ "/Tests/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Fabien Potencier",
+ "email": "fabien@symfony.com"
+ },
+ {
+ "name": "Symfony Community",
+ "homepage": "https://symfony.com/contributors"
+ }
+ ],
+ "description": "Symfony Process Component",
+ "homepage": "https://symfony.com",
+ "support": {
+ "source": "https://github.com/symfony/process/tree/v5.2.0-BETA2"
+ },
+ "funding": [
+ {
+ "url": "https://symfony.com/sponsor",
+ "type": "custom"
+ },
+ {
+ "url": "https://github.com/fabpot",
+ "type": "github"
+ },
+ {
+ "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
+ "type": "tidelift"
+ }
+ ],
+ "time": "2020-10-13T13:22:54+00:00"
+ },
+ {
+ "name": "symfony/service-contracts",
+ "version": "dev-main",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/symfony/service-contracts.git",
+ "reference": "0aeee2f70f4550e6c48c9a796d98f5ceda58dfda"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/symfony/service-contracts/zipball/0aeee2f70f4550e6c48c9a796d98f5ceda58dfda",
+ "reference": "0aeee2f70f4550e6c48c9a796d98f5ceda58dfda",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=7.2.5",
+ "psr/container": "^1.0"
+ },
+ "suggest": {
+ "symfony/service-implementation": ""
+ },
+ "default-branch": true,
+ "type": "library",
+ "extra": {
+ "branch-version": "2.3",
+ "branch-alias": {
+ "dev-main": "2.3-dev"
+ },
+ "thanks": {
+ "name": "symfony/contracts",
+ "url": "https://github.com/symfony/contracts"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Symfony\\Contracts\\Service\\": ""
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Nicolas Grekas",
+ "email": "p@tchwork.com"
+ },
+ {
+ "name": "Symfony Community",
+ "homepage": "https://symfony.com/contributors"
+ }
+ ],
+ "description": "Generic abstractions related to writing services",
+ "homepage": "https://symfony.com",
+ "keywords": [
+ "abstractions",
+ "contracts",
+ "decoupling",
+ "interfaces",
+ "interoperability",
+ "standards"
+ ],
+ "support": {
+ "source": "https://github.com/symfony/service-contracts/tree/main"
+ },
+ "funding": [
+ {
+ "url": "https://symfony.com/sponsor",
+ "type": "custom"
+ },
+ {
+ "url": "https://github.com/fabpot",
+ "type": "github"
+ },
+ {
+ "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
+ "type": "tidelift"
+ }
+ ],
+ "time": "2020-10-14T17:08:19+00:00"
+ },
+ {
+ "name": "twig/twig",
+ "version": "2.x-dev",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/twigphp/Twig.git",
+ "reference": "78173b3c850e344cb8515fc2a05138d39a6c39e0"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/twigphp/Twig/zipball/78173b3c850e344cb8515fc2a05138d39a6c39e0",
+ "reference": "78173b3c850e344cb8515fc2a05138d39a6c39e0",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=7.2.5",
+ "symfony/polyfill-ctype": "^1.8",
+ "symfony/polyfill-mbstring": "^1.3"
+ },
+ "require-dev": {
+ "psr/container": "^1.0",
+ "symfony/phpunit-bridge": "^4.4.9|^5.0.9"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "2.14-dev"
+ }
+ },
+ "autoload": {
+ "psr-0": {
+ "Twig_": "lib/"
+ },
+ "psr-4": {
+ "Twig\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Fabien Potencier",
+ "email": "fabien@symfony.com",
+ "homepage": "http://fabien.potencier.org",
+ "role": "Lead Developer"
+ },
+ {
+ "name": "Twig Team",
+ "role": "Contributors"
+ },
+ {
+ "name": "Armin Ronacher",
+ "email": "armin.ronacher@active-4.com",
+ "role": "Project Founder"
+ }
+ ],
+ "description": "Twig, the flexible, fast, and secure template language for PHP",
+ "homepage": "https://twig.symfony.com",
+ "keywords": [
+ "templating"
+ ],
+ "support": {
+ "issues": "https://github.com/twigphp/Twig/issues",
+ "source": "https://github.com/twigphp/Twig/tree/2.x"
+ },
+ "funding": [
+ {
+ "url": "https://github.com/fabpot",
+ "type": "github"
+ },
+ {
+ "url": "https://tidelift.com/funding/github/packagist/twig/twig",
+ "type": "tidelift"
+ }
+ ],
+ "time": "2020-10-21T12:45:52+00:00"
+ }
+ ],
+ "packages-dev": [],
+ "aliases": [],
+ "minimum-stability": "dev",
+ "stability-flags": {
+ "symfony/docs-builder": 20,
+ "symfony/process": 20
+ },
+ "prefer-stable": false,
+ "prefer-lowest": false,
+ "platform": {
+ "php": ">=7.2.9"
+ },
+ "platform-dev": [],
+ "platform-overrides": {
+ "php": "7.2.9"
+ },
+ "plugin-api-version": "2.0.0"
+}
diff --git a/docs.json b/docs.json
new file mode 100644
index 00000000000..70c1a299f0e
--- /dev/null
+++ b/docs.json
@@ -0,0 +1,3 @@
+{
+ "exclude": ["_build"]
+}
From b152b91d6d58cc71e0cc11f822ad26a9c69bfe8d Mon Sep 17 00:00:00 2001
From: Wouter de Jong
Date: Sun, 25 Oct 2020 13:56:48 +0100
Subject: [PATCH 0069/5766] Added Github actions integration
---
.github/workflows/ci.yaml | 38 +++
_build/build.php | 3 +-
_build/composer.json | 1 +
_build/composer.lock | 528 +++++++++++++-------------------------
4 files changed, 225 insertions(+), 345 deletions(-)
diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml
index 26f0e537118..dd7599889d0 100644
--- a/.github/workflows/ci.yaml
+++ b/.github/workflows/ci.yaml
@@ -43,6 +43,44 @@ jobs:
- name: "Build documentation"
run: make -C _build SPHINXOPTS="-nqW -j auto" html
+ build-php:
+ name: Symfony doc builder
+
+ runs-on: ubuntu-latest
+
+ continue-on-error: true
+
+ steps:
+ - name: "Checkout"
+ uses: actions/checkout@v2
+
+ - name: "Set-up PHP"
+ uses: shivammathur/setup-php@v2
+ with:
+ php-version: 7.2
+ coverage: none
+ tools: "composer:v2"
+
+ - name: Get composer cache directory
+ id: composercache
+ working-directory: _build
+ run: echo "::set-output name=dir::$(composer config cache-files-dir)"
+
+ - name: Cache dependencies
+ uses: actions/cache@v2
+ with:
+ path: ${{ steps.composercache.outputs.dir }}
+ key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
+ restore-keys: ${{ runner.os }}-composer-
+
+ - name: "Install dependencies"
+ working-directory: _build
+ run: composer install --prefer-dist --no-progress
+
+ - name: "Build the docs"
+ working-directory: _build
+ run: php build.php -vvv
+
doctor-rst:
name: DOCtor-RST
diff --git a/_build/build.php b/_build/build.php
index 5a2fd660bda..9dba64d5145 100755
--- a/_build/build.php
+++ b/_build/build.php
@@ -33,7 +33,8 @@
$process = new Process($command);
$process->setTimeout(3600);
- $process->run();
+
+ $this->getHelper('process')->run($output, $process);
if (!$process->isSuccessful()) {
throw new ProcessFailedException($process);
diff --git a/_build/composer.json b/_build/composer.json
index 30de6365ecb..ea0ef4eee25 100644
--- a/_build/composer.json
+++ b/_build/composer.json
@@ -1,5 +1,6 @@
{
"minimum-stability": "dev",
+ "prefer-stable": true,
"repositories": [
{ "type": "git", "url": "https://github.com/weaverryan/docs-builder" }
],
diff --git a/_build/composer.lock b/_build/composer.lock
index 101c85b4165..8a5ab63dcb7 100644
--- a/_build/composer.lock
+++ b/_build/composer.lock
@@ -4,20 +4,20 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
- "content-hash": "6ee53de4a5225f7f273333a94e84fdd1",
+ "content-hash": "e580f6d54e3fe0b71ca6103550882138",
"packages": [
{
"name": "doctrine/event-manager",
- "version": "1.1.x-dev",
+ "version": "1.1.1",
"source": {
"type": "git",
"url": "https://github.com/doctrine/event-manager.git",
- "reference": "348f72ec92c7e0b1f5462f6616af2b448ba3cbb1"
+ "reference": "41370af6a30faa9dc0368c4a6814d596e81aba7f"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/doctrine/event-manager/zipball/348f72ec92c7e0b1f5462f6616af2b448ba3cbb1",
- "reference": "348f72ec92c7e0b1f5462f6616af2b448ba3cbb1",
+ "url": "https://api.github.com/repos/doctrine/event-manager/zipball/41370af6a30faa9dc0368c4a6814d596e81aba7f",
+ "reference": "41370af6a30faa9dc0368c4a6814d596e81aba7f",
"shasum": ""
},
"require": {
@@ -30,7 +30,6 @@
"doctrine/coding-standard": "^6.0",
"phpunit/phpunit": "^7.0"
},
- "default-branch": true,
"type": "library",
"extra": {
"branch-alias": {
@@ -99,7 +98,7 @@
"type": "tidelift"
}
],
- "time": "2020-10-05T12:08:55+00:00"
+ "time": "2020-05-29T18:28:51+00:00"
},
{
"name": "doctrine/rst-parser",
@@ -107,12 +106,12 @@
"source": {
"type": "git",
"url": "https://github.com/doctrine/rst-parser.git",
- "reference": "1873475b3791954f1ca1539d4063cfcbd1c9e351"
+ "reference": "68419cbf92d60177b95e44d79a79cae1098a91ef"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/doctrine/rst-parser/zipball/1873475b3791954f1ca1539d4063cfcbd1c9e351",
- "reference": "1873475b3791954f1ca1539d4063cfcbd1c9e351",
+ "url": "https://api.github.com/repos/doctrine/rst-parser/zipball/68419cbf92d60177b95e44d79a79cae1098a91ef",
+ "reference": "68419cbf92d60177b95e44d79a79cae1098a91ef",
"shasum": ""
},
"require": {
@@ -167,20 +166,20 @@
"issues": "https://github.com/doctrine/rst-parser/issues",
"source": "https://github.com/doctrine/rst-parser/tree/master"
},
- "time": "2020-10-23T00:13:24+00:00"
+ "time": "2020-10-26T13:37:24+00:00"
},
{
"name": "guzzlehttp/guzzle",
- "version": "6.5.x-dev",
+ "version": "6.5.5",
"source": {
"type": "git",
"url": "https://github.com/guzzle/guzzle.git",
- "reference": "e8ed4dbf49b260ff129ff0e0400718c3269971bf"
+ "reference": "9d4290de1cfd701f38099ef7e183b64b4b7b0c5e"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/guzzle/guzzle/zipball/e8ed4dbf49b260ff129ff0e0400718c3269971bf",
- "reference": "e8ed4dbf49b260ff129ff0e0400718c3269971bf",
+ "url": "https://api.github.com/repos/guzzle/guzzle/zipball/9d4290de1cfd701f38099ef7e183b64b4b7b0c5e",
+ "reference": "9d4290de1cfd701f38099ef7e183b64b4b7b0c5e",
"shasum": ""
},
"require": {
@@ -238,42 +237,20 @@
"issues": "https://github.com/guzzle/guzzle/issues",
"source": "https://github.com/guzzle/guzzle/tree/6.5"
},
- "funding": [
- {
- "url": "https://github.com/GrahamCampbell",
- "type": "github"
- },
- {
- "url": "https://github.com/Nyholm",
- "type": "github"
- },
- {
- "url": "https://github.com/alexeyshockov",
- "type": "github"
- },
- {
- "url": "https://github.com/gmponos",
- "type": "github"
- },
- {
- "url": "https://github.com/sagikazarmark",
- "type": "github"
- }
- ],
- "time": "2020-07-02T06:52:04+00:00"
+ "time": "2020-06-16T21:01:06+00:00"
},
{
"name": "guzzlehttp/promises",
- "version": "dev-master",
+ "version": "1.4.0",
"source": {
"type": "git",
"url": "https://github.com/guzzle/promises.git",
- "reference": "ddfeedfff2a52661429437da0702979f708e6ac6"
+ "reference": "60d379c243457e073cff02bc323a2a86cb355631"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/guzzle/promises/zipball/ddfeedfff2a52661429437da0702979f708e6ac6",
- "reference": "ddfeedfff2a52661429437da0702979f708e6ac6",
+ "url": "https://api.github.com/repos/guzzle/promises/zipball/60d379c243457e073cff02bc323a2a86cb355631",
+ "reference": "60d379c243457e073cff02bc323a2a86cb355631",
"shasum": ""
},
"require": {
@@ -282,7 +259,6 @@
"require-dev": {
"symfony/phpunit-bridge": "^4.4 || ^5.1"
},
- "default-branch": true,
"type": "library",
"extra": {
"branch-alias": {
@@ -314,22 +290,22 @@
],
"support": {
"issues": "https://github.com/guzzle/promises/issues",
- "source": "https://github.com/guzzle/promises/tree/master"
+ "source": "https://github.com/guzzle/promises/tree/1.4.0"
},
- "time": "2020-10-19T16:50:15+00:00"
+ "time": "2020-09-30T07:37:28+00:00"
},
{
"name": "guzzlehttp/psr7",
- "version": "1.x-dev",
+ "version": "1.7.0",
"source": {
"type": "git",
"url": "https://github.com/guzzle/psr7.git",
- "reference": "25f7f893f0b52b7b14e244a16679d72b1f0088de"
+ "reference": "53330f47520498c0ae1f61f7e2c90f55690c06a3"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/guzzle/psr7/zipball/25f7f893f0b52b7b14e244a16679d72b1f0088de",
- "reference": "25f7f893f0b52b7b14e244a16679d72b1f0088de",
+ "url": "https://api.github.com/repos/guzzle/psr7/zipball/53330f47520498c0ae1f61f7e2c90f55690c06a3",
+ "reference": "53330f47520498c0ae1f61f7e2c90f55690c06a3",
"shasum": ""
},
"require": {
@@ -389,82 +365,31 @@
],
"support": {
"issues": "https://github.com/guzzle/psr7/issues",
- "source": "https://github.com/guzzle/psr7/tree/1.x"
+ "source": "https://github.com/guzzle/psr7/tree/1.7.0"
},
- "time": "2020-10-22T07:42:05+00:00"
- },
- {
- "name": "paragonie/random_compat",
- "version": "v9.99.100",
- "source": {
- "type": "git",
- "url": "https://github.com/paragonie/random_compat.git",
- "reference": "996434e5492cb4c3edcb9168db6fbb1359ef965a"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/paragonie/random_compat/zipball/996434e5492cb4c3edcb9168db6fbb1359ef965a",
- "reference": "996434e5492cb4c3edcb9168db6fbb1359ef965a",
- "shasum": ""
- },
- "require": {
- "php": ">= 7"
- },
- "require-dev": {
- "phpunit/phpunit": "4.*|5.*",
- "vimeo/psalm": "^1"
- },
- "suggest": {
- "ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes."
- },
- "type": "library",
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Paragon Initiative Enterprises",
- "email": "security@paragonie.com",
- "homepage": "https://paragonie.com"
- }
- ],
- "description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7",
- "keywords": [
- "csprng",
- "polyfill",
- "pseudorandom",
- "random"
- ],
- "support": {
- "email": "info@paragonie.com",
- "issues": "https://github.com/paragonie/random_compat/issues",
- "source": "https://github.com/paragonie/random_compat"
- },
- "time": "2020-10-15T08:29:30+00:00"
+ "time": "2020-09-30T07:37:11+00:00"
},
{
"name": "psr/container",
- "version": "dev-master",
+ "version": "1.0.0",
"source": {
"type": "git",
"url": "https://github.com/php-fig/container.git",
- "reference": "381524e8568e07f31d504a945b88556548c8c42e"
+ "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/php-fig/container/zipball/381524e8568e07f31d504a945b88556548c8c42e",
- "reference": "381524e8568e07f31d504a945b88556548c8c42e",
+ "url": "https://api.github.com/repos/php-fig/container/zipball/b7ce3b176482dbbc1245ebf52b181af44c2cf55f",
+ "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f",
"shasum": ""
},
"require": {
- "php": ">=7.2.0"
+ "php": ">=5.3.0"
},
- "default-branch": true,
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "1.1.x-dev"
+ "dev-master": "1.0.x-dev"
}
},
"autoload": {
@@ -479,7 +404,7 @@
"authors": [
{
"name": "PHP-FIG",
- "homepage": "https://www.php-fig.org/"
+ "homepage": "http://www.php-fig.org/"
}
],
"description": "Common Container Interface (PHP FIG PSR-11)",
@@ -495,26 +420,25 @@
"issues": "https://github.com/php-fig/container/issues",
"source": "https://github.com/php-fig/container/tree/master"
},
- "time": "2020-10-13T07:07:53+00:00"
+ "time": "2017-02-14T16:28:37+00:00"
},
{
"name": "psr/http-message",
- "version": "dev-master",
+ "version": "1.0.1",
"source": {
"type": "git",
"url": "https://github.com/php-fig/http-message.git",
- "reference": "efd67d1dc14a7ef4fc4e518e7dee91c271d524e4"
+ "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/php-fig/http-message/zipball/efd67d1dc14a7ef4fc4e518e7dee91c271d524e4",
- "reference": "efd67d1dc14a7ef4fc4e518e7dee91c271d524e4",
+ "url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363",
+ "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
},
- "default-branch": true,
"type": "library",
"extra": {
"branch-alias": {
@@ -549,26 +473,25 @@
"support": {
"source": "https://github.com/php-fig/http-message/tree/master"
},
- "time": "2019-08-29T13:16:46+00:00"
+ "time": "2016-08-06T14:39:51+00:00"
},
{
"name": "psr/log",
- "version": "dev-master",
+ "version": "1.1.3",
"source": {
"type": "git",
"url": "https://github.com/php-fig/log.git",
- "reference": "dd738d0b4491f32725492cf345f6b501f5922fec"
+ "reference": "0f73288fd15629204f9d42b7055f72dacbe811fc"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/php-fig/log/zipball/dd738d0b4491f32725492cf345f6b501f5922fec",
- "reference": "dd738d0b4491f32725492cf345f6b501f5922fec",
+ "url": "https://api.github.com/repos/php-fig/log/zipball/0f73288fd15629204f9d42b7055f72dacbe811fc",
+ "reference": "0f73288fd15629204f9d42b7055f72dacbe811fc",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
},
- "default-branch": true,
"type": "library",
"extra": {
"branch-alias": {
@@ -587,7 +510,7 @@
"authors": [
{
"name": "PHP-FIG",
- "homepage": "https://www.php-fig.org/"
+ "homepage": "http://www.php-fig.org/"
}
],
"description": "Common interface for logging libraries",
@@ -598,9 +521,9 @@
"psr-3"
],
"support": {
- "source": "https://github.com/php-fig/log/tree/master"
+ "source": "https://github.com/php-fig/log/tree/1.1.3"
},
- "time": "2020-09-18T06:44:51+00:00"
+ "time": "2020-03-23T09:12:05+00:00"
},
{
"name": "ralouphie/getallheaders",
@@ -648,16 +571,16 @@
},
{
"name": "scrivo/highlight.php",
- "version": "9.18.x-dev",
+ "version": "v9.18.1.3",
"source": {
"type": "git",
"url": "https://github.com/scrivo/highlight.php.git",
- "reference": "006e334dbf8e0a30573174e2cb6e11682b224f15"
+ "reference": "6a1699707b099081f20a488ac1f92d682181018c"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/scrivo/highlight.php/zipball/006e334dbf8e0a30573174e2cb6e11682b224f15",
- "reference": "006e334dbf8e0a30573174e2cb6e11682b224f15",
+ "url": "https://api.github.com/repos/scrivo/highlight.php/zipball/6a1699707b099081f20a488ac1f92d682181018c",
+ "reference": "6a1699707b099081f20a488ac1f92d682181018c",
"shasum": ""
},
"require": {
@@ -723,20 +646,20 @@
"type": "github"
}
],
- "time": "2020-10-17T21:12:39+00:00"
+ "time": "2020-10-16T07:43:22+00:00"
},
{
"name": "symfony/console",
- "version": "4.4.x-dev",
+ "version": "v4.4.15",
"source": {
"type": "git",
"url": "https://github.com/symfony/console.git",
- "reference": "a30dd52eb2129e90e2e15bf107f91eab2219b52c"
+ "reference": "90933b39c7b312fc3ceaa1ddeac7eb48cb953124"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/console/zipball/a30dd52eb2129e90e2e15bf107f91eab2219b52c",
- "reference": "a30dd52eb2129e90e2e15bf107f91eab2219b52c",
+ "url": "https://api.github.com/repos/symfony/console/zipball/90933b39c7b312fc3ceaa1ddeac7eb48cb953124",
+ "reference": "90933b39c7b312fc3ceaa1ddeac7eb48cb953124",
"shasum": ""
},
"require": {
@@ -772,7 +695,9 @@
},
"type": "library",
"extra": {
- "branch-version": "4.4"
+ "branch-alias": {
+ "dev-master": "4.4-dev"
+ }
},
"autoload": {
"psr-4": {
@@ -799,7 +724,7 @@
"description": "Symfony Console Component",
"homepage": "https://symfony.com",
"support": {
- "source": "https://github.com/symfony/console/tree/4.4"
+ "source": "https://github.com/symfony/console/tree/v4.4.15"
},
"funding": [
{
@@ -815,20 +740,20 @@
"type": "tidelift"
}
],
- "time": "2020-10-13T13:20:53+00:00"
+ "time": "2020-09-15T07:58:55+00:00"
},
{
"name": "symfony/css-selector",
- "version": "4.4.x-dev",
+ "version": "v4.4.15",
"source": {
"type": "git",
"url": "https://github.com/symfony/css-selector.git",
- "reference": "e529efc81e4b3f06932e6ac4e0dab9d536e6afd1"
+ "reference": "bf17dc9f6ce144e41f786c32435feea4d8e11dcc"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/css-selector/zipball/e529efc81e4b3f06932e6ac4e0dab9d536e6afd1",
- "reference": "e529efc81e4b3f06932e6ac4e0dab9d536e6afd1",
+ "url": "https://api.github.com/repos/symfony/css-selector/zipball/bf17dc9f6ce144e41f786c32435feea4d8e11dcc",
+ "reference": "bf17dc9f6ce144e41f786c32435feea4d8e11dcc",
"shasum": ""
},
"require": {
@@ -836,7 +761,9 @@
},
"type": "library",
"extra": {
- "branch-version": "4.4"
+ "branch-alias": {
+ "dev-master": "4.4-dev"
+ }
},
"autoload": {
"psr-4": {
@@ -867,7 +794,7 @@
"description": "Symfony CssSelector Component",
"homepage": "https://symfony.com",
"support": {
- "source": "https://github.com/symfony/css-selector/tree/4.4"
+ "source": "https://github.com/symfony/css-selector/tree/v4.4.15"
},
"funding": [
{
@@ -883,7 +810,7 @@
"type": "tidelift"
}
],
- "time": "2020-10-13T13:20:53+00:00"
+ "time": "2020-07-05T09:39:30+00:00"
},
{
"name": "symfony/docs-builder",
@@ -891,7 +818,7 @@
"source": {
"type": "git",
"url": "https://github.com/weaverryan/docs-builder",
- "reference": "5def2fef2e7c8acade040d74d55b9b96fb8ed262"
+ "reference": "e388a6f8cd7a98c34cdc913d18adc9e92ef73441"
},
"require": {
"doctrine/rst-parser": "dev-master",
@@ -923,20 +850,20 @@
"MIT"
],
"description": "The build system for Symfony's documentation",
- "time": "2020-10-23T00:22:44+00:00"
+ "time": "2020-10-26T22:58:16+00:00"
},
{
"name": "symfony/dom-crawler",
- "version": "4.4.x-dev",
+ "version": "v4.4.15",
"source": {
"type": "git",
"url": "https://github.com/symfony/dom-crawler.git",
- "reference": "0e6f7848438ec672ce9230f774d5272ec02e47dc"
+ "reference": "bdcb7633a501770a0daefbf81d2e6b28c3864f2b"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/0e6f7848438ec672ce9230f774d5272ec02e47dc",
- "reference": "0e6f7848438ec672ce9230f774d5272ec02e47dc",
+ "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/bdcb7633a501770a0daefbf81d2e6b28c3864f2b",
+ "reference": "bdcb7633a501770a0daefbf81d2e6b28c3864f2b",
"shasum": ""
},
"require": {
@@ -956,7 +883,9 @@
},
"type": "library",
"extra": {
- "branch-version": "4.4"
+ "branch-alias": {
+ "dev-master": "4.4-dev"
+ }
},
"autoload": {
"psr-4": {
@@ -983,7 +912,7 @@
"description": "Symfony DomCrawler Component",
"homepage": "https://symfony.com",
"support": {
- "source": "https://github.com/symfony/dom-crawler/tree/4.4"
+ "source": "https://github.com/symfony/dom-crawler/tree/v4.4.15"
},
"funding": [
{
@@ -999,20 +928,20 @@
"type": "tidelift"
}
],
- "time": "2020-10-13T13:20:53+00:00"
+ "time": "2020-10-02T07:34:48+00:00"
},
{
"name": "symfony/filesystem",
- "version": "4.4.x-dev",
+ "version": "v4.4.15",
"source": {
"type": "git",
"url": "https://github.com/symfony/filesystem.git",
- "reference": "0921fda04596119d1bcbe6a17cf9989fadd71095"
+ "reference": "ebc51494739d3b081ea543ed7c462fa73a4f74db"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/filesystem/zipball/0921fda04596119d1bcbe6a17cf9989fadd71095",
- "reference": "0921fda04596119d1bcbe6a17cf9989fadd71095",
+ "url": "https://api.github.com/repos/symfony/filesystem/zipball/ebc51494739d3b081ea543ed7c462fa73a4f74db",
+ "reference": "ebc51494739d3b081ea543ed7c462fa73a4f74db",
"shasum": ""
},
"require": {
@@ -1021,7 +950,9 @@
},
"type": "library",
"extra": {
- "branch-version": "4.4"
+ "branch-alias": {
+ "dev-master": "4.4-dev"
+ }
},
"autoload": {
"psr-4": {
@@ -1048,7 +979,7 @@
"description": "Symfony Filesystem Component",
"homepage": "https://symfony.com",
"support": {
- "source": "https://github.com/symfony/filesystem/tree/4.4"
+ "source": "https://github.com/symfony/filesystem/tree/v4.4.15"
},
"funding": [
{
@@ -1064,20 +995,20 @@
"type": "tidelift"
}
],
- "time": "2020-10-21T04:38:54+00:00"
+ "time": "2020-09-27T13:54:16+00:00"
},
{
"name": "symfony/finder",
- "version": "4.4.x-dev",
+ "version": "v4.4.15",
"source": {
"type": "git",
"url": "https://github.com/symfony/finder.git",
- "reference": "591f0fa22eaf3ad819332ac3de1d4ea67cca5932"
+ "reference": "60d08560f9aa72997c44077c40d47aa28a963230"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/finder/zipball/591f0fa22eaf3ad819332ac3de1d4ea67cca5932",
- "reference": "591f0fa22eaf3ad819332ac3de1d4ea67cca5932",
+ "url": "https://api.github.com/repos/symfony/finder/zipball/60d08560f9aa72997c44077c40d47aa28a963230",
+ "reference": "60d08560f9aa72997c44077c40d47aa28a963230",
"shasum": ""
},
"require": {
@@ -1085,7 +1016,9 @@
},
"type": "library",
"extra": {
- "branch-version": "4.4"
+ "branch-alias": {
+ "dev-master": "4.4-dev"
+ }
},
"autoload": {
"psr-4": {
@@ -1112,7 +1045,7 @@
"description": "Symfony Finder Component",
"homepage": "https://symfony.com",
"support": {
- "source": "https://github.com/symfony/finder/tree/4.4"
+ "source": "https://github.com/symfony/finder/tree/v4.4.15"
},
"funding": [
{
@@ -1128,20 +1061,20 @@
"type": "tidelift"
}
],
- "time": "2020-10-13T13:20:53+00:00"
+ "time": "2020-10-02T07:34:48+00:00"
},
{
"name": "symfony/http-client",
- "version": "4.4.x-dev",
+ "version": "v4.4.15",
"source": {
"type": "git",
"url": "https://github.com/symfony/http-client.git",
- "reference": "64db2909fb9311545a118bc46ed620d110cd2e25"
+ "reference": "b1cb966898aaf8df37280fde537a27b6724b3bc4"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/http-client/zipball/64db2909fb9311545a118bc46ed620d110cd2e25",
- "reference": "64db2909fb9311545a118bc46ed620d110cd2e25",
+ "url": "https://api.github.com/repos/symfony/http-client/zipball/b1cb966898aaf8df37280fde537a27b6724b3bc4",
+ "reference": "b1cb966898aaf8df37280fde537a27b6724b3bc4",
"shasum": ""
},
"require": {
@@ -1168,7 +1101,9 @@
},
"type": "library",
"extra": {
- "branch-version": "4.4"
+ "branch-alias": {
+ "dev-master": "4.4-dev"
+ }
},
"autoload": {
"psr-4": {
@@ -1195,7 +1130,7 @@
"description": "Symfony HttpClient component",
"homepage": "https://symfony.com",
"support": {
- "source": "https://github.com/symfony/http-client/tree/4.4"
+ "source": "https://github.com/symfony/http-client/tree/v4.4.15"
},
"funding": [
{
@@ -1211,11 +1146,11 @@
"type": "tidelift"
}
],
- "time": "2020-10-20T13:38:40+00:00"
+ "time": "2020-10-02T13:41:48+00:00"
},
{
"name": "symfony/http-client-contracts",
- "version": "dev-main",
+ "version": "v2.3.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/http-client-contracts.git",
@@ -1233,7 +1168,6 @@
"suggest": {
"symfony/http-client-implementation": ""
},
- "default-branch": true,
"type": "library",
"extra": {
"branch-version": "2.3",
@@ -1295,29 +1229,28 @@
},
{
"name": "symfony/polyfill-ctype",
- "version": "dev-main",
+ "version": "v1.20.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-ctype.git",
- "reference": "aed596913b70fae57be53d86faa2e9ef85a2297b"
+ "reference": "f4ba089a5b6366e453971d3aad5fe8e897b37f41"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/aed596913b70fae57be53d86faa2e9ef85a2297b",
- "reference": "aed596913b70fae57be53d86faa2e9ef85a2297b",
+ "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/f4ba089a5b6366e453971d3aad5fe8e897b37f41",
+ "reference": "f4ba089a5b6366e453971d3aad5fe8e897b37f41",
"shasum": ""
},
"require": {
- "php": ">=5.3.3"
+ "php": ">=7.1"
},
"suggest": {
"ext-ctype": "For best performance"
},
- "default-branch": true,
"type": "library",
"extra": {
"branch-alias": {
- "dev-main": "1.19-dev"
+ "dev-main": "1.20-dev"
},
"thanks": {
"name": "symfony/polyfill",
@@ -1355,7 +1288,7 @@
"portable"
],
"support": {
- "source": "https://github.com/symfony/polyfill-ctype/tree/v1.19.0"
+ "source": "https://github.com/symfony/polyfill-ctype/tree/v1.20.0"
},
"funding": [
{
@@ -1371,36 +1304,34 @@
"type": "tidelift"
}
],
- "time": "2020-10-23T09:01:57+00:00"
+ "time": "2020-10-23T14:02:19+00:00"
},
{
"name": "symfony/polyfill-intl-idn",
- "version": "dev-main",
+ "version": "v1.20.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-intl-idn.git",
- "reference": "fd17ae0603e76ae99d041f567e8611a97d899b03"
+ "reference": "3b75acd829741c768bc8b1f84eb33265e7cc5117"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/fd17ae0603e76ae99d041f567e8611a97d899b03",
- "reference": "fd17ae0603e76ae99d041f567e8611a97d899b03",
+ "url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/3b75acd829741c768bc8b1f84eb33265e7cc5117",
+ "reference": "3b75acd829741c768bc8b1f84eb33265e7cc5117",
"shasum": ""
},
"require": {
- "php": ">=5.3.3",
+ "php": ">=7.1",
"symfony/polyfill-intl-normalizer": "^1.10",
- "symfony/polyfill-php70": "^1.10",
"symfony/polyfill-php72": "^1.10"
},
"suggest": {
"ext-intl": "For best performance"
},
- "default-branch": true,
"type": "library",
"extra": {
"branch-alias": {
- "dev-main": "1.19-dev"
+ "dev-main": "1.20-dev"
},
"thanks": {
"name": "symfony/polyfill",
@@ -1444,7 +1375,7 @@
"shim"
],
"support": {
- "source": "https://github.com/symfony/polyfill-intl-idn/tree/main"
+ "source": "https://github.com/symfony/polyfill-intl-idn/tree/v1.20.0"
},
"funding": [
{
@@ -1460,33 +1391,32 @@
"type": "tidelift"
}
],
- "time": "2020-10-23T09:34:17+00:00"
+ "time": "2020-10-23T14:02:19+00:00"
},
{
"name": "symfony/polyfill-intl-normalizer",
- "version": "dev-main",
+ "version": "v1.20.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-intl-normalizer.git",
- "reference": "8db0ae7936b42feb370840cf24de1a144fb0ef27"
+ "reference": "727d1096295d807c309fb01a851577302394c897"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/8db0ae7936b42feb370840cf24de1a144fb0ef27",
- "reference": "8db0ae7936b42feb370840cf24de1a144fb0ef27",
+ "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/727d1096295d807c309fb01a851577302394c897",
+ "reference": "727d1096295d807c309fb01a851577302394c897",
"shasum": ""
},
"require": {
- "php": ">=5.3.3"
+ "php": ">=7.1"
},
"suggest": {
"ext-intl": "For best performance"
},
- "default-branch": true,
"type": "library",
"extra": {
"branch-alias": {
- "dev-main": "1.19-dev"
+ "dev-main": "1.20-dev"
},
"thanks": {
"name": "symfony/polyfill",
@@ -1529,7 +1459,7 @@
"shim"
],
"support": {
- "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.19.0"
+ "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.20.0"
},
"funding": [
{
@@ -1545,33 +1475,32 @@
"type": "tidelift"
}
],
- "time": "2020-10-23T09:01:57+00:00"
+ "time": "2020-10-23T14:02:19+00:00"
},
{
"name": "symfony/polyfill-mbstring",
- "version": "dev-main",
+ "version": "v1.20.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-mbstring.git",
- "reference": "b5f7b932ee6fa802fc792eabd77c4c88084517ce"
+ "reference": "39d483bdf39be819deabf04ec872eb0b2410b531"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/b5f7b932ee6fa802fc792eabd77c4c88084517ce",
- "reference": "b5f7b932ee6fa802fc792eabd77c4c88084517ce",
+ "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/39d483bdf39be819deabf04ec872eb0b2410b531",
+ "reference": "39d483bdf39be819deabf04ec872eb0b2410b531",
"shasum": ""
},
"require": {
- "php": ">=5.3.3"
+ "php": ">=7.1"
},
"suggest": {
"ext-mbstring": "For best performance"
},
- "default-branch": true,
"type": "library",
"extra": {
"branch-alias": {
- "dev-main": "1.19-dev"
+ "dev-main": "1.20-dev"
},
"thanks": {
"name": "symfony/polyfill",
@@ -1610,7 +1539,7 @@
"shim"
],
"support": {
- "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.19.0"
+ "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.20.0"
},
"funding": [
{
@@ -1626,111 +1555,29 @@
"type": "tidelift"
}
],
- "time": "2020-10-23T09:01:57+00:00"
- },
- {
- "name": "symfony/polyfill-php70",
- "version": "dev-main",
- "source": {
- "type": "git",
- "url": "https://github.com/symfony/polyfill-php70.git",
- "reference": "3fe414077251a81a1b15b1c709faf5c2fbae3d4e"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/3fe414077251a81a1b15b1c709faf5c2fbae3d4e",
- "reference": "3fe414077251a81a1b15b1c709faf5c2fbae3d4e",
- "shasum": ""
- },
- "require": {
- "paragonie/random_compat": "~1.0|~2.0|~9.99",
- "php": ">=5.3.3"
- },
- "default-branch": true,
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-main": "1.19-dev"
- },
- "thanks": {
- "name": "symfony/polyfill",
- "url": "https://github.com/symfony/polyfill"
- }
- },
- "autoload": {
- "psr-4": {
- "Symfony\\Polyfill\\Php70\\": ""
- },
- "files": [
- "bootstrap.php"
- ],
- "classmap": [
- "Resources/stubs"
- ]
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Nicolas Grekas",
- "email": "p@tchwork.com"
- },
- {
- "name": "Symfony Community",
- "homepage": "https://symfony.com/contributors"
- }
- ],
- "description": "Symfony polyfill backporting some PHP 7.0+ features to lower PHP versions",
- "homepage": "https://symfony.com",
- "keywords": [
- "compatibility",
- "polyfill",
- "portable",
- "shim"
- ],
- "support": {
- "source": "https://github.com/symfony/polyfill-php70/tree/v1.19.0"
- },
- "funding": [
- {
- "url": "https://symfony.com/sponsor",
- "type": "custom"
- },
- {
- "url": "https://github.com/fabpot",
- "type": "github"
- },
- {
- "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
- "type": "tidelift"
- }
- ],
- "time": "2020-10-23T09:01:57+00:00"
+ "time": "2020-10-23T14:02:19+00:00"
},
{
"name": "symfony/polyfill-php72",
- "version": "dev-main",
+ "version": "v1.20.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-php72.git",
- "reference": "beecef6b463b06954638f02378f52496cb84bacc"
+ "reference": "cede45fcdfabdd6043b3592e83678e42ec69e930"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/beecef6b463b06954638f02378f52496cb84bacc",
- "reference": "beecef6b463b06954638f02378f52496cb84bacc",
+ "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/cede45fcdfabdd6043b3592e83678e42ec69e930",
+ "reference": "cede45fcdfabdd6043b3592e83678e42ec69e930",
"shasum": ""
},
"require": {
- "php": ">=5.3.3"
+ "php": ">=7.1"
},
- "default-branch": true,
"type": "library",
"extra": {
"branch-alias": {
- "dev-main": "1.19-dev"
+ "dev-main": "1.20-dev"
},
"thanks": {
"name": "symfony/polyfill",
@@ -1768,7 +1615,7 @@
"shim"
],
"support": {
- "source": "https://github.com/symfony/polyfill-php72/tree/v1.19.0"
+ "source": "https://github.com/symfony/polyfill-php72/tree/v1.20.0"
},
"funding": [
{
@@ -1784,30 +1631,29 @@
"type": "tidelift"
}
],
- "time": "2020-10-23T09:01:57+00:00"
+ "time": "2020-10-23T14:02:19+00:00"
},
{
"name": "symfony/polyfill-php73",
- "version": "dev-main",
+ "version": "v1.20.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-php73.git",
- "reference": "9d920e3218205554171b2503bb3e4a1366824a16"
+ "reference": "8ff431c517be11c78c48a39a66d37431e26a6bed"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/9d920e3218205554171b2503bb3e4a1366824a16",
- "reference": "9d920e3218205554171b2503bb3e4a1366824a16",
+ "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/8ff431c517be11c78c48a39a66d37431e26a6bed",
+ "reference": "8ff431c517be11c78c48a39a66d37431e26a6bed",
"shasum": ""
},
"require": {
- "php": ">=5.3.3"
+ "php": ">=7.1"
},
- "default-branch": true,
"type": "library",
"extra": {
"branch-alias": {
- "dev-main": "1.19-dev"
+ "dev-main": "1.20-dev"
},
"thanks": {
"name": "symfony/polyfill",
@@ -1848,7 +1694,7 @@
"shim"
],
"support": {
- "source": "https://github.com/symfony/polyfill-php73/tree/v1.19.0"
+ "source": "https://github.com/symfony/polyfill-php73/tree/v1.20.0"
},
"funding": [
{
@@ -1864,30 +1710,29 @@
"type": "tidelift"
}
],
- "time": "2020-10-23T09:01:57+00:00"
+ "time": "2020-10-23T14:02:19+00:00"
},
{
"name": "symfony/polyfill-php80",
- "version": "dev-main",
+ "version": "v1.20.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-php80.git",
- "reference": "f54ef00f4678f348f133097fa8c3701d197ff44d"
+ "reference": "e70aa8b064c5b72d3df2abd5ab1e90464ad009de"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/f54ef00f4678f348f133097fa8c3701d197ff44d",
- "reference": "f54ef00f4678f348f133097fa8c3701d197ff44d",
+ "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/e70aa8b064c5b72d3df2abd5ab1e90464ad009de",
+ "reference": "e70aa8b064c5b72d3df2abd5ab1e90464ad009de",
"shasum": ""
},
"require": {
- "php": ">=7.0.8"
+ "php": ">=7.1"
},
- "default-branch": true,
"type": "library",
"extra": {
"branch-alias": {
- "dev-main": "1.19-dev"
+ "dev-main": "1.20-dev"
},
"thanks": {
"name": "symfony/polyfill",
@@ -1932,7 +1777,7 @@
"shim"
],
"support": {
- "source": "https://github.com/symfony/polyfill-php80/tree/v1.19.0"
+ "source": "https://github.com/symfony/polyfill-php80/tree/v1.20.0"
},
"funding": [
{
@@ -1948,7 +1793,7 @@
"type": "tidelift"
}
],
- "time": "2020-10-23T09:01:57+00:00"
+ "time": "2020-10-23T14:02:19+00:00"
},
{
"name": "symfony/process",
@@ -1956,12 +1801,12 @@
"source": {
"type": "git",
"url": "https://github.com/symfony/process.git",
- "reference": "f3957bcc7ec492baf22812c48e7cccf152491770"
+ "reference": "88d47196a2fe06db8f90f0c2a986651e91ee3660"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/process/zipball/f3957bcc7ec492baf22812c48e7cccf152491770",
- "reference": "f3957bcc7ec492baf22812c48e7cccf152491770",
+ "url": "https://api.github.com/repos/symfony/process/zipball/88d47196a2fe06db8f90f0c2a986651e91ee3660",
+ "reference": "88d47196a2fe06db8f90f0c2a986651e91ee3660",
"shasum": ""
},
"require": {
@@ -1970,9 +1815,6 @@
},
"default-branch": true,
"type": "library",
- "extra": {
- "branch-version": "5.2"
- },
"autoload": {
"psr-4": {
"Symfony\\Component\\Process\\": ""
@@ -1998,7 +1840,7 @@
"description": "Symfony Process Component",
"homepage": "https://symfony.com",
"support": {
- "source": "https://github.com/symfony/process/tree/v5.2.0-BETA2"
+ "source": "https://github.com/symfony/process/tree/5.x"
},
"funding": [
{
@@ -2014,20 +1856,20 @@
"type": "tidelift"
}
],
- "time": "2020-10-13T13:22:54+00:00"
+ "time": "2020-10-24T12:08:07+00:00"
},
{
"name": "symfony/service-contracts",
- "version": "dev-main",
+ "version": "v2.2.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/service-contracts.git",
- "reference": "0aeee2f70f4550e6c48c9a796d98f5ceda58dfda"
+ "reference": "d15da7ba4957ffb8f1747218be9e1a121fd298a1"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/service-contracts/zipball/0aeee2f70f4550e6c48c9a796d98f5ceda58dfda",
- "reference": "0aeee2f70f4550e6c48c9a796d98f5ceda58dfda",
+ "url": "https://api.github.com/repos/symfony/service-contracts/zipball/d15da7ba4957ffb8f1747218be9e1a121fd298a1",
+ "reference": "d15da7ba4957ffb8f1747218be9e1a121fd298a1",
"shasum": ""
},
"require": {
@@ -2037,12 +1879,10 @@
"suggest": {
"symfony/service-implementation": ""
},
- "default-branch": true,
"type": "library",
"extra": {
- "branch-version": "2.3",
"branch-alias": {
- "dev-main": "2.3-dev"
+ "dev-master": "2.2-dev"
},
"thanks": {
"name": "symfony/contracts",
@@ -2079,7 +1919,7 @@
"standards"
],
"support": {
- "source": "https://github.com/symfony/service-contracts/tree/main"
+ "source": "https://github.com/symfony/service-contracts/tree/master"
},
"funding": [
{
@@ -2095,20 +1935,20 @@
"type": "tidelift"
}
],
- "time": "2020-10-14T17:08:19+00:00"
+ "time": "2020-09-07T11:33:47+00:00"
},
{
"name": "twig/twig",
- "version": "2.x-dev",
+ "version": "v2.14.0",
"source": {
"type": "git",
"url": "https://github.com/twigphp/Twig.git",
- "reference": "78173b3c850e344cb8515fc2a05138d39a6c39e0"
+ "reference": "d495243dade48c39b6a5261c26cdbd8c5703f6a0"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/twigphp/Twig/zipball/78173b3c850e344cb8515fc2a05138d39a6c39e0",
- "reference": "78173b3c850e344cb8515fc2a05138d39a6c39e0",
+ "url": "https://api.github.com/repos/twigphp/Twig/zipball/d495243dade48c39b6a5261c26cdbd8c5703f6a0",
+ "reference": "d495243dade48c39b6a5261c26cdbd8c5703f6a0",
"shasum": ""
},
"require": {
@@ -2162,7 +2002,7 @@
],
"support": {
"issues": "https://github.com/twigphp/Twig/issues",
- "source": "https://github.com/twigphp/Twig/tree/2.x"
+ "source": "https://github.com/twigphp/Twig/tree/v2.14.0"
},
"funding": [
{
@@ -2174,7 +2014,7 @@
"type": "tidelift"
}
],
- "time": "2020-10-21T12:45:52+00:00"
+ "time": "2020-10-21T12:35:06+00:00"
}
],
"packages-dev": [],
@@ -2184,7 +2024,7 @@
"symfony/docs-builder": 20,
"symfony/process": 20
},
- "prefer-stable": false,
+ "prefer-stable": true,
"prefer-lowest": false,
"platform": {
"php": ">=7.2.9"
From 3eeb845cd5269fec8fb338043300396e15e47a13 Mon Sep 17 00:00:00 2001
From: Wouter de Jong
Date: Mon, 26 Oct 2020 16:43:31 +0100
Subject: [PATCH 0070/5766] Use PHP docs builder for SymfonyCloud deploys
---
.symfony.cloud.yaml | 20 +++++---------------
1 file changed, 5 insertions(+), 15 deletions(-)
diff --git a/.symfony.cloud.yaml b/.symfony.cloud.yaml
index faa3c24780e..bcb1a48bf08 100644
--- a/.symfony.cloud.yaml
+++ b/.symfony.cloud.yaml
@@ -5,12 +5,12 @@
name: symfonydocs
# The toolstack used to build the application.
-type: "python:3.7"
+type: "php:7.2"
# The configuration of app when it is exposed to the web.
web:
# The public directory of the app, relative to its root.
- document_root: "/_build/html"
+ document_root: "/_build/output"
index_files:
- index.html
whitelist:
@@ -40,19 +40,9 @@ web:
# The size of the persistent disk of the application (in MB).
disk: 512
-# Build time dependencies.
-dependencies:
- python:
- virtualenv: 15.1.0
-
# The hooks that will be performed when the package is deployed.
hooks:
build: |
- virtualenv .virtualenv
- . .virtualenv/bin/activate
- # SymfonyCloud currently sets PIP_USER=1.
- export PIP_USER=
- pip install pip==9.0.1 wheel==0.29.0
- pip install -r _build/.requirements.txt
- find .virtualenv -type f -name "*.rst" -delete
- make -C _build html
+ cd _build
+ composer install --prefer-dist --no-progress
+ php build.php
From 09be97abda04f5b6a865baa0ecefd1029e2d067d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Yann=20Eugon=C3=A9?=
Date: Mon, 26 Oct 2020 10:34:08 +0100
Subject: [PATCH 0071/5766] [DependencyInjection] Fix tagged service priority
inconsistent method name
---
service_container/tags.rst | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/service_container/tags.rst b/service_container/tags.rst
index 7aee0061c0c..7ec5fcc5637 100644
--- a/service_container/tags.rst
+++ b/service_container/tags.rst
@@ -655,8 +655,9 @@ service itself::
}
}
-If you want to have another method defining the priority, you can define it
-in the configuration of the collecting service:
+If you want to have another method defining the priority
+(e.g. ``getPriority()`` rather than ``getDefaultPriority()``),
+you can define it in the configuration of the collecting service:
.. configuration-block::
From 0d182b33c00c00977d8cd468a068ca463c71bc9d Mon Sep 17 00:00:00 2001
From: Med Ghaith Sellami
Date: Tue, 27 Oct 2020 20:35:28 +0100
Subject: [PATCH 0072/5766] update PHP callable docs link
---
components/event_dispatcher.rst | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/components/event_dispatcher.rst b/components/event_dispatcher.rst
index e89441e6a08..0344acf4e8e 100644
--- a/components/event_dispatcher.rst
+++ b/components/event_dispatcher.rst
@@ -532,4 +532,4 @@ Learn More
.. _Mediator: https://en.wikipedia.org/wiki/Mediator_pattern
.. _Observer: https://en.wikipedia.org/wiki/Observer_pattern
.. _Closures: https://www.php.net/manual/en/functions.anonymous.php
-.. _PHP callable: https://www.php.net/manual/en/language.pseudo-types.php#language.types.callback
+.. _PHP callable: https://www.php.net/manual/en/language.types.callable.php
From 46ba35933a1480ac981c7a1ccf0d53534f544815 Mon Sep 17 00:00:00 2001
From: Nyholm
Date: Fri, 30 Oct 2020 08:58:52 +0100
Subject: [PATCH 0073/5766] Update to twig/cssinliner-extra
---
components/mime.rst | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/components/mime.rst b/components/mime.rst
index ce884a51193..95206fa22e3 100644
--- a/components/mime.rst
+++ b/components/mime.rst
@@ -103,12 +103,12 @@ extension:
.. code-block:: terminal
- $ composer require twig/cssinliner-extension
+ $ composer require twig/cssinliner-extra
Now, enable the extension::
// ...
- use Twig\CssInliner\CssInlinerExtension;
+ use Twig\Extra\CssInliner\CssInlinerExtension;
$loader = new FilesystemLoader(__DIR__.'/templates');
$twig = new Environment($loader);
From 5a36f03d309624c8dd2d251d9db5a0c666e7c7df Mon Sep 17 00:00:00 2001
From: Wouter J
Date: Fri, 30 Oct 2020 10:39:54 +0100
Subject: [PATCH 0074/5766] Fixed code block rendering
---
components/process.rst | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/components/process.rst b/components/process.rst
index 8664ddead85..f89935036f1 100644
--- a/components/process.rst
+++ b/components/process.rst
@@ -394,7 +394,7 @@ Using a Prepared Command Line
You can run a process by using a prepared command line with double quote
variable notation. This allows you to use placeholders so that only the
-parameterized values can be changed, but not the rest of the script:
+parameterized values can be changed, but not the rest of the script::
use Symfony\Component\Process\Process;
From d8658352e0cc152aa3ec1f5c9e006a3a1c54ca3f Mon Sep 17 00:00:00 2001
From: Quentin Dequippe
Date: Thu, 29 Oct 2020 15:34:43 +0100
Subject: [PATCH 0075/5766] Update doctrine fetchAll deprecated
---
doctrine.rst | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/doctrine.rst b/doctrine.rst
index eab24ae8f13..fb491df8c2b 100644
--- a/doctrine.rst
+++ b/doctrine.rst
@@ -812,7 +812,7 @@ In addition, you can query directly with SQL if you need to::
$stmt->execute(['price' => $price]);
// returns an array of arrays (i.e. a raw data set)
- return $stmt->fetchAll();
+ return $stmt->fetchAllAssociative();
}
With SQL, you will get back raw data, not objects (unless you use the `NativeQuery`_
From 64058aa3c6a3da18112ac9d92e638137490783c0 Mon Sep 17 00:00:00 2001
From: freezy
Date: Wed, 28 Oct 2020 14:15:13 +0100
Subject: [PATCH 0076/5766] Mention supported hex colors
---
console/coloring.rst | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
diff --git a/console/coloring.rst b/console/coloring.rst
index 3684d71709d..913805b5cea 100644
--- a/console/coloring.rst
+++ b/console/coloring.rst
@@ -40,13 +40,22 @@ It is possible to define your own styles using the
use Symfony\Component\Console\Formatter\OutputFormatterStyle;
// ...
- $outputStyle = new OutputFormatterStyle('red', 'yellow', ['bold', 'blink']);
+ $outputStyle = new OutputFormatterStyle('red', '#ff0', ['bold', 'blink']);
$output->getFormatter()->setStyle('fire', $outputStyle);
$output->writeln('foo>');
-Available foreground and background colors are: ``black``, ``red``, ``green``,
-``yellow``, ``blue``, ``magenta``, ``cyan`` and ``white``.
+Any hex color is supported for foreground and background colors. Besides that, these named colors are supported:
+``black``, ``red``, ``green``, ``yellow``, ``blue``, ``magenta``, ``cyan`` and ``white``.
+
+.. versionadded:: 5.2
+
+ True (hex) color support was introduced in Symfony 5.2
+
+.. note::
+
+ If the terminal doesn't support true colors, the nearest named color is used.
+ E.g. ``#c0392b`` is degraded to ``red`` or ``#f1c40f`` is degraded to ``yellow``.
And available options are: ``bold``, ``underscore``, ``blink``, ``reverse``
(enables the "reverse video" mode where the background and foreground colors
@@ -59,6 +68,9 @@ You can also set these colors and options directly inside the tag name::
// green text
$output->writeln('foo>');
+ // red text
+ $output->writeln('foo>');
+
// black text on a cyan background
$output->writeln('foo>');
From 24312cb7292bf9f3aceefbf7f8c4ec9c68ee7b02 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andre=CC=81=20R?=
Date: Wed, 28 Oct 2020 15:37:11 +0100
Subject: [PATCH 0077/5766] [Cache] Adds mention of using
FileSystemTagAwareAdatpter
---
components/cache/adapters/filesystem_adapter.rst | 13 +++++++++++++
components/cache/cache_invalidation.rst | 3 ++-
2 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/components/cache/adapters/filesystem_adapter.rst b/components/cache/adapters/filesystem_adapter.rst
index 33097fbd202..3939d5f568f 100644
--- a/components/cache/adapters/filesystem_adapter.rst
+++ b/components/cache/adapters/filesystem_adapter.rst
@@ -55,5 +55,18 @@ and cache root path as constructor parameters::
:ref:`pruning of expired cache items ` by
calling its ``prune()`` method.
+
+.. _filesystem-tag-aware-adapter:
+
+Working with Tags
+-----------------
+
+In order to use tag-based invalidation, you can wrap your adapter in :class:`Symfony\\Component\\Cache\\Adapter\\TagAwareAdapter`, but it's often more interesting to use the dedicated :class:`Symfony\\Component\\Cache\\Adapter\\FilesystemTagAwareAdapter`. Since tag invalidation logic is implemented using links on filesystem, this adapter offers better read performance when using tag-based invalidation::
+
+ use Symfony\Component\Cache\Adapter\FilesystemTagAwareAdapter;
+
+ $cache = new FilesystemTagAwareAdapter();
+
+
.. _`tmpfs`: https://wiki.archlinux.org/index.php/tmpfs
.. _`RAM disk solutions`: https://en.wikipedia.org/wiki/List_of_RAM_drive_software
diff --git a/components/cache/cache_invalidation.rst b/components/cache/cache_invalidation.rst
index 22f5830cf3e..084cee4cb70 100644
--- a/components/cache/cache_invalidation.rst
+++ b/components/cache/cache_invalidation.rst
@@ -61,7 +61,8 @@ method.
.. note::
When using a Redis backend, consider using :ref:`RedisTagAwareAdapter `
- which is optimized for this purpose.
+ which is optimized for this purpose. When using File system, likewise consider to use
+ :ref:`FilesystemTagAwareAdapter `.
The :class:`Symfony\\Component\\Cache\\Adapter\\TagAwareAdapter` class implements
instantaneous invalidation (time complexity is ``O(N)`` where ``N`` is the number
From 34a16a8624c6ae61cda9b974ee2146f05ca36040 Mon Sep 17 00:00:00 2001
From: Oskar Stark
Date: Fri, 30 Oct 2020 13:47:57 +0100
Subject: [PATCH 0078/5766] Fix: Typo
---
components/cache/cache_invalidation.rst | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/components/cache/cache_invalidation.rst b/components/cache/cache_invalidation.rst
index 084cee4cb70..bef2c29b0b7 100644
--- a/components/cache/cache_invalidation.rst
+++ b/components/cache/cache_invalidation.rst
@@ -61,7 +61,7 @@ method.
.. note::
When using a Redis backend, consider using :ref:`RedisTagAwareAdapter `
- which is optimized for this purpose. When using File system, likewise consider to use
+ which is optimized for this purpose. When using filesystem, likewise consider to use
:ref:`FilesystemTagAwareAdapter `.
The :class:`Symfony\\Component\\Cache\\Adapter\\TagAwareAdapter` class implements
From 5cd490de3d32acf820be5f3bbd18457ce631336e Mon Sep 17 00:00:00 2001
From: Oskar Stark
Date: Fri, 30 Oct 2020 13:48:58 +0100
Subject: [PATCH 0079/5766] Fix: Add line breaks
---
components/cache/adapters/filesystem_adapter.rst | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/components/cache/adapters/filesystem_adapter.rst b/components/cache/adapters/filesystem_adapter.rst
index 3939d5f568f..c4db3a7fb76 100644
--- a/components/cache/adapters/filesystem_adapter.rst
+++ b/components/cache/adapters/filesystem_adapter.rst
@@ -61,7 +61,11 @@ and cache root path as constructor parameters::
Working with Tags
-----------------
-In order to use tag-based invalidation, you can wrap your adapter in :class:`Symfony\\Component\\Cache\\Adapter\\TagAwareAdapter`, but it's often more interesting to use the dedicated :class:`Symfony\\Component\\Cache\\Adapter\\FilesystemTagAwareAdapter`. Since tag invalidation logic is implemented using links on filesystem, this adapter offers better read performance when using tag-based invalidation::
+In order to use tag-based invalidation, you can wrap your adapter in
+:class:`Symfony\\Component\\Cache\\Adapter\\TagAwareAdapter`, but it's often
+more interesting to use the dedicated :class:`Symfony\\Component\\Cache\\Adapter\\FilesystemTagAwareAdapter`.
+Since tag invalidation logic is implemented using links on filesystem, this
+adapter offers better read performance when using tag-based invalidation::
use Symfony\Component\Cache\Adapter\FilesystemTagAwareAdapter;
From ace5e3a8cc5b984b53a699a4e16e413dad084ccc Mon Sep 17 00:00:00 2001
From: Quentin Dequippe
Date: Fri, 9 Oct 2020 10:31:46 +0200
Subject: [PATCH 0080/5766] Add warning on Docker integration
---
setup/symfony_server.rst | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/setup/symfony_server.rst b/setup/symfony_server.rst
index 70155de0637..a8374aaca4a 100644
--- a/setup/symfony_server.rst
+++ b/setup/symfony_server.rst
@@ -378,6 +378,16 @@ its location, same as for ``docker-compose``:
If you have more than one Docker Compose file, you can provide them all
separated by ``:`` as explained in the `Docker compose CLI env var reference`_.
+.. caution::
+
+ When using Symfony binary with ``php bin/console`` (``symfony console ...``)
+ the binay will **always** use environment variables detected via Docker and will
+ ignore local environment variables.
+ For example if you set up a different database name in your ``.env.test`` file
+ (``DATABASE_URL=mysql://db_user:db_password@127.0.0.1:3306/test``) and if you run
+ ``symfony console doctrine:database:drop --force --env=test`` the command will drop the database
+ defined in your Docker configuration and not the "test" one.
+
SymfonyCloud Integration
------------------------
From 8d1614e2e2c4a3ec22b9ca91cb7ad48b8ec14f6e Mon Sep 17 00:00:00 2001
From: Oskar Stark
Date: Fri, 30 Oct 2020 14:01:09 +0100
Subject: [PATCH 0081/5766] Enhancement: Private member variables in code
example
---
create_framework/separation_of_concerns.rst | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/create_framework/separation_of_concerns.rst b/create_framework/separation_of_concerns.rst
index e1e46f3ebe3..24d34f0e82b 100644
--- a/create_framework/separation_of_concerns.rst
+++ b/create_framework/separation_of_concerns.rst
@@ -27,9 +27,9 @@ request handling logic into its own ``Simplex\Framework`` class::
class Framework
{
- protected $matcher;
- protected $controllerResolver;
- protected $argumentResolver;
+ private $matcher;
+ private $controllerResolver;
+ private $argumentResolver;
public function __construct(UrlMatcher $matcher, ControllerResolver $controllerResolver, ArgumentResolver $argumentResolver)
{
From ae45622a92dfd8bd8b206a2c0f70e0310481d702 Mon Sep 17 00:00:00 2001
From: Ca-Jou
Date: Wed, 28 Oct 2020 16:30:54 +0100
Subject: [PATCH 0082/5766] =?UTF-8?q?spotted=20minor=20EN=20mistakes=20and?=
=?UTF-8?q?=20coherence=20issues=20between=20the=20different=20=E2=80=A6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
create_framework/dependency_injection.rst | 2 +-
create_framework/event_dispatcher.rst | 2 +-
create_framework/front_controller.rst | 2 +-
create_framework/http_foundation.rst | 4 ++--
create_framework/http_kernel_controller_resolver.rst | 2 +-
create_framework/http_kernel_httpkernelinterface.rst | 7 ++++---
6 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/create_framework/dependency_injection.rst b/create_framework/dependency_injection.rst
index b38241e3ce2..cd20a947251 100644
--- a/create_framework/dependency_injection.rst
+++ b/create_framework/dependency_injection.rst
@@ -205,7 +205,7 @@ Now, here is how you can register a custom listener in the front controller::
->addMethodCall('addSubscriber', [new Reference('listener.string_response')])
;
-Beside describing your objects, the dependency injection container can also be
+Besides describing your objects, the dependency injection container can also be
configured via parameters. Let's create one that defines if we are in debug
mode or not::
diff --git a/create_framework/event_dispatcher.rst b/create_framework/event_dispatcher.rst
index fd655a93ebf..bf872a5bb50 100644
--- a/create_framework/event_dispatcher.rst
+++ b/create_framework/event_dispatcher.rst
@@ -23,7 +23,7 @@ version of this pattern:
How does it work? The *dispatcher*, the central object of the event dispatcher
system, notifies *listeners* of an *event* dispatched to it. Put another way:
your code dispatches an event to the dispatcher, the dispatcher notifies all
-registered listeners for the event, and each listener do whatever it wants
+registered listeners for the event, and each listener does whatever it wants
with the event.
As an example, let's create a listener that transparently adds the Google
diff --git a/create_framework/front_controller.rst b/create_framework/front_controller.rst
index 39286ba8c16..e6a7293fa6b 100644
--- a/create_framework/front_controller.rst
+++ b/create_framework/front_controller.rst
@@ -132,7 +132,7 @@ its sub-directories (only if needed -- see above tip).
like ``$request = Request::create('/hello?name=Fabien');`` where the
argument is the URL path you want to simulate.
-Now that the web server always access the same script (``front.php``) for all
+Now that the web server always accesses the same script (``front.php``) for all
pages, we can secure the code further by moving all other PHP files outside the
web root directory:
diff --git a/create_framework/http_foundation.rst b/create_framework/http_foundation.rst
index b56834319a8..99dff5c1faf 100644
--- a/create_framework/http_foundation.rst
+++ b/create_framework/http_foundation.rst
@@ -273,7 +273,7 @@ cases by yourself. Why not using a technology that already works?
a look at the ``Symfony\Component\HttpFoundation`` API or read
its dedicated :doc:`documentation `.
-Believe or not but we have our first framework. You can stop now if you want.
+Believe it or not but we have our first framework. You can stop now if you want.
Using just the Symfony HttpFoundation component already allows you to write
better and more testable code. It also allows you to write code faster as many
day-to-day problems have already been solved for you.
@@ -282,7 +282,7 @@ As a matter of fact, projects like Drupal have adopted the HttpFoundation
component; if it works for them, it will probably work for you. Don't reinvent
the wheel.
-I've almost forgot to talk about one added benefit: using the HttpFoundation
+I've almost forgotten to talk about one added benefit: using the HttpFoundation
component is the start of better interoperability between all frameworks and
`applications using it`_ (like `Symfony`_, `Drupal 8`_, `phpBB 3`_, `Laravel`_
and `ezPublish 5`_, and `more`_).
diff --git a/create_framework/http_kernel_controller_resolver.rst b/create_framework/http_kernel_controller_resolver.rst
index bac631073e6..12d9efead6e 100644
--- a/create_framework/http_kernel_controller_resolver.rst
+++ b/create_framework/http_kernel_controller_resolver.rst
@@ -31,7 +31,7 @@ The move is pretty straightforward and makes a lot of sense as soon as you
create more pages but you might have noticed a non-desirable side effect...
The ``LeapYearController`` class is *always* instantiated, even if the
requested URL does not match the ``leap_year`` route. This is bad for one main
-reason: performance wise, all controllers for all routes must now be
+reason: performance-wise, all controllers for all routes must now be
instantiated for every request. It would be better if controllers were
lazy-loaded so that only the controller associated with the matched route is
instantiated.
diff --git a/create_framework/http_kernel_httpkernelinterface.rst b/create_framework/http_kernel_httpkernelinterface.rst
index 9207ba342b0..9bda9e5c731 100644
--- a/create_framework/http_kernel_httpkernelinterface.rst
+++ b/create_framework/http_kernel_httpkernelinterface.rst
@@ -46,8 +46,8 @@ Update your framework so that it implements this interface::
}
}
-Even if this change looks not too complex, it brings us a lot! Let's talk about one of
-the most impressive one: transparent :doc:`HTTP caching ` support.
+With this change, a little goes a long way! Let's talk about one of
+the most impressive upsides: transparent :doc:`HTTP caching ` support.
The ``HttpCache`` class implements a fully-featured reverse proxy, written in
PHP; it implements ``HttpKernelInterface`` and wraps another
@@ -64,7 +64,8 @@ PHP; it implements ``HttpKernelInterface`` and wraps another
new HttpKernel\HttpCache\Store(__DIR__.'/../cache')
);
- $framework->handle($request)->send();
+ $response = $framework->handle($request);
+ $response->send();
That's all it takes to add HTTP caching support to our framework. Isn't it
amazing?
From f746ec156d528b76e69872d31e2101232b56af5a Mon Sep 17 00:00:00 2001
From: Javier Eguiluz
Date: Fri, 30 Oct 2020 16:54:28 +0100
Subject: [PATCH 0083/5766] [Performance] Mention Symfony Stowatch in some doc
sections
---
performance.rst | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/performance.rst b/performance.rst
index ec9d44e5610..65859141433 100644
--- a/performance.rst
+++ b/performance.rst
@@ -211,21 +211,24 @@ deployment process too):
.. _profiling-applications:
-Profiling Applications
-----------------------
+Profiling Symfony Applications
+------------------------------
+
+Profiling with Blackfire
+~~~~~~~~~~~~~~~~~~~~~~~~
`Blackfire`_ is the best tool to profile and optimize performance of Symfony
applications during development, test and production. It's a commercial service,
but provides free features that you can use to find bottlenecks in your projects.
+Profilwing with Symfony Stopwatch
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
Symfony provides a basic performance profiler in the development
:ref:`config environment `. Click on the "time panel"
of the :ref:`web debug toolbar ` to see how much time Symfony
spent on tasks such as making database queries and rendering templates.
-Custom Profiling
-~~~~~~~~~~~~~~~~
-
You can measure the execution time and memory consumption of your own code and
display the result in the Symfony profiler thanks to the `Stopwatch component`_.
From 950f2552731f63827330b65abe4f2944d12a921f Mon Sep 17 00:00:00 2001
From: Zairig Imad
Date: Tue, 9 Jun 2020 21:48:07 +0200
Subject: [PATCH 0084/5766] add _failure_path option to reference
---
reference/configuration/security.rst | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/reference/configuration/security.rst b/reference/configuration/security.rst
index 9c7f5da8755..399794e2402 100644
--- a/reference/configuration/security.rst
+++ b/reference/configuration/security.rst
@@ -528,6 +528,14 @@ target_path_parameter
When using a login form, if you include an HTML element to set the target path,
this option lets you change the name of the HTML element itself.
+failure_path_parameter
+......................
+
+**type**: ``string`` **default**: ``_failure_path``
+
+When using a login form, if you include an HTML element to set the failure path,
+this option lets you change the name of the HTML element itself.
+
use_referer
...........
From 53abe31aae73f39a68bd13d81c581b4389ab9a2c Mon Sep 17 00:00:00 2001
From: Wouter de Jong
Date: Sat, 31 Oct 2020 22:57:24 +0100
Subject: [PATCH 0085/5766] Use Symfony Flex and do not favor any CI tool
---
bundles/best_practices.rst | 124 ++++++++++++++++---------------------
1 file changed, 55 insertions(+), 69 deletions(-)
diff --git a/bundles/best_practices.rst b/bundles/best_practices.rst
index e80050e2fce..010ba551832 100644
--- a/bundles/best_practices.rst
+++ b/bundles/best_practices.rst
@@ -171,73 +171,59 @@ Continuous Integration
Testing bundle code continuously, including all its commits and pull requests,
is a good practice called Continuous Integration. There are several services
-providing this feature for free for open source projects. The most popular
-service for Symfony bundles is called `Travis CI`_.
-
-Here is the recommended configuration file (``.travis.yml``) for Symfony bundles,
-which test the two latest :doc:`LTS versions `
-of Symfony and the latest beta release:
-
-.. code-block:: yaml
-
- language: php
-
- cache:
- directories:
- - $HOME/.composer/cache/files
- - $HOME/symfony-bridge/.phpunit
-
- env:
- global:
- - PHPUNIT_FLAGS="-v"
- - SYMFONY_PHPUNIT_DIR="$HOME/symfony-bridge/.phpunit"
-
- matrix:
- fast_finish: true
- include:
- # Minimum supported dependencies with the latest and oldest PHP version
- - php: 7.2
- env: COMPOSER_FLAGS="--prefer-stable --prefer-lowest" SYMFONY_DEPRECATIONS_HELPER="max[self]=0"
- - php: 7.1
- env: COMPOSER_FLAGS="--prefer-stable --prefer-lowest" SYMFONY_DEPRECATIONS_HELPER="max[self]=0"
-
- # Test the latest stable release
- - php: 7.1
- - php: 7.2
- env: COVERAGE=true PHPUNIT_FLAGS="-v --coverage-text"
-
- # Test LTS versions. This makes sure we do not use Symfony packages with version greater
- # than 2 or 3 respectively. Read more at https://github.com/symfony/lts
- - php: 7.2
- env: DEPENDENCIES="symfony/lts:^2"
- - php: 7.2
- env: DEPENDENCIES="symfony/lts:^3"
-
- # Latest commit to master
- - php: 7.2
- env: STABILITY="dev"
-
- allow_failures:
- # Dev-master is allowed to fail.
- - env: STABILITY="dev"
-
- before_install:
- - if [[ $COVERAGE != true ]]; then phpenv config-rm xdebug.ini || true; fi
- - if ! [ -z "$STABILITY" ]; then composer config minimum-stability ${STABILITY}; fi;
- - if ! [ -v "$DEPENDENCIES" ]; then composer require --no-update ${DEPENDENCIES}; fi;
-
- install:
- - composer update ${COMPOSER_FLAGS} --prefer-dist --no-interaction
- - ./vendor/bin/simple-phpunit install
-
- script:
- - composer validate --strict --no-check-lock
- # simple-phpunit is the PHPUnit wrapper provided by the PHPUnit Bridge component and
- # it helps with testing legacy code and deprecations (composer require symfony/phpunit-bridge)
- - ./vendor/bin/simple-phpunit $PHPUNIT_FLAGS
-
-Consider using the `Travis cron`_ tool to make sure your project is built even if
-there are no new pull requests or commits.
+providing this feature for free for open source projects, like `GitHub Actions`_
+and `Travis CI`_.
+
+A bundle should at least test:
+
+* The lower bound of their dependencies (by running ``composer update --prefer-lowest``);
+* The supported PHP versions;
+* All supported major Symfony versions (e.g. both ``3.x`` and ``4.x`` if
+ support is claimed for both).
+
+Thus, a bundle support PHP 7.3, 7.4 and 8.0, and Symfony 3.4 and 4.x should
+have at least this test matrix:
+
+=========== =============== ===================
+PHP version Symfony version Composer flags
+=========== =============== ===================
+7.3 ``3.*`` ``--prefer-lowest``
+7.4 ``4.*``
+8.0 ``4.*``
+=========== =============== ===================
+
+.. tip::
+
+ The tests should be run with the ``SYMFONY_DEPRECATIONS_HELPER``
+ env variable set to ``max[direct]=0``. This ensures no code in the
+ bundle uses deprecated features directly.
+
+ The lowest dependency tests can be run with this variable set to
+ ``disabled=1``.
+
+Require a Specific Symfony Version
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+You can use the special ``SYMFONY_REQUIRE`` environment variable together
+with Symfony Flex to install a specific Symfony version:
+
+.. code-block:: bash
+
+ # this requires Symfony 5.x for all Symfony packages
+ export SYMFONY_REQUIRE=5.*
+
+ # install Symfony Flex in the CI environment
+ composer global require --no-progress --no-scripts --no-plugins symfony/flex
+
+ # install the dependencies (using --prefer-dist and --no-progress is
+ # recommended to have a better output and faster download time)
+ composer update --prefer-dist --no-progress
+
+.. caution::
+
+ If you want to cache your Composer dependencies, **do not** cache the
+ ``vendor/`` directory as this has side-effects. Instead cache
+ ``$HOME/.composer/cache/files``.
Installation
------------
@@ -529,5 +515,5 @@ Learn more
.. _`Packagist`: https://packagist.org/
.. _`choose any license`: https://choosealicense.com/
.. _`valid license identifier`: https://spdx.org/licenses/
-.. _`Travis CI`: https://travis-ci.org/
-.. _`Travis cron`: https://docs.travis-ci.com/user/cron-jobs/
+.. _`GitHub Actions`: https://docs.github.com/en/free-pro-team@latest/actions
+.. _`Travis CI`: https://docs.travis-ci.com/
From 50dfc9097da5fe075e353bc95c1b609dd484a0f0 Mon Sep 17 00:00:00 2001
From: Thomas Landauer
Date: Tue, 19 May 2020 16:51:17 +0200
Subject: [PATCH 0086/5766] Update form_customization.rst
---
form/bootstrap4.rst | 2 ++
form/form_customization.rst | 5 +++++
2 files changed, 7 insertions(+)
diff --git a/form/bootstrap4.rst b/form/bootstrap4.rst
index cc19dd2f8c9..e96db1afb3b 100644
--- a/form/bootstrap4.rst
+++ b/form/bootstrap4.rst
@@ -77,6 +77,8 @@ If you prefer to apply the Bootstrap styles on a form to form basis, include the
{{ form(form) }}
{% endblock %}
+.. _reference-forms-bootstrap-error-messages:
+
Error Messages
--------------
diff --git a/form/form_customization.rst b/form/form_customization.rst
index 3094eb08f40..9c4a32919f2 100644
--- a/form/form_customization.rst
+++ b/form/form_customization.rst
@@ -255,6 +255,11 @@ Renders any errors for the given field.
{# render any "global" errors not associated to any form field #}
{{ form_errors(form) }}
+.. caution::
+
+ In the Bootstrap 4 form theme, ``form_errors()`` is already included
+ in ``form_label()``, see ":ref:`reference-forms-bootstrap-error-messages`"
+
.. _reference-forms-twig-widget:
form_widget(form_view, variables)
From cb1a140e0ff208e0b5d78786e7918d18e255c26e Mon Sep 17 00:00:00 2001
From: Carlos Pereira De Amorim
Date: Fri, 28 Aug 2020 23:28:38 +0200
Subject: [PATCH 0087/5766] Clarify how workflow can be injected
---
workflow.rst | 61 ++++++++++++++++++++++++++++++++++++----------------
1 file changed, 43 insertions(+), 18 deletions(-)
diff --git a/workflow.rst b/workflow.rst
index 3ca81fbea6c..7f7acffaa3a 100644
--- a/workflow.rst
+++ b/workflow.rst
@@ -236,28 +236,28 @@ what actions are allowed on a blog post::
Accessing the Workflow in a Class
---------------------------------
-To access workflow inside a class, use dependency injection and inject the
-registry in the constructor::
+You can use the workflow inside a class by using
+:doc:`service autowiring ` and using
+``camelCased workflow name + Workflow`` as parameter name::
use App\Entity\BlogPost;
- use Symfony\Component\Workflow\Registry;
+ use Symfony\Component\Workflow\WorkflowInterface;
class MyClass
{
- private $workflowRegistry;
+ private $blogPublishingWorkflow;
- public function __construct(Registry $workflowRegistry)
+ // this injects the blog_publishing workflow configured before
+ public function __construct(WorkflowInterface $blogPublishingWorkflow)
{
- $this->workflowRegistry = $workflowRegistry;
+ $this->blogPublishingWorkflow = $blogPublishingWorkflow;
}
public function toReview(BlogPost $post)
{
- $workflow = $this->workflowRegistry->get($post);
-
// Update the currentState on the post
try {
- $workflow->apply($post, 'to_review');
+ $this->blogPublishingWorkflow->apply($post, 'to_review');
} catch (LogicException $exception) {
// ...
}
@@ -265,6 +265,33 @@ registry in the constructor::
}
}
+Alternatively, use the registry::
+
+ use App\Entity\BlogPost;
+ use Symfony\Component\Workflow\Registry;
+
+ class MyClass
+ {
+ private $workflowRegistry;
+
+ public function __construct(Registry $workflowRegistry)
+ {
+ $this->workflowRegistry = $workflowRegistry;
+ }
+
+ public function toReview(BlogPost $post)
+ {
+ $blogPublishingWorkflow = $this->workflowRegistry->get($post);
+
+ // ...
+ }
+ }
+
+.. tip::
+
+ You can find the list of available workflow services with the
+ ``php bin/console debug:autowiring workflow`` command.
+
Using Events
------------
@@ -829,25 +856,23 @@ Then you can access this metadata in your controller as follows::
// src/App/Controller/BlogPostController.php
use App\Entity\BlogPost;
- use Symfony\Component\Workflow\Registry;
+ use Symfony\Component\Workflow\WorkflowInterface;
// ...
- public function myAction(Registry $registry, BlogPost $post)
+ public function myAction(WorkflowInterface $blogPublishingWorkflow, BlogPost $post)
{
- $workflow = $registry->get($post);
-
- $title = $workflow
+ $title = $blogPublishingWorkflow
->getMetadataStore()
->getWorkflowMetadata()['title'] ?? 'Default title'
;
- $maxNumOfWords = $workflow
+ $maxNumOfWords = $blogPublishingWorkflow
->getMetadataStore()
->getPlaceMetadata('draft')['max_num_of_words'] ?? 500
;
- $aTransition = $workflow->getDefinition()->getTransitions()[0];
- $priority = $workflow
+ $aTransition = $blogPublishingWorkflow->getDefinition()->getTransitions()[0];
+ $priority = $blogPublishingWorkflow
->getMetadataStore()
->getTransitionMetadata($aTransition)['priority'] ?? 0
;
@@ -870,7 +895,7 @@ In a :ref:`flash message ` in your controller::
// $transition = ...; (an instance of Transition)
- // $workflow is a Workflow instance retrieved from the Registry (see above)
+ // $workflow is a Workflow instance retrieved from the Registry or injected directly (see above)
$title = $workflow->getMetadataStore()->getMetadata('title', $transition);
$this->addFlash('info', "You have successfully applied the transition with title: '$title'");
From 104c8f01ee465fe9b95553504d8c115d64799bf5 Mon Sep 17 00:00:00 2001
From: Thomas Landauer
Date: Sun, 1 Nov 2020 14:37:17 +0100
Subject: [PATCH 0088/5766] Update routing.rst
Fixing argument number. Function signature is:
```php
final public function import($resource, string $type = null, bool $ignoreErrors = false, $exclude = null): ImportConfigurator
```
---
routing.rst | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/routing.rst b/routing.rst
index 5aaebf659cd..d88ebb773a5 100644
--- a/routing.rst
+++ b/routing.rst
@@ -1243,7 +1243,7 @@ the common configuration using options when importing the routes.
use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;
return function (RoutingConfigurator $routes) {
- // use the optional fifth argument of import() to exclude some files
+ // use the optional fourth argument of import() to exclude some files
// or subdirectories when loading annotations
$routes->import('../../src/Controller/', 'annotation')
// this is added to the beginning of all imported route URLs
From e62f4c73b4458bc3f485ebf067d14b5a3fb528cd Mon Sep 17 00:00:00 2001
From: Javier Eguiluz
Date: Mon, 2 Nov 2020 09:24:49 +0100
Subject: [PATCH 0089/5766] -
---
performance.rst | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/performance.rst b/performance.rst
index 65859141433..de0d7883a04 100644
--- a/performance.rst
+++ b/performance.rst
@@ -221,8 +221,8 @@ Profiling with Blackfire
applications during development, test and production. It's a commercial service,
but provides free features that you can use to find bottlenecks in your projects.
-Profilwing with Symfony Stopwatch
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Profiling with Symfony Stopwatch
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Symfony provides a basic performance profiler in the development
:ref:`config environment `. Click on the "time panel"
From 953845cddc63f9a12a54fff135fff7a9485bdb78 Mon Sep 17 00:00:00 2001
From: Christian Flothmann
Date: Mon, 2 Nov 2020 13:57:47 +0100
Subject: [PATCH 0090/5766] some minor tweaks
---
setup/symfony_server.rst | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/setup/symfony_server.rst b/setup/symfony_server.rst
index a8374aaca4a..0f4d88904d6 100644
--- a/setup/symfony_server.rst
+++ b/setup/symfony_server.rst
@@ -380,12 +380,12 @@ its location, same as for ``docker-compose``:
.. caution::
- When using Symfony binary with ``php bin/console`` (``symfony console ...``)
- the binay will **always** use environment variables detected via Docker and will
+ When using the Symfony binary with ``php bin/console`` (``symfony console ...``),
+ the binary will **always** use environment variables detected via Docker and will
ignore local environment variables.
For example if you set up a different database name in your ``.env.test`` file
(``DATABASE_URL=mysql://db_user:db_password@127.0.0.1:3306/test``) and if you run
- ``symfony console doctrine:database:drop --force --env=test`` the command will drop the database
+ ``symfony console doctrine:database:drop --force --env=test``, the command will drop the database
defined in your Docker configuration and not the "test" one.
SymfonyCloud Integration
From 8cdbb3935bf9b42428f97583d2a1e2d73a96d7e0 Mon Sep 17 00:00:00 2001
From: Ilya Bakhlin
Date: Tue, 3 Nov 2020 08:49:36 +0100
Subject: [PATCH 0091/5766] Updating the Installer Related Instructions
---
setup.rst | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/setup.rst b/setup.rst
index b2fe9ab23bd..1bf907318d9 100644
--- a/setup.rst
+++ b/setup.rst
@@ -67,7 +67,7 @@ with the ``new`` command:
.. code-block:: terminal
- $ symfony new my_project_name --version=3.4
+ $ symfony new my_project_name 3.4
This command creates a new directory called ``my_project_name/`` that contains
an empty project based on the most recent stable Symfony version available. In
@@ -111,14 +111,14 @@ In case your project needs to be based on a specific Symfony version, use the
.. code-block:: terminal
# use the most recent version in any Symfony branch
- $ symfony new my_project_name --version=3.3
- $ symfony new my_project_name --version=3.4
+ $ symfony new my_project_name 3.3
+ $ symfony new my_project_name 3.4
# use the most recent 'lts' version (Long Term Support version)
- $ symfony new my_project_name --version=lts
+ $ symfony new my_project_name lts
# use the 'next' Symfony version to be released (still in development)
- $ symfony new my_project_name --version=next
+ $ symfony new my_project_name next
Each version has its *own* documentation, which you can select on any documentation
page.
From 2e848b41189b82cee4d46a1277f2116e5ab75bac Mon Sep 17 00:00:00 2001
From: Oskar Stark
Date: Tue, 3 Nov 2020 15:43:05 +0100
Subject: [PATCH 0092/5766] Minor: Use Twig code block
this way it can easily be copied
---
routing.rst | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/routing.rst b/routing.rst
index 5aaebf659cd..ed7e5df48f8 100644
--- a/routing.rst
+++ b/routing.rst
@@ -2266,8 +2266,11 @@ generating the route::
$this->generateUrl('blog_show', ['slug' => 'slug-value']);
- // or, in Twig
- // {{ path('blog_show', {slug: 'slug-value'}) }}
+or, in Twig:
+
+.. code-block:: twig
+
+ {{ path('blog_show', {slug: 'slug-value'}) }}
Learn more about Routing
------------------------
From dbed899b608229706ed88b84fb36d5e7a7ba7da1 Mon Sep 17 00:00:00 2001
From: Nyholm
Date: Sun, 25 Oct 2020 16:42:30 +0100
Subject: [PATCH 0093/5766] [Notifier][Discord] Use correct use statements
---
notifier/chatters.rst | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/notifier/chatters.rst b/notifier/chatters.rst
index 9d03f83987c..7fe42a02f67 100644
--- a/notifier/chatters.rst
+++ b/notifier/chatters.rst
@@ -107,11 +107,11 @@ With a Discord message, you can use the
:class:`Symfony\\Component\\Notifier\\Bridge\\Discord\\DiscordOptions` to add
some interactive options called `Embed elements`_::
- use Symfony\Component\Notifier\Bridge\Discord\Block\DiscordEmbed;
- use Symfony\Component\Notifier\Bridge\Discord\Block\DiscordFieldEmbedObject;
- use Symfony\Component\Notifier\Bridge\Discord\Block\DiscordFooterEmbedObject;
- use Symfony\Component\Notifier\Bridge\Discord\Block\DiscordMediaEmbedObject;
use Symfony\Component\Notifier\Bridge\Discord\DiscordOptions;
+ use Symfony\Component\Notifier\Bridge\Discord\Embeds\DiscordEmbed;
+ use Symfony\Component\Notifier\Bridge\Discord\Embeds\DiscordFieldEmbedObject;
+ use Symfony\Component\Notifier\Bridge\Discord\Embeds\DiscordFooterEmbedObject;
+ use Symfony\Component\Notifier\Bridge\Discord\Embeds\DiscordMediaEmbedObject;
use Symfony\Component\Notifier\Message\ChatMessage;
$chatMessage = new ChatMessage('');
From 958aeafd32cb4bd44aefb540efb59442911d3e1e Mon Sep 17 00:00:00 2001
From: Florian Hermann
Date: Tue, 3 Nov 2020 16:47:40 +0100
Subject: [PATCH 0094/5766] Add priority order explanation for tagged services
---
service_container/tags.rst | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/service_container/tags.rst b/service_container/tags.rst
index 7ec5fcc5637..bbe7df1af6b 100644
--- a/service_container/tags.rst
+++ b/service_container/tags.rst
@@ -596,8 +596,9 @@ Tagged Services with Priority
The ability to prioritize tagged services was introduced in Symfony 4.4.
-The tagged services can be prioritized using the ``priority`` attribute,
-thus providing a way to inject a sorted collection of services:
+The tagged services can be prioritized using the ``priority`` attribute.
+The priority is a positive or negative integer. The higher the number,
+the earlier the tagged service will be located in the collection:
.. configuration-block::
@@ -655,7 +656,7 @@ service itself::
}
}
-If you want to have another method defining the priority
+If you want to have another method defining the priority
(e.g. ``getPriority()`` rather than ``getDefaultPriority()``),
you can define it in the configuration of the collecting service:
From 447065dc4fe6fb83fd658bf4ea1bd10c65821d60 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Deruss=C3=A9?=
Date: Wed, 4 Nov 2020 10:03:11 +0100
Subject: [PATCH 0095/5766] Add documentation about GetQueueUrl and DSN format
in SQS transport
---
messenger.rst | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/messenger.rst b/messenger.rst
index 6c2f2e35794..2e41a0ca86f 100644
--- a/messenger.rst
+++ b/messenger.rst
@@ -1300,7 +1300,7 @@ Amazon SQS
.. versionadded:: 5.1
- The Amazon SQS transport as introduced in Symfony 5.1.
+ The Amazon SQS transport has been introduced in Symfony 5.1.
The Amazon SQS transport is perfect for application hosted on AWS. Install it by
running:
@@ -1314,7 +1314,7 @@ The SQS transport DSN may looks like this:
.. code-block:: env
# .env
- MESSENGER_TRANSPORT_DSN=sqs://AKIAIOSFODNN7EXAMPLE:j17M97ffSVoKI0briFoo9a@sqs.eu-west-3.amazonaws.com/messages
+ MESSENGER_TRANSPORT_DSN=https://AKIAIOSFODNN7EXAMPLE:j17M97ffSVoKI0briFoo9a@sqs.eu-west-3.amazonaws.com/123456789012/messages
MESSENGER_TRANSPORT_DSN=sqs://localhost:9494/messages?sslmode=disable
.. note::
@@ -1322,6 +1322,17 @@ The SQS transport DSN may looks like this:
The transport will automatically create queues that are needed. This
can be disabled setting the ``auto_setup`` option to ``false``.
+.. tip::
+
+ Before sending or receiving a message, Symfony needs to convert the queue
+ name into an AWS queue URL by calling the ``GetQueueUrl`` API in AWS. This
+ extra API call can be avoided by providing a DSN which is the queue URL.
+
+.. versionadded:: 5.2
+
+ Providing a DSN equals to the queue URL to avoid call to ``GetQueueUrl``
+ has been introduced in Symfony 5.2.
+
The transport has a number of options:
====================== ====================================== ===================================
From 2a48c4410f659638d42c51c0e8388cfe7a177030 Mon Sep 17 00:00:00 2001
From: Javier Eguiluz
Date: Thu, 5 Nov 2020 10:26:53 +0100
Subject: [PATCH 0096/5766] Tweaks
---
messenger.rst | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/messenger.rst b/messenger.rst
index 2e41a0ca86f..ac07b40c624 100644
--- a/messenger.rst
+++ b/messenger.rst
@@ -1300,7 +1300,7 @@ Amazon SQS
.. versionadded:: 5.1
- The Amazon SQS transport has been introduced in Symfony 5.1.
+ The Amazon SQS transport was introduced in Symfony 5.1.
The Amazon SQS transport is perfect for application hosted on AWS. Install it by
running:
@@ -1328,10 +1328,9 @@ The SQS transport DSN may looks like this:
name into an AWS queue URL by calling the ``GetQueueUrl`` API in AWS. This
extra API call can be avoided by providing a DSN which is the queue URL.
-.. versionadded:: 5.2
+ .. versionadded:: 5.2
- Providing a DSN equals to the queue URL to avoid call to ``GetQueueUrl``
- has been introduced in Symfony 5.2.
+ The feature to provide the queue URL in the DSN was introduced in Symfony 5.2.
The transport has a number of options:
From 3abecebd33c11c0373a775f0b9de1d0c491798e4 Mon Sep 17 00:00:00 2001
From: Thibaut Cheymol
Date: Sun, 4 Oct 2020 22:53:49 +0200
Subject: [PATCH 0097/5766] [Collection forms] Make javascript generic
---
form/form_collections.rst | 37 +++++++++++++++++++------------------
1 file changed, 19 insertions(+), 18 deletions(-)
diff --git a/form/form_collections.rst b/form/form_collections.rst
index 1d0b56c244a..068b4c84985 100644
--- a/form/form_collections.rst
+++ b/form/form_collections.rst
@@ -242,7 +242,13 @@ the following ``data-prototype`` attribute to the existing ``
`` in your temp
.. code-block:: html+twig
-
+
+
+Now add a button just next to the ``
`` to dynamically add a new tag
+
+.. code-block:: html+twig
+
+
On the rendered page, the result will look something like this:
@@ -285,27 +291,18 @@ will be show next):
.. code-block:: javascript
- var $collectionHolder;
-
- // setup an "add a tag" link
- var $addTagButton = $('');
- var $newLinkLi = $('').append($addTagButton);
-
jQuery(document).ready(function() {
// Get the ul that holds the collection of tags
- $collectionHolder = $('ul.tags');
-
- // add the "add a tag" anchor and li to the tags ul
- $collectionHolder.append($newLinkLi);
-
+ var $tagsCollectionHolder = $('ul.tags');
// count the current form inputs we have (e.g. 2), use that as the new
// index when inserting a new item (e.g. 2)
- $collectionHolder.data('index', $collectionHolder.find('input').length);
+ $tagsCollectionHolder.data('index', $tagsCollectionHolder.find('input').length);
- $addTagButton.on('click', function(e) {
+ $('body').on('click', '.add_item_link', function(e) {
+ var $collectionHolderClass = $(e.currentTarget).data('collectionHolderClass');
// add a new tag form (see next code block)
- addTagForm($collectionHolder, $newLinkLi);
- });
+ addFormToCollection($collectionHolderClass);
+ })
});
The ``addTagForm()`` function's job will be to use the ``data-prototype`` attribute
@@ -319,7 +316,10 @@ one example:
.. code-block:: javascript
- function addTagForm($collectionHolder, $newLinkLi) {
+ function addFormToCollection($collectionHolderClass) {
+ // Get the ul that holds the collection of tags
+ var $collectionHolder = $('.' + $collectionHolderClass);
+
// Get the data-prototype explained earlier
var prototype = $collectionHolder.data('prototype');
@@ -341,7 +341,8 @@ one example:
// Display the form in the page in an li, before the "Add a tag" link li
var $newFormLi = $('').append(newForm);
- $newLinkLi.before($newFormLi);
+ // Add the new form at the end of the list
+ $collectionHolder.append($newFormLi)
}
.. note::
From acfe6b620538d4bc21b9e2d9bd81bb8be0aef4fb Mon Sep 17 00:00:00 2001
From: Wouter de Jong
Date: Thu, 5 Nov 2020 15:11:29 +0100
Subject: [PATCH 0098/5766] [#14340] Some minor textual changes
---
form/form_collections.rst | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/form/form_collections.rst b/form/form_collections.rst
index 068b4c84985..405ffed53e4 100644
--- a/form/form_collections.rst
+++ b/form/form_collections.rst
@@ -280,14 +280,12 @@ On the rendered page, the result will look something like this:
and you need to adjust the following JavaScript accordingly.
The goal of this section will be to use JavaScript to read this attribute
-and dynamically add new tag forms when the user clicks a "Add a tag" link.
+and dynamically add new tag forms when the user clicks the "Add a tag" button.
This example uses jQuery and assumes you have it included somewhere on your page.
-Add a ``script`` tag somewhere on your page so you can start writing some JavaScript.
-
-First, add a link to the bottom of the "tags" list via JavaScript. Second,
-bind to the "click" event of that link so you can add a new tag form (``addTagForm()``
-will be show next):
+Add a ``script`` tag somewhere on your page so you can start writing some
+JavaScript. In this script, bind to the "click" event of the "Add a tag"
+button so you can add a new tag form (``addFormToCollection()`` will be show next):
.. code-block:: javascript
From 4bdab6fb8fc7f06eb05b3c5141a1ed415b1b035c Mon Sep 17 00:00:00 2001
From: Laurent VOULLEMIER
Date: Sun, 3 May 2020 21:36:09 +0200
Subject: [PATCH 0099/5766] Add wither behavior with PHP8 static return type
---
service_container/calls.rst | 19 ++++++++++++++++---
1 file changed, 16 insertions(+), 3 deletions(-)
diff --git a/service_container/calls.rst b/service_container/calls.rst
index 11dea241613..8496caa724a 100644
--- a/service_container/calls.rst
+++ b/service_container/calls.rst
@@ -90,9 +90,6 @@ instead of mutating the object they were called on::
{
private $logger;
- /**
- * @return static
- */
public function withLogger(LoggerInterface $logger)
{
$new = clone $this;
@@ -146,3 +143,19 @@ The configuration to tell the container it should do so would be like:
$container->register(MessageGenerator::class)
->addMethodCall('withLogger', [new Reference('logger')], true);
+
+If autowire is enabled, you can also use annotations; with the previous exemple it would be::
+
+ /**
+ * @required
+ * @return static
+ */
+ public function withLogger(LoggerInterface $logger)
+ {
+ $new = clone $this;
+ $new->logger = $logger;
+
+ return $new;
+ }
+
+You can also leverage the PHP8 ``static`` return type instead of the ``@return static`` annotation. Note if you don't want a method with a PHP8 ``static`` return type and a ``@required`` annotation to behave as a wither, you can add a ``@return $this`` annotation to disable the *returns clone* feature.
From 281d758f331081bf27e6046958169474b5bff53c Mon Sep 17 00:00:00 2001
From: Wouter de Jong
Date: Thu, 5 Nov 2020 16:12:49 +0100
Subject: [PATCH 0100/5766] [#13619] Moved text into a note and added
versionadded
---
service_container/calls.rst | 36 ++++++++++++++++++++++++------------
1 file changed, 24 insertions(+), 12 deletions(-)
diff --git a/service_container/calls.rst b/service_container/calls.rst
index 8496caa724a..7f12a38ac4c 100644
--- a/service_container/calls.rst
+++ b/service_container/calls.rst
@@ -144,18 +144,30 @@ The configuration to tell the container it should do so would be like:
$container->register(MessageGenerator::class)
->addMethodCall('withLogger', [new Reference('logger')], true);
-If autowire is enabled, you can also use annotations; with the previous exemple it would be::
+.. tip::
- /**
- * @required
- * @return static
- */
- public function withLogger(LoggerInterface $logger)
- {
- $new = clone $this;
- $new->logger = $logger;
+ If autowire is enabled, you can also use annotations; with the previous
+ example it would be::
- return $new;
- }
+ /**
+ * @required
+ * @return static
+ */
+ public function withLogger(LoggerInterface $logger)
+ {
+ $new = clone $this;
+ $new->logger = $logger;
+
+ return $new;
+ }
+
+ You can also leverage the PHP 8 ``static`` return type instead of the
+ ``@return static`` annotation. If you don't want a method with a
+ PHP 8 ``static`` return type and a ``@required`` annotation to behave as
+ a wither, you can add a ``@return $this`` annotation to disable the
+ *returns clone* feature.
+
+ .. versionadded:: 5.1
-You can also leverage the PHP8 ``static`` return type instead of the ``@return static`` annotation. Note if you don't want a method with a PHP8 ``static`` return type and a ``@required`` annotation to behave as a wither, you can add a ``@return $this`` annotation to disable the *returns clone* feature.
+ Support for the PHP 8 ``static`` return type was introduced in
+ Symfony 5.1.
From 9176faa6375ed46433c14487f9753425b75f1cef Mon Sep 17 00:00:00 2001
From: LucileDT
Date: Wed, 13 May 2020 17:56:48 +0200
Subject: [PATCH 0101/5766] Add array example on ChoiceType choice_attr option
---
reference/forms/types/options/choice_attr.rst.inc | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/reference/forms/types/options/choice_attr.rst.inc b/reference/forms/types/options/choice_attr.rst.inc
index ac149f3999d..b86b7450778 100644
--- a/reference/forms/types/options/choice_attr.rst.inc
+++ b/reference/forms/types/options/choice_attr.rst.inc
@@ -13,6 +13,20 @@ If an array, the keys of the ``choices`` array must be used as keys::
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
// ...
+ $builder->add('fruits', ChoiceType::class, [
+ 'choices' => [
+ 'Apple' => 1,
+ 'Banana' => 2,
+ 'Durian' => 3,
+ ],
+ 'choice_attr' => [
+ 'Apple' => ['data-color' => 'Red'],
+ 'Banana' => ['data-color' => 'Yellow'],
+ 'Durian' => ['data-color' => 'Green'],
+ ],
+ ]);
+
+ // or use a callable
$builder->add('attending', ChoiceType::class, [
'choices' => [
'Yes' => true,
From 0163ab399562c2a84acee070dee73b79d843434d Mon Sep 17 00:00:00 2001
From: armin-github
Date: Thu, 27 Feb 2020 17:50:51 +0100
Subject: [PATCH 0102/5766] addressed issue #11786
The following issue has been addressed: Repeated entry in the Serializer components doc #11786
The separate documentations for XMLEncoder were put into one section with minor changes in text. The documentation now contains one single section for XMLEncoder.
---
components/serializer.rst | 110 +++++++++++++++-----------------------
1 file changed, 42 insertions(+), 68 deletions(-)
diff --git a/components/serializer.rst b/components/serializer.rst
index eba1e0a57cc..fdc34fb6f44 100644
--- a/components/serializer.rst
+++ b/components/serializer.rst
@@ -841,8 +841,20 @@ The ``XmlEncoder`` will encode this object like that::
1
-Be aware that this encoder will consider keys beginning with ``@`` as attributes, and will use
-the key ``#comment`` for encoding XML comments::
+The special ``#`` key can be used to define the data of a node::
+
+ ['foo' => ['@bar' => 'value', '#' => 'baz']];
+
+ // is encoded as follows:
+ //
+ //
+ //
+ // baz
+ //
+ //
+
+Furthermore, keys beginning with ``@`` will be considered attributes, and
+the key ``#comment`` can be used for encoding XML comments::
$encoder = new XmlEncoder();
$encoder->encode([
@@ -869,6 +881,34 @@ always as a collection.
changed with the optional ``$encoderIgnoredNodeTypes`` argument of the
``XmlEncoder`` class constructor.
+The ``XmlEncoder`` Context Options
+..................................
+
+The ``encode()`` method defines a third optional parameter called ``context``
+which defines the configuration options for the XmlEncoder an associative array::
+
+ $xmlEncoder->encode($array, 'xml', $context);
+
+These are the options available:
+
+``xml_format_output``
+ If set to true, formats the generated XML with line breaks and indentation.
+
+``xml_version``
+ Sets the XML version attribute (default: ``1.1``).
+
+``xml_encoding``
+ Sets the XML encoding attribute (default: ``utf-8``).
+
+``xml_standalone``
+ Adds standalone attribute in the generated XML (default: ``true``).
+
+``xml_root_node_name``
+ Sets the root node name (default: ``response``).
+
+``remove_empty_tags``
+ If set to true, removes all empty tags in the generated XML (default: ``false``).
+
The ``YamlEncoder``
~~~~~~~~~~~~~~~~~~~
@@ -1192,72 +1232,6 @@ you indicate that you're expecting an array instead of a single object::
$data = ...; // The serialized data from the previous example
$persons = $serializer->deserialize($data, 'Acme\Person[]', 'json');
-The ``XmlEncoder``
-------------------
-
-This encoder transforms arrays into XML and vice versa. For example, take an
-object normalized as following::
-
- ['foo' => [1, 2], 'bar' => true];
-
-The ``XmlEncoder`` encodes this object as follows:
-
-.. code-block:: xml
-
-
-
- 1
- 2
- 1
-
-
-The array keys beginning with ``@`` are considered XML attributes::
-
- ['foo' => ['@bar' => 'value']];
-
- // is encoded as follows:
- //
- //
- //
- //
-
-Use the special ``#`` key to define the data of a node::
-
- ['foo' => ['@bar' => 'value', '#' => 'baz']];
-
- // is encoded as follows:
- //
- //
- // baz
- //
-
-Context
-~~~~~~~
-
-The ``encode()`` method defines a third optional parameter called ``context``
-which defines the configuration options for the XmlEncoder an associative array::
-
- $xmlEncoder->encode($array, 'xml', $context);
-
-These are the options available:
-
-``xml_format_output``
- If set to true, formats the generated XML with line breaks and indentation.
-
-``xml_version``
- Sets the XML version attribute (default: ``1.1``).
-
-``xml_encoding``
- Sets the XML encoding attribute (default: ``utf-8``).
-
-``xml_standalone``
- Adds standalone attribute in the generated XML (default: ``true``).
-
-``xml_root_node_name``
- Sets the root node name (default: ``response``).
-
-``remove_empty_tags``
- If set to true, removes all empty tags in the generated XML (default: ``false``).
The ``CsvEncoder``
------------------
From adf1978d322bcf2977cdc7c5c8ce01a4b5402886 Mon Sep 17 00:00:00 2001
From: Maarten de Keizer
Date: Sun, 8 Nov 2020 10:08:32 +0100
Subject: [PATCH 0103/5766] Correct case of suffix in example rate limiter
The suffix should be with an uppercase (`limiter` -> `Limiter)
---
rate_limiter.rst | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/rate_limiter.rst b/rate_limiter.rst
index 22a56168498..f5473607fe7 100644
--- a/rate_limiter.rst
+++ b/rate_limiter.rst
@@ -129,7 +129,7 @@ the number of requests to the API::
class ApiController extends AbstractController
{
// if you're using service autowiring, the variable name must be:
- // "rate limiter name" (in camelCase) + "limiter" suffix
+ // "rate limiter name" (in camelCase) + "Limiter" suffix
public function index(RateLimiterFactory $anonymousApiLimiter)
{
// create a limiter based on a unique identifier of the client
From d397c38b43ba4fddcc49326ae1d415049e805d69 Mon Sep 17 00:00:00 2001
From: Wouter de Jong
Date: Thu, 5 Nov 2020 18:47:02 +0100
Subject: [PATCH 0104/5766] Merge encoder sections and show options in a table
---
components/serializer.rst | 108 ++++++++++++++++----------------------
1 file changed, 44 insertions(+), 64 deletions(-)
diff --git a/components/serializer.rst b/components/serializer.rst
index fdc34fb6f44..20d31fa8c0c 100644
--- a/components/serializer.rst
+++ b/components/serializer.rst
@@ -823,6 +823,38 @@ The ``CsvEncoder``
The ``CsvEncoder`` encodes to and decodes from CSV.
+The ``CsvEncoder`` Context Options
+..................................
+
+The ``encode()`` method defines a third optional parameter called ``context``
+which defines the configuration options for the CsvEncoder an associative array::
+
+ $csvEncoder->encode($array, 'csv', $context);
+
+These are the options available:
+
+======================= ==================================================== ==========================
+Option Description Default
+======================= ==================================================== ==========================
+``csv_delimiter`` Sets the field delimiter separating values (one ``,``
+ character only)
+``csv_enclosure`` Sets the field enclosure (one character only) ``"``
+``csv_escape_char`` Sets the escape character (at most one character)
+``csv_key_separator`` Sets the separator for array's keys during its ``.``
+ flattening
+``csv_headers`` Sets the headers for the data ``[]``, inferred from input data's keys
+``csv_escape_formulas`` Escapes fields containg formulas by prepending them ``false``
+ with a ``\t`` character
+``as_collection`` Always returns results as a collection, even if only
+ one line is decoded.
+``no_headers`` Disables header in the encoded CSV ``false``
+``output_utf8_bom`` Outputs special `UTF-8 BOM`_ along with encoded data ``false``
+======================= ==================================================== ==========================
+
+.. versionadded:: 4.4
+
+ The ``output_utf8_bom`` option was introduced in Symfony 4.4.
+
The ``XmlEncoder``
~~~~~~~~~~~~~~~~~~
@@ -891,23 +923,18 @@ which defines the configuration options for the XmlEncoder an associative array:
These are the options available:
-``xml_format_output``
- If set to true, formats the generated XML with line breaks and indentation.
-
-``xml_version``
- Sets the XML version attribute (default: ``1.1``).
-
-``xml_encoding``
- Sets the XML encoding attribute (default: ``utf-8``).
-
-``xml_standalone``
- Adds standalone attribute in the generated XML (default: ``true``).
-
-``xml_root_node_name``
- Sets the root node name (default: ``response``).
-
-``remove_empty_tags``
- If set to true, removes all empty tags in the generated XML (default: ``false``).
+====================== ==================================================== ==========================
+Option Description Default
+====================== ==================================================== ==========================
+``xml_format_output`` If set to true, formats the generated XML with line
+ breaks and indentation.
+``xml_version`` Sets the XML version attribute ``1.1``
+``xml_encoding`` Sets the XML encoding attribute ``utf-8``
+``xml_standalone`` Adds standalone attribute in the generated XML ``true``
+``xml_root_node_name`` Sets the root node name (default: ``response``).
+``remove_empty_tags`` If set to true, removes all empty tags in the ``false``
+ generated XML
+====================== ==================================================== ==========================
The ``YamlEncoder``
~~~~~~~~~~~~~~~~~~~
@@ -1232,53 +1259,6 @@ you indicate that you're expecting an array instead of a single object::
$data = ...; // The serialized data from the previous example
$persons = $serializer->deserialize($data, 'Acme\Person[]', 'json');
-
-The ``CsvEncoder``
-------------------
-
-This encoder transforms arrays into CSV and vice versa.
-
-Context
-~~~~~~~
-
-The ``encode()`` method defines a third optional parameter called ``context``
-which defines the configuration options for the CsvEncoder an associative array::
-
- $csvEncoder->encode($array, 'csv', $context);
-
-These are the options available:
-
-``csv_delimiter``
- Sets the field delimiter separating values (one character only, default: ``,``).
-
-``csv_enclosure``
- Sets the field enclosure (one character only, default: ``"``).
-
-``csv_escape_char``
- Sets the escape character (at most one character, default: empty string).
-
-``csv_key_separator``
- Sets the separator for array's keys during its flattening (default: ``.``).
-
-``csv_headers``
- Sets the headers for the data (default: ``[]``, inferred from input data's keys).
-
-``csv_escape_formulas``
- Escapes fields containg formulas by prepending them with a ``\t`` character (default: ``false``).
-
-``as_collection``
- Always returns results as a collection, even if only one line is decoded.
-
-``no_headers``
- Disables header in the encoded CSV (default: ``false``).
-
-``output_utf8_bom``
- Outputs special `UTF-8 BOM`_ along with encoded data (default: ``false``).
-
-.. versionadded:: 4.4
-
- The ``output_utf8_bom`` option was introduced in Symfony 4.4.
-
Handling Constructor Arguments
------------------------------
From bdbd7a697ea722e4a5e076b590d52e4472f06521 Mon Sep 17 00:00:00 2001
From: Yoann Chocteau
Date: Mon, 9 Nov 2020 09:28:21 +0100
Subject: [PATCH 0105/5766] Update simple-example.rst
Just a little typo, now we use ./styles and not ../css
---
frontend/encore/simple-example.rst | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/frontend/encore/simple-example.rst b/frontend/encore/simple-example.rst
index 3d38686ce05..d0ed86a5922 100644
--- a/frontend/encore/simple-example.rst
+++ b/frontend/encore/simple-example.rst
@@ -17,7 +17,7 @@ application: it will *require* all of the dependencies it needs (e.g. jQuery or
// assets/app.js
// ...
- import '../css/app.css';
+ import './styles/app.css';
// var $ = require('jquery');
From 6d51c6c80038ef53d5948837681fd2b46a25c595 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Maxime=20H=C3=A9lias?=
Date: Sun, 4 Oct 2020 04:06:32 +0200
Subject: [PATCH 0106/5766] [Serializer] move note on Custom Normalizer page
about cacheable performance
---
components/serializer.rst | 26 --------------------------
serializer/custom_normalizer.rst | 29 +++++++++++++++++++++++++++++
2 files changed, 29 insertions(+), 26 deletions(-)
diff --git a/components/serializer.rst b/components/serializer.rst
index 345642c9770..515773d18c3 100644
--- a/components/serializer.rst
+++ b/components/serializer.rst
@@ -1499,32 +1499,6 @@ Once configured, the serializer uses the mapping to pick the correct class::
$repository = $serializer->deserialize($serialized, CodeRepository::class, 'json');
// instanceof GitHubCodeRepository
-Performance
------------
-
-To figure which normalizer (or denormalizer) must be used to handle an object,
-the :class:`Symfony\\Component\\Serializer\\Serializer` class will call the
-:method:`Symfony\\Component\\Serializer\\Normalizer\\NormalizerInterface::supportsNormalization`
-(or :method:`Symfony\\Component\\Serializer\\Normalizer\\DenormalizerInterface::supportsDenormalization`)
-of all registered normalizers (or denormalizers) in a loop.
-
-The result of these methods can vary depending on the object to serialize, the
-format and the context. That's why the result **is not cached** by default and
-can result in a significant performance bottleneck.
-
-However, most normalizers (and denormalizers) always return the same result when
-the object's type and the format are the same, so the result can be cached. To
-do so, make those normalizers (and denormalizers) implement the
-:class:`Symfony\\Component\\Serializer\\Normalizer\\CacheableSupportsMethodInterface`
-and return ``true`` when
-:method:`Symfony\\Component\\Serializer\\Normalizer\\CacheableSupportsMethodInterface::hasCacheableSupportsMethod`
-is called.
-
-.. note::
-
- All built-in :ref:`normalizers and denormalizers `
- as well the ones included in `API Platform`_ natively implement this interface.
-
Learn more
----------
diff --git a/serializer/custom_normalizer.rst b/serializer/custom_normalizer.rst
index 9f2e50fdcf1..2c7c7eedf88 100644
--- a/serializer/custom_normalizer.rst
+++ b/serializer/custom_normalizer.rst
@@ -60,3 +60,32 @@ Before using this normalizer in a Symfony application it must be registered as
a service and :doc:`tagged ` with ``serializer.normalizer``.
If you're using the :ref:`default services.yaml configuration `,
this is done automatically!
+
+Performance
+-----------
+
+To figure which normalizer (or denormalizer) must be used to handle an object,
+the :class:`Symfony\\Component\\Serializer\\Serializer` class will call the
+:method:`Symfony\\Component\\Serializer\\Normalizer\\NormalizerInterface::supportsNormalization`
+(or :method:`Symfony\\Component\\Serializer\\Normalizer\\DenormalizerInterface::supportsDenormalization`)
+of all registered normalizers (or denormalizers) in a loop.
+
+The result of these methods can vary depending on the object to serialize, the
+format and the context. That's why the result **is not cached** by default and
+can result in a significant performance bottleneck.
+
+However, most normalizers (and denormalizers) always return the same result when
+the object's type and the format are the same, so the result can be cached. To
+do so, make those normalizers (and denormalizers) implement the
+:class:`Symfony\\Component\\Serializer\\Normalizer\\CacheableSupportsMethodInterface`
+and return ``true`` when
+:method:`Symfony\\Component\\Serializer\\Normalizer\\CacheableSupportsMethodInterface::hasCacheableSupportsMethod`
+is called.
+
+.. note::
+
+ All built-in :ref:`normalizers and denormalizers `
+ as well the ones included in `API Platform`_ natively implement this interface.
+
+.. _`API Platform`: https://api-platform.com
+
From cca746686382f80f3a9307915d92669e9c3c6d5e Mon Sep 17 00:00:00 2001
From: Romain Monteil
Date: Thu, 5 Nov 2020 15:18:19 +0100
Subject: [PATCH 0107/5766] [Encore] Fix CSS path
---
frontend/encore/installation.rst | 2 +-
frontend/encore/simple-example.rst | 10 +++++-----
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/frontend/encore/installation.rst b/frontend/encore/installation.rst
index 8241dbcd0b2..bbd6469a1c3 100644
--- a/frontend/encore/installation.rst
+++ b/frontend/encore/installation.rst
@@ -143,7 +143,7 @@ Next, open the new ``assets/app.js`` file which contains some JavaScript code
*/
// any CSS you import will output into a single css file (app.css in this case)
- import '../css/app.css';
+ import './styles/app.css';
// Need jQuery? Install it with "yarn add jquery", then uncomment to import it.
// import $ from 'jquery';
diff --git a/frontend/encore/simple-example.rst b/frontend/encore/simple-example.rst
index d0ed86a5922..23c215b1105 100644
--- a/frontend/encore/simple-example.rst
+++ b/frontend/encore/simple-example.rst
@@ -19,7 +19,7 @@ application: it will *require* all of the dependencies it needs (e.g. jQuery or
import './styles/app.css';
- // var $ = require('jquery');
+ // import $ from 'jquery';
Encore's job (via Webpack) is simple: to read and follow *all* of the ``require()``
statements and create one final ``app.js`` (and ``app.css``) that contains *everything*
@@ -204,8 +204,8 @@ To import values, use ``import``:
.. code-block:: diff
// assets/app.js
- - require('../css/app.css');
- + import '../css/app.css';
+ - require('../styles/app.css');
+ + import './styles/app.css';
- var $ = require('jquery');
+ import $ from 'jquery';
@@ -292,8 +292,8 @@ file to ``app.scss`` and update the ``import`` statement:
.. code-block:: diff
// assets/app.js
- - import '../css/app.css';
- + import '../css/app.scss';
+ - import './styles/app.css';
+ + import './styles/app.scss';
Then, tell Encore to enable the Sass pre-processor:
From 66491462f0cc583c4b4fab40c7901bd3dcf84d51 Mon Sep 17 00:00:00 2001
From: Greg Suraci
Date: Tue, 10 Nov 2020 08:11:38 +0100
Subject: [PATCH 0108/5766] Remove simple quotes in
config/routes/annotations.yaml
I find it weird to have both quoted and un-quoted values for `resource:` key in this code block.
I went to an actual project to double check the content of `config/routes/annotations.yaml` provided by the recipe (https://github.com/symfony/recipes/blob/master/doctrine/annotations/1.0/config/routes/annotations.yaml) and found out that both `resource:` are unquoted.
Versions : 4.4, 5.0, 5.1, 5.2
Have a good day ;)
---
routing.rst | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/routing.rst b/routing.rst
index cfcbeb39b73..5fd4ad30225 100644
--- a/routing.rst
+++ b/routing.rst
@@ -36,7 +36,7 @@ following configuration file:
# config/routes/annotations.yaml
controllers:
- resource: '../../src/Controller/'
+ resource: ../../src/Controller/
type: annotation
kernel:
From 2c0cad0155fe7ec66b5f853388e40d6acb149b22 Mon Sep 17 00:00:00 2001
From: Youssef Benhssaien
Date: Wed, 11 Nov 2020 08:34:42 +0100
Subject: [PATCH 0109/5766] Use int type instead integer
Uses the same type hint `int` for all the page
Used in `optimizations` config
---
reference/configuration/twig.rst | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/reference/configuration/twig.rst b/reference/configuration/twig.rst
index e00d7f63958..055568b1f2e 100644
--- a/reference/configuration/twig.rst
+++ b/reference/configuration/twig.rst
@@ -269,7 +269,7 @@ every ``number_format`` filter call.
decimals
........
-**type**: ``integer`` **default**: ``0``
+**type**: ``int`` **default**: ``0``
The number of decimals used to format numeric values when no specific number is
passed as argument to the ``number_format`` filter.
From beea71cbcbac5af0104886aee217968981bfc1a2 Mon Sep 17 00:00:00 2001
From: Kamil P
Date: Mon, 9 Nov 2020 09:09:22 +0100
Subject: [PATCH 0110/5766] Update mailer.rst
The registeted namespace is "styles", not "css".
---
mailer.rst | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mailer.rst b/mailer.rst
index 025a5c43813..ac83f41fe1e 100644
--- a/mailer.rst
+++ b/mailer.rst
@@ -586,7 +586,7 @@ arguments to the filter:
.. code-block:: html+twig
- {% apply inline_css(source('@css/email.css')) %}
+ {% apply inline_css(source('@styles/email.css')) %}
{# ... #}
{% endapply %}
From b3ef599517f14edf6be9ec602faa3c97f51512ac Mon Sep 17 00:00:00 2001
From: Youssef Benhssaien
Date: Wed, 11 Nov 2020 08:44:53 +0100
Subject: [PATCH 0113/5766] add html extension to snake_case recommendation
examples
Some readers may inconsciently memorize the syntax `file_name.twig` and ignores the second `recommendation` (declaring two extension `html.twig`), it can happen if someone looks only for `snak_case` keyword without reading whole page.
I suggest to add `html` extension on the first examples to make sure recommendations cannot escape reader.
---
templates.rst | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/templates.rst b/templates.rst
index f415eaa82e3..1431e0244a9 100644
--- a/templates.rst
+++ b/templates.rst
@@ -118,8 +118,8 @@ Template Naming
Symfony recommends the following for template names:
-* Use `snake case`_ for filenames and directories (e.g. ``blog_posts.twig``,
- ``admin/default_theme/blog/index.twig``, etc.);
+* Use `snake case`_ for filenames and directories (e.g. ``blog_posts.html.twig``,
+ ``admin/default_theme/blog/index.html.twig``, etc.);
* Define two extensions for filenames (e.g. ``index.html.twig`` or
``blog_posts.xml.twig``) being the first extension (``html``, ``xml``, etc.)
the final format that the template will generate.
From 35474186058890bf32c6fa286425ce6cf1a27225 Mon Sep 17 00:00:00 2001
From: Youssef Benhssaien
Date: Wed, 11 Nov 2020 09:23:48 +0100
Subject: [PATCH 0114/5766] Throw Exception if twig variable is not found
An exception of type `Twig\Error\RuntimeError` is thrown when a variable is not found and `strict_variables` is enabled
---
templates.rst | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/templates.rst b/templates.rst
index 1431e0244a9..67fdf4a07ef 100644
--- a/templates.rst
+++ b/templates.rst
@@ -164,7 +164,7 @@ in the following order:
#. ``$foo->getBar()`` (object and *getter* method);
#. ``$foo->isBar()`` (object and *isser* method);
#. ``$foo->hasBar()`` (object and *hasser* method);
-#. If none of the above exists, use ``null``.
+#. If none of the above exists, use ``null`` or throw a ``Twig\Error\RuntimeError`` exception if ``strict_variables`` config is enabled.
This allows to evolve your application code without having to change the
template code (you can start with array variables for the application proof of
From 6d1fac84859b31e8de699f2a62c5e75d334ea3c7 Mon Sep 17 00:00:00 2001
From: Javier Eguiluz
Date: Thu, 12 Nov 2020 10:21:51 +0100
Subject: [PATCH 0115/5766] Tweak
---
reference/configuration/twig.rst | 2 ++
templates.rst | 4 +++-
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/reference/configuration/twig.rst b/reference/configuration/twig.rst
index 1d11db3e3da..96f596d1db6 100644
--- a/reference/configuration/twig.rst
+++ b/reference/configuration/twig.rst
@@ -382,6 +382,8 @@ the directory defined in the :ref:`default_path option `.
+.. _config-twig-strict-variables:
+
strict_variables
~~~~~~~~~~~~~~~~
diff --git a/templates.rst b/templates.rst
index 67fdf4a07ef..09314868c2d 100644
--- a/templates.rst
+++ b/templates.rst
@@ -164,7 +164,9 @@ in the following order:
#. ``$foo->getBar()`` (object and *getter* method);
#. ``$foo->isBar()`` (object and *isser* method);
#. ``$foo->hasBar()`` (object and *hasser* method);
-#. If none of the above exists, use ``null`` or throw a ``Twig\Error\RuntimeError`` exception if ``strict_variables`` config is enabled.
+#. If none of the above exists, use ``null`` (or throw a ``Twig\Error\RuntimeError``
+ exception if the :ref:`strict_variables `
+ option is enabled).
This allows to evolve your application code without having to change the
template code (you can start with array variables for the application proof of
From 1e4a70f50564bb01b5cab5111797f02cc3016ea6 Mon Sep 17 00:00:00 2001
From: Alessio Pierobon
Date: Wed, 11 Nov 2020 00:07:48 +0100
Subject: [PATCH 0116/5766] Fix a typo on Messenger handler results example
---
messenger/handler_results.rst | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/messenger/handler_results.rst b/messenger/handler_results.rst
index dc4c1fd0821..2ab36a2b40d 100644
--- a/messenger/handler_results.rst
+++ b/messenger/handler_results.rst
@@ -40,7 +40,7 @@ handler is registered. The ``HandleTrait`` can be used in any class that has a
namespace App\Action;
use App\Message\ListItemsQuery;
- use App\MessageHandler\ListItemsQueryResult;
+ use App\MessageHandler\ListItemsResult;
use Symfony\Component\Messenger\HandleTrait;
use Symfony\Component\Messenger\MessageBusInterface;
From d84c04c25043e92f0aa28b47d1696dcb424254fe Mon Sep 17 00:00:00 2001
From: Javier Eguiluz
Date: Thu, 12 Nov 2020 10:26:50 +0100
Subject: [PATCH 0117/5766] Tweak
---
messenger/handler_results.rst | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/messenger/handler_results.rst b/messenger/handler_results.rst
index 2ab36a2b40d..ee3b09dc99d 100644
--- a/messenger/handler_results.rst
+++ b/messenger/handler_results.rst
@@ -40,7 +40,7 @@ handler is registered. The ``HandleTrait`` can be used in any class that has a
namespace App\Action;
use App\Message\ListItemsQuery;
- use App\MessageHandler\ListItemsResult;
+ use App\MessageHandler\ListItemsQueryResult;
use Symfony\Component\Messenger\HandleTrait;
use Symfony\Component\Messenger\MessageBusInterface;
@@ -62,7 +62,7 @@ handler is registered. The ``HandleTrait`` can be used in any class that has a
}
// Creating such a method is optional, but allows type-hinting the result
- private function query(ListItemsQuery $query): ListItemsResult
+ private function query(ListItemsQuery $query): ListItemsQueryResult
{
return $this->handle($query);
}
From fc220753a708416e2f007f9317bae266b0ffee2e Mon Sep 17 00:00:00 2001
From: Youssef Benhssaien
Date: Thu, 12 Nov 2020 12:04:48 +0100
Subject: [PATCH 0118/5766] Use integer typehint instead int
---
reference/configuration/twig.rst | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/reference/configuration/twig.rst b/reference/configuration/twig.rst
index 055568b1f2e..100d168b792 100644
--- a/reference/configuration/twig.rst
+++ b/reference/configuration/twig.rst
@@ -269,7 +269,7 @@ every ``number_format`` filter call.
decimals
........
-**type**: ``int`` **default**: ``0``
+**type**: ``integer`` **default**: ``0``
The number of decimals used to format numeric values when no specific number is
passed as argument to the ``number_format`` filter.
@@ -294,7 +294,7 @@ no specific character is passed as argument to the ``number_format`` filter.
optimizations
~~~~~~~~~~~~~
-**type**: ``int`` **default**: ``-1``
+**type**: ``integer`` **default**: ``-1``
Twig includes an extension called ``optimizer`` which is enabled by default in
Symfony applications. This extension analyzes the templates to optimize them
From 120290daedd1f928c7c78d781d3911f4d754a60f Mon Sep 17 00:00:00 2001
From: Youssef BENHSSAIEN
Date: Thu, 12 Nov 2020 14:16:44 +0100
Subject: [PATCH 0119/5766] Replace bool by boolean
---
reference/configuration/framework.rst | 4 ++--
reference/constraints/AtLeastOneOf.rst | 2 +-
reference/constraints/Hostname.rst | 2 +-
reference/constraints/NotBlank.rst | 2 +-
reference/constraints/Traverse.rst | 2 +-
reference/forms/types/color.rst | 2 +-
reference/forms/types/options/help_html.rst.inc | 2 +-
reference/forms/types/options/label_html.rst.inc | 2 +-
8 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/reference/configuration/framework.rst b/reference/configuration/framework.rst
index d4058e76c82..c353f73f163 100644
--- a/reference/configuration/framework.rst
+++ b/reference/configuration/framework.rst
@@ -801,7 +801,7 @@ outgoing network interface.
buffer
......
-**type**: ``bool`` | ``Closure``
+**type**: ``boolean`` | ``Closure``
Buffering the response means that you can access its content multiple times
without performing the request again. Buffering is enabled by default when the
@@ -2851,7 +2851,7 @@ Name of the workflow you want to create.
audit_trail
"""""""""""
-**type**: ``bool``
+**type**: ``boolean``
If set to ``true``, the :class:`Symfony\\Component\\Workflow\\EventListener\\AuditTrailListener`
will be enabled.
diff --git a/reference/constraints/AtLeastOneOf.rst b/reference/constraints/AtLeastOneOf.rst
index 6a48c44a4fd..b69894184d6 100644
--- a/reference/constraints/AtLeastOneOf.rst
+++ b/reference/constraints/AtLeastOneOf.rst
@@ -163,7 +163,7 @@ has to be satisfied in order for the validation to succeed.
includeInternalMessages
~~~~~~~~~~~~~~~~~~~~~~~
-**type**: ``bool`` **default**: ``true``
+**type**: ``boolean`` **default**: ``true``
If set to ``true``, the message that is shown if the validation fails,
will include the list of messages for the internal constraints. See option
diff --git a/reference/constraints/Hostname.rst b/reference/constraints/Hostname.rst
index 4cbe606ccb4..a08425f5fa2 100644
--- a/reference/constraints/Hostname.rst
+++ b/reference/constraints/Hostname.rst
@@ -117,7 +117,7 @@ Parameter Description
``requireTld``
~~~~~~~~~~~~~~
-**type**: ``bool`` **default**: ``true``
+**type**: ``boolean`` **default**: ``true``
By default, hostnames are considered valid only when they are fully qualified
and include their TLDs (top-level domain names). For instance, ``example.com``
diff --git a/reference/constraints/NotBlank.rst b/reference/constraints/NotBlank.rst
index c3c16f21eae..a87b8696824 100644
--- a/reference/constraints/NotBlank.rst
+++ b/reference/constraints/NotBlank.rst
@@ -85,7 +85,7 @@ Options
allowNull
~~~~~~~~~
-**type**: ``bool`` **default**: ``false``
+**type**: ``boolean`` **default**: ``false``
If set to ``true``, ``null`` values are considered valid and won't trigger a
constraint violation.
diff --git a/reference/constraints/Traverse.rst b/reference/constraints/Traverse.rst
index 852f17cdd01..aea7e051ee1 100644
--- a/reference/constraints/Traverse.rst
+++ b/reference/constraints/Traverse.rst
@@ -146,7 +146,7 @@ The ``groups`` option is not available for this constraint.
``traverse``
~~~~~~~~~~~~
-**type**: ``bool`` **default**: ``true``
+**type**: ``boolean`` **default**: ``true``
Instances of ``\Traversable`` are traversed by default, use this option to
disable validating:
diff --git a/reference/forms/types/color.rst b/reference/forms/types/color.rst
index a290b31e673..5dfd61915ce 100644
--- a/reference/forms/types/color.rst
+++ b/reference/forms/types/color.rst
@@ -49,7 +49,7 @@ Field Options
html5
~~~~~
-**type**: ``bool`` **default**: ``false``
+**type**: ``boolean`` **default**: ``false``
.. versionadded:: 5.1
diff --git a/reference/forms/types/options/help_html.rst.inc b/reference/forms/types/options/help_html.rst.inc
index 83bbe583ca6..2a5dccfb32e 100644
--- a/reference/forms/types/options/help_html.rst.inc
+++ b/reference/forms/types/options/help_html.rst.inc
@@ -1,7 +1,7 @@
help_html
~~~~~~~~~
-**type**: ``bool`` **default**: ``false``
+**type**: ``boolean`` **default**: ``false``
By default, the contents of the ``help`` option are escaped before rendering
them in the template. Set this option to ``true`` to not escape them, which is
diff --git a/reference/forms/types/options/label_html.rst.inc b/reference/forms/types/options/label_html.rst.inc
index 06568ed08f4..a87ad4ab6db 100644
--- a/reference/forms/types/options/label_html.rst.inc
+++ b/reference/forms/types/options/label_html.rst.inc
@@ -1,7 +1,7 @@
``label_html``
~~~~~~~~~~~~~~
-**type**: ``bool`` **default**: ``false``
+**type**: ``boolean`` **default**: ``false``
.. versionadded:: 5.1
From df7682967fc887e516779ea015b4787728f69d6e Mon Sep 17 00:00:00 2001
From: Youssef Benhssaien
Date: Wed, 11 Nov 2020 08:34:42 +0100
Subject: [PATCH 0120/5766] Use integer type instead of int & boolean instead
of bool
---
reference/configuration/framework.rst | 4 ++--
reference/configuration/twig.rst | 2 +-
reference/constraints/AtLeastOneOf.rst | 2 +-
reference/constraints/Hostname.rst | 2 +-
reference/constraints/NotBlank.rst | 2 +-
reference/constraints/Traverse.rst | 2 +-
reference/forms/types/color.rst | 2 +-
reference/forms/types/options/help_html.rst.inc | 2 +-
reference/forms/types/options/label_html.rst.inc | 2 +-
9 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/reference/configuration/framework.rst b/reference/configuration/framework.rst
index d4058e76c82..c353f73f163 100644
--- a/reference/configuration/framework.rst
+++ b/reference/configuration/framework.rst
@@ -801,7 +801,7 @@ outgoing network interface.
buffer
......
-**type**: ``bool`` | ``Closure``
+**type**: ``boolean`` | ``Closure``
Buffering the response means that you can access its content multiple times
without performing the request again. Buffering is enabled by default when the
@@ -2851,7 +2851,7 @@ Name of the workflow you want to create.
audit_trail
"""""""""""
-**type**: ``bool``
+**type**: ``boolean``
If set to ``true``, the :class:`Symfony\\Component\\Workflow\\EventListener\\AuditTrailListener`
will be enabled.
diff --git a/reference/configuration/twig.rst b/reference/configuration/twig.rst
index e00d7f63958..100d168b792 100644
--- a/reference/configuration/twig.rst
+++ b/reference/configuration/twig.rst
@@ -294,7 +294,7 @@ no specific character is passed as argument to the ``number_format`` filter.
optimizations
~~~~~~~~~~~~~
-**type**: ``int`` **default**: ``-1``
+**type**: ``integer`` **default**: ``-1``
Twig includes an extension called ``optimizer`` which is enabled by default in
Symfony applications. This extension analyzes the templates to optimize them
diff --git a/reference/constraints/AtLeastOneOf.rst b/reference/constraints/AtLeastOneOf.rst
index 6a48c44a4fd..b69894184d6 100644
--- a/reference/constraints/AtLeastOneOf.rst
+++ b/reference/constraints/AtLeastOneOf.rst
@@ -163,7 +163,7 @@ has to be satisfied in order for the validation to succeed.
includeInternalMessages
~~~~~~~~~~~~~~~~~~~~~~~
-**type**: ``bool`` **default**: ``true``
+**type**: ``boolean`` **default**: ``true``
If set to ``true``, the message that is shown if the validation fails,
will include the list of messages for the internal constraints. See option
diff --git a/reference/constraints/Hostname.rst b/reference/constraints/Hostname.rst
index 4cbe606ccb4..a08425f5fa2 100644
--- a/reference/constraints/Hostname.rst
+++ b/reference/constraints/Hostname.rst
@@ -117,7 +117,7 @@ Parameter Description
``requireTld``
~~~~~~~~~~~~~~
-**type**: ``bool`` **default**: ``true``
+**type**: ``boolean`` **default**: ``true``
By default, hostnames are considered valid only when they are fully qualified
and include their TLDs (top-level domain names). For instance, ``example.com``
diff --git a/reference/constraints/NotBlank.rst b/reference/constraints/NotBlank.rst
index c3c16f21eae..a87b8696824 100644
--- a/reference/constraints/NotBlank.rst
+++ b/reference/constraints/NotBlank.rst
@@ -85,7 +85,7 @@ Options
allowNull
~~~~~~~~~
-**type**: ``bool`` **default**: ``false``
+**type**: ``boolean`` **default**: ``false``
If set to ``true``, ``null`` values are considered valid and won't trigger a
constraint violation.
diff --git a/reference/constraints/Traverse.rst b/reference/constraints/Traverse.rst
index 852f17cdd01..aea7e051ee1 100644
--- a/reference/constraints/Traverse.rst
+++ b/reference/constraints/Traverse.rst
@@ -146,7 +146,7 @@ The ``groups`` option is not available for this constraint.
``traverse``
~~~~~~~~~~~~
-**type**: ``bool`` **default**: ``true``
+**type**: ``boolean`` **default**: ``true``
Instances of ``\Traversable`` are traversed by default, use this option to
disable validating:
diff --git a/reference/forms/types/color.rst b/reference/forms/types/color.rst
index a290b31e673..5dfd61915ce 100644
--- a/reference/forms/types/color.rst
+++ b/reference/forms/types/color.rst
@@ -49,7 +49,7 @@ Field Options
html5
~~~~~
-**type**: ``bool`` **default**: ``false``
+**type**: ``boolean`` **default**: ``false``
.. versionadded:: 5.1
diff --git a/reference/forms/types/options/help_html.rst.inc b/reference/forms/types/options/help_html.rst.inc
index 83bbe583ca6..2a5dccfb32e 100644
--- a/reference/forms/types/options/help_html.rst.inc
+++ b/reference/forms/types/options/help_html.rst.inc
@@ -1,7 +1,7 @@
help_html
~~~~~~~~~
-**type**: ``bool`` **default**: ``false``
+**type**: ``boolean`` **default**: ``false``
By default, the contents of the ``help`` option are escaped before rendering
them in the template. Set this option to ``true`` to not escape them, which is
diff --git a/reference/forms/types/options/label_html.rst.inc b/reference/forms/types/options/label_html.rst.inc
index 06568ed08f4..a87ad4ab6db 100644
--- a/reference/forms/types/options/label_html.rst.inc
+++ b/reference/forms/types/options/label_html.rst.inc
@@ -1,7 +1,7 @@
``label_html``
~~~~~~~~~~~~~~
-**type**: ``bool`` **default**: ``false``
+**type**: ``boolean`` **default**: ``false``
.. versionadded:: 5.1
From da74408ae32e30e55f527915feb48bec6b5bd724 Mon Sep 17 00:00:00 2001
From: Oskar Stark
Date: Thu, 12 Nov 2020 14:37:29 +0100
Subject: [PATCH 0121/5766] Minor
---
reference/configuration/framework.rst | 4 ++--
reference/configuration/twig.rst | 2 +-
reference/constraints/NotBlank.rst | 2 +-
reference/constraints/Traverse.rst | 2 +-
reference/forms/types/options/help_html.rst.inc | 2 +-
reference/forms/types/timezone.rst | 2 +-
6 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/reference/configuration/framework.rst b/reference/configuration/framework.rst
index f388b5c9eb5..cd76b908c64 100644
--- a/reference/configuration/framework.rst
+++ b/reference/configuration/framework.rst
@@ -829,7 +829,7 @@ outgoing network interface.
buffer
......
-**type**: ``bool`` | ``Closure``
+**type**: ``boolean`` | ``Closure``
Buffering the response means that you can access its content multiple times
without performing the request again. Buffering is enabled by default when the
@@ -2960,7 +2960,7 @@ Name of the workflow you want to create.
audit_trail
"""""""""""
-**type**: ``bool``
+**type**: ``boolean``
If set to ``true``, the :class:`Symfony\\Component\\Workflow\\EventListener\\AuditTrailListener`
will be enabled.
diff --git a/reference/configuration/twig.rst b/reference/configuration/twig.rst
index 96f596d1db6..5fc8b95313c 100644
--- a/reference/configuration/twig.rst
+++ b/reference/configuration/twig.rst
@@ -318,7 +318,7 @@ no specific character is passed as argument to the ``number_format`` filter.
optimizations
~~~~~~~~~~~~~
-**type**: ``int`` **default**: ``-1``
+**type**: ``integer`` **default**: ``-1``
Twig includes an extension called ``optimizer`` which is enabled by default in
Symfony applications. This extension analyzes the templates to optimize them
diff --git a/reference/constraints/NotBlank.rst b/reference/constraints/NotBlank.rst
index 19ac9542ec9..342293b2394 100644
--- a/reference/constraints/NotBlank.rst
+++ b/reference/constraints/NotBlank.rst
@@ -85,7 +85,7 @@ Options
allowNull
~~~~~~~~~
-**type**: ``bool`` **default**: ``false``
+**type**: ``boolean`` **default**: ``false``
If set to ``true``, ``null`` values are considered valid and won't trigger a
constraint violation.
diff --git a/reference/constraints/Traverse.rst b/reference/constraints/Traverse.rst
index 852f17cdd01..aea7e051ee1 100644
--- a/reference/constraints/Traverse.rst
+++ b/reference/constraints/Traverse.rst
@@ -146,7 +146,7 @@ The ``groups`` option is not available for this constraint.
``traverse``
~~~~~~~~~~~~
-**type**: ``bool`` **default**: ``true``
+**type**: ``boolean`` **default**: ``true``
Instances of ``\Traversable`` are traversed by default, use this option to
disable validating:
diff --git a/reference/forms/types/options/help_html.rst.inc b/reference/forms/types/options/help_html.rst.inc
index 83bbe583ca6..2a5dccfb32e 100644
--- a/reference/forms/types/options/help_html.rst.inc
+++ b/reference/forms/types/options/help_html.rst.inc
@@ -1,7 +1,7 @@
help_html
~~~~~~~~~
-**type**: ``bool`` **default**: ``false``
+**type**: ``boolean`` **default**: ``false``
By default, the contents of the ``help`` option are escaped before rendering
them in the template. Set this option to ``true`` to not escape them, which is
diff --git a/reference/forms/types/timezone.rst b/reference/forms/types/timezone.rst
index 1cdba0d5d78..9458e3a7d1a 100644
--- a/reference/forms/types/timezone.rst
+++ b/reference/forms/types/timezone.rst
@@ -101,7 +101,7 @@ with the ``choice_translation_locale`` option.
``regions``
~~~~~~~~~~~
-**type**: ``int`` **default**: ``\DateTimeZone::ALL``
+**type**: ``integer`` **default**: ``\DateTimeZone::ALL``
.. deprecated:: 4.2
From 7b5bb01370ce749e2eeaacd6c061008b9f9ca34f Mon Sep 17 00:00:00 2001
From: Oskar Stark
Date: Thu, 12 Nov 2020 11:40:34 +0100
Subject: [PATCH 0122/5766] Enhancement: Add new rule "string_replacement"
---
.doctor-rst.yaml | 1 +
1 file changed, 1 insertion(+)
diff --git a/.doctor-rst.yaml b/.doctor-rst.yaml
index e8f02a9fb05..52a1fc2ba4a 100644
--- a/.doctor-rst.yaml
+++ b/.doctor-rst.yaml
@@ -34,6 +34,7 @@ rules:
short_array_syntax: ~
space_between_label_and_link_in_doc: ~
space_between_label_and_link_in_ref: ~
+ string_replacement: ~
typo: ~
unused_links: ~
use_deprecated_directive_instead_of_versionadded: ~
From 1aa619a120c847a796ce2bebcd37c9189acd8534 Mon Sep 17 00:00:00 2001
From: HypeMC
Date: Fri, 13 Nov 2020 17:49:22 +0100
Subject: [PATCH 0123/5766] Fix broken configuration block
---
lock.rst | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lock.rst b/lock.rst
index 51f375adc33..3fde32ee190 100644
--- a/lock.rst
+++ b/lock.rst
@@ -223,7 +223,7 @@ Named Lock
----------
If the application needs different kind of Stores alongside each other, Symfony
-provides :ref:`named lock `::
+provides :ref:`named lock `:
.. configuration-block::
From 6b7c7fb1bfbdd64052c900423c50e3223abbd9b7 Mon Sep 17 00:00:00 2001
From: wkania <57155526+wkania@users.noreply.github.com>
Date: Sat, 14 Nov 2020 10:40:26 +0100
Subject: [PATCH 0124/5766] [Validator] Remove empty line from annotation
---
reference/constraints/DivisibleBy.rst | 1 -
1 file changed, 1 deletion(-)
diff --git a/reference/constraints/DivisibleBy.rst b/reference/constraints/DivisibleBy.rst
index c93052a248a..f4ae78ab0f8 100644
--- a/reference/constraints/DivisibleBy.rst
+++ b/reference/constraints/DivisibleBy.rst
@@ -33,7 +33,6 @@ The following constraints ensure that:
class Item
{
-
/**
* @Assert\DivisibleBy(0.25)
*/
From b781296cf0e084b00ee8f4f4aee78c7604c60099 Mon Sep 17 00:00:00 2001
From: wkania <57155526+wkania@users.noreply.github.com>
Date: Sat, 14 Nov 2020 15:27:25 +0100
Subject: [PATCH 0125/5766] [Validator] Fix ExpressionLanguageSyntax example
---
reference/constraints/ExpressionLanguageSyntax.rst | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/reference/constraints/ExpressionLanguageSyntax.rst b/reference/constraints/ExpressionLanguageSyntax.rst
index 2ca0355dfaf..18c465e8a9d 100644
--- a/reference/constraints/ExpressionLanguageSyntax.rst
+++ b/reference/constraints/ExpressionLanguageSyntax.rst
@@ -40,13 +40,13 @@ The following constraints ensure that:
class Order
{
/**
- * @Assert\ExpressionLanguageSyntax()
+ * @Assert\ExpressionLanguageSyntax
*/
protected $promotion;
/**
* @Assert\ExpressionLanguageSyntax(
- * allowedVariables = ['user', 'shipping_centers']
+ * allowedVariables={"user", "shipping_centers"}
* )
*/
protected $shippingOptions;
@@ -77,7 +77,10 @@ The following constraints ensure that:
-
+
From 2496ee7b29ea29da22f3da1b2dec6ea062c38dfe Mon Sep 17 00:00:00 2001
From: Arman Hosseini
Date: Sun, 15 Nov 2020 02:16:52 +0330
Subject: [PATCH 0126/5766] Update README.markdown
Clarify the Note section
---
README.markdown | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/README.markdown b/README.markdown
index 1d94f6f1ff0..8923f022322 100644
--- a/README.markdown
+++ b/README.markdown
@@ -11,9 +11,9 @@ Symfony documentation, please read
[Contributing to the Documentation](https://symfony.com/doc/current/contributing/documentation/overview.html)
> **Note**
-> Unless you're documenting a feature that was introduced *after* Symfony 3.4
-> (e.g. in Symfony 4.4), all pull requests must be based off of the **3.4** branch,
-> **not** the master or older branches.
+> All pull requests must be based off of the **3.4** branch,
+> unless you're documenting a feature that was introduced *after* Symfony 3.4
+> (e.g. in Symfony 4.4), **not** the master or older branches.
SymfonyCloud
------------
From a08f0959917ba5a647796759466e3603cbaa8adc Mon Sep 17 00:00:00 2001
From: wkania <57155526+wkania@users.noreply.github.com>
Date: Sat, 14 Nov 2020 10:09:28 +0100
Subject: [PATCH 0127/5766] [Validator] Remove extra space
---
reference/constraints/Isbn.rst | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/reference/constraints/Isbn.rst b/reference/constraints/Isbn.rst
index d2ad1e2c909..2820fce0052 100644
--- a/reference/constraints/Isbn.rst
+++ b/reference/constraints/Isbn.rst
@@ -37,7 +37,7 @@ on an object that will contain an ISBN.
/**
* @Assert\Isbn(
* type = "isbn10",
- * message = "This value is not valid."
+ * message = "This value is not valid."
* )
*/
protected $isbn;
@@ -51,7 +51,7 @@ on an object that will contain an ISBN.
isbn:
- Isbn:
type: isbn10
- message: This value is not valid.
+ message: This value is not valid.
.. code-block:: xml
@@ -65,7 +65,7 @@ on an object that will contain an ISBN.
-
+
From bea2e77e83412a560bc9503ec473e2243551b3e6 Mon Sep 17 00:00:00 2001
From: obsirdian
Date: Sat, 14 Nov 2020 12:44:14 -0600
Subject: [PATCH 0128/5766] Fix user entity import
---
security/user_checkers.rst | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/security/user_checkers.rst b/security/user_checkers.rst
index 83e1dc0554b..d5374e44b03 100644
--- a/security/user_checkers.rst
+++ b/security/user_checkers.rst
@@ -21,8 +21,8 @@ or :class:`Symfony\\Component\\Security\\Core\\Exception\\AuthenticationExceptio
namespace App\Security;
+ use App\Entity\User as AppUser;
use App\Exception\AccountDeletedException;
- use App\Security\User as AppUser;
use Symfony\Component\Security\Core\Exception\AccountExpiredException;
use Symfony\Component\Security\Core\User\UserCheckerInterface;
use Symfony\Component\Security\Core\User\UserInterface;
From 3189563ce824beb9871f4ef27195eed21a3a07d2 Mon Sep 17 00:00:00 2001
From: Arman Hosseini
Date: Sun, 15 Nov 2020 21:48:36 +0330
Subject: [PATCH 0129/5766] Use AppBundle instead of Acme\UserBundle
AppBundle is used in all contexts and it is better to keep this name until the end in this branch.
---
security/named_encoders.rst | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/security/named_encoders.rst b/security/named_encoders.rst
index 803f3d16992..78d3094ebbf 100644
--- a/security/named_encoders.rst
+++ b/security/named_encoders.rst
@@ -52,7 +52,7 @@ to apply to all instances of a specific class:
Another option is to use a "named" encoder and then select which encoder
you want to use dynamically.
-In the previous example, you've set the ``sha512`` algorithm for ``Acme\UserBundle\Entity\User``.
+In the previous example, you've set the ``sha512`` algorithm for ``AppBundle\Entity\User``.
This may be secure enough for a regular user, but what if you want your admins
to have a stronger algorithm, for example ``bcrypt``. This can be done with
named encoders:
@@ -113,8 +113,8 @@ to use it, the class must implement
The interface requires one method - ``getEncoderName()`` - which should return
the name of the encoder to use::
- // src/Acme/UserBundle/Entity/User.php
- namespace Acme\UserBundle\Entity;
+ // src/AppBundle/Entity/User.php
+ namespace AppBundle\Entity\User;
use Symfony\Component\Security\Core\Encoder\EncoderAwareInterface;
use Symfony\Component\Security\Core\User\UserInterface;
From 3a439bddc1646c482f3f6f78894391c0153199da Mon Sep 17 00:00:00 2001
From: Wouter de Jong
Date: Mon, 16 Nov 2020 00:02:25 +0100
Subject: [PATCH 0130/5766] [#14011] Documented the NullToken usage
---
security/experimental_authenticators.rst | 36 ++++++++++++++++++++++++
1 file changed, 36 insertions(+)
diff --git a/security/experimental_authenticators.rst b/security/experimental_authenticators.rst
index d0813795b12..45c0edb882d 100644
--- a/security/experimental_authenticators.rst
+++ b/security/experimental_authenticators.rst
@@ -135,6 +135,42 @@ unauthenticated access (e.g. the login page):
],
]);
+Granting Anonymous Users Access in a Custom Voter
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+.. versionadded:: 5.2
+
+ The ``NullToken`` class was introduced in Symfony 5.2.
+
+If you're using a :doc:`custom voter `, you can allow
+anonymous users access by checking for a special
+:class:`Symfony\\Component\\Security\\Core\\Authentication\\Token\\NullToken`. This token is used
+in the voters to represent the unauthenticated access::
+
+ // src/Security/PostVoter.php
+ namespace App\Security;
+
+ // ...
+ use Symfony\Component\Security\Core\Authentication\Token\NullToken;
+ use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
+ use Symfony\Component\Security\Core\Authorization\Voter\Voter;
+
+ class PostVoter extends Voter
+ {
+ // ...
+
+ protected function voteOnAttribute(string $attribute, $subject, TokenInterface $token): bool
+ {
+ // ...
+
+ if ($token instanceof NullToken) {
+ // the user is not authenticated, e.g. only allow them to
+ // see public posts
+ return $subject->isPublic();
+ }
+ }
+ }
+
.. _authenticators-required-entry-point:
Configuring the Authentication Entry Point
From 0eae59cf1d7b3c8a02d6610127ea89115dd628dd Mon Sep 17 00:00:00 2001
From: Wouter de Jong
Date: Mon, 16 Nov 2020 00:12:03 +0100
Subject: [PATCH 0131/5766] Documented passport attributes
---
security/experimental_authenticators.rst | 37 ++++++++++++++++++++++++
1 file changed, 37 insertions(+)
diff --git a/security/experimental_authenticators.rst b/security/experimental_authenticators.rst
index d0813795b12..0a713e6b0ca 100644
--- a/security/experimental_authenticators.rst
+++ b/security/experimental_authenticators.rst
@@ -502,3 +502,40 @@ authenticator, you would initialize the passport like this::
]);
}
}
+
+.. tip::
+
+ Besides badges, passports can define attributes, which allows the
+ ``authenticate()`` method to store arbitrary information in the
+ passport to access it from other authenticator methods (e.g.
+ ``createAuthenticatedToken()``)::
+
+ // ...
+ use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
+
+ class LoginAuthenticator extends AbstractAuthenticator
+ {
+ // ...
+
+ public function authenticate(Request $request): PassportInterface
+ {
+ // ... process the request
+
+ $passport = new SelfValidatingPassport($username, []);
+
+ // set a custom attribute (e.g. scope)
+ $passport->setAttribute('scope', $oauthScope);
+
+ return $passport;
+ }
+
+ public function createAuthenticatedToken(PassportInterface $passport, string $firewallName): TokenInterface
+ {
+ // read the attribute value
+ return new CustomOauthToken($passport->getUser(), $passport->getAttribute('scope'));
+ }
+ }
+
+.. versionadded:: 5.2
+
+ Passport attributes were introduced in Symfony 5.2.
From 4129e8ece169f80d10741eb2baf2b7ab5af1fb6a Mon Sep 17 00:00:00 2001
From: jmsche
Date: Mon, 16 Nov 2020 11:20:31 +0100
Subject: [PATCH 0132/5766] [Event Dispatcher] Fix typo for __invoke()
---
event_dispatcher.rst | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/event_dispatcher.rst b/event_dispatcher.rst
index c7fa7b7d905..3462659efb5 100644
--- a/event_dispatcher.rst
+++ b/event_dispatcher.rst
@@ -122,7 +122,7 @@ listener class:
the ``kernel.exception`` event);
#. If that method is not defined either, try to call the ``__invoke()`` magic
method (which makes event listeners invokable);
-#. If the ``_invoke()`` method is not defined either, throw an exception.
+#. If the ``__invoke()`` method is not defined either, throw an exception.
.. note::
From 4e0bdc59bff163866ddae899e11f002a8dd91439 Mon Sep 17 00:00:00 2001
From: wkania <57155526+wkania@users.noreply.github.com>
Date: Mon, 16 Nov 2020 19:55:01 +0100
Subject: [PATCH 0133/5766] [Validator] Fix namespace of UserPassword and
UserPasswordValidator
---
reference/constraints/UserPassword.rst | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/reference/constraints/UserPassword.rst b/reference/constraints/UserPassword.rst
index 9655380bf95..91017168a82 100644
--- a/reference/constraints/UserPassword.rst
+++ b/reference/constraints/UserPassword.rst
@@ -20,8 +20,8 @@ Applies to :ref:`property or method `
Options - `groups`_
- `message`_
- `payload`_
-Class :class:`Symfony\\Component\\Validator\\Constraints\\UserPassword`
-Validator :class:`Symfony\\Component\\Validator\\Constraints\\UserPasswordValidator`
+Class :class:`Symfony\\Component\\Security\\Core\\Validator\\Constraints\\UserPassword`
+Validator :class:`Symfony\\Component\\Security\\Core\\Validator\\Constraints\\UserPasswordValidator`
========== ===================================================================
Basic Usage
From cb81bdeac1a0e24532742193c5858cd8be69c06a Mon Sep 17 00:00:00 2001
From: Wouter de Jong
Date: Tue, 17 Nov 2020 10:24:42 +0100
Subject: [PATCH 0134/5766] Removed 3.3 DI changes article
---
_build/redirection_map | 1 +
service_container/3.3-di-changes.rst | 873 ---------------------------
setup/flex.rst | 2 +-
3 files changed, 2 insertions(+), 874 deletions(-)
delete mode 100644 service_container/3.3-di-changes.rst
diff --git a/_build/redirection_map b/_build/redirection_map
index 66fc6db1b47..6c49dc6bed6 100644
--- a/_build/redirection_map
+++ b/_build/redirection_map
@@ -508,3 +508,4 @@
/components/mailer /mailer
/messenger/message-recorder messenger/dispatch_after_current_bus
/components/stopwatch https://github.com/symfony/stopwatch
+/service_container/3.3-di-changes https://symfony.com/doc/3.4/service_container/3.3-di-changes.html
diff --git a/service_container/3.3-di-changes.rst b/service_container/3.3-di-changes.rst
deleted file mode 100644
index d57be2c0e5b..00000000000
--- a/service_container/3.3-di-changes.rst
+++ /dev/null
@@ -1,873 +0,0 @@
-The Symfony 3.3 DI Container Changes Explained (autowiring, _defaults, etc)
-===========================================================================
-
-If you look at the ``services.yaml`` file in a new Symfony 3.3 or newer project, you'll
-notice some big changes: ``_defaults``, ``autowiring``, ``autoconfigure`` and more.
-These features are designed to *automate* configuration and make development faster,
-without sacrificing predictability, which is very important! Another goal is to make
-controllers and services behave more consistently. In Symfony 3.3, controllers *are*
-services by default.
-
-The documentation has already been updated to assume you have these new features
-enabled. If you're an existing Symfony user and want to understand the "what"
-and "why" behind these changes, this article is for you!
-
-All Changes are Optional
-------------------------
-
-Most importantly, **you can upgrade to Symfony 3.3 today without making any changes to your app**.
-Symfony has a strict :doc:`backwards compatibility promise `,
-which means it's always safe to upgrade across minor versions.
-
-All of the new features are **optional**: they are not enabled by default, so you
-need to actually change your configuration files to use them.
-
-.. _`service-33-default_definition`:
-
-The new Default services.yaml File
-----------------------------------
-
-To understand the changes, look at the new default ``services.yaml`` file (this is
-what the file looks like in Symfony 4):
-
-.. configuration-block::
-
- .. code-block:: yaml
-
- # config/services.yaml
- services:
- # default configuration for services in *this* file
- _defaults:
- autowire: true # Automatically injects dependencies in your services.
- autoconfigure: true # Automatically registers your services as commands, event subscribers, etc.
- public: false # Allows optimizing the container by removing unused services; this also means
- # fetching services directly from the container via $container->get() won't work.
- # The best practice is to be explicit about your dependencies anyway.
-
- # makes classes in src/ available to be used as services
- # this creates a service per class whose id is the fully-qualified class name
- App\:
- resource: '../src/*'
- exclude: '../src/{Entity,Migrations,Tests}'
-
- # controllers are imported separately to make sure services can be injected
- # as action arguments even if you don't extend any base controller class
- App\Controller\:
- resource: '../src/Controller'
- tags: ['controller.service_arguments']
-
- # add more service definitions when explicit configuration is needed
- # please note that last definitions always *replace* previous ones
-
- .. code-block:: xml
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- .. code-block:: php
-
- // config/services.php
- namespace Symfony\Component\DependencyInjection\Loader\Configurator;
-
- return function(ContainerConfigurator $configurator) {
- // default configuration for services in *this* file
- $services = $configurator->services()
- ->defaults()
- ->autowire() // Automatically injects dependencies in your services.
- ->autoconfigure() // Automatically registers your services as commands, event subscribers, etc.
- ;
-
- // makes classes in src/ available to be used as services
- // this creates a service per class whose id is the fully-qualified class name
- $services->load('App\\', '../src/*')
- ->exclude('../src/{Entity,Migrations,Tests}');
-
- // controllers are imported separately to make sure services can be injected
- // as action arguments even if you don't extend any base controller class
- $services->load('App\\Controller\\', '../src/Controller')
- ->tag('controller.service_arguments');
-
- // add more service definitions when explicit configuration is needed
- // please note that last definitions always *replace* previous ones
- };
-
-This small bit of configuration contains a paradigm shift of how services
-are configured in Symfony.
-
-.. _`service-33-changes-automatic-registration`:
-
-1) Services are Loaded Automatically
-------------------------------------
-
-.. seealso::
-
- Read the documentation for :ref:`automatic service loading `.
-
-The first big change is that services do *not* need to be defined one-by-one anymore,
-thanks to the following config:
-
-.. configuration-block::
-
- .. code-block:: yaml
-
- # config/services.yaml
- services:
- # ...
-
- # makes classes in src/ available to be used as services
- # this creates a service per class whose id is the fully-qualified class name
- App\:
- resource: '../src/*'
- exclude: '../src/{Entity,Migrations,Tests}'
-
- .. code-block:: xml
-
-
-
-
-
-
-
-
-
-
-
-
- .. code-block:: php
-
- // config/services.php
- namespace Symfony\Component\DependencyInjection\Loader\Configurator;
-
- return function(ContainerConfigurator $configurator) {
- // ...
-
- // makes classes in src/ available to be used as services
- // this creates a service per class whose id is the fully-qualified class name
- $services->load('App\\', '../src/*')
- ->exclude('../src/{Entity,Migrations,Tests}');
- };
-
-This means that every class in ``src/`` is *available* to be used as a
-service. And thanks to the ``_defaults`` section at the top of the file, all of
-these services are **autowired** and **private** (i.e. ``public: false``).
-
-The service ids are equal to the class name (e.g. ``App\Service\InvoiceGenerator``).
-And that's another change you'll notice in Symfony 3.3: we recommend that you use
-the class name as your service id, unless you have :ref:`multiple services for the same class `.
-
- But how does the container know the arguments to my services?
-
-Since each service is :ref:`autowired `, the container is able
-to determine most arguments automatically. But, you can always override the service
-and :ref:`manually configure arguments ` or anything
-else special about your service.
-
- But wait, if I have some model (non-service) classes in my ``src/``
- directory, doesn't this mean that *they* will also be registered as services?
- Isn't that a problem?
-
-Actually, this is *not* a problem. Since all the new services are :ref:`private `
-(thanks to ``_defaults``), if any of the services are *not* used in your code, they're
-automatically removed from the compiled container. This means that the number of
-services in your container should be the *same* whether your explicitly configure
-each service or load them all at once with this method.
-
- Ok, but can I exclude some paths that I *know* won't contain services?
-
-Yes! The ``exclude`` key is a glob pattern that can be used to *ignore* paths
-that you do *not* want to be included as services. But, since unused services are
-automatically removed from the container, ``exclude`` is not that important. The
-biggest benefit is that those paths are not *tracked* by the container, and so may
-result in the container needing to be rebuilt less-often in the ``dev`` environment.
-
-2) Autowiring by Default: Use Type-hint instead of Service id
--------------------------------------------------------------
-
-The second big change is that autowiring is enabled (via ``_defaults``) for all
-services you register. This also means that service id's are now *less* important
-and "types" (i.e. class or interface names) are now *more* important.
-
-For example, before Symfony 3.3 (and this is still allowed), you could pass one
-service as an argument to another with the following config:
-
-.. configuration-block::
-
- .. code-block:: yaml
-
- # config/services.yaml
- services:
- app.invoice_generator:
- class: App\Service\InvoiceGenerator
-
- app.invoice_mailer:
- class: App\Service\InvoiceMailer
- arguments:
- - '@app.invoice_generator'
-
- .. code-block:: xml
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- .. code-block:: php
-
- // config/services.php
- use App\Service\InvoiceGenerator;
- use App\Service\InvoiceMailer;
- use Symfony\Component\DependencyInjection\Reference;
-
- $container->register('app.invoice_generator', InvoiceGenerator::class);
- $container->register('app.invoice_mailer', InvoiceMailer::class)
- ->setArguments([new Reference('app.invoice_generator')]);
-
-To pass the ``InvoiceGenerator`` as an argument to ``InvoiceMailer``, you needed
-to specify the service's *id* as an argument: ``app.invoice_generator``. Service
-id's were the main way that you configured things.
-
-But in Symfony 3.3, thanks to autowiring, all you need to do is type-hint the
-argument with ``InvoiceGenerator``::
-
- // src/Service/InvoiceMailer.php
- namespace App\Service;
-
- // ...
-
- class InvoiceMailer
- {
- private $generator;
-
- public function __construct(InvoiceGenerator $generator)
- {
- $this->generator = $generator
- }
-
- // ...
- }
-
-That's it! Both services are :ref:`automatically registered `
-and set to autowire. Without *any* configuration, the container knows to pass the
-auto-registered ``App\Service\InvoiceGenerator`` as the first argument. As
-you can see, the *type* of the class - ``App\Service\InvoiceGenerator`` - is
-what's most important, not the id. You request an *instance* of a specific type and
-the container automatically passes you the correct service.
-
- Isn't that magic? How does it know which service to pass me exactly? What if
- I have multiple services of the same instance?
-
-The autowiring system was designed to be *super* predictable. It first works by looking
-for a service whose id *exactly* matches the type-hint. This means you're in full
-control of what type-hint maps to what service. You can even use service aliases
-to get more control. If you have multiple services for a specific type, *you* choose
-which should be used for autowiring. For full details on the autowiring logic, see :ref:`autowiring-logic-explained`.
-
- But what if I have a scalar (e.g. string) argument? How does it autowire that?
-
-If you have an argument that is *not* an object, it can't be autowired. But that's
-ok! Symfony will give you a clear exception (on the next refresh of *any* page) telling
-you which argument of which service could not be autowired. To fix it, you can
-:ref:`manually configure *just* that one argument `.
-This is the philosophy of autowiring: only configure the parts that you need to.
-Most configuration is automated.
-
- Ok, but autowiring makes your applications less stable. If you change one thing
- or make a mistake, unexpected things might happen. Isn't that a problem?
-
-Symfony has always valued stability, security and predictability first. Autowiring
-was designed with that in mind. Specifically:
-
-* If there is a problem wiring *any* argument to *any* service, a clear exception
- is thrown on the next refresh of *any* page, even if you don't use that service
- on that page. That's *powerful*: it is *not* possible to make an autowiring mistake
- and not realize it.
-
-* The container determines *which* service to pass in an explicit way: it looks for
- a service whose id matches the type-hint exactly. It does *not* scan all services
- looking for objects that have that class/interface.
-
-Autowiring aims to *automate* configuration without magic.
-
-3) Controllers are Registered as Services
------------------------------------------
-
-The third big change is that, in a new Symfony 3.3 project, your controllers are *services*:
-
-.. configuration-block::
-
- .. code-block:: yaml
-
- # config/services.yaml
- services:
- # ...
-
- # controllers are imported separately to make sure they're public
- # and have a tag that allows actions to type-hint services
- App\Controller\:
- resource: '../src/Controller'
- tags: ['controller.service_arguments']
-
- .. code-block:: xml
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- .. code-block:: php
-
- // config/services.php
- namespace Symfony\Component\DependencyInjection\Loader\Configurator;
-
- return function(ContainerConfigurator $configurator) {
- // ...
-
- // controllers are imported separately to make sure they're public
- // and have a tag that allows actions to type-hint services
- $services->load('App\\Controller\\', '../src/Controller')
- ->tag('controller.service_arguments');
- };
-
-
-But, you might not even notice this. First, your controllers *can* still extend
-the same base controller class (``AbstractController``).
-This means you have access to all of the same shortcuts as before. Additionally,
-the ``@Route`` annotation and ``_controller`` syntax (e.g. ``App:Default:homepage``)
-used in routing will automatically use your controller as a service (as long as its
-service id matches its class name, which it *does* in this case). See :doc:`/controller/service`
-for more details. You can even create :ref:`invokable controllers `
-
-In other words, everything works the same. You can even add the above configuration
-to your existing project without any issues: your controllers will behave the same
-as before. But now that your controllers are services, you can use dependency injection
-and autowiring like any other service.
-
-To make life even easier, it's now possible to autowire arguments to your controller
-action methods, like you can with the constructor of services. For example::
-
- // src/Controller/InvoiceController.php
- namespace App\Controller;
-
- use Psr\Log\LoggerInterface;
-
- class InvoiceController extends AbstractController
- {
- public function listInvoices(LoggerInterface $logger)
- {
- $logger->info('A new way to access services!');
- }
- }
-
-This is *only* possible in a controller, and your controller service must be tagged
-with ``controller.service_arguments`` to make it happen. This new feature is used
-throughout the documentation.
-
-In general, the new best practice is to use normal constructor dependency injection
-(or "action" injection in controllers) instead of fetching public services via
-``$this->get()`` (though that does still work).
-
-.. _service_autoconfigure:
-
-4) Auto-tagging with autoconfigure
-----------------------------------
-
-The fourth big change is the ``autoconfigure`` key, which is set to ``true`` under
-``_defaults``. Thanks to this, the container will auto-tag services registered in
-this file. For example, suppose you want to create an event subscriber. First, you
-create the class::
-
- // src/EventSubscriber/SetHeaderSusbcriber.php
- namespace App\EventSubscriber;
-
- // ...
-
- use Symfony\Component\EventDispatcher\EventSubscriberInterface;
- use Symfony\Component\HttpKernel\Event\ResponseEvent;
- use Symfony\Component\HttpKernel\KernelEvents;
-
- class SetHeaderSusbcriber implements EventSubscriberInterface
- {
- public function onKernelResponse(ResponseEvent $event)
- {
- $event->getResponse()->headers->set('X-SYMFONY-3.3', 'Less config');
- }
-
- public static function getSubscribedEvents()
- {
- return [
- KernelEvents::RESPONSE => 'onKernelResponse'
- ];
- }
- }
-
-Great! In Symfony 3.2 or lower, you would now need to register this as a service
-in ``services.yaml`` and tag it with ``kernel.event_subscriber``. In Symfony 3.3,
-you're already done!
-
-The service is :ref:`automatically registered `.
-And thanks to ``autoconfigure``, Symfony automatically tags the service because
-it implements ``EventSubscriberInterface``.
-
- That sounds like magic - it *automatically* tags my services?
-
-In this case, you've created a class that implements ``EventSubscriberInterface``
-and registered it as a service. This is more than enough for the container to know
-that you want this to be used as an event subscriber: more configuration is not needed.
-And the tags system is its own, Symfony-specific mechanism. And you can
-always set ``autoconfigure`` to ``false`` in ``services.yaml``, or disable it
-for a specific service.
-
- Does this mean tags are dead? Does this work for all tags?
-
-This does *not* work for all tags. Many tags have *required* attributes, like event
-*listeners*, where you also need to specify the event name and method in your tag.
-Autoconfigure works only for tags without any required tag attributes, and as you
-read the docs for a feature, it'll tell you whether or not the tag is needed. You
-can also look at the extension classes (e.g. `FrameworkExtension for 3.3.0`_) to
-see what it autoconfigures.
-
- What if I need to add a priority to my tag?
-
-Many autoconfigured tags have an optional priority. If you need to specify a priority
-(or any other optional tag attribute), no problem! :ref:`Manually configure your service `
-and add the tag. Your tag will take precedence over the one added by auto-configuration.
-
-5) Auto-configure with _instanceof
-----------------------------------
-
-And the final big change is ``_instanceof``. It acts as a default definition
-template (see `service-33-default_definition`_), but only for services whose
-class matches a defined one.
-
-This can be very useful when many services share some tag that cannot be
-inherited from an abstract definition:
-
-.. configuration-block::
-
- .. code-block:: yaml
-
- # config/services.yaml
- services:
- # ...
-
- _instanceof:
- App\Domain\LoaderInterface:
- public: true
- tags: ['app.domain_loader']
-
- .. code-block:: xml
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- .. code-block:: php
-
- // config/services.php
- namespace Symfony\Component\DependencyInjection\Loader\Configurator;
-
- use App\Domain\LoaderInterface;
-
- return function(ContainerConfigurator $configurator) {
- // ...
-
- $services->instanceof(LoaderInterface::class)
- ->public()
- ->tag('app.domain_loader');
- };
-
-What about Performance
-----------------------
-
-Symfony is unique because it has a *compiled* container. This means that there is
-*no* runtime performance impact for using any of these features. That's also why
-the autowiring system can give you such clear errors.
-
-However, there is some performance impact in the ``dev`` environment. Most importantly,
-your container will likely be rebuilt more often when you modify your service classes.
-This is because it needs to rebuild whenever you add a new argument to a service,
-or add an interface to your class that should be autoconfigured.
-
-In very big projects, this may be a problem. If it is, you can always opt to *not*
-use autowiring. If you think the cache rebuilding system could be smarter in some
-situation, please open an issue!
-
-Upgrading to the new Symfony 3.3 Configuration
-----------------------------------------------
-
-Ready to upgrade your existing project? Great! Suppose you have the following configuration:
-
-.. code-block:: yaml
-
- # config/services.yaml
- services:
- app.github_notifier:
- class: App\Service\GitHubNotifier
- arguments:
- - '@app.api_client_github'
-
- markdown_transformer:
- class: App\Service\MarkdownTransformer
-
- app.api_client_github:
- class: App\Service\ApiClient
- arguments:
- - 'https://api.github.com'
-
- app.api_client_sl_connect:
- class: App\Service\ApiClient
- arguments:
- - 'https://connect.symfony.com/api'
-
-It's optional, but let's upgrade this to the new Symfony 3.3 configuration step-by-step,
-*without* breaking our application.
-
-Step 1): Adding _defaults
-~~~~~~~~~~~~~~~~~~~~~~~~~
-
-Start by adding a ``_defaults`` section with ``autowire`` and ``autoconfigure``.
-
-.. code-block:: diff
-
- # config/services.yaml
- services:
- + _defaults:
- + autowire: true
- + autoconfigure: true
-
- # ...
-
-You're already *explicitly* configuring all of your services. So, ``autowire``
-does nothing. You're also already tagging your services, so ``autoconfigure``
-also doesn't change any existing services.
-
-You have not added ``public: false`` yet. That will come in a minute.
-
-Step 2) Using Class Service id's
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-Right now, the service ids are machine names - e.g. ``app.github_notifier``. To
-work well with the new configuration system, your service ids should be class names,
-except when you have multiple instances of the same service.
-
-Start by updating the service ids to class names:
-
-.. code-block:: diff
-
- # config/services.yaml
- services:
- # ...
-
- - app.github_notifier:
- - class: App\Service\GitHubNotifier
- + App\Service\GitHubNotifier:
- arguments:
- - '@app.api_client_github'
-
- - markdown_transformer:
- - class: App\Service\MarkdownTransformer
- + App\Service\MarkdownTransformer: ~
-
- # keep these ids because there are multiple instances per class
- app.api_client_github:
- # ...
- app.api_client_sl_connect:
- # ...
-
-.. caution::
-
- Services associated with global PHP classes (i.e. not using PHP namespaces)
- must maintain the ``class`` parameter. For example, when using the old Twig
- classes (e.g. ``Twig_Extensions_Extension_Intl`` instead of ``Twig\Extensions\IntlExtension``),
- you can't redefine the service as ``Twig_Extensions_Extension_Intl: ~`` and
- you must keep the original ``class`` parameter.
-
-.. caution::
-
- If a service is processed by a :doc:`compiler pass `,
- you could face a "You have requested a non-existent service" error.
- To get rid of this, be sure that the Compiler Pass is using ``findDefinition()``
- instead of ``getDefinition()``. The latter won't take aliases into
- account when looking up for services.
- Furthermore it is always recommended to check for definition existence
- using ``has()`` function.
-
-.. note::
-
- If you get rid of deprecations and make your controllers extend from
- ``AbstractController`` instead of ``Controller``, you can skip the rest of
- this step because ``AbstractController`` doesn't provide a container where
- you can get the services from. All services need to be injected as explained
- in the :ref:`step 5 of this article `.
-
-But, this change will break our app! The old service ids (e.g. ``app.github_notifier``)
-no longer exist. The simplest way to fix this is to find all your old service ids
-and update them to the new class id: ``app.github_notifier`` to ``App\Service\GitHubNotifier``.
-
-In large projects, there's a better way: create legacy aliases that map the old id
-to the new id. Create a new ``legacy_aliases.yaml`` file:
-
-.. code-block:: yaml
-
- # config/legacy_aliases.yaml
- services:
- _defaults:
- public: true
- # aliases so that the old service ids can still be accessed
- # remove these if/when you are not fetching these directly
- # from the container via $container->get()
- app.github_notifier: '@App\Service\GitHubNotifier'
- markdown_transformer: '@App\Service\MarkdownTransformer'
-
-Then import this at the top of ``services.yaml``:
-
-.. code-block:: diff
-
- # config/services.yaml
- + imports:
- + - { resource: legacy_aliases.yaml }
-
- # ...
-
-That's it! The old service ids still work. Later, (see the cleanup step below), you
-can remove these from your app.
-
-Step 3) Make the Services Private
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-Now you're ready to default all services to be private:
-
-.. code-block:: diff
-
- # config/services.yaml
- # ...
-
- services:
- _defaults:
- autowire: true
- autoconfigure: true
- + public: false
-
-Thanks to this, any services created in this file cannot be fetched directly from
-the container. But, since the old service id's are aliases in a separate file (``legacy_aliases.yaml``),
-these *are* still public. This makes sure the app keeps working.
-
-If you did *not* change the id of some of your services (because there are multiple
-instances of the same class), you may need to make those public:
-
-.. code-block:: diff
-
- # config/services.yaml
- # ...
-
- services:
- # ...
-
- app.api_client_github:
- # ...
-
- + # remove this if/when you are not fetching this
- + # directly from the container via $container->get()
- + public: true
-
- app.api_client_sl_connect:
- # ...
- + public: true
-
-This is to guarantee that the application doesn't break. If you're not fetching
-these services directly from the container, this isn't needed. In a minute, you'll
-clean that up.
-
-Step 4) Auto-registering Services
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-You're now ready to automatically register all services in ``src/``
-(and/or any other directory/bundle you have):
-
-.. code-block:: diff
-
- # config/services.yaml
-
- services:
- _defaults:
- # ...
-
- + App\:
- + resource: '../src/*'
- + exclude: '../src/{Entity,Migrations,Tests}'
- +
- + App\Controller\:
- + resource: '../src/Controller'
- + tags: ['controller.service_arguments']
-
- # ...
-
-That's it! Actually, you're already overriding and reconfiguring all the services
-you're using (``App\Service\GitHubNotifier`` and ``App\Service\MarkdownTransformer``).
-But now, you won't need to manually register future services.
-
-Once again, there is one extra complication if you have multiple services of the
-same class:
-
-.. code-block:: diff
-
- # config/services.yaml
-
- services:
- # ...
-
- + # alias ApiClient to one of our services below
- + # app.api_client_github will be used to autowire ApiClient type-hints
- + App\Service\ApiClient: '@app.api_client_github'
-
- app.api_client_github:
- # ...
- app.api_client_sl_connect:
- # ...
-
-This guarantees that if you try to autowire an ``ApiClient`` instance, the ``app.api_client_github``
-will be used. If you *don't* have this, the auto-registration feature will try to
-register a third ``ApiClient`` service and use that for autowiring (which will fail,
-because the class has a non-autowireable argument).
-
-.. _step-5:
-
-Step 5) Cleanup!
-~~~~~~~~~~~~~~~~
-
-To make sure your application didn't break, you did some extra work. Now it's time
-to clean things up! First, update your application to *not* use the old service id's (the
-ones in ``legacy_aliases.yaml``). This means updating any service arguments (e.g.
-``@app.github_notifier`` to ``@App\Service\GitHubNotifier``) and updating your
-code to not fetch this service directly from the container. For example:
-
-.. code-block:: diff
-
- - public function index()
- + public function index(GitHubNotifier $gitHubNotifier, MarkdownTransformer $markdownTransformer)
- {
- - // the old way of fetching services
- - $githubNotifier = $this->container->get('app.github_notifier');
- - $markdownTransformer = $this->container->get('markdown_transformer');
-
- // ...
- }
-
-As soon as you do this, you can delete ``legacy_aliases.yaml`` and remove its import.
-You should do the same thing for any services that you made public, like
-``app.api_client_github`` and ``app.api_client_sl_connect``. Once you're not fetching
-these directly from the container, you can remove the ``public: true`` flag:
-
-.. code-block:: diff
-
- # config/services.yaml
- services:
- # ...
-
- app.api_client_github:
- # ...
- - public: true
-
- app.api_client_sl_connect:
- # ...
- - public: true
-
-Finally, you can optionally remove any services from ``services.yaml`` whose arguments
-can be autowired. The final configuration looks like this:
-
-.. code-block:: yaml
-
- services:
- _defaults:
- autowire: true
- autoconfigure: true
- public: false
-
- App\:
- resource: '../src/*'
- exclude: '../src/{Entity,Migrations,Tests}'
-
- App\Controller\:
- resource: '../src/Controller'
- tags: ['controller.service_arguments']
-
- App\Service\GitHubNotifier:
- # this could be deleted, or I can keep being explicit
- arguments:
- - '@app.api_client_github'
-
- # alias ApiClient to one of our services below
- # app.api_client_github will be used to autowire ApiClient type-hints
- App\Service\ApiClient: '@app.api_client_github'
-
- # keep these ids because there are multiple instances per class
- app.api_client_github:
- class: App\Service\ApiClient
- arguments:
- - 'https://api.github.com'
-
- app.api_client_sl_connect:
- class: App\Service\ApiClient
- arguments:
- - 'https://connect.symfony.com/api'
-
-You can now take advantage of the new features going forward.
-
-.. _`FrameworkExtension for 3.3.0`: https://github.com/symfony/symfony/blob/7938fdeceb03cc1df277a249cf3da70f0b50eb98/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php#L247-L284
diff --git a/setup/flex.rst b/setup/flex.rst
index df1bf1eaa14..eaba102d073 100644
--- a/setup/flex.rst
+++ b/setup/flex.rst
@@ -100,7 +100,7 @@ manual steps:
located at ``config/services.yaml``. Copy the contents of the
`default services.yaml file`_ and then add your own service configuration.
Later you can revisit this file because thanks to Symfony's
- :doc:`autowiring feature ` you can remove
+ :doc:`autowiring feature ` you can remove
most of the service configuration.
.. note::
From ab4b613ed3859ddb70b9b00356ecef1d1786eddb Mon Sep 17 00:00:00 2001
From: Youssef BENHSSAIEN
Date: Tue, 17 Nov 2020 10:02:05 +0100
Subject: [PATCH 0135/5766] Fix option double dashes
---
console/input.rst | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/console/input.rst b/console/input.rst
index 3e99b39e515..0813bad58c5 100644
--- a/console/input.rst
+++ b/console/input.rst
@@ -247,7 +247,7 @@ optionally accepts a value, but it's a bit tricky. Consider this example::
)
;
-This option can be used in 3 ways: ``greet --yell``, ``greet yell=louder``,
+This option can be used in 3 ways: ``greet --yell``, ``greet --yell=louder``,
and ``greet``. However, it's hard to distinguish between passing the option
without a value (``greet --yell``) and not passing the option (``greet``).
From ad7a7ce1ef03c63f0ddc5978b56bb74ed7e6cfdd Mon Sep 17 00:00:00 2001
From: David Vigo
Date: Tue, 17 Nov 2020 13:42:33 +0100
Subject: [PATCH 0136/5766] Add forgotten use
---
security/access_denied_handler.rst | 1 +
1 file changed, 1 insertion(+)
diff --git a/security/access_denied_handler.rst b/security/access_denied_handler.rst
index 59d6d6bb8d6..8601218ab56 100644
--- a/security/access_denied_handler.rst
+++ b/security/access_denied_handler.rst
@@ -29,6 +29,7 @@ unauthenticated user tries to access a protected resource::
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Session\SessionInterface;
+ use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Symfony\Component\Security\Core\Exception\AuthenticationException;
use Symfony\Component\Security\Http\EntryPoint\AuthenticationEntryPointInterface;
From b93b1a791900ed8823ef0a566a9d1168e73bf802 Mon Sep 17 00:00:00 2001
From: Wouter de Jong
Date: Tue, 17 Nov 2020 10:18:36 +0100
Subject: [PATCH 0137/5766] Prepare for 3.4 end of life
---
README.markdown | 6 ++--
.../cache/adapters/filesystem_adapter.rst | 8 ++---
.../adapters/pdo_doctrine_dbal_adapter.rst | 2 +-
.../cache/adapters/php_files_adapter.rst | 2 +-
components/cache/cache_invalidation.rst | 2 +-
contributing/code/pull_requests.rst | 32 +++++++++----------
contributing/community/releases.rst | 18 +++++------
contributing/documentation/overview.rst | 14 ++++----
8 files changed, 41 insertions(+), 43 deletions(-)
diff --git a/README.markdown b/README.markdown
index 8923f022322..b993cd45ed4 100644
--- a/README.markdown
+++ b/README.markdown
@@ -11,9 +11,9 @@ Symfony documentation, please read
[Contributing to the Documentation](https://symfony.com/doc/current/contributing/documentation/overview.html)
> **Note**
-> All pull requests must be based off of the **3.4** branch,
-> unless you're documenting a feature that was introduced *after* Symfony 3.4
-> (e.g. in Symfony 4.4), **not** the master or older branches.
+> All pull requests must be based off of the **4.4** branch,
+> unless you're documenting a feature that was introduced *after* Symfony 4.4
+> (e.g. in Symfony 5.2), **not** the ``5.x`` or older branches.
SymfonyCloud
------------
diff --git a/components/cache/adapters/filesystem_adapter.rst b/components/cache/adapters/filesystem_adapter.rst
index c4db3a7fb76..772a6d7b6a9 100644
--- a/components/cache/adapters/filesystem_adapter.rst
+++ b/components/cache/adapters/filesystem_adapter.rst
@@ -50,11 +50,9 @@ and cache root path as constructor parameters::
.. note::
- Since Symfony 3.4, this adapter implements
- :class:`Symfony\\Component\\Cache\\PruneableInterface`, enabling manual
- :ref:`pruning of expired cache items ` by
- calling its ``prune()`` method.
-
+ This adapter implements :class:`Symfony\\Component\\Cache\\PruneableInterface`,
+ enabling manual :ref:`pruning of expired cache items `
+ by calling its ``prune()`` method.
.. _filesystem-tag-aware-adapter:
diff --git a/components/cache/adapters/pdo_doctrine_dbal_adapter.rst b/components/cache/adapters/pdo_doctrine_dbal_adapter.rst
index 841071dc586..b840da76de7 100644
--- a/components/cache/adapters/pdo_doctrine_dbal_adapter.rst
+++ b/components/cache/adapters/pdo_doctrine_dbal_adapter.rst
@@ -44,7 +44,7 @@ your code.
.. note::
- Since Symfony 3.4, this adapter implements :class:`Symfony\\Component\\Cache\\PruneableInterface`,
+ This adapter implements :class:`Symfony\\Component\\Cache\\PruneableInterface`,
allowing for manual :ref:`pruning of expired cache entries ` by
calling its ``prune()`` method.
diff --git a/components/cache/adapters/php_files_adapter.rst b/components/cache/adapters/php_files_adapter.rst
index 5bec5715801..fcb5bcfffd1 100644
--- a/components/cache/adapters/php_files_adapter.rst
+++ b/components/cache/adapters/php_files_adapter.rst
@@ -63,7 +63,7 @@ directory path as constructor arguments::
.. note::
- Since Symfony 3.4, this adapter implements :class:`Symfony\\Component\\Cache\\PruneableInterface`,
+ This adapter implements :class:`Symfony\\Component\\Cache\\PruneableInterface`,
allowing for manual :ref:`pruning of expired cache entries ` by
calling its ``prune()`` method.
diff --git a/components/cache/cache_invalidation.rst b/components/cache/cache_invalidation.rst
index bef2c29b0b7..d7e44031d90 100644
--- a/components/cache/cache_invalidation.rst
+++ b/components/cache/cache_invalidation.rst
@@ -87,7 +87,7 @@ your fronts and have very fast invalidation checks::
.. note::
- Since Symfony 3.4, :class:`Symfony\\Component\\Cache\\Adapter\\TagAwareAdapter`
+ :class:`Symfony\\Component\\Cache\\Adapter\\TagAwareAdapter`
implements :class:`Symfony\\Component\\Cache\\PruneableInterface`,
enabling manual
:ref:`pruning of expired cache entries ` by
diff --git a/contributing/code/pull_requests.rst b/contributing/code/pull_requests.rst
index 15c2f6a4484..f76e778763f 100644
--- a/contributing/code/pull_requests.rst
+++ b/contributing/code/pull_requests.rst
@@ -124,7 +124,7 @@ Choose the right Branch
Before working on a PR, you must determine on which branch you need to
work:
-* ``3.4``, if you are fixing a bug for an existing feature or want to make a
+* ``4.4``, if you are fixing a bug for an existing feature or want to make a
change that falls into the :doc:`list of acceptable changes in patch versions
` (you may have to choose a higher branch if
the feature you are fixing was introduced in a later version);
@@ -132,16 +132,16 @@ work:
* ``5.x``, if you are adding a new feature.
The only exception is when a new :doc:`major Symfony version `
- (4.0, 5.0, etc.) comes out every two years. Because of the
+ (5.0, 6.0, etc.) comes out every two years. Because of the
:ref:`special development process ` of those versions,
- you need to use the previous minor version for the features (e.g. use ``3.4``
- instead of ``4.0``, use ``4.4`` instead of ``5.0``, etc.)
+ you need to use the previous minor version for the features (e.g. use ``4.4``
+ instead of ``5.0``, use ``5.4`` instead of ``6.0``, etc.)
.. note::
All bug fixes merged into maintenance branches are also merged into more
recent branches on a regular basis. For instance, if you submit a PR
- for the ``3.4`` branch, the PR will also be applied by the core team on
+ for the ``4.4`` branch, the PR will also be applied by the core team on
the ``5.x`` branch.
Create a Topic Branch
@@ -154,18 +154,18 @@ topic branch:
$ git checkout -b BRANCH_NAME 5.x
-Or, if you want to provide a bug fix for the ``3.4`` branch, first track the remote
-``3.4`` branch locally:
+Or, if you want to provide a bug fix for the ``4.4`` branch, first track the remote
+``4.4`` branch locally:
.. code-block:: terminal
- $ git checkout --track origin/3.4
+ $ git checkout --track origin/4.4
-Then create a new branch off the ``3.4`` branch to work on the bug fix:
+Then create a new branch off the ``4.4`` branch to work on the bug fix:
.. code-block:: terminal
- $ git checkout -b BRANCH_NAME 3.4
+ $ git checkout -b BRANCH_NAME 4.4
.. tip::
@@ -193,8 +193,8 @@ want to debug are installed by running ``composer install`` inside it.
.. tip::
- If symlinks to your local Symfony fork cannot be resolved inside your project due to
- your dev environment (for instance when using Vagrant where only the current project
+ If symlinks to your local Symfony fork cannot be resolved inside your project due to
+ your dev environment (for instance when using Vagrant where only the current project
directory is mounted), you can alternatively use the ``--copy`` option.
When finishing testing your Symfony code into your project, you can use
the ``--rollback`` option to make your project back to its original dependencies.
@@ -285,7 +285,7 @@ while to finish your changes):
.. tip::
- Replace ``5.x`` with the branch you selected previously (e.g. ``3.4``)
+ Replace ``5.x`` with the branch you selected previously (e.g. ``4.4``)
if you are working on a bug fix.
When doing the ``rebase`` command, you might have to fix merge conflicts.
@@ -312,8 +312,8 @@ You can now make a pull request on the ``symfony/symfony`` GitHub repository.
.. tip::
- Take care to point your pull request towards ``symfony:3.4`` if you want
- the core team to pull a bug fix based on the ``3.4`` branch.
+ Take care to point your pull request towards ``symfony:4.4`` if you want
+ the core team to pull a bug fix based on the ``4.4`` branch.
To ease the core team work, always include the modified components in your
pull request message, like in:
@@ -403,7 +403,7 @@ Rework your Pull Request
Based on the feedback on the pull request, you might need to rework your
PR. Before re-submitting the PR, rebase with ``upstream/5.x`` or
-``upstream/3.4``, don't merge; and force the push to the origin:
+``upstream/4.4``, don't merge; and force the push to the origin:
.. code-block:: terminal
diff --git a/contributing/community/releases.rst b/contributing/community/releases.rst
index fa8471717f2..80d5033accd 100644
--- a/contributing/community/releases.rst
+++ b/contributing/community/releases.rst
@@ -7,7 +7,7 @@ release and maintain its different versions.
Symfony releases follow the `semantic versioning`_ strategy and they are
published through a *time-based model*:
-* A new **Symfony patch version** (e.g. 3.4.41, 4.4.9) comes out roughly every
+* A new **Symfony patch version** (e.g. 4.4.12, 5.1.9) comes out roughly every
month. It only contains bug fixes, so you can safely upgrade your applications;
* A new **Symfony minor version** (e.g. 4.4, 5.0, 5.1) comes out every *six months*:
one in *May* and one in *November*. It contains bug fixes and new features, but
@@ -53,7 +53,7 @@ Maintenance
Starting from the Symfony 3.x branch, the number of minor versions is limited to
five per branch (X.0, X.1, X.2, X.3 and X.4). The last minor version of a branch
-(e.g. 3.4, 4.4, 5.4) is considered a **long-term support version** and the other
+(e.g. 4.4, 5.4) is considered a **long-term support version** and the other
ones are considered **standard versions**:
======================= ===================== ================================
@@ -87,17 +87,17 @@ learn more about how deprecations are handled in Symfony.
.. _major-version-development:
This deprecation policy also requires a custom development process for major
-versions (4.0, 5.0, 6.0, etc.) In those cases, Symfony develops at the same time
-two versions: the new major one (e.g. 4.0) and the latest version of the
-previous branch (e.g. 3.4).
+versions (5.0, 6.0, etc.) In those cases, Symfony develops at the same time
+two versions: the new major one (e.g. 5.0) and the latest version of the
+previous branch (e.g. 4.4).
Both versions have the same new features, but they differ in the deprecated
-features. The oldest version (3.4 in this example) contains all the deprecated
-features whereas the new version (4.0 in this example) removes all of them.
+features. The oldest version (4.4 in this example) contains all the deprecated
+features whereas the new version (5.0 in this example) removes all of them.
-This allows you to upgrade your projects to the latest minor version (e.g. 3.4),
+This allows you to upgrade your projects to the latest minor version (e.g. 4.4),
see all the deprecation messages and fix them. Once you have fixed all those
-deprecations, you can upgrade to the new major version (e.g. 4.0) without
+deprecations, you can upgrade to the new major version (e.g. 5.0) without
effort, because it contains the same features (the only difference are the
deprecated features, which your project no longer uses).
diff --git a/contributing/documentation/overview.rst b/contributing/documentation/overview.rst
index fc6a2c4e5e5..f7d1e4e8a03 100644
--- a/contributing/documentation/overview.rst
+++ b/contributing/documentation/overview.rst
@@ -112,14 +112,14 @@ memorable name for the new branch (if you are fixing a reported issue, use
.. code-block:: terminal
- $ git checkout -b improve_install_article upstream/3.4
+ $ git checkout -b improve_install_article upstream/4.4
In this example, the name of the branch is ``improve_install_article`` and the
-``upstream/3.4`` value tells Git to create this branch based on the ``3.4``
+``upstream/4.4`` value tells Git to create this branch based on the ``4.4``
branch of the ``upstream`` remote, which is the original Symfony Docs repository.
Fixes should always be based on the **oldest maintained branch** which contains
-the error. Nowadays this is the ``3.4`` branch. If you are instead documenting a
+the error. Nowadays this is the ``4.4`` branch. If you are instead documenting a
new feature, switch to the first Symfony version that included it, e.g.
``upstream/3.1``. Not sure? That's OK! Just use the ``upstream/master`` branch.
@@ -155,7 +155,7 @@ changes should be applied:
:align: center
In this example, the **base fork** should be ``symfony/symfony-docs`` and
-the **base** branch should be the ``3.4``, which is the branch that you selected
+the **base** branch should be the ``4.4``, which is the branch that you selected
to base your changes on. The **head fork** should be your forked copy
of ``symfony-docs`` and the **compare** branch should be ``improve_install_article``,
which is the name of the branch you created and where you made your changes.
@@ -205,7 +205,7 @@ contribution to the Symfony docs:
# create a new branch based on the oldest maintained version
$ cd projects/symfony-docs/
$ git fetch upstream
- $ git checkout -b my_changes upstream/3.4
+ $ git checkout -b my_changes upstream/4.4
# ... do your changes
@@ -303,8 +303,8 @@ into multiple branches, corresponding to the different versions of Symfony itsel
The ``master`` branch holds the documentation for the development branch of
the code.
-Unless you're documenting a feature that was introduced after Symfony 3.4,
-your changes should always be based on the ``3.4`` branch. Documentation managers
+Unless you're documenting a feature that was introduced after Symfony 4.4,
+your changes should always be based on the ``4.4`` branch. Documentation managers
will use the necessary Git-magic to also apply your changes to all the active
branches of the documentation.
From e5918146ca5fbd2d54a88965d0df26bd6880a49c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Deruss=C3=A9?=
Date: Wed, 4 Nov 2020 10:18:54 +0100
Subject: [PATCH 0138/5766] Remove deprecated HEADER_X_FORWARDED_ALL header
---
deployment/proxies.rst | 12 ++++++++++--
migration.rst | 2 +-
2 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/deployment/proxies.rst b/deployment/proxies.rst
index 12bf3f1cac1..a7e0aff99b2 100644
--- a/deployment/proxies.rst
+++ b/deployment/proxies.rst
@@ -35,15 +35,22 @@ and what headers your reverse proxy uses to send information::
['192.0.0.1', '10.0.0.0/8'],
// trust *all* "X-Forwarded-*" headers
- Request::HEADER_X_FORWARDED_ALL
+ Request::HEADER_X_FORWARDED_FOR | Request::HEADER_X_FORWARDED_HOST | Request::HEADER_X_FORWARDED_PORT | Request::HEADER_X_FORWARDED_PROTO
// or, if your proxy instead uses the "Forwarded" header
// Request::HEADER_FORWARDED
- // or, if you're using AWS ELB
+ // or, if you're using a wellknown proxy
// Request::HEADER_X_FORWARDED_AWS_ELB
+ // Request::HEADER_X_FORWARDED_TRAEFIK
);
+.. caution::
+
+ Enabling the ``Request::HEADER_X_FORWARDED_HOST`` option exposes the
+ application to "`HTTP Host header attacks`_". Make sure the proxy really
+ send a ``x-forwarded-host`` header.
+
The Request object has several ``Request::HEADER_*`` constants that control exactly
*which* headers from your reverse proxy are trusted. The argument is a bit field,
so you can also pass your own value (e.g. ``0b00110``).
@@ -114,3 +121,4 @@ In this case, you'll need to set the header ``X-Forwarded-Proto`` with the value
.. _`security groups`: https://docs.aws.amazon.com/elasticloadbalancing/latest/classic/elb-security-groups.html
.. _`CloudFront`: https://en.wikipedia.org/wiki/Amazon_CloudFront
.. _`CloudFront IP ranges`: https://ip-ranges.amazonaws.com/ip-ranges.json
+.. _`HTTP Host header attacks`: https://www.skeletonscribe.net/2013/05/practical-http-host-header-attacks.html
diff --git a/migration.rst b/migration.rst
index fa8c2bfc24b..5c786c103b9 100644
--- a/migration.rst
+++ b/migration.rst
@@ -262,7 +262,7 @@ could look something like this::
if ($trustedProxies = $_SERVER['TRUSTED_PROXIES'] ?? $_ENV['TRUSTED_PROXIES'] ?? false) {
Request::setTrustedProxies(
explode(',', $trustedProxies),
- Request::HEADER_X_FORWARDED_ALL ^ Request::HEADER_X_FORWARDED_HOST
+ Request::HEADER_X_FORWARDED_FOR | Request::HEADER_X_FORWARDED_PORT | Request::HEADER_X_FORWARDED_PROTO
);
}
From c5dbbd7c07e9c852a3bba6f0edc6fb9bac9612f6 Mon Sep 17 00:00:00 2001
From: Wouter de Jong
Date: Wed, 18 Nov 2020 10:54:29 +0100
Subject: [PATCH 0139/5766] [#14561] Fixed wrong reference
---
serializer/custom_encoders.rst | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/serializer/custom_encoders.rst b/serializer/custom_encoders.rst
index 4c08b410dbd..d212f94a2f5 100644
--- a/serializer/custom_encoders.rst
+++ b/serializer/custom_encoders.rst
@@ -66,7 +66,7 @@ that's done automatically!
.. tip::
- If you're not using :ref:`autoconfigure `, make sure
+ If you're not using :ref:`autoconfigure `, make sure
to register your class as a service and tag it with ``serializer.encoder``.
Now you'll be able to serialize and deserialize YAML!
From 42c1ca4fe901ec3e7339f13b00ac7764f8dfada9 Mon Sep 17 00:00:00 2001
From: Javier Eguiluz
Date: Wed, 18 Nov 2020 10:54:34 +0100
Subject: [PATCH 0140/5766] Added a deprecation notice
---
deployment/proxies.rst | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/deployment/proxies.rst b/deployment/proxies.rst
index a7e0aff99b2..81c1f5c7826 100644
--- a/deployment/proxies.rst
+++ b/deployment/proxies.rst
@@ -40,16 +40,22 @@ and what headers your reverse proxy uses to send information::
// or, if your proxy instead uses the "Forwarded" header
// Request::HEADER_FORWARDED
- // or, if you're using a wellknown proxy
+ // or, if you're using a well-known proxy
// Request::HEADER_X_FORWARDED_AWS_ELB
// Request::HEADER_X_FORWARDED_TRAEFIK
);
+.. deprecated:: 5.2
+
+ In previous Symfony versions, the above example used ``HEADER_X_FORWARDED_ALL``
+ to trust all "X-Forwarded-*" headers, but that constant is deprecated since
+ Symfony 5.2 in favor of the individual ``HEADER_X_FORWARDED_*`` constants.
+
.. caution::
Enabling the ``Request::HEADER_X_FORWARDED_HOST`` option exposes the
- application to "`HTTP Host header attacks`_". Make sure the proxy really
- send a ``x-forwarded-host`` header.
+ application to `HTTP Host header attacks`_. Make sure the proxy really
+ sends an ``x-forwarded-host`` header.
The Request object has several ``Request::HEADER_*`` constants that control exactly
*which* headers from your reverse proxy are trusted. The argument is a bit field,
From 163c6941e9b8cc0cc7fd2721e34b4445b86c5554 Mon Sep 17 00:00:00 2001
From: Javier Eguiluz
Date: Wed, 18 Nov 2020 11:27:44 +0100
Subject: [PATCH 0141/5766] Fixed a RST syntax issue
---
deployment/proxies.rst | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/deployment/proxies.rst b/deployment/proxies.rst
index 81c1f5c7826..cae9e285648 100644
--- a/deployment/proxies.rst
+++ b/deployment/proxies.rst
@@ -48,7 +48,7 @@ and what headers your reverse proxy uses to send information::
.. deprecated:: 5.2
In previous Symfony versions, the above example used ``HEADER_X_FORWARDED_ALL``
- to trust all "X-Forwarded-*" headers, but that constant is deprecated since
+ to trust all "X-Forwarded-" headers, but that constant is deprecated since
Symfony 5.2 in favor of the individual ``HEADER_X_FORWARDED_*`` constants.
.. caution::
From 035335cb0ec35b73034f624cb7f9837486efc00d Mon Sep 17 00:00:00 2001
From: Wouter de Jong
Date: Wed, 18 Nov 2020 12:59:08 +0100
Subject: [PATCH 0142/5766] Document named arguments BC policy
---
contributing/code/bc.rst | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/contributing/code/bc.rst b/contributing/code/bc.rst
index d0c82ab1c1f..15f1f03674d 100644
--- a/contributing/code/bc.rst
+++ b/contributing/code/bc.rst
@@ -72,7 +72,7 @@ backward compatibility promise:
+-----------------------------------------------+-----------------------------+
| Type hint against the interface | Yes |
+-----------------------------------------------+-----------------------------+
-| Call a method | Yes |
+| Call a method | Yes [10]_ |
+-----------------------------------------------+-----------------------------+
| **If you implement the interface and...** | **Then we guarantee BC...** |
+-----------------------------------------------+-----------------------------+
@@ -114,13 +114,13 @@ covered by our backward compatibility promise:
+-----------------------------------------------+-----------------------------+
| Access a public property | Yes |
+-----------------------------------------------+-----------------------------+
-| Call a public method | Yes |
+| Call a public method | Yes [10]_ |
+-----------------------------------------------+-----------------------------+
| **If you extend the class and...** | **Then we guarantee BC...** |
+-----------------------------------------------+-----------------------------+
| Access a protected property | Yes |
+-----------------------------------------------+-----------------------------+
-| Call a protected method | Yes |
+| Call a protected method | Yes [10]_ |
+-----------------------------------------------+-----------------------------+
| Override a public property | Yes |
+-----------------------------------------------+-----------------------------+
@@ -445,4 +445,8 @@ Turn static into non static No
.. [9] Allowed for the ``void`` return type.
+.. [10] Parameter names are not part of the compatibility promise. Using
+ PHP 8's named arguments feature might break your code when upgrading to
+ newer Symfony versions.
+
.. _`Semantic Versioning`: https://semver.org/
From 50f3ece07c22e16326616b0b420880d154bea37b Mon Sep 17 00:00:00 2001
From: Wouter de Jong
Date: Wed, 18 Nov 2020 17:03:01 +0100
Subject: [PATCH 0143/5766] Add little tip about PHPdocs
---
messenger/multiple_buses.rst | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/messenger/multiple_buses.rst b/messenger/multiple_buses.rst
index 5136553dac2..6191bc0556c 100644
--- a/messenger/multiple_buses.rst
+++ b/messenger/multiple_buses.rst
@@ -249,4 +249,9 @@ You can also restrict the list to a specific bus by providing its name as argume
handled by App\MessageHandler\MultipleBusesMessageHandler
---------------------------------------------------------------------------------------
+.. tip::
+
+ Since Symfony 5.1, the command will also show the PHPDoc description of
+ the message and handler classes.
+
.. _article about CQRS: https://martinfowler.com/bliki/CQRS.html
From b47ccb91e9e27ea02a5ca52fdd09f90fcb4adf8d Mon Sep 17 00:00:00 2001
From: Abdouni Abdelkarim
Date: Thu, 19 Nov 2020 01:59:09 +0100
Subject: [PATCH 0144/5766] Update testing.rst
Hello, I update mysql env variable with server version.
---
testing.rst | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/testing.rst b/testing.rst
index 479a26be864..365626ceacd 100644
--- a/testing.rst
+++ b/testing.rst
@@ -990,7 +990,7 @@ need in your ``.env.test`` file:
.. code-block:: text
# .env.test
- DATABASE_URL="mysql://db_user:db_password@127.0.0.1:3306/db_name_test"
+ DATABASE_URL=mysql://db_user:db_password@127.0.0.1:3306/db_name_test?serverVersion=5.7
# use SQLITE
# DATABASE_URL="sqlite:///%kernel.project_dir%/var/app.db"
From 3b1ade011908e82d3e5d361d6aea5aa0328208b9 Mon Sep 17 00:00:00 2001
From: Abdouni Abdelkarim
Date: Thu, 19 Nov 2020 02:03:13 +0100
Subject: [PATCH 0145/5766] Update doctrine.rst
Hello, I update mysql server version.
---
reference/configuration/doctrine.rst | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/reference/configuration/doctrine.rst b/reference/configuration/doctrine.rst
index fd44b56b2bc..cf49aaaa2b9 100644
--- a/reference/configuration/doctrine.rst
+++ b/reference/configuration/doctrine.rst
@@ -65,7 +65,7 @@ The following block shows all possible configuration keys:
charset: UTF8
logging: '%kernel.debug%'
platform_service: App\DBAL\MyDatabasePlatformService
- server_version: '5.6'
+ server_version: '5.7'
mapping_types:
enum: string
types:
@@ -99,7 +99,7 @@ The following block shows all possible configuration keys:
charset="UTF8"
logging="%kernel.debug%"
platform-service="App\DBAL\MyDatabasePlatformService"
- server-version="5.6">
+ server-version="5.7">
barstring
@@ -121,8 +121,8 @@ The following block shows all possible configuration keys:
Always wrap the server version number with quotes to parse it as a string
instead of a float number. Otherwise, the floating-point representation
- issues can make your version be considered a different number (e.g. ``5.6``
- will be rounded as ``5.5999999999999996447286321199499070644378662109375``).
+ issues can make your version be considered a different number (e.g. ``5.7``
+ will be rounded as ``5.6999999999999996447286321199499070644378662109375``).
If you don't define this option and you haven't created your database
yet, you may get ``PDOException`` errors because Doctrine will try to
From 5a95590b0c53f9075e0ca814a0ecc86f1f46ed33 Mon Sep 17 00:00:00 2001
From: Abdouni Abdelkarim
Date: Thu, 19 Nov 2020 02:05:29 +0100
Subject: [PATCH 0146/5766] Update dbal.rst
Hello, I updated mysql env database_url.
---
doctrine/dbal.rst | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/doctrine/dbal.rst b/doctrine/dbal.rst
index 3d451fb4af6..4b9f26d3f7b 100644
--- a/doctrine/dbal.rst
+++ b/doctrine/dbal.rst
@@ -35,7 +35,7 @@ Then configure the ``DATABASE_URL`` environment variable in ``.env``:
# .env (or override DATABASE_URL in .env.local to avoid committing your changes)
# customize this line!
- DATABASE_URL="mysql://db_user:db_password@127.0.0.1:3306/db_name"
+ DATABASE_URL=mysql://db_user:db_password@127.0.0.1:3306/db_name?serverVersion=5.7
Further things can be configured in ``config/packages/doctrine.yaml`` - see
:ref:`reference-dbal-configuration`. Remove the ``orm`` key in that file
From c639ea407b86d5e8e63abf34b1cc66c8629ecad1 Mon Sep 17 00:00:00 2001
From: Abdouni Abdelkarim
Date: Thu, 19 Nov 2020 02:12:47 +0100
Subject: [PATCH 0147/5766] Update doctrine.rst
Hello,
I just add env variable for mariadb.
---
doctrine.rst | 3 +++
1 file changed, 3 insertions(+)
diff --git a/doctrine.rst b/doctrine.rst
index fb491df8c2b..21b14c2ae4c 100644
--- a/doctrine.rst
+++ b/doctrine.rst
@@ -46,6 +46,9 @@ The database connection information is stored as an environment variable called
# customize this line!
DATABASE_URL="mysql://db_user:db_password@127.0.0.1:3306/db_name?serverVersion=5.7"
+ # to use mariadb:
+ DATABASE_URL="mysql://db_user:db_password@127.0.0.1:3306/db_name?serverVersion=mariadb-10.5.8"
+
# to use sqlite:
# DATABASE_URL="sqlite:///%kernel.project_dir%/var/app.db"
From 74de492ada02ece7221a55390825e013e3dedf42 Mon Sep 17 00:00:00 2001
From: Maxime Steinhausser
Date: Thu, 19 Nov 2020 09:23:27 +0100
Subject: [PATCH 0148/5766] Fix strict_variables default value since Symfony 5
The default was changed in https://github.com/symfony/symfony/blob/494ef421c554a78b38c6779c4b7deb9a20d89923/UPGRADE-5.0.md#twigbundle
---
reference/configuration/twig.rst | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/reference/configuration/twig.rst b/reference/configuration/twig.rst
index c7d77739b1c..5d5edd1d43c 100644
--- a/reference/configuration/twig.rst
+++ b/reference/configuration/twig.rst
@@ -363,7 +363,7 @@ Read more about :ref:`template directories and namespaces
strict_variables
~~~~~~~~~~~~~~~~
-**type**: ``boolean`` **default**: ``false``
+**type**: ``boolean`` **default**: ``%kernel.debug%``
If set to ``true``, Symfony shows an exception whenever a Twig variable,
attribute or method doesn't exist. If set to ``false`` these errors are ignored
From 6e2a758b75744cca019edeab55fd651800236fd0 Mon Sep 17 00:00:00 2001
From: Romain Monteil
Date: Thu, 19 Nov 2020 17:29:25 +0100
Subject: [PATCH 0149/5766] Replace old ICU Formatting Messages url
---
translation.rst | 2 +-
translation/message_format.rst | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/translation.rst b/translation.rst
index 8fdffe83baa..20025b8b5cd 100644
--- a/translation.rst
+++ b/translation.rst
@@ -607,7 +607,7 @@ Learn more
translation/xliff
.. _`i18n`: https://en.wikipedia.org/wiki/Internationalization_and_localization
-.. _`ICU MessageFormat`: http://userguide.icu-project.org/formatparse/messages
+.. _`ICU MessageFormat`: https://unicode-org.github.io/icu/userguide/format_parse/messages/
.. _`ISO 3166-1 alpha-2`: https://en.wikipedia.org/wiki/ISO_3166-1#Current_codes
.. _`ISO 639-1`: https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes
.. _`Translatable Extension`: http://atlantic18.github.io/DoctrineExtensions/doc/translatable.html
diff --git a/translation/message_format.rst b/translation/message_format.rst
index 4ec520682ef..218d479d795 100644
--- a/translation/message_format.rst
+++ b/translation/message_format.rst
@@ -474,7 +474,7 @@ The ``number`` formatter allows you to format numbers using Intl's :phpclass:`Nu
echo $translator->trans('value_of_object', ['value' => 9988776.65]);
.. _`online editor`: http://format-message.github.io/icu-message-format-for-translators/
-.. _`ICU MessageFormat`: http://userguide.icu-project.org/formatparse/messages
+.. _`ICU MessageFormat`: https://unicode-org.github.io/icu/userguide/format_parse/messages/
.. _`switch statement`: https://www.php.net/control-structures.switch
.. _`Language Plural Rules`: http://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html
.. _`constants defined by the IntlDateFormatter class`: https://www.php.net/manual/en/class.intldateformatter.php
From 074db0d1024b99d44918ceca65b5a68c547982d0 Mon Sep 17 00:00:00 2001
From: Laurent VOULLEMIER
Date: Tue, 17 Nov 2020 22:16:50 +0100
Subject: [PATCH 0150/5766] Complete mailer integration
---
mailer.rst | 49 +++++++++++
reference/configuration/framework.rst | 116 +++++++++++++++++++++++++-
2 files changed, 162 insertions(+), 3 deletions(-)
diff --git a/mailer.rst b/mailer.rst
index 025a5c43813..ebf79865a72 100644
--- a/mailer.rst
+++ b/mailer.rst
@@ -29,11 +29,58 @@ over SMTP by configuring the DSN in your ``.env`` file (the ``user``,
# .env
MAILER_DSN=smtp://user:pass@smtp.example.com:port
+.. configuration-block::
+
+ .. code-block:: yaml
+
+ # config/packages/mailer.yaml
+ framework:
+ mailer:
+ dsn: '%env(MAILER_DSN)%'
+
+ .. code-block:: xml
+
+
+
+
+
+
+
+
+
+ .. code-block:: php
+
+ // config/packages/mailer.php
+ use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
+ return static function (ContainerConfigurator $containerConfigurator): void {
+ $containerConfigurator->extension('framework', [
+ 'mailer' => [
+ 'dsn' => '%env(MAILER_DSN)%',
+ ]
+ ]);
+ };
+
.. caution::
If you are migrating from Swiftmailer (and the Swiftmailer bundle), be
warned that the DSN format is different.
+Using built-in transports
+~~~~~~~~~~~~~~~~~~~~~~~~~
+
+============ ==================================== ===========
+DSN protocol Example Description
+============ ==================================== ===========
+smtp smtp://user:pass@smtp.example.com:25 Mailer uses an SMTP server to send emails
+sendmail sendmail://default Mailer uses the local sendmail binary to send emails
+============ ==================================== ===========
+
+
Using a 3rd Party Transport
~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -822,6 +869,8 @@ and it will select the appropriate certificate depending on the ``To`` option::
$firstEncryptedEmail = $encrypter->encrypt($firstEmail);
$secondEncryptedEmail = $encrypter->encrypt($secondEmail);
+.. _multiple-email-transports:
+
Multiple Email Transports
-------------------------
diff --git a/reference/configuration/framework.rst b/reference/configuration/framework.rst
index cd76b908c64..255adc11fec 100644
--- a/reference/configuration/framework.rst
+++ b/reference/configuration/framework.rst
@@ -98,7 +98,7 @@ Configuration
* `cafile`_
* `capath`_
* `ciphers`_
- * `headers`_
+ * :ref:`headers `
* `http_version`_
* `local_cert`_
* `local_pk`_
@@ -126,7 +126,7 @@ Configuration
* `cafile`_
* `capath`_
* `ciphers`_
- * `headers`_
+ * :ref:`headers `
* `http_version`_
* `local_cert`_
* `local_pk`_
@@ -151,6 +151,17 @@ Configuration
* :ref:`name `
+* `mailer`_
+
+ * :ref:`dsn `
+ * `transports`_
+ * `envelope`_
+
+ * `sender`_
+ * `recipients`_
+
+ * :ref:`headers `
+
* `php_errors`_
* `log`_
@@ -159,7 +170,7 @@ Configuration
* `profiler`_
* `collect`_
- * `dsn`_
+ * :ref:`dsn `
* :ref:`enabled `
* `only_exceptions`_
* `only_master_requests`_
@@ -867,6 +878,8 @@ ciphers
A list of the names of the ciphers allowed for the SSL/TLS connections. They
can be separated by colons, commas or spaces (e.g. ``'RC4-SHA:TLS13-AES-128-GCM-SHA256'``).
+.. _http-headers:
+
headers
.......
@@ -1075,6 +1088,8 @@ only_master_requests
When this is set to ``true``, the profiler will only be enabled on the master
requests (and not on the subrequests).
+.. _profiler-dsn:
+
dsn
...
@@ -2888,6 +2903,101 @@ Name of the lock you want to create.
decorates: lock.invoice.store
arguments: ['@lock.invoice.retry_till_save.store.inner', 100, 50]
+mailer
+~~~~~~
+
+.. _mailer-dsn:
+
+dsn
+...
+
+**type**: ``string``
+
+The DSN used by the mailer. When several DSN may be used, use `transports` (see below) instead.
+
+transports
+..........
+
+**type**: ``array``
+
+A :ref:`list of DSN ` that can be used by the mailer. A transport name is the key and the dsn is the value.
+
+envelope
+........
+
+sender
+""""""
+
+**type**: ``string``
+
+Sender used by the ``Mailer``. Keep in mind that this setting override a sender set in the code.
+
+recipients
+""""""""""
+
+**type**: ``array``
+
+Recipients used by the ``Mailer``. Keep in mind that this setting override recipients set in the code.
+
+.. configuration-block::
+
+ .. code-block:: yaml
+
+ # config/packages/mailer.yaml
+ framework:
+ mailer:
+ dsn: 'smtp://localhost:25'
+ envelope:
+ recipients: ['admin@symfony.com', 'lead@symfony.com']
+
+ .. code-block:: xml
+
+
+
+
+
+
+
+ admin@symfony.com
+ lead@symfony.com
+
+
+
+
+
+ .. code-block:: php
+
+ // config/packages/mailer.php
+ namespace Symfony\Component\DependencyInjection\Loader\Configurator;
+ return static function (ContainerConfigurator $containerConfigurator): void {
+ $containerConfigurator->extension('framework', [
+ 'mailer' => [
+ 'dsn' => 'smtp://localhost:25',
+ 'envelope' => [
+ 'recipients' => [
+ 'admin@symfony.com',
+ 'lead@symfony.com',
+ ]
+ ]
+ ]
+ ]);
+ };
+
+.. _mailer-headers:
+
+headers
+.......
+
+**type**: ``array``
+
+Headers to add to emails. key (``name`` attribute in xml format)
+is the header name and value the header value.
+
workflows
~~~~~~~~~
From 649a63397f9dc404294a037ef41deb48e92f3872 Mon Sep 17 00:00:00 2001
From: Timo Bakx
Date: Fri, 20 Nov 2020 00:34:27 +0100
Subject: [PATCH 0151/5766] [Form] Documented legacy_error_messages
---
forms.rst | 43 ++++++++++
reference/forms/types/birthday.rst | 86 ++++++++++----------
reference/forms/types/checkbox.rst | 63 ++++++++-------
reference/forms/types/choice.rst | 99 ++++++++++++-----------
reference/forms/types/collection.rst | 73 +++++++++--------
reference/forms/types/color.rst | 63 +++++++++------
reference/forms/types/country.rst | 85 +++++++++++---------
reference/forms/types/currency.rst | 81 ++++++++++---------
reference/forms/types/date.rst | 88 ++++++++++----------
reference/forms/types/dateinterval.rst | 94 ++++++++++++----------
reference/forms/types/datetime.rst | 106 +++++++++++++------------
reference/forms/types/email.rst | 59 ++++++++------
reference/forms/types/file.rst | 64 ++++++++-------
reference/forms/types/form.rst | 94 +++++++++++-----------
reference/forms/types/hidden.rst | 45 ++++++-----
reference/forms/types/integer.rst | 69 ++++++++--------
reference/forms/types/language.rst | 87 ++++++++++----------
reference/forms/types/locale.rst | 83 ++++++++++---------
reference/forms/types/money.rst | 77 +++++++++---------
reference/forms/types/number.rst | 75 ++++++++---------
reference/forms/types/password.rst | 60 +++++++-------
reference/forms/types/percent.rst | 75 ++++++++---------
reference/forms/types/radio.rst | 69 +++++++++-------
reference/forms/types/range.rst | 57 +++++++------
reference/forms/types/repeated.rst | 63 ++++++++-------
reference/forms/types/search.rst | 57 +++++++------
reference/forms/types/tel.rst | 59 ++++++++------
reference/forms/types/time.rst | 92 +++++++++++----------
reference/forms/types/timezone.rst | 85 +++++++++++---------
reference/forms/types/url.rst | 63 +++++++++------
reference/forms/types/week.rst | 74 +++++++++--------
31 files changed, 1269 insertions(+), 1019 deletions(-)
diff --git a/forms.rst b/forms.rst
index ec5a04fcfc1..6e2c9ec5120 100644
--- a/forms.rst
+++ b/forms.rst
@@ -553,6 +553,49 @@ To see the second approach - adding constraints to the form - and to
learn more about the validation constraints, please refer to the
:doc:`Symfony validation documentation `.
+.. versionadded:: 5.2
+
+ Validation messages for forms have been rewritten to be more user-friendly.
+ These newer messages can be enabled by setting the `legacy_error_messages`
+ option to "false". Details about these messages can be found in the corresponding
+ form type documentation.
+
+ .. configuration-block::
+
+ .. code-block:: yaml
+
+ # config/packages/framework.yaml
+ framework:
+ form:
+ legacy_error_messages: false
+
+ .. code-block:: xml
+
+
+
+
+
+
+
+
+
+
+ .. code-block:: php
+
+ // config/packages/framework.php
+ $container->loadFromExtension('framework', [
+ 'form' => [
+ 'legacy-error-messages' => false,
+ ],
+ ]);
+
+
Other Common Form Features
--------------------------
diff --git a/reference/forms/types/birthday.rst b/reference/forms/types/birthday.rst
index 6299dbf1e09..127528bc774 100644
--- a/reference/forms/types/birthday.rst
+++ b/reference/forms/types/birthday.rst
@@ -14,51 +14,57 @@ This type is essentially the same as the :doc:`DateType `) |
-+----------------------+-------------------------------------------------------------------------------+
-| Rendered as | can be three select boxes or 1 or 3 text boxes, based on the `widget`_ option |
-+----------------------+-------------------------------------------------------------------------------+
-| Overridden options | - `years`_ |
-+----------------------+-------------------------------------------------------------------------------+
-| Inherited options | from the :doc:`DateType `: |
-| | |
-| | - `choice_translation_domain`_ |
-| | - `days`_ |
-| | - `placeholder`_ |
-| | - `format`_ |
-| | - `input`_ |
-| | - `input_format`_ |
-| | - `model_timezone`_ |
-| | - `months`_ |
-| | - `view_timezone`_ |
-| | - `widget`_ |
-| | |
-| | from the :doc:`FormType `: |
-| | |
-| | - `attr`_ |
-| | - `data`_ |
-| | - `disabled`_ |
-| | - `help`_ |
-| | - `help_attr`_ |
-| | - `help_html`_ |
-| | - `inherit_data`_ |
-| | - `invalid_message`_ |
-| | - `invalid_message_parameters`_ |
-| | - `mapped`_ |
-| | - `row_attr`_ |
-+----------------------+-------------------------------------------------------------------------------+
-| Parent type | :doc:`DateType ` |
-+----------------------+-------------------------------------------------------------------------------+
-| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\BirthdayType` |
-+----------------------+-------------------------------------------------------------------------------+
++---------------------------+-------------------------------------------------------------------------------+
+| Underlying Data Type | can be ``DateTime``, ``string``, ``timestamp``, or ``array`` |
+| | (see the :ref:`input option `) |
++---------------------------+-------------------------------------------------------------------------------+
+| Rendered as | can be three select boxes or 1 or 3 text boxes, based on the `widget`_ option |
++---------------------------+-------------------------------------------------------------------------------+
+| Overridden options | - `invalid_message`_ |
+| | - `years`_ |
++---------------------------+-------------------------------------------------------------------------------+
+| Inherited options | from the :doc:`DateType `: |
+| | |
+| | - `choice_translation_domain`_ |
+| | - `days`_ |
+| | - `placeholder`_ |
+| | - `format`_ |
+| | - `input`_ |
+| | - `input_format`_ |
+| | - `model_timezone`_ |
+| | - `months`_ |
+| | - `view_timezone`_ |
+| | - `widget`_ |
+| | |
+| | from the :doc:`FormType `: |
+| | |
+| | - `attr`_ |
+| | - `data`_ |
+| | - `disabled`_ |
+| | - `help`_ |
+| | - `help_attr`_ |
+| | - `help_html`_ |
+| | - `inherit_data`_ |
+| | - `invalid_message_parameters`_ |
+| | - `mapped`_ |
+| | - `row_attr`_ |
++---------------------------+-------------------------------------------------------------------------------+
+| Default `invalid_message` | Please enter a valid birthdate. |
++---------------------------+-------------------------------------------------------------------------------+
+| Legacy `invalid_message` | The value {{ value }} is not valid. |
++---------------------------+-------------------------------------------------------------------------------+
+| Parent type | :doc:`DateType ` |
++---------------------------+-------------------------------------------------------------------------------+
+| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\BirthdayType` |
++---------------------------+-------------------------------------------------------------------------------+
.. include:: /reference/forms/types/options/_debug_form.rst.inc
Overridden Options
------------------
+.. include:: /reference/forms/types/options/invalid_message.rst.inc
+
``years``
~~~~~~~~~
@@ -128,8 +134,6 @@ These options inherit from the :doc:`FormType `:
.. include:: /reference/forms/types/options/inherit_data.rst.inc
-.. include:: /reference/forms/types/options/invalid_message.rst.inc
-
.. include:: /reference/forms/types/options/invalid_message_parameters.rst.inc
.. include:: /reference/forms/types/options/mapped.rst.inc
diff --git a/reference/forms/types/checkbox.rst b/reference/forms/types/checkbox.rst
index aef03ef1e44..1463c542a1e 100644
--- a/reference/forms/types/checkbox.rst
+++ b/reference/forms/types/checkbox.rst
@@ -11,34 +11,39 @@ you can specify an array of values that, if submitted, will be evaluated
to "false" as well (this differs from what HTTP defines, but can be handy
if you want to handle submitted values like "0" or "false").
-+-------------+------------------------------------------------------------------------+
-| Rendered as | ``input`` ``checkbox`` field |
-+-------------+------------------------------------------------------------------------+
-| Options | - `false_values`_ |
-| | - `value`_ |
-+-------------+------------------------------------------------------------------------+
-| Overridden | - `compound`_ |
-| options | - `empty_data`_ |
-+-------------+------------------------------------------------------------------------+
-| Inherited | - `attr`_ |
-| options | - `data`_ |
-| | - `disabled`_ |
-| | - `error_bubbling`_ |
-| | - `error_mapping`_ |
-| | - `help`_ |
-| | - `help_attr`_ |
-| | - `help_html`_ |
-| | - `label`_ |
-| | - `label_attr`_ |
-| | - `label_format`_ |
-| | - `mapped`_ |
-| | - `required`_ |
-| | - `row_attr`_ |
-+-------------+------------------------------------------------------------------------+
-| Parent type | :doc:`FormType ` |
-+-------------+------------------------------------------------------------------------+
-| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\CheckboxType` |
-+-------------+------------------------------------------------------------------------+
++---------------------------+------------------------------------------------------------------------+
+| Rendered as | ``input`` ``checkbox`` field |
++---------------------------+------------------------------------------------------------------------+
+| Options | - `false_values`_ |
+| | - `value`_ |
++---------------------------+------------------------------------------------------------------------+
+| Overridden options | - `compound`_ |
+| | - `empty_data`_ |
+| | - `invalid_message`_ |
++---------------------------+------------------------------------------------------------------------+
+| Inherited options | - `attr`_ |
+| | - `data`_ |
+| | - `disabled`_ |
+| | - `error_bubbling`_ |
+| | - `error_mapping`_ |
+| | - `help`_ |
+| | - `help_attr`_ |
+| | - `help_html`_ |
+| | - `label`_ |
+| | - `label_attr`_ |
+| | - `label_format`_ |
+| | - `mapped`_ |
+| | - `required`_ |
+| | - `row_attr`_ |
++---------------------------+------------------------------------------------------------------------+
+| Default `invalid_message` | The checkbox has an invalid value. |
++---------------------------+------------------------------------------------------------------------+
+| Legacy `invalid_message` | The value {{ value }} is not valid. |
++---------------------------+------------------------------------------------------------------------+
+| Parent type | :doc:`FormType ` |
++---------------------------+------------------------------------------------------------------------+
+| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\CheckboxType` |
++---------------------------+------------------------------------------------------------------------+
.. include:: /reference/forms/types/options/_debug_form.rst.inc
@@ -74,6 +79,8 @@ Overridden Options
.. include:: /reference/forms/types/options/checkbox_empty_data.rst.inc
+.. include:: /reference/forms/types/options/invalid_message.rst.inc
+
Inherited Options
-----------------
diff --git a/reference/forms/types/choice.rst b/reference/forms/types/choice.rst
index 04efd2fe02c..d0c81a829bd 100644
--- a/reference/forms/types/choice.rst
+++ b/reference/forms/types/choice.rst
@@ -9,52 +9,57 @@ It can be rendered as a ``select`` tag, radio buttons, or checkboxes.
To use this field, you must specify *either* ``choices`` or ``choice_loader`` option.
-+-------------+------------------------------------------------------------------------------+
-| Rendered as | can be various tags (see below) |
-+-------------+------------------------------------------------------------------------------+
-| Options | - `choices`_ |
-| | - `choice_attr`_ |
-| | - `choice_filter`_ |
-| | - `choice_label`_ |
-| | - `choice_loader`_ |
-| | - `choice_name`_ |
-| | - `choice_translation_domain`_ |
-| | - `choice_value`_ |
-| | - `expanded`_ |
-| | - `group_by`_ |
-| | - `multiple`_ |
-| | - `placeholder`_ |
-| | - `preferred_choices`_ |
-+-------------+------------------------------------------------------------------------------+
-| Overridden | - `compound`_ |
-| options | - `empty_data`_ |
-| | - `error_bubbling`_ |
-| | - `trim`_ |
-+-------------+------------------------------------------------------------------------------+
-| Inherited | - `attr`_ |
-| options | - `by_reference`_ |
-| | - `data`_ |
-| | - `disabled`_ |
-| | - `error_mapping`_ |
-| | - `help`_ |
-| | - `help_attr`_ |
-| | - `help_html`_ |
-| | - `inherit_data`_ |
-| | - `label`_ |
-| | - `label_attr`_ |
-| | - `label_format`_ |
-| | - `mapped`_ |
-| | - `required`_ |
-| | - `row_attr`_ |
-| | - `translation_domain`_ |
-| | - `label_translation_parameters`_ |
-| | - `attr_translation_parameters`_ |
-| | - `help_translation_parameters`_ |
-+-------------+------------------------------------------------------------------------------+
-| Parent type | :doc:`FormType ` |
-+-------------+------------------------------------------------------------------------------+
-| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\ChoiceType` |
-+-------------+------------------------------------------------------------------------------+
++---------------------------+----------------------------------------------------------------------+
+| Rendered as | can be various tags (see below) |
++---------------------------+----------------------------------------------------------------------+
+| Options | - `choices`_ |
+| | - `choice_attr`_ |
+| | - `choice_filter`_ |
+| | - `choice_label`_ |
+| | - `choice_loader`_ |
+| | - `choice_name`_ |
+| | - `choice_translation_domain`_ |
+| | - `choice_value`_ |
+| | - `expanded`_ |
+| | - `group_by`_ |
+| | - `multiple`_ |
+| | - `placeholder`_ |
+| | - `preferred_choices`_ |
++---------------------------+----------------------------------------------------------------------+
+| Overridden options | - `compound`_ |
+| | - `empty_data`_ |
+| | - `error_bubbling`_ |
+| | - `trim`_ |
+| | - `invalid_message`_ |
++---------------------------+----------------------------------------------------------------------+
+| Inherited options | - `attr`_ |
+| | - `by_reference`_ |
+| | - `data`_ |
+| | - `disabled`_ |
+| | - `error_mapping`_ |
+| | - `help`_ |
+| | - `help_attr`_ |
+| | - `help_html`_ |
+| | - `inherit_data`_ |
+| | - `label`_ |
+| | - `label_attr`_ |
+| | - `label_format`_ |
+| | - `mapped`_ |
+| | - `required`_ |
+| | - `row_attr`_ |
+| | - `translation_domain`_ |
+| | - `label_translation_parameters`_ |
+| | - `attr_translation_parameters`_ |
+| | - `help_translation_parameters`_ |
++---------------------------+----------------------------------------------------------------------+
+| Default `invalid_message` | The selected choice is invalid. |
++---------------------------+----------------------------------------------------------------------+
+| Legacy `invalid_message` | The value {{ value }} is not valid. |
++---------------------------+----------------------------------------------------------------------+
+| Parent type | :doc:`FormType ` |
++---------------------------+----------------------------------------------------------------------+
+| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\ChoiceType` |
++---------------------------+----------------------------------------------------------------------+
.. include:: /reference/forms/types/options/_debug_form.rst.inc
@@ -272,6 +277,8 @@ the parent field (the form in most cases).
.. include:: /reference/forms/types/options/choice_type_trim.rst.inc
+.. include:: /reference/forms/types/options/invalid_message.rst.inc
+
Inherited Options
-----------------
diff --git a/reference/forms/types/collection.rst b/reference/forms/types/collection.rst
index f3f0c8f4562..a30cc250f6f 100644
--- a/reference/forms/types/collection.rst
+++ b/reference/forms/types/collection.rst
@@ -11,37 +11,43 @@ forms, which is useful when creating forms that expose one-to-many
relationships (e.g. a product from where you can manage many related product
photos).
-+-------------+-----------------------------------------------------------------------------+
-| Rendered as | depends on the `entry_type`_ option |
-+-------------+-----------------------------------------------------------------------------+
-| Options | - `allow_add`_ |
-| | - `allow_delete`_ |
-| | - `delete_empty`_ |
-| | - `entry_options`_ |
-| | - `entry_type`_ |
-| | - `prototype`_ |
-| | - `prototype_data`_ |
-| | - `prototype_name`_ |
-+-------------+-----------------------------------------------------------------------------+
-| Inherited | - `attr`_ |
-| options | - `by_reference`_ |
-| | - `empty_data`_ |
-| | - `error_bubbling`_ |
-| | - `error_mapping`_ |
-| | - `help`_ |
-| | - `help_attr`_ |
-| | - `help_html`_ |
-| | - `label`_ |
-| | - `label_attr`_ |
-| | - `label_format`_ |
-| | - `mapped`_ |
-| | - `required`_ |
-| | - `row_attr`_ |
-+-------------+-----------------------------------------------------------------------------+
-| Parent type | :doc:`FormType ` |
-+-------------+-----------------------------------------------------------------------------+
-| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\CollectionType` |
-+-------------+-----------------------------------------------------------------------------+
++---------------------------+--------------------------------------------------------------------------+
+| Rendered as | depends on the `entry_type`_ option |
++---------------------------+--------------------------------------------------------------------------+
+| Options | - `allow_add`_ |
+| | - `allow_delete`_ |
+| | - `delete_empty`_ |
+| | - `entry_options`_ |
+| | - `entry_type`_ |
+| | - `prototype`_ |
+| | - `prototype_data`_ |
+| | - `prototype_name`_ |
++---------------------------+--------------------------------------------------------------------------+
+| Overridden options | - `invalid_message`_ |
++---------------------------+--------------------------------------------------------------------------+
+| Inherited options | - `attr`_ |
+| | - `by_reference`_ |
+| | - `empty_data`_ |
+| | - `error_bubbling`_ |
+| | - `error_mapping`_ |
+| | - `help`_ |
+| | - `help_attr`_ |
+| | - `help_html`_ |
+| | - `label`_ |
+| | - `label_attr`_ |
+| | - `label_format`_ |
+| | - `mapped`_ |
+| | - `required`_ |
+| | - `row_attr`_ |
++---------------------------+--------------------------------------------------------------------------+
+| Default `invalid_message` | The collection is invalid. |
++---------------------------+--------------------------------------------------------------------------+
+| Legacy `invalid_message` | The value {{ value }} is not valid. |
++---------------------------+--------------------------------------------------------------------------+
+| Parent type | :doc:`FormType ` |
++---------------------------+--------------------------------------------------------------------------+
+| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\CollectionType` |
++---------------------------+--------------------------------------------------------------------------+
.. include:: /reference/forms/types/options/_debug_form.rst.inc
@@ -396,6 +402,11 @@ If you have several collections in your form, or worse, nested collections
you may want to change the placeholder so that unrelated placeholders are
not replaced with the same value.
+Overridden Options
+------------------
+
+.. include:: /reference/forms/types/options/invalid_message.rst.inc
+
Inherited Options
-----------------
diff --git a/reference/forms/types/color.rst b/reference/forms/types/color.rst
index 5dfd61915ce..f3d97c6cd1b 100644
--- a/reference/forms/types/color.rst
+++ b/reference/forms/types/color.rst
@@ -14,32 +14,38 @@ The value of the underlying ```` field is always a
That's why it's not possible to select semi-transparent colors with this
element.
-+-------------+---------------------------------------------------------------------+
-| Rendered as | ``input`` ``color`` field (a text box) |
-+-------------+---------------------------------------------------------------------+
-| Options | - `html5`_ |
-+-------------+---------------------------------------------------------------------+
-| Inherited | - `attr`_ |
-| options | - `data`_ |
-| | - `disabled`_ |
-| | - `empty_data`_ |
-| | - `error_bubbling`_ |
-| | - `error_mapping`_ |
-| | - `help`_ |
-| | - `help_attr`_ |
-| | - `help_html`_ |
-| | - `label`_ |
-| | - `label_attr`_ |
-| | - `label_format`_ |
-| | - `mapped`_ |
-| | - `required`_ |
-| | - `row_attr`_ |
-| | - `trim`_ |
-+-------------+---------------------------------------------------------------------+
-| Parent type | :doc:`TextType ` |
-+-------------+---------------------------------------------------------------------+
-| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\ColorType` |
-+-------------+---------------------------------------------------------------------+
++---------------------------+---------------------------------------------------------------------+
+| Rendered as | ``input`` ``color`` field (a text box) |
++---------------------------+---------------------------------------------------------------------+
+| Options | - `html5`_ |
++---------------------------+---------------------------------------------------------------------+
+| Overridden options | - `invalid_message`_ |
++---------------------------+---------------------------------------------------------------------+
+| Inherited options | - `attr`_ |
+| | - `data`_ |
+| | - `disabled`_ |
+| | - `empty_data`_ |
+| | - `error_bubbling`_ |
+| | - `error_mapping`_ |
+| | - `help`_ |
+| | - `help_attr`_ |
+| | - `help_html`_ |
+| | - `label`_ |
+| | - `label_attr`_ |
+| | - `label_format`_ |
+| | - `mapped`_ |
+| | - `required`_ |
+| | - `row_attr`_ |
+| | - `trim`_ |
++---------------------------+---------------------------------------------------------------------+
+| Default `invalid_message` | Please select a valid color. |
++---------------------------+---------------------------------------------------------------------+
+| Legacy `invalid_message` | The value {{ value }} is not valid. |
++---------------------------+---------------------------------------------------------------------+
+| Parent type | :doc:`TextType ` |
++---------------------------+---------------------------------------------------------------------+
+| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\ColorType` |
++---------------------------+---------------------------------------------------------------------+
.. include:: /reference/forms/types/options/_debug_form.rst.inc
@@ -59,6 +65,11 @@ When this option is set to ``true``, the form type checks that its value matches
the `HTML5 color format`_ (``/^#[0-9a-f]{6}$/i``). If it doesn't match it,
you'll see the following error message: *"This value is not a valid HTML5 color"*.
+Overridden Options
+------------------
+
+.. include:: /reference/forms/types/options/invalid_message.rst.inc
+
Inherited Options
-----------------
diff --git a/reference/forms/types/country.rst b/reference/forms/types/country.rst
index f4082e498e8..a2b1527764e 100644
--- a/reference/forms/types/country.rst
+++ b/reference/forms/types/country.rst
@@ -18,45 +18,50 @@ Unlike the ``ChoiceType``, you don't need to specify a ``choices`` option as the
field type automatically uses all of the countries of the world. You *can* specify
the option manually, but then you should just use the ``ChoiceType`` directly.
-+-------------+-----------------------------------------------------------------------+
-| Rendered as | can be various tags (see :ref:`forms-reference-choice-tags`) |
-+-------------+-----------------------------------------------------------------------+
-| Options | - `alpha3`_ |
-| | - `choice_translation_locale`_ |
-+-------------+-----------------------------------------------------------------------+
-| Overridden | - `choices`_ |
-| options | - `choice_translation_domain`_ |
-+-------------+-----------------------------------------------------------------------+
-| Inherited | from the :doc:`ChoiceType ` |
-| options | |
-| | - `error_bubbling`_ |
-| | - `error_mapping`_ |
-| | - `expanded`_ |
-| | - `multiple`_ |
-| | - `placeholder`_ |
-| | - `preferred_choices`_ |
-| | - `trim`_ |
-| | |
-| | from the :doc:`FormType ` |
-| | |
-| | - `attr`_ |
-| | - `data`_ |
-| | - `disabled`_ |
-| | - `empty_data`_ |
-| | - `help`_ |
-| | - `help_attr`_ |
-| | - `help_html`_ |
-| | - `label`_ |
-| | - `label_attr`_ |
-| | - `label_format`_ |
-| | - `mapped`_ |
-| | - `required`_ |
-| | - `row_attr`_ |
-+-------------+-----------------------------------------------------------------------+
-| Parent type | :doc:`ChoiceType ` |
-+-------------+-----------------------------------------------------------------------+
-| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\CountryType` |
-+-------------+-----------------------------------------------------------------------+
++---------------------------+-----------------------------------------------------------------------+
+| Rendered as | can be various tags (see :ref:`forms-reference-choice-tags`) |
++---------------------------+-----------------------------------------------------------------------+
+| Options | - `alpha3`_ |
+| | - `choice_translation_locale`_ |
++---------------------------+-----------------------------------------------------------------------+
+| Overridden options | - `choices`_ |
+| | - `choice_translation_domain`_ |
+| | - `invalid_message`_ |
++---------------------------+-----------------------------------------------------------------------+
+| Inherited options | from the :doc:`ChoiceType ` |
+| | |
+| | - `error_bubbling`_ |
+| | - `error_mapping`_ |
+| | - `expanded`_ |
+| | - `multiple`_ |
+| | - `placeholder`_ |
+| | - `preferred_choices`_ |
+| | - `trim`_ |
+| | |
+| | from the :doc:`FormType ` |
+| | |
+| | - `attr`_ |
+| | - `data`_ |
+| | - `disabled`_ |
+| | - `empty_data`_ |
+| | - `help`_ |
+| | - `help_attr`_ |
+| | - `help_html`_ |
+| | - `label`_ |
+| | - `label_attr`_ |
+| | - `label_format`_ |
+| | - `mapped`_ |
+| | - `required`_ |
+| | - `row_attr`_ |
++---------------------------+-----------------------------------------------------------------------+
+| Default `invalid_message` | Please select a valid country. |
++---------------------------+-----------------------------------------------------------------------+
+| Legacy `invalid_message` | The value {{ value }} is not valid. |
++---------------------------+-----------------------------------------------------------------------+
+| Parent type | :doc:`ChoiceType ` |
++---------------------------+-----------------------------------------------------------------------+
+| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\CountryType` |
++---------------------------+-----------------------------------------------------------------------+
.. include:: /reference/forms/types/options/_debug_form.rst.inc
@@ -92,6 +97,8 @@ The locale is used to translate the countries names.
.. include:: /reference/forms/types/options/choice_translation_domain_disabled.rst.inc
+.. include:: /reference/forms/types/options/invalid_message.rst.inc
+
Inherited Options
-----------------
diff --git a/reference/forms/types/currency.rst b/reference/forms/types/currency.rst
index 77da0481942..e8628aa3edf 100644
--- a/reference/forms/types/currency.rst
+++ b/reference/forms/types/currency.rst
@@ -11,43 +11,48 @@ Unlike the ``ChoiceType``, you don't need to specify a ``choices`` option as the
field type automatically uses a large list of currencies. You *can* specify the option
manually, but then you should just use the ``ChoiceType`` directly.
-+-------------+------------------------------------------------------------------------+
-| Rendered as | can be various tags (see :ref:`forms-reference-choice-tags`) |
-+-------------+------------------------------------------------------------------------+
-| Options | - `choice_translation_locale`_ |
-+-------------+------------------------------------------------------------------------+
-| Overridden | - `choices`_ |
-| options | - `choice_translation_domain`_ |
-+-------------+------------------------------------------------------------------------+
-| Inherited | from the :doc:`ChoiceType ` |
-| options | |
-| | - `error_bubbling`_ |
-| | - `expanded`_ |
-| | - `multiple`_ |
-| | - `placeholder`_ |
-| | - `preferred_choices`_ |
-| | - `trim`_ |
-| | |
-| | from the :doc:`FormType ` type |
-| | |
-| | - `attr`_ |
-| | - `data`_ |
-| | - `disabled`_ |
-| | - `empty_data`_ |
-| | - `help`_ |
-| | - `help_attr`_ |
-| | - `help_html`_ |
-| | - `label`_ |
-| | - `label_attr`_ |
-| | - `label_format`_ |
-| | - `mapped`_ |
-| | - `required`_ |
-| | - `row_attr`_ |
-+-------------+------------------------------------------------------------------------+
-| Parent type | :doc:`ChoiceType ` |
-+-------------+------------------------------------------------------------------------+
-| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\CurrencyType` |
-+-------------+------------------------------------------------------------------------+
++---------------------------+------------------------------------------------------------------------+
+| Rendered as | can be various tags (see :ref:`forms-reference-choice-tags`) |
++---------------------------+------------------------------------------------------------------------+
+| Options | - `choice_translation_locale`_ |
++---------------------------+------------------------------------------------------------------------+
+| Overridden options | - `choices`_ |
+| | - `choice_translation_domain`_ |
+| | - `invalid_message`_ |
++---------------------------+------------------------------------------------------------------------+
+| Inherited options | from the :doc:`ChoiceType ` |
+| | |
+| | - `error_bubbling`_ |
+| | - `expanded`_ |
+| | - `multiple`_ |
+| | - `placeholder`_ |
+| | - `preferred_choices`_ |
+| | - `trim`_ |
+| | |
+| | from the :doc:`FormType ` type |
+| | |
+| | - `attr`_ |
+| | - `data`_ |
+| | - `disabled`_ |
+| | - `empty_data`_ |
+| | - `help`_ |
+| | - `help_attr`_ |
+| | - `help_html`_ |
+| | - `label`_ |
+| | - `label_attr`_ |
+| | - `label_format`_ |
+| | - `mapped`_ |
+| | - `required`_ |
+| | - `row_attr`_ |
++---------------------------+------------------------------------------------------------------------+
+| Default `invalid_message` | Please select a valid currency. |
++---------------------------+------------------------------------------------------------------------+
+| Legacy `invalid_message` | The value {{ value }} is not valid. |
++---------------------------+------------------------------------------------------------------------+
+| Parent type | :doc:`ChoiceType ` |
++---------------------------+------------------------------------------------------------------------+
+| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\CurrencyType` |
++---------------------------+------------------------------------------------------------------------+
.. include:: /reference/forms/types/options/_debug_form.rst.inc
@@ -73,6 +78,8 @@ The choices option defaults to all currencies.
.. include:: /reference/forms/types/options/choice_translation_domain_disabled.rst.inc
+.. include:: /reference/forms/types/options/invalid_message.rst.inc
+
Inherited Options
-----------------
diff --git a/reference/forms/types/date.rst b/reference/forms/types/date.rst
index 582b5bef6ff..fa696007803 100644
--- a/reference/forms/types/date.rst
+++ b/reference/forms/types/date.rst
@@ -10,46 +10,50 @@ different HTML elements.
This field can be rendered in a variety of different ways via the `widget`_ option
and can understand a number of different input formats via the `input`_ option.
-+----------------------+-----------------------------------------------------------------------------+
-| Underlying Data Type | can be ``DateTime``, string, timestamp, or array (see the ``input`` option) |
-+----------------------+-----------------------------------------------------------------------------+
-| Rendered as | single text box or three select fields |
-+----------------------+-----------------------------------------------------------------------------+
-| Options | - `days`_ |
-| | - `placeholder`_ |
-| | - `format`_ |
-| | - `html5`_ |
-| | - `input`_ |
-| | - `input_format`_ |
-| | - `model_timezone`_ |
-| | - `months`_ |
-| | - `view_timezone`_ |
-| | - `widget`_ |
-| | - `years`_ |
-+----------------------+-----------------------------------------------------------------------------+
-| Overridden options | - `by_reference`_ |
-| | - `choice_translation_domain`_ |
-| | - `compound`_ |
-| | - `data_class`_ |
-| | - `error_bubbling`_ |
-+----------------------+-----------------------------------------------------------------------------+
-| Inherited | - `attr`_ |
-| options | - `data`_ |
-| | - `disabled`_ |
-| | - `error_mapping`_ |
-| | - `help`_ |
-| | - `help_attr`_ |
-| | - `help_html`_ |
-| | - `inherit_data`_ |
-| | - `invalid_message`_ |
-| | - `invalid_message_parameters`_ |
-| | - `mapped`_ |
-| | - `row_attr`_ |
-+----------------------+-----------------------------------------------------------------------------+
-| Parent type | :doc:`FormType ` |
-+----------------------+-----------------------------------------------------------------------------+
-| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\DateType` |
-+----------------------+-----------------------------------------------------------------------------+
++---------------------------+-----------------------------------------------------------------------------+
+| Underlying Data Type | can be ``DateTime``, string, timestamp, or array (see the ``input`` option) |
++---------------------------+-----------------------------------------------------------------------------+
+| Rendered as | single text box or three select fields |
++---------------------------+-----------------------------------------------------------------------------+
+| Options | - `days`_ |
+| | - `placeholder`_ |
+| | - `format`_ |
+| | - `html5`_ |
+| | - `input`_ |
+| | - `input_format`_ |
+| | - `model_timezone`_ |
+| | - `months`_ |
+| | - `view_timezone`_ |
+| | - `widget`_ |
+| | - `years`_ |
++---------------------------+-----------------------------------------------------------------------------+
+| Overridden options | - `by_reference`_ |
+| | - `choice_translation_domain`_ |
+| | - `compound`_ |
+| | - `data_class`_ |
+| | - `error_bubbling`_ |
+| | - `invalid_message`_ |
++---------------------------+-----------------------------------------------------------------------------+
+| Inherited options | - `attr`_ |
+| | - `data`_ |
+| | - `disabled`_ |
+| | - `error_mapping`_ |
+| | - `help`_ |
+| | - `help_attr`_ |
+| | - `help_html`_ |
+| | - `inherit_data`_ |
+| | - `invalid_message_parameters`_ |
+| | - `mapped`_ |
+| | - `row_attr`_ |
++---------------------------+-----------------------------------------------------------------------------+
+| Default `invalid_message` | Please enter a valid date. |
++---------------------------+-----------------------------------------------------------------------------+
+| Legacy `invalid_message` | The value {{ value }} is not valid. |
++---------------------------+-----------------------------------------------------------------------------+
+| Parent type | :doc:`FormType ` |
++---------------------------+-----------------------------------------------------------------------------+
+| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\DateType` |
++---------------------------+-----------------------------------------------------------------------------+
.. include:: /reference/forms/types/options/_debug_form.rst.inc
@@ -210,6 +214,8 @@ The ``DateTime`` classes are treated as immutable objects.
**default**: ``false``
+.. include:: /reference/forms/types/options/invalid_message.rst.inc
+
Inherited Options
-----------------
@@ -231,8 +237,6 @@ These options inherit from the :doc:`FormType `:
.. include:: /reference/forms/types/options/inherit_data.rst.inc
-.. include:: /reference/forms/types/options/invalid_message.rst.inc
-
.. include:: /reference/forms/types/options/invalid_message_parameters.rst.inc
.. include:: /reference/forms/types/options/mapped.rst.inc
diff --git a/reference/forms/types/dateinterval.rst b/reference/forms/types/dateinterval.rst
index 84986f93c87..69147d95bee 100644
--- a/reference/forms/types/dateinterval.rst
+++ b/reference/forms/types/dateinterval.rst
@@ -12,47 +12,52 @@ The field can be rendered in a variety of different ways (see `widget`_) and can
give you a ``DateInterval`` object, an `ISO 8601`_ duration string (e.g. ``P1DT12H``)
or an array (see `input`_).
-+----------------------+----------------------------------------------------------------------------------+
-| Underlying Data Type | can be ``DateInterval``, string or array (see the ``input`` option) |
-+----------------------+----------------------------------------------------------------------------------+
-| Rendered as | single text box, multiple text boxes or select fields - see the `widget`_ option |
-+----------------------+----------------------------------------------------------------------------------+
-| Options | - `days`_ |
-| | - `hours`_ |
-| | - `minutes`_ |
-| | - `months`_ |
-| | - `seconds`_ |
-| | - `weeks`_ |
-| | - `input`_ |
-| | - `labels`_ |
-| | - `placeholder`_ |
-| | - `widget`_ |
-| | - `with_days`_ |
-| | - `with_hours`_ |
-| | - `with_invert`_ |
-| | - `with_minutes`_ |
-| | - `with_months`_ |
-| | - `with_seconds`_ |
-| | - `with_weeks`_ |
-| | - `with_years`_ |
-| | - `years`_ |
-+----------------------+----------------------------------------------------------------------------------+
-| Inherited | - `attr`_ |
-| options | - `data`_ |
-| | - `disabled`_ |
-| | - `help`_ |
-| | - `help_attr`_ |
-| | - `help_html`_ |
-| | - `inherit_data`_ |
-| | - `invalid_message`_ |
-| | - `invalid_message_parameters`_ |
-| | - `mapped`_ |
-| | - `row_attr`_ |
-+----------------------+----------------------------------------------------------------------------------+
-| Parent type | :doc:`FormType ` |
-+----------------------+----------------------------------------------------------------------------------+
-| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\DateIntervalType` |
-+----------------------+----------------------------------------------------------------------------------+
++---------------------------+----------------------------------------------------------------------------------+
+| Underlying Data Type | can be ``DateInterval``, string or array (see the ``input`` option) |
++---------------------------+----------------------------------------------------------------------------------+
+| Rendered as | single text box, multiple text boxes or select fields - see the `widget`_ option |
++---------------------------+----------------------------------------------------------------------------------+
+| Options | - `days`_ |
+| | - `hours`_ |
+| | - `minutes`_ |
+| | - `months`_ |
+| | - `seconds`_ |
+| | - `weeks`_ |
+| | - `input`_ |
+| | - `labels`_ |
+| | - `placeholder`_ |
+| | - `widget`_ |
+| | - `with_days`_ |
+| | - `with_hours`_ |
+| | - `with_invert`_ |
+| | - `with_minutes`_ |
+| | - `with_months`_ |
+| | - `with_seconds`_ |
+| | - `with_weeks`_ |
+| | - `with_years`_ |
+| | - `years`_ |
++---------------------------+----------------------------------------------------------------------------------+
+| Overridden options | - `invalid_message`_ |
++---------------------------+----------------------------------------------------------------------------------+
+| Inherited options | - `attr`_ |
+| | - `data`_ |
+| | - `disabled`_ |
+| | - `help`_ |
+| | - `help_attr`_ |
+| | - `help_html`_ |
+| | - `inherit_data`_ |
+| | - `invalid_message_parameters`_ |
+| | - `mapped`_ |
+| | - `row_attr`_ |
++---------------------------+----------------------------------------------------------------------------------+
+| Default `invalid_message` | Please choose a valid date interval. |
++---------------------------+----------------------------------------------------------------------------------+
+| Legacy `invalid_message` | The value {{ value }} is not valid. |
++---------------------------+----------------------------------------------------------------------------------+
+| Parent type | :doc:`FormType ` |
++---------------------------+----------------------------------------------------------------------------------+
+| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\DateIntervalType` |
++---------------------------+----------------------------------------------------------------------------------+
.. include:: /reference/forms/types/options/_debug_form.rst.inc
@@ -333,6 +338,11 @@ when the ``widget`` option is set to ``choice``::
// values displayed to users range from 1 to 100 (both inclusive)
'years' => array_combine(range(1, 100), range(1, 100)),
+Overridden Options
+------------------
+
+.. include:: /reference/forms/types/options/invalid_message.rst.inc
+
Inherited Options
-----------------
@@ -352,8 +362,6 @@ These options inherit from the :doc:`form ` type:
.. include:: /reference/forms/types/options/inherit_data.rst.inc
-.. include:: /reference/forms/types/options/invalid_message.rst.inc
-
.. include:: /reference/forms/types/options/invalid_message_parameters.rst.inc
.. include:: /reference/forms/types/options/mapped.rst.inc
diff --git a/reference/forms/types/datetime.rst b/reference/forms/types/datetime.rst
index ad56b6e2d52..ca61be3e538 100644
--- a/reference/forms/types/datetime.rst
+++ b/reference/forms/types/datetime.rst
@@ -10,55 +10,59 @@ date and time (e.g. ``1984-06-05 12:15:30``).
Can be rendered as a text input or select tags. The underlying format of
the data can be a ``DateTime`` object, a string, a timestamp or an array.
-+----------------------+-----------------------------------------------------------------------------+
-| Underlying Data Type | can be ``DateTime``, string, timestamp, or array (see the ``input`` option) |
-+----------------------+-----------------------------------------------------------------------------+
-| Rendered as | single text box or three select fields |
-+----------------------+-----------------------------------------------------------------------------+
-| Options | - `choice_translation_domain`_ |
-| | - `date_format`_ |
-| | - `date_label`_ |
-| | - `date_widget`_ |
-| | - `days`_ |
-| | - `placeholder`_ |
-| | - `format`_ |
-| | - `hours`_ |
-| | - `html5`_ |
-| | - `input`_ |
-| | - `input_format`_ |
-| | - `minutes`_ |
-| | - `model_timezone`_ |
-| | - `months`_ |
-| | - `seconds`_ |
-| | - `time_label`_ |
-| | - `time_widget`_ |
-| | - `view_timezone`_ |
-| | - `widget`_ |
-| | - `with_minutes`_ |
-| | - `with_seconds`_ |
-| | - `years`_ |
-+----------------------+-----------------------------------------------------------------------------+
-| Overridden options | - `by_reference`_ |
-| | - `compound`_ |
-| | - `data_class`_ |
-| | - `error_bubbling`_ |
-+----------------------+-----------------------------------------------------------------------------+
-| Inherited | - `attr`_ |
-| options | - `data`_ |
-| | - `disabled`_ |
-| | - `help`_ |
-| | - `help_attr`_ |
-| | - `help_html`_ |
-| | - `inherit_data`_ |
-| | - `invalid_message`_ |
-| | - `invalid_message_parameters`_ |
-| | - `mapped`_ |
-| | - `row_attr`_ |
-+----------------------+-----------------------------------------------------------------------------+
-| Parent type | :doc:`FormType ` |
-+----------------------+-----------------------------------------------------------------------------+
-| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\DateTimeType` |
-+----------------------+-----------------------------------------------------------------------------+
++---------------------------+-----------------------------------------------------------------------------+
+| Underlying Data Type | can be ``DateTime``, string, timestamp, or array (see the ``input`` option) |
++---------------------------+-----------------------------------------------------------------------------+
+| Rendered as | single text box or three select fields |
++---------------------------+-----------------------------------------------------------------------------+
+| Options | - `choice_translation_domain`_ |
+| | - `date_format`_ |
+| | - `date_label`_ |
+| | - `date_widget`_ |
+| | - `days`_ |
+| | - `placeholder`_ |
+| | - `format`_ |
+| | - `hours`_ |
+| | - `html5`_ |
+| | - `input`_ |
+| | - `input_format`_ |
+| | - `minutes`_ |
+| | - `model_timezone`_ |
+| | - `months`_ |
+| | - `seconds`_ |
+| | - `time_label`_ |
+| | - `time_widget`_ |
+| | - `view_timezone`_ |
+| | - `widget`_ |
+| | - `with_minutes`_ |
+| | - `with_seconds`_ |
+| | - `years`_ |
++---------------------------+-----------------------------------------------------------------------------+
+| Overridden options | - `by_reference`_ |
+| | - `compound`_ |
+| | - `data_class`_ |
+| | - `error_bubbling`_ |
+| | - `invalid_message`_ |
++---------------------------+-----------------------------------------------------------------------------+
+| Inherited options | - `attr`_ |
+| | - `data`_ |
+| | - `disabled`_ |
+| | - `help`_ |
+| | - `help_attr`_ |
+| | - `help_html`_ |
+| | - `inherit_data`_ |
+| | - `invalid_message_parameters`_ |
+| | - `mapped`_ |
+| | - `row_attr`_ |
++---------------------------+-----------------------------------------------------------------------------+
+| Default `invalid_message` | Please enter a valid date and time. |
++---------------------------+-----------------------------------------------------------------------------+
+| Legacy `invalid_message` | The value {{ value }} is not valid. |
++---------------------------+-----------------------------------------------------------------------------+
+| Parent type | :doc:`FormType ` |
++---------------------------+-----------------------------------------------------------------------------+
+| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\DateTimeType` |
++---------------------------+-----------------------------------------------------------------------------+
.. include:: /reference/forms/types/options/_debug_form.rst.inc
@@ -231,6 +235,8 @@ error_bubbling
**default**: ``false``
+.. include:: /reference/forms/types/options/invalid_message.rst.inc
+
Inherited Options
-----------------
@@ -250,8 +256,6 @@ These options inherit from the :doc:`FormType `:
.. include:: /reference/forms/types/options/inherit_data.rst.inc
-.. include:: /reference/forms/types/options/invalid_message.rst.inc
-
.. include:: /reference/forms/types/options/invalid_message_parameters.rst.inc
.. include:: /reference/forms/types/options/mapped.rst.inc
diff --git a/reference/forms/types/email.rst b/reference/forms/types/email.rst
index 74eeaa95272..31d6f5db90b 100644
--- a/reference/forms/types/email.rst
+++ b/reference/forms/types/email.rst
@@ -7,33 +7,44 @@ EmailType Field
The ``EmailType`` field is a text field that is rendered using the HTML5
```` tag.
-+-------------+---------------------------------------------------------------------+
-| Rendered as | ``input`` ``email`` field (a text box) |
-+-------------+---------------------------------------------------------------------+
-| Inherited | - `attr`_ |
-| options | - `data`_ |
-| | - `disabled`_ |
-| | - `empty_data`_ |
-| | - `error_bubbling`_ |
-| | - `error_mapping`_ |
-| | - `help`_ |
-| | - `help_attr`_ |
-| | - `help_html`_ |
-| | - `label`_ |
-| | - `label_attr`_ |
-| | - `label_format`_ |
-| | - `mapped`_ |
-| | - `required`_ |
-| | - `row_attr`_ |
-| | - `trim`_ |
-+-------------+---------------------------------------------------------------------+
-| Parent type | :doc:`TextType ` |
-+-------------+---------------------------------------------------------------------+
-| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\EmailType` |
-+-------------+---------------------------------------------------------------------+
++---------------------------+---------------------------------------------------------------------+
+| Rendered as | ``input`` ``email`` field (a text box) |
++---------------------------+---------------------------------------------------------------------+
+| Overridden options | - `invalid_message`_ |
++---------------------------+---------------------------------------------------------------------+
+| Inherited options | - `attr`_ |
+| | - `data`_ |
+| | - `disabled`_ |
+| | - `empty_data`_ |
+| | - `error_bubbling`_ |
+| | - `error_mapping`_ |
+| | - `help`_ |
+| | - `help_attr`_ |
+| | - `help_html`_ |
+| | - `label`_ |
+| | - `label_attr`_ |
+| | - `label_format`_ |
+| | - `mapped`_ |
+| | - `required`_ |
+| | - `row_attr`_ |
+| | - `trim`_ |
++---------------------------+---------------------------------------------------------------------+
+| Default `invalid_message` | Please enter a valid email address. |
++---------------------------+---------------------------------------------------------------------+
+| Legacy `invalid_message` | The value {{ value }} is not valid. |
++---------------------------+---------------------------------------------------------------------+
+| Parent type | :doc:`TextType ` |
++---------------------------+---------------------------------------------------------------------+
+| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\EmailType` |
++---------------------------+---------------------------------------------------------------------+
.. include:: /reference/forms/types/options/_debug_form.rst.inc
+Overridden Options
+------------------
+
+.. include:: /reference/forms/types/options/invalid_message.rst.inc
+
Inherited Options
-----------------
diff --git a/reference/forms/types/file.rst b/reference/forms/types/file.rst
index 66a18560577..f745c9bc1fd 100644
--- a/reference/forms/types/file.rst
+++ b/reference/forms/types/file.rst
@@ -6,33 +6,38 @@ FileType Field
The ``FileType`` represents a file input in your form.
-+-------------+---------------------------------------------------------------------+
-| Rendered as | ``input`` ``file`` field |
-+-------------+---------------------------------------------------------------------+
-| Options | - `multiple`_ |
-+-------------+---------------------------------------------------------------------+
-| Overridden | - `compound`_ |
-| options | - `data_class`_ |
-| | - `empty_data`_ |
-+-------------+---------------------------------------------------------------------+
-| Inherited | - `attr`_ |
-| options | - `disabled`_ |
-| | - `error_bubbling`_ |
-| | - `error_mapping`_ |
-| | - `help`_ |
-| | - `help_attr`_ |
-| | - `help_html`_ |
-| | - `label`_ |
-| | - `label_attr`_ |
-| | - `label_format`_ |
-| | - `mapped`_ |
-| | - `required`_ |
-| | - `row_attr`_ |
-+-------------+---------------------------------------------------------------------+
-| Parent type | :doc:`FormType ` |
-+-------------+---------------------------------------------------------------------+
-| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\FileType` |
-+-------------+---------------------------------------------------------------------+
++---------------------------+--------------------------------------------------------------------+
+| Rendered as | ``input`` ``file`` field |
++---------------------------+--------------------------------------------------------------------+
+| Options | - `multiple`_ |
++---------------------------+--------------------------------------------------------------------+
+| Overridden options | - `compound`_ |
+| | - `data_class`_ |
+| | - `empty_data`_ |
+| | - `invalid_message`_ |
++---------------------------+--------------------------------------------------------------------+
+| Inherited options | - `attr`_ |
+| | - `disabled`_ |
+| | - `error_bubbling`_ |
+| | - `error_mapping`_ |
+| | - `help`_ |
+| | - `help_attr`_ |
+| | - `help_html`_ |
+| | - `label`_ |
+| | - `label_attr`_ |
+| | - `label_format`_ |
+| | - `mapped`_ |
+| | - `required`_ |
+| | - `row_attr`_ |
++---------------------------+--------------------------------------------------------------------+
+| Default `invalid_message` | Please select a valid file. |
++---------------------------+--------------------------------------------------------------------+
+| Legacy `invalid_message` | The value {{ value }} is not valid. |
++---------------------------+--------------------------------------------------------------------+
+| Parent type | :doc:`FormType ` |
++---------------------------+--------------------------------------------------------------------+
+| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\FileType` |
++---------------------------+--------------------------------------------------------------------+
.. include:: /reference/forms/types/options/_debug_form.rst.inc
@@ -120,6 +125,11 @@ This option sets the appropriate file-related data mapper to be used by the type
This option determines what value the field will return when the submitted
value is empty.
+Overridden Options
+------------------
+
+.. include:: /reference/forms/types/options/invalid_message.rst.inc
+
Inherited Options
-----------------
diff --git a/reference/forms/types/form.rst b/reference/forms/types/form.rst
index 8a0c219f410..e406413bf37 100644
--- a/reference/forms/types/form.rst
+++ b/reference/forms/types/form.rst
@@ -7,51 +7,55 @@ FormType Field
The ``FormType`` predefines a couple of options that are then available
on all types for which ``FormType`` is the parent.
-+-----------+--------------------------------------------------------------------+
-| Options | - `action`_ |
-| | - `allow_extra_fields`_ |
-| | - `by_reference`_ |
-| | - `compound`_ |
-| | - `constraints`_ |
-| | - `data`_ |
-| | - `data_class`_ |
-| | - `empty_data`_ |
-| | - `error_bubbling`_ |
-| | - `error_mapping`_ |
-| | - `extra_fields_message`_ |
-| | - `help`_ |
-| | - `help_attr`_ |
-| | - `help_html`_ |
-| | - `help_translation_parameters`_ |
-| | - `inherit_data`_ |
-| | - `invalid_message`_ |
-| | - `invalid_message_parameters`_ |
-| | - `label_attr`_ |
-| | - `label_format`_ |
-| | - `mapped`_ |
-| | - `method`_ |
-| | - `post_max_size_message`_ |
-| | - `property_path`_ |
-| | - `required`_ |
-| | - `trim`_ |
-| | - `validation_groups`_ |
-+-----------+--------------------------------------------------------------------+
-| Inherited | - `attr`_ |
-| options | - `auto_initialize`_ |
-| | - `block_name`_ |
-| | - `block_prefix`_ |
-| | - `disabled`_ |
-| | - `label`_ |
-| | - `label_html`_ |
-| | - `row_attr`_ |
-| | - `translation_domain`_ |
-| | - `label_translation_parameters`_ |
-| | - `attr_translation_parameters`_ |
-+-----------+--------------------------------------------------------------------+
-| Parent | none |
-+-----------+--------------------------------------------------------------------+
-| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\FormType` |
-+-----------+--------------------------------------------------------------------+
++---------------------------+--------------------------------------------------------------------+
+| Options | - `action`_ |
+| | - `allow_extra_fields`_ |
+| | - `by_reference`_ |
+| | - `compound`_ |
+| | - `constraints`_ |
+| | - `data`_ |
+| | - `data_class`_ |
+| | - `empty_data`_ |
+| | - `error_bubbling`_ |
+| | - `error_mapping`_ |
+| | - `extra_fields_message`_ |
+| | - `help`_ |
+| | - `help_attr`_ |
+| | - `help_html`_ |
+| | - `help_translation_parameters`_ |
+| | - `inherit_data`_ |
+| | - `invalid_message`_ |
+| | - `invalid_message_parameters`_ |
+| | - `label_attr`_ |
+| | - `label_format`_ |
+| | - `mapped`_ |
+| | - `method`_ |
+| | - `post_max_size_message`_ |
+| | - `property_path`_ |
+| | - `required`_ |
+| | - `trim`_ |
+| | - `validation_groups`_ |
++---------------------------+--------------------------------------------------------------------+
+| Inherited options | - `attr`_ |
+| | - `auto_initialize`_ |
+| | - `block_name`_ |
+| | - `block_prefix`_ |
+| | - `disabled`_ |
+| | - `label`_ |
+| | - `label_html`_ |
+| | - `row_attr`_ |
+| | - `translation_domain`_ |
+| | - `label_translation_parameters`_ |
+| | - `attr_translation_parameters`_ |
++---------------------------+--------------------------------------------------------------------+
+| Default `invalid_message` | This value is not valid. |
++---------------------------+--------------------------------------------------------------------+
+| Legacy `invalid_message` | This value is not valid. |
++---------------------------+--------------------------------------------------------------------+
+| Parent | none |
++---------------------------+--------------------------------------------------------------------+
+| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\FormType` |
++---------------------------+--------------------------------------------------------------------+
.. include:: /reference/forms/types/options/_debug_form.rst.inc
diff --git a/reference/forms/types/hidden.rst b/reference/forms/types/hidden.rst
index 1a74e107555..f0bddfa4260 100644
--- a/reference/forms/types/hidden.rst
+++ b/reference/forms/types/hidden.rst
@@ -6,25 +6,30 @@ HiddenType Field
The hidden type represents a hidden input field.
-+-------------+----------------------------------------------------------------------+
-| Rendered as | ``input`` ``hidden`` field |
-+-------------+----------------------------------------------------------------------+
-| Overridden | - `compound`_ |
-| options | - `error_bubbling`_ |
-| | - `required`_ |
-+-------------+----------------------------------------------------------------------+
-| Inherited | - `attr`_ |
-| options | - `data`_ |
-| | - `empty_data`_ |
-| | - `error_mapping`_ |
-| | - `mapped`_ |
-| | - `property_path`_ |
-| | - `row_attr`_ |
-+-------------+----------------------------------------------------------------------+
-| Parent type | :doc:`FormType ` |
-+-------------+----------------------------------------------------------------------+
-| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\HiddenType` |
-+-------------+----------------------------------------------------------------------+
++---------------------------+----------------------------------------------------------------------+
+| Rendered as | ``input`` ``hidden`` field |
++---------------------------+----------------------------------------------------------------------+
+| Overridden options | - `compound`_ |
+| | - `error_bubbling`_ |
+| | - `invalid_message`_ |
+| | - `required`_ |
++---------------------------+----------------------------------------------------------------------+
+| Inherited options | - `attr`_ |
+| | - `data`_ |
+| | - `empty_data`_ |
+| | - `error_mapping`_ |
+| | - `mapped`_ |
+| | - `property_path`_ |
+| | - `row_attr`_ |
++---------------------------+----------------------------------------------------------------------+
+| Default `invalid_message` | The hidden field is invalid. |
++---------------------------+----------------------------------------------------------------------+
+| Legacy `invalid_message` | The value {{ value }} is not valid. |
++---------------------------+----------------------------------------------------------------------+
+| Parent type | :doc:`FormType ` |
++---------------------------+----------------------------------------------------------------------+
+| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\HiddenType` |
++---------------------------+----------------------------------------------------------------------+
.. include:: /reference/forms/types/options/_debug_form.rst.inc
@@ -40,6 +45,8 @@ Overridden Options
Pass errors to the root form, otherwise they will not be visible.
+.. include:: /reference/forms/types/options/invalid_message.rst.inc
+
``required``
~~~~~~~~~~~~
diff --git a/reference/forms/types/integer.rst b/reference/forms/types/integer.rst
index fa5660158bc..7eb32abf7f9 100644
--- a/reference/forms/types/integer.rst
+++ b/reference/forms/types/integer.rst
@@ -13,37 +13,40 @@ This field has different options on how to handle input values that aren't
integers. By default, all non-integer values (e.g. 6.78) will round down
(e.g. 6).
-+-------------+-----------------------------------------------------------------------+
-| Rendered as | ``input`` ``number`` field |
-+-------------+-----------------------------------------------------------------------+
-| Options | - `grouping`_ |
-| | - `rounding_mode`_ |
-+-------------+-----------------------------------------------------------------------+
-| Overridden | - `compound`_ |
-| options | |
-+-------------+-----------------------------------------------------------------------+
-| Inherited | - `attr`_ |
-| options | - `data`_ |
-| | - `disabled`_ |
-| | - `empty_data`_ |
-| | - `error_bubbling`_ |
-| | - `error_mapping`_ |
-| | - `help`_ |
-| | - `help_attr`_ |
-| | - `help_html`_ |
-| | - `invalid_message`_ |
-| | - `invalid_message_parameters`_ |
-| | - `label`_ |
-| | - `label_attr`_ |
-| | - `label_format`_ |
-| | - `mapped`_ |
-| | - `required`_ |
-| | - `row_attr`_ |
-+-------------+-----------------------------------------------------------------------+
-| Parent type | :doc:`FormType ` |
-+-------------+-----------------------------------------------------------------------+
-| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\IntegerType` |
-+-------------+-----------------------------------------------------------------------+
++---------------------------+-----------------------------------------------------------------------+
+| Rendered as | ``input`` ``number`` field |
++---------------------------+-----------------------------------------------------------------------+
+| Options | - `grouping`_ |
+| | - `rounding_mode`_ |
++---------------------------+-----------------------------------------------------------------------+
+| Overridden options | - `compound`_ |
+| | - `invalid_message`_ |
++---------------------------+-----------------------------------------------------------------------+
+| Inherited options | - `attr`_ |
+| | - `data`_ |
+| | - `disabled`_ |
+| | - `empty_data`_ |
+| | - `error_bubbling`_ |
+| | - `error_mapping`_ |
+| | - `help`_ |
+| | - `help_attr`_ |
+| | - `help_html`_ |
+| | - `invalid_message_parameters`_ |
+| | - `label`_ |
+| | - `label_attr`_ |
+| | - `label_format`_ |
+| | - `mapped`_ |
+| | - `required`_ |
+| | - `row_attr`_ |
++---------------------------+-----------------------------------------------------------------------+
+| Default `invalid_message` | Please enter an integer. |
++---------------------------+-----------------------------------------------------------------------+
+| Legacy `invalid_message` | The value {{ value }} is not valid. |
++---------------------------+-----------------------------------------------------------------------+
+| Parent type | :doc:`FormType ` |
++---------------------------+-----------------------------------------------------------------------+
+| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\IntegerType` |
++---------------------------+-----------------------------------------------------------------------+
.. include:: /reference/forms/types/options/_debug_form.rst.inc
@@ -86,6 +89,8 @@ Overridden Options
.. include:: /reference/forms/types/options/compound_type.rst.inc
+.. include:: /reference/forms/types/options/invalid_message.rst.inc
+
Inherited Options
-----------------
@@ -115,8 +120,6 @@ The default value is ``''`` (the empty string).
.. include:: /reference/forms/types/options/help_html.rst.inc
-.. include:: /reference/forms/types/options/invalid_message.rst.inc
-
.. include:: /reference/forms/types/options/invalid_message_parameters.rst.inc
.. include:: /reference/forms/types/options/label.rst.inc
diff --git a/reference/forms/types/language.rst b/reference/forms/types/language.rst
index 5fa38697701..420ab1b59a0 100644
--- a/reference/forms/types/language.rst
+++ b/reference/forms/types/language.rst
@@ -20,46 +20,51 @@ Unlike the ``ChoiceType``, you don't need to specify a ``choices`` option as the
field type automatically uses a large list of languages. You *can* specify the option
manually, but then you should just use the ``ChoiceType`` directly.
-+-------------+------------------------------------------------------------------------+
-| Rendered as | can be various tags (see :ref:`forms-reference-choice-tags`) |
-+-------------+------------------------------------------------------------------------+
-| Options | - `alpha3`_ |
-| | - `choice_self_translation`_ |
-| | - `choice_translation_locale`_ |
-+-------------+------------------------------------------------------------------------+
-| Overridden | - `choices`_ |
-| options | - `choice_translation_domain`_ |
-+-------------+------------------------------------------------------------------------+
-| Inherited | from the :doc:`ChoiceType ` |
-| options | |
-| | - `error_bubbling`_ |
-| | - `error_mapping`_ |
-| | - `expanded`_ |
-| | - `multiple`_ |
-| | - `placeholder`_ |
-| | - `preferred_choices`_ |
-| | - `trim`_ |
-| | |
-| | from the :doc:`FormType ` |
-| | |
-| | - `attr`_ |
-| | - `data`_ |
-| | - `disabled`_ |
-| | - `empty_data`_ |
-| | - `help`_ |
-| | - `help_attr`_ |
-| | - `help_html`_ |
-| | - `label`_ |
-| | - `label_attr`_ |
-| | - `label_format`_ |
-| | - `mapped`_ |
-| | - `required`_ |
-| | - `row_attr`_ |
-+-------------+------------------------------------------------------------------------+
-| Parent type | :doc:`ChoiceType ` |
-+-------------+------------------------------------------------------------------------+
-| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\LanguageType` |
-+-------------+------------------------------------------------------------------------+
++---------------------------+------------------------------------------------------------------------+
+| Rendered as | can be various tags (see :ref:`forms-reference-choice-tags`) |
++---------------------------+------------------------------------------------------------------------+
+| Options | - `alpha3`_ |
+| | - `choice_self_translation`_ |
+| | - `choice_translation_locale`_ |
++---------------------------+------------------------------------------------------------------------+
+| Overridden options | - `choices`_ |
+| | - `choice_translation_domain`_ |
+| | - `invalid_message`_ |
++---------------------------+------------------------------------------------------------------------+
+| Inherited options | from the :doc:`ChoiceType ` |
+| | |
+| | - `error_bubbling`_ |
+| | - `error_mapping`_ |
+| | - `expanded`_ |
+| | - `multiple`_ |
+| | - `placeholder`_ |
+| | - `preferred_choices`_ |
+| | - `trim`_ |
+| | |
+| | from the :doc:`FormType ` |
+| | |
+| | - `attr`_ |
+| | - `data`_ |
+| | - `disabled`_ |
+| | - `empty_data`_ |
+| | - `help`_ |
+| | - `help_attr`_ |
+| | - `help_html`_ |
+| | - `label`_ |
+| | - `label_attr`_ |
+| | - `label_format`_ |
+| | - `mapped`_ |
+| | - `required`_ |
+| | - `row_attr`_ |
++---------------------------+------------------------------------------------------------------------+
+| Default `invalid_message` | Please select a valid language. |
++---------------------------+------------------------------------------------------------------------+
+| Legacy `invalid_message` | The value {{ value }} is not valid. |
++---------------------------+------------------------------------------------------------------------+
+| Parent type | :doc:`ChoiceType ` |
++---------------------------+------------------------------------------------------------------------+
+| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\LanguageType` |
++---------------------------+------------------------------------------------------------------------+
.. include:: /reference/forms/types/options/_debug_form.rst.inc
@@ -114,6 +119,8 @@ The default locale is used to translate the languages names.
.. include:: /reference/forms/types/options/choice_translation_domain_disabled.rst.inc
+.. include:: /reference/forms/types/options/invalid_message.rst.inc
+
Inherited Options
-----------------
diff --git a/reference/forms/types/locale.rst b/reference/forms/types/locale.rst
index 385cc4f6fd8..be6dde7e950 100644
--- a/reference/forms/types/locale.rst
+++ b/reference/forms/types/locale.rst
@@ -21,44 +21,49 @@ Unlike the ``ChoiceType``, you don't need to specify a ``choices`` option as the
field type automatically uses a large list of locales. You *can* specify these options
manually, but then you should just use the ``ChoiceType`` directly.
-+-------------+------------------------------------------------------------------------+
-| Rendered as | can be various tags (see :ref:`forms-reference-choice-tags`) |
-+-------------+------------------------------------------------------------------------+
-| Options | - `choice_translation_locale`_ |
-+-------------+------------------------------------------------------------------------+
-| Overridden | - `choices`_ |
-| options | - `choice_translation_domain`_ |
-+-------------+------------------------------------------------------------------------+
-| Inherited | from the :doc:`ChoiceType ` |
-| options | |
-| | - `error_bubbling`_ |
-| | - `error_mapping`_ |
-| | - `expanded`_ |
-| | - `multiple`_ |
-| | - `placeholder`_ |
-| | - `preferred_choices`_ |
-| | - `trim`_ |
-| | |
-| | from the :doc:`FormType ` |
-| | |
-| | - `attr`_ |
-| | - `data`_ |
-| | - `disabled`_ |
-| | - `empty_data`_ |
-| | - `help`_ |
-| | - `help_attr`_ |
-| | - `help_html`_ |
-| | - `label`_ |
-| | - `label_attr`_ |
-| | - `label_format`_ |
-| | - `mapped`_ |
-| | - `required`_ |
-| | - `row_attr`_ |
-+-------------+------------------------------------------------------------------------+
-| Parent type | :doc:`ChoiceType ` |
-+-------------+------------------------------------------------------------------------+
-| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\LocaleType` |
-+-------------+------------------------------------------------------------------------+
++---------------------------+----------------------------------------------------------------------+
+| Rendered as | can be various tags (see :ref:`forms-reference-choice-tags`) |
++---------------------------+----------------------------------------------------------------------+
+| Options | - `choice_translation_locale`_ |
++---------------------------+----------------------------------------------------------------------+
+| Overridden options | - `choices`_ |
+| | - `choice_translation_domain`_ |
+| | - `invalid_message`_ |
++---------------------------+----------------------------------------------------------------------+
+| Inherited options | from the :doc:`ChoiceType ` |
+| | |
+| | - `error_bubbling`_ |
+| | - `error_mapping`_ |
+| | - `expanded`_ |
+| | - `multiple`_ |
+| | - `placeholder`_ |
+| | - `preferred_choices`_ |
+| | - `trim`_ |
+| | |
+| | from the :doc:`FormType ` |
+| | |
+| | - `attr`_ |
+| | - `data`_ |
+| | - `disabled`_ |
+| | - `empty_data`_ |
+| | - `help`_ |
+| | - `help_attr`_ |
+| | - `help_html`_ |
+| | - `label`_ |
+| | - `label_attr`_ |
+| | - `label_format`_ |
+| | - `mapped`_ |
+| | - `required`_ |
+| | - `row_attr`_ |
++---------------------------+----------------------------------------------------------------------+
+| Default `invalid_message` | Please select a valid locale. |
++---------------------------+----------------------------------------------------------------------+
+| Legacy `invalid_message` | The value {{ value }} is not valid. |
++---------------------------+----------------------------------------------------------------------+
+| Parent type | :doc:`ChoiceType ` |
++---------------------------+----------------------------------------------------------------------+
+| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\LocaleType` |
++---------------------------+----------------------------------------------------------------------+
.. include:: /reference/forms/types/options/_debug_form.rst.inc
@@ -85,6 +90,8 @@ specify the language.
.. include:: /reference/forms/types/options/choice_translation_domain_disabled.rst.inc
+.. include:: /reference/forms/types/options/invalid_message.rst.inc
+
Inherited Options
-----------------
diff --git a/reference/forms/types/money.rst b/reference/forms/types/money.rst
index bb91d0b08da..ca7a5aceac7 100644
--- a/reference/forms/types/money.rst
+++ b/reference/forms/types/money.rst
@@ -11,41 +11,44 @@ This field type allows you to specify a currency, whose symbol is rendered
next to the text field. There are also several other options for customizing
how the input and output of the data is handled.
-+-------------+---------------------------------------------------------------------+
-| Rendered as | ``input`` ``text`` field |
-+-------------+---------------------------------------------------------------------+
-| Options | - `currency`_ |
-| | - `divisor`_ |
-| | - `grouping`_ |
-| | - `html5`_ |
-| | - `rounding_mode`_ |
-| | - `scale`_ |
-+-------------+---------------------------------------------------------------------+
-| Overridden | - `compound`_ |
-| options | |
-+-------------+---------------------------------------------------------------------+
-| Inherited | - `attr`_ |
-| options | - `data`_ |
-| | - `disabled`_ |
-| | - `empty_data`_ |
-| | - `error_bubbling`_ |
-| | - `error_mapping`_ |
-| | - `help`_ |
-| | - `help_attr`_ |
-| | - `help_html`_ |
-| | - `invalid_message`_ |
-| | - `invalid_message_parameters`_ |
-| | - `label`_ |
-| | - `label_attr`_ |
-| | - `label_format`_ |
-| | - `mapped`_ |
-| | - `required`_ |
-| | - `row_attr`_ |
-+-------------+---------------------------------------------------------------------+
-| Parent type | :doc:`FormType ` |
-+-------------+---------------------------------------------------------------------+
-| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\MoneyType` |
-+-------------+---------------------------------------------------------------------+
++---------------------------+---------------------------------------------------------------------+
+| Rendered as | ``input`` ``text`` field |
++---------------------------+---------------------------------------------------------------------+
+| Options | - `currency`_ |
+| | - `divisor`_ |
+| | - `grouping`_ |
+| | - `html5`_ |
+| | - `rounding_mode`_ |
+| | - `scale`_ |
++---------------------------+---------------------------------------------------------------------+
+| Overridden options | - `compound`_ |
+| | - `invalid_message`_ |
++---------------------------+---------------------------------------------------------------------+
+| Inherited options | - `attr`_ |
+| | - `data`_ |
+| | - `disabled`_ |
+| | - `empty_data`_ |
+| | - `error_bubbling`_ |
+| | - `error_mapping`_ |
+| | - `help`_ |
+| | - `help_attr`_ |
+| | - `help_html`_ |
+| | - `invalid_message_parameters`_ |
+| | - `label`_ |
+| | - `label_attr`_ |
+| | - `label_format`_ |
+| | - `mapped`_ |
+| | - `required`_ |
+| | - `row_attr`_ |
++---------------------------+---------------------------------------------------------------------+
+| Default `invalid_message` | Please enter a valid money amount. |
++---------------------------+---------------------------------------------------------------------+
+| Legacy `invalid_message` | The value {{ value }} is not valid. |
++---------------------------+---------------------------------------------------------------------+
+| Parent type | :doc:`FormType ` |
++---------------------------+---------------------------------------------------------------------+
+| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\MoneyType` |
++---------------------------+---------------------------------------------------------------------+
.. include:: /reference/forms/types/options/_debug_form.rst.inc
@@ -122,6 +125,8 @@ Overridden Options
.. include:: /reference/forms/types/options/compound_type.rst.inc
+.. include:: /reference/forms/types/options/invalid_message.rst.inc
+
Inherited Options
-----------------
@@ -151,8 +156,6 @@ The default value is ``''`` (the empty string).
.. include:: /reference/forms/types/options/help_html.rst.inc
-.. include:: /reference/forms/types/options/invalid_message.rst.inc
-
.. include:: /reference/forms/types/options/invalid_message_parameters.rst.inc
.. include:: /reference/forms/types/options/label.rst.inc
diff --git a/reference/forms/types/number.rst b/reference/forms/types/number.rst
index 599d0efa4cd..319c84b951e 100644
--- a/reference/forms/types/number.rst
+++ b/reference/forms/types/number.rst
@@ -8,40 +8,43 @@ Renders an input text field and specializes in handling number input. This
type offers different options for the scale, rounding and grouping
that you want to use for your number.
-+-------------+----------------------------------------------------------------------+
-| Rendered as | ``input`` ``text`` field |
-+-------------+----------------------------------------------------------------------+
-| Options | - `grouping`_ |
-| | - `html5`_ |
-| | - `input`_ |
-| | - `scale`_ |
-| | - `rounding_mode`_ |
-+-------------+----------------------------------------------------------------------+
-| Overridden | - `compound`_ |
-| options | |
-+-------------+----------------------------------------------------------------------+
-| Inherited | - `attr`_ |
-| options | - `data`_ |
-| | - `disabled`_ |
-| | - `empty_data`_ |
-| | - `error_bubbling`_ |
-| | - `error_mapping`_ |
-| | - `help`_ |
-| | - `help_attr`_ |
-| | - `help_html`_ |
-| | - `invalid_message`_ |
-| | - `invalid_message_parameters`_ |
-| | - `label`_ |
-| | - `label_attr`_ |
-| | - `label_format`_ |
-| | - `mapped`_ |
-| | - `required`_ |
-| | - `row_attr`_ |
-+-------------+----------------------------------------------------------------------+
-| Parent type | :doc:`FormType ` |
-+-------------+----------------------------------------------------------------------+
-| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\NumberType` |
-+-------------+----------------------------------------------------------------------+
++---------------------------+----------------------------------------------------------------------+
+| Rendered as | ``input`` ``text`` field |
++---------------------------+----------------------------------------------------------------------+
+| Options | - `grouping`_ |
+| | - `html5`_ |
+| | - `input`_ |
+| | - `scale`_ |
+| | - `rounding_mode`_ |
++---------------------------+----------------------------------------------------------------------+
+| Overridden options | - `compound`_ |
+| | - `invalid_message`_ |
++---------------------------+----------------------------------------------------------------------+
+| Inherited options | - `attr`_ |
+| | - `data`_ |
+| | - `disabled`_ |
+| | - `empty_data`_ |
+| | - `error_bubbling`_ |
+| | - `error_mapping`_ |
+| | - `help`_ |
+| | - `help_attr`_ |
+| | - `help_html`_ |
+| | - `invalid_message_parameters`_ |
+| | - `label`_ |
+| | - `label_attr`_ |
+| | - `label_format`_ |
+| | - `mapped`_ |
+| | - `required`_ |
+| | - `row_attr`_ |
++---------------------------+----------------------------------------------------------------------+
+| Default `invalid_message` | Please enter a number. |
++---------------------------+----------------------------------------------------------------------+
+| Legacy `invalid_message` | The value {{ value }} is not valid. |
++---------------------------+----------------------------------------------------------------------+
+| Parent type | :doc:`FormType ` |
++---------------------------+----------------------------------------------------------------------+
+| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\NumberType` |
++---------------------------+----------------------------------------------------------------------+
.. include:: /reference/forms/types/options/_debug_form.rst.inc
@@ -86,6 +89,8 @@ Overridden Options
.. include:: /reference/forms/types/options/compound_type.rst.inc
+.. include:: /reference/forms/types/options/invalid_message.rst.inc
+
Inherited Options
-----------------
@@ -115,8 +120,6 @@ The default value is ``''`` (the empty string).
.. include:: /reference/forms/types/options/help_html.rst.inc
-.. include:: /reference/forms/types/options/invalid_message.rst.inc
-
.. include:: /reference/forms/types/options/invalid_message_parameters.rst.inc
.. include:: /reference/forms/types/options/label.rst.inc
diff --git a/reference/forms/types/password.rst b/reference/forms/types/password.rst
index 37acff1a616..10b38a5ac8b 100644
--- a/reference/forms/types/password.rst
+++ b/reference/forms/types/password.rst
@@ -6,33 +6,37 @@ PasswordType Field
The ``PasswordType`` field renders an input password text box.
-+-------------+------------------------------------------------------------------------+
-| Rendered as | ``input`` ``password`` field |
-+-------------+------------------------------------------------------------------------+
-| Options | - `always_empty`_ |
-+-------------+------------------------------------------------------------------------+
-| Overridden | - `trim`_ |
-| options | |
-+-------------+------------------------------------------------------------------------+
-| Inherited | - `attr`_ |
-| options | - `disabled`_ |
-| | - `empty_data`_ |
-| | - `error_bubbling`_ |
-| | - `error_mapping`_ |
-| | - `help`_ |
-| | - `help_attr`_ |
-| | - `help_html`_ |
-| | - `label`_ |
-| | - `label_attr`_ |
-| | - `label_format`_ |
-| | - `mapped`_ |
-| | - `required`_ |
-| | - `row_attr`_ |
-+-------------+------------------------------------------------------------------------+
-| Parent type | :doc:`TextType ` |
-+-------------+------------------------------------------------------------------------+
-| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\PasswordType` |
-+-------------+------------------------------------------------------------------------+
++---------------------------+------------------------------------------------------------------------+
+| Rendered as | ``input`` ``password`` field |
++---------------------------+------------------------------------------------------------------------+
+| Options | - `always_empty`_ |
++---------------------------+------------------------------------------------------------------------+
+| Overridden options | - `invalid_message`_ |
+| | - `trim`_ |
++---------------------------+------------------------------------------------------------------------+
+| Inherited options | - `attr`_ |
+| | - `disabled`_ |
+| | - `empty_data`_ |
+| | - `error_bubbling`_ |
+| | - `error_mapping`_ |
+| | - `help`_ |
+| | - `help_attr`_ |
+| | - `help_html`_ |
+| | - `label`_ |
+| | - `label_attr`_ |
+| | - `label_format`_ |
+| | - `mapped`_ |
+| | - `required`_ |
+| | - `row_attr`_ |
++---------------------------+------------------------------------------------------------------------+
+| Default `invalid_message` | The password is invalid. |
++---------------------------+------------------------------------------------------------------------+
+| Legacy `invalid_message` | The value {{ value }} is not valid. |
++---------------------------+------------------------------------------------------------------------+
+| Parent type | :doc:`TextType ` |
++---------------------------+------------------------------------------------------------------------+
+| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\PasswordType` |
++---------------------------+------------------------------------------------------------------------+
.. include:: /reference/forms/types/options/_debug_form.rst.inc
@@ -54,6 +58,8 @@ entered into the box, set this to false and submit the form.
Overridden Options
------------------
+.. include:: /reference/forms/types/options/invalid_message.rst.inc
+
``trim``
~~~~~~~~
diff --git a/reference/forms/types/percent.rst b/reference/forms/types/percent.rst
index 4b21f1f2856..3dd47e1d320 100644
--- a/reference/forms/types/percent.rst
+++ b/reference/forms/types/percent.rst
@@ -12,40 +12,43 @@ you can use this field out-of-the-box. If you store your data as a number
When ``symbol`` is not ``false``, the field will render the given string after
the input.
-+-------------+-----------------------------------------------------------------------+
-| Rendered as | ``input`` ``text`` field |
-+-------------+-----------------------------------------------------------------------+
-| Options | - `html5`_ |
-| | - `rounding_mode`_ |
-| | - `scale`_ |
-| | - `symbol`_ |
-| | - `type`_ |
-+-------------+-----------------------------------------------------------------------+
-| Overridden | - `compound`_ |
-| options | |
-+-------------+-----------------------------------------------------------------------+
-| Inherited | - `attr`_ |
-| options | - `data`_ |
-| | - `disabled`_ |
-| | - `empty_data`_ |
-| | - `error_bubbling`_ |
-| | - `error_mapping`_ |
-| | - `help`_ |
-| | - `help_attr`_ |
-| | - `help_html`_ |
-| | - `invalid_message`_ |
-| | - `invalid_message_parameters`_ |
-| | - `label`_ |
-| | - `label_attr`_ |
-| | - `label_format`_ |
-| | - `mapped`_ |
-| | - `required`_ |
-| | - `row_attr`_ |
-+-------------+-----------------------------------------------------------------------+
-| Parent type | :doc:`FormType ` |
-+-------------+-----------------------------------------------------------------------+
-| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\PercentType` |
-+-------------+-----------------------------------------------------------------------+
++---------------------------+-----------------------------------------------------------------------+
+| Rendered as | ``input`` ``text`` field |
++---------------------------+-----------------------------------------------------------------------+
+| Options | - `html5`_ |
+| | - `rounding_mode`_ |
+| | - `scale`_ |
+| | - `symbol`_ |
+| | - `type`_ |
++---------------------------+-----------------------------------------------------------------------+
+| Overridden options | - `compound`_ |
+| | - `invalid_message`_ |
++---------------------------+-----------------------------------------------------------------------+
+| Inherited options | - `attr`_ |
+| | - `data`_ |
+| | - `disabled`_ |
+| | - `empty_data`_ |
+| | - `error_bubbling`_ |
+| | - `error_mapping`_ |
+| | - `help`_ |
+| | - `help_attr`_ |
+| | - `help_html`_ |
+| | - `invalid_message_parameters`_ |
+| | - `label`_ |
+| | - `label_attr`_ |
+| | - `label_format`_ |
+| | - `mapped`_ |
+| | - `required`_ |
+| | - `row_attr`_ |
++---------------------------+-----------------------------------------------------------------------+
+| Default `invalid_message` | Please enter a percentage value. |
++---------------------------+-----------------------------------------------------------------------+
+| Legacy `invalid_message` | The value {{ value }} is not valid. |
++---------------------------+-----------------------------------------------------------------------+
+| Parent type | :doc:`FormType ` |
++---------------------------+-----------------------------------------------------------------------+
+| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\PercentType` |
++---------------------------+-----------------------------------------------------------------------+
.. include:: /reference/forms/types/options/_debug_form.rst.inc
@@ -115,6 +118,8 @@ Overridden Options
.. include:: /reference/forms/types/options/compound_type.rst.inc
+.. include:: /reference/forms/types/options/invalid_message.rst.inc
+
Inherited Options
-----------------
@@ -144,8 +149,6 @@ The default value is ``''`` (the empty string).
.. include:: /reference/forms/types/options/help_html.rst.inc
-.. include:: /reference/forms/types/options/invalid_message.rst.inc
-
.. include:: /reference/forms/types/options/invalid_message_parameters.rst.inc
.. include:: /reference/forms/types/options/label.rst.inc
diff --git a/reference/forms/types/radio.rst b/reference/forms/types/radio.rst
index ae0d58d2fe4..579dab0bc1d 100644
--- a/reference/forms/types/radio.rst
+++ b/reference/forms/types/radio.rst
@@ -13,38 +13,49 @@ The ``RadioType`` isn't usually used directly. More commonly it's used
internally by other types such as :doc:`ChoiceType `.
If you want to have a boolean field, use :doc:`CheckboxType `.
-+-------------+---------------------------------------------------------------------+
-| Rendered as | ``input`` ``radio`` field |
-+-------------+---------------------------------------------------------------------+
-| Inherited | from the :doc:`CheckboxType `: |
-| options | |
-| | - `value`_ |
-| | |
-| | from the :doc:`FormType `: |
-| | |
-| | - `attr`_ |
-| | - `data`_ |
-| | - `disabled`_ |
-| | - `empty_data`_ |
-| | - `error_bubbling`_ |
-| | - `error_mapping`_ |
-| | - `help`_ |
-| | - `help_attr`_ |
-| | - `help_html`_ |
-| | - `label`_ |
-| | - `label_attr`_ |
-| | - `label_format`_ |
-| | - `mapped`_ |
-| | - `required`_ |
-| | - `row_attr`_ |
-+-------------+---------------------------------------------------------------------+
-| Parent type | :doc:`CheckboxType ` |
-+-------------+---------------------------------------------------------------------+
-| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\RadioType` |
-+-------------+---------------------------------------------------------------------+
++---------------------------+---------------------------------------------------------------------+
+| Rendered as | ``input`` ``radio`` field |
++---------------------------+---------------------------------------------------------------------+
+| Overridden options | - `invalid_message`_ |
++---------------------------+---------------------------------------------------------------------+
+| Inherited options | from the :doc:`CheckboxType `: |
+| | |
+| | - `value`_ |
+| | |
+| | from the :doc:`FormType `: |
+| | |
+| | - `attr`_ |
+| | - `data`_ |
+| | - `disabled`_ |
+| | - `empty_data`_ |
+| | - `error_bubbling`_ |
+| | - `error_mapping`_ |
+| | - `help`_ |
+| | - `help_attr`_ |
+| | - `help_html`_ |
+| | - `label`_ |
+| | - `label_attr`_ |
+| | - `label_format`_ |
+| | - `mapped`_ |
+| | - `required`_ |
+| | - `row_attr`_ |
++---------------------------+---------------------------------------------------------------------+
+| Default `invalid_message` | Please select a valid option. |
++---------------------------+---------------------------------------------------------------------+
+| Legacy `invalid_message` | The value {{ value }} is not valid. |
++---------------------------+---------------------------------------------------------------------+
+| Parent type | :doc:`CheckboxType ` |
++---------------------------+---------------------------------------------------------------------+
+| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\RadioType` |
++---------------------------+---------------------------------------------------------------------+
.. include:: /reference/forms/types/options/_debug_form.rst.inc
+Overridden Options
+------------------
+
+.. include:: /reference/forms/types/options/invalid_message.rst.inc
+
Inherited Options
-----------------
diff --git a/reference/forms/types/range.rst b/reference/forms/types/range.rst
index e328a1bbe97..ab3a0d15859 100644
--- a/reference/forms/types/range.rst
+++ b/reference/forms/types/range.rst
@@ -7,29 +7,35 @@ RangeType Field
The ``RangeType`` field is a slider that is rendered using the HTML5
```` tag.
-+-------------+---------------------------------------------------------------------+
-| Rendered as | ``input`` ``range`` field (slider in HTML5 supported browser) |
-+-------------+---------------------------------------------------------------------+
-| Inherited | - `attr`_ |
-| options | - `data`_ |
-| | - `disabled`_ |
-| | - `empty_data`_ |
-| | - `error_bubbling`_ |
-| | - `error_mapping`_ |
-| | - `help`_ |
-| | - `help_attr`_ |
-| | - `help_html`_ |
-| | - `label`_ |
-| | - `label_attr`_ |
-| | - `mapped`_ |
-| | - `required`_ |
-| | - `row_attr`_ |
-| | - `trim`_ |
-+-------------+---------------------------------------------------------------------+
-| Parent type | :doc:`TextType ` |
-+-------------+---------------------------------------------------------------------+
-| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\RangeType` |
-+-------------+---------------------------------------------------------------------+
++---------------------------+---------------------------------------------------------------------+
+| Rendered as | ``input`` ``range`` field (slider in HTML5 supported browser) |
++---------------------------+---------------------------------------------------------------------+
+| Overridden options | - `invalid_message`_ |
++---------------------------+---------------------------------------------------------------------+
+| Inherited options | - `attr`_ |
+| | - `data`_ |
+| | - `disabled`_ |
+| | - `empty_data`_ |
+| | - `error_bubbling`_ |
+| | - `error_mapping`_ |
+| | - `help`_ |
+| | - `help_attr`_ |
+| | - `help_html`_ |
+| | - `label`_ |
+| | - `label_attr`_ |
+| | - `mapped`_ |
+| | - `required`_ |
+| | - `row_attr`_ |
+| | - `trim`_ |
++---------------------------+---------------------------------------------------------------------+
+| Default `invalid_message` | Please choose a valid range. |
++---------------------------+---------------------------------------------------------------------+
+| Legacy `invalid_message` | The value {{ value }} is not valid. |
++---------------------------+---------------------------------------------------------------------+
+| Parent type | :doc:`TextType ` |
++---------------------------+---------------------------------------------------------------------+
+| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\RangeType` |
++---------------------------+---------------------------------------------------------------------+
.. include:: /reference/forms/types/options/_debug_form.rst.inc
@@ -48,6 +54,11 @@ Basic Usage
]
]);
+Overridden Options
+------------------
+
+.. include:: /reference/forms/types/options/invalid_message.rst.inc
+
Inherited Options
-----------------
diff --git a/reference/forms/types/repeated.rst b/reference/forms/types/repeated.rst
index c78e6cc318e..7a9f6d9d9be 100644
--- a/reference/forms/types/repeated.rst
+++ b/reference/forms/types/repeated.rst
@@ -9,34 +9,37 @@ values must match (or a validation error is thrown). The most common use
is when you need the user to repeat their password or email to verify
accuracy.
-+-------------+------------------------------------------------------------------------+
-| Rendered as | input ``text`` field by default, but see `type`_ option |
-+-------------+------------------------------------------------------------------------+
-| Options | - `first_name`_ |
-| | - `first_options`_ |
-| | - `options`_ |
-| | - `second_name`_ |
-| | - `second_options`_ |
-| | - `type`_ |
-+-------------+------------------------------------------------------------------------+
-| Overridden | - `error_bubbling`_ |
-| options | |
-+-------------+------------------------------------------------------------------------+
-| Inherited | - `attr`_ |
-| options | - `data`_ |
-| | - `error_mapping`_ |
-| | - `help`_ |
-| | - `help_attr`_ |
-| | - `help_html`_ |
-| | - `invalid_message`_ |
-| | - `invalid_message_parameters`_ |
-| | - `mapped`_ |
-| | - `row_attr`_ |
-+-------------+------------------------------------------------------------------------+
-| Parent type | :doc:`FormType ` |
-+-------------+------------------------------------------------------------------------+
-| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\RepeatedType` |
-+-------------+------------------------------------------------------------------------+
++---------------------------+------------------------------------------------------------------------+
+| Rendered as | input ``text`` field by default, but see `type`_ option |
++---------------------------+------------------------------------------------------------------------+
+| Options | - `first_name`_ |
+| | - `first_options`_ |
+| | - `options`_ |
+| | - `second_name`_ |
+| | - `second_options`_ |
+| | - `type`_ |
++---------------------------+------------------------------------------------------------------------+
+| Overridden options | - `error_bubbling`_ |
+| | - `invalid_message`_ |
++---------------------------+------------------------------------------------------------------------+
+| Inherited options | - `attr`_ |
+| | - `data`_ |
+| | - `error_mapping`_ |
+| | - `help`_ |
+| | - `help_attr`_ |
+| | - `help_html`_ |
+| | - `invalid_message_parameters`_ |
+| | - `mapped`_ |
+| | - `row_attr`_ |
++---------------------------+------------------------------------------------------------------------+
+| Default `invalid_message` | The values do not match. |
++---------------------------+------------------------------------------------------------------------+
+| Legacy `invalid_message` | The value {{ value }} is not valid. |
++---------------------------+------------------------------------------------------------------------+
+| Parent type | :doc:`FormType ` |
++---------------------------+------------------------------------------------------------------------+
+| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\RepeatedType` |
++---------------------------+------------------------------------------------------------------------+
.. include:: /reference/forms/types/options/_debug_form.rst.inc
@@ -184,6 +187,8 @@ Overridden Options
**default**: ``false``
+.. include:: /reference/forms/types/options/invalid_message.rst.inc
+
Inherited Options
-----------------
@@ -201,8 +206,6 @@ These options inherit from the :doc:`FormType `:
.. include:: /reference/forms/types/options/help_html.rst.inc
-.. include:: /reference/forms/types/options/invalid_message.rst.inc
-
.. include:: /reference/forms/types/options/invalid_message_parameters.rst.inc
.. include:: /reference/forms/types/options/mapped.rst.inc
diff --git a/reference/forms/types/search.rst b/reference/forms/types/search.rst
index e0f8233aa5b..f9c53733872 100644
--- a/reference/forms/types/search.rst
+++ b/reference/forms/types/search.rst
@@ -9,32 +9,43 @@ special functionality supported by some browsers.
Read about the input search field at `DiveIntoHTML5.info`_
-+-------------+----------------------------------------------------------------------+
-| Rendered as | ``input search`` field |
-+-------------+----------------------------------------------------------------------+
-| Inherited | - `attr`_ |
-| options | - `disabled`_ |
-| | - `empty_data`_ |
-| | - `error_bubbling`_ |
-| | - `error_mapping`_ |
-| | - `help`_ |
-| | - `help_attr`_ |
-| | - `help_html`_ |
-| | - `label`_ |
-| | - `label_attr`_ |
-| | - `label_format`_ |
-| | - `mapped`_ |
-| | - `required`_ |
-| | - `row_attr`_ |
-| | - `trim`_ |
-+-------------+----------------------------------------------------------------------+
-| Parent type | :doc:`TextType ` |
-+-------------+----------------------------------------------------------------------+
-| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\SearchType` |
-+-------------+----------------------------------------------------------------------+
++---------------------------+----------------------------------------------------------------------+
+| Rendered as | ``input search`` field |
++---------------------------+----------------------------------------------------------------------+
+| Overridden options | - `invalid_message`_ |
++---------------------------+----------------------------------------------------------------------+
+| Inherited options | - `attr`_ |
+| | - `disabled`_ |
+| | - `empty_data`_ |
+| | - `error_bubbling`_ |
+| | - `error_mapping`_ |
+| | - `help`_ |
+| | - `help_attr`_ |
+| | - `help_html`_ |
+| | - `label`_ |
+| | - `label_attr`_ |
+| | - `label_format`_ |
+| | - `mapped`_ |
+| | - `required`_ |
+| | - `row_attr`_ |
+| | - `trim`_ |
++---------------------------+----------------------------------------------------------------------+
+| Default `invalid_message` | Please enter a valid search term. |
++---------------------------+----------------------------------------------------------------------+
+| Legacy `invalid_message` | The value {{ value }} is not valid. |
++---------------------------+----------------------------------------------------------------------+
+| Parent type | :doc:`TextType ` |
++---------------------------+----------------------------------------------------------------------+
+| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\SearchType` |
++---------------------------+----------------------------------------------------------------------+
.. include:: /reference/forms/types/options/_debug_form.rst.inc
+Overridden Options
+------------------
+
+.. include:: /reference/forms/types/options/invalid_message.rst.inc
+
Inherited Options
-----------------
diff --git a/reference/forms/types/tel.rst b/reference/forms/types/tel.rst
index f6c19391ada..fc45434bc4e 100644
--- a/reference/forms/types/tel.rst
+++ b/reference/forms/types/tel.rst
@@ -13,33 +13,44 @@ Nevertheless, it may be useful to use this type in web applications because some
browsers (e.g. smartphone browsers) adapt the input keyboard to make it easier
to input phone numbers.
-+-------------+---------------------------------------------------------------------+
-| Rendered as | ``input`` ``tel`` field (a text box) |
-+-------------+---------------------------------------------------------------------+
-| Inherited | - `attr`_ |
-| options | - `data`_ |
-| | - `disabled`_ |
-| | - `empty_data`_ |
-| | - `error_bubbling`_ |
-| | - `error_mapping`_ |
-| | - `help`_ |
-| | - `help_attr`_ |
-| | - `help_html`_ |
-| | - `label`_ |
-| | - `label_attr`_ |
-| | - `label_format`_ |
-| | - `mapped`_ |
-| | - `required`_ |
-| | - `row_attr`_ |
-| | - `trim`_ |
-+-------------+---------------------------------------------------------------------+
-| Parent type | :doc:`TextType ` |
-+-------------+---------------------------------------------------------------------+
-| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\TelType` |
-+-------------+---------------------------------------------------------------------+
++---------------------------+-------------------------------------------------------------------+
+| Rendered as | ``input`` ``tel`` field (a text box) |
++---------------------------+-------------------------------------------------------------------+
+| Overridden options | - `invalid_message`_ |
++---------------------------+-------------------------------------------------------------------+
+| Inherited options | - `attr`_ |
+| | - `data`_ |
+| | - `disabled`_ |
+| | - `empty_data`_ |
+| | - `error_bubbling`_ |
+| | - `error_mapping`_ |
+| | - `help`_ |
+| | - `help_attr`_ |
+| | - `help_html`_ |
+| | - `label`_ |
+| | - `label_attr`_ |
+| | - `label_format`_ |
+| | - `mapped`_ |
+| | - `required`_ |
+| | - `row_attr`_ |
+| | - `trim`_ |
++---------------------------+-------------------------------------------------------------------+
+| Default `invalid_message` | Please provide a valid phone number. |
++---------------------------+-------------------------------------------------------------------+
+| Legacy `invalid_message` | The value {{ value }} is not valid. |
++---------------------------+-------------------------------------------------------------------+
+| Parent type | :doc:`TextType ` |
++---------------------------+-------------------------------------------------------------------+
+| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\TelType` |
++---------------------------+-------------------------------------------------------------------+
.. include:: /reference/forms/types/options/_debug_form.rst.inc
+Overridden Options
+------------------
+
+.. include:: /reference/forms/types/options/invalid_message.rst.inc
+
Inherited Options
-----------------
diff --git a/reference/forms/types/time.rst b/reference/forms/types/time.rst
index 042e3e7da0c..08c3efb77f4 100644
--- a/reference/forms/types/time.rst
+++ b/reference/forms/types/time.rst
@@ -10,48 +10,52 @@ This can be rendered as a text field, a series of text fields (e.g. hour,
minute, second) or a series of select fields. The underlying data can be
stored as a ``DateTime`` object, a string, a timestamp or an array.
-+----------------------+-----------------------------------------------------------------------------+
-| Underlying Data Type | can be ``DateTime``, string, timestamp, or array (see the ``input`` option) |
-+----------------------+-----------------------------------------------------------------------------+
-| Rendered as | can be various tags (see below) |
-+----------------------+-----------------------------------------------------------------------------+
-| Options | - `choice_translation_domain`_ |
-| | - `placeholder`_ |
-| | - `hours`_ |
-| | - `html5`_ |
-| | - `input`_ |
-| | - `input_format`_ |
-| | - `minutes`_ |
-| | - `model_timezone`_ |
-| | - `reference_date`_ |
-| | - `seconds`_ |
-| | - `view_timezone`_ |
-| | - `widget`_ |
-| | - `with_minutes`_ |
-| | - `with_seconds`_ |
-+----------------------+-----------------------------------------------------------------------------+
-| Overridden options | - `by_reference`_ |
-| | - `compound`_ |
-| | - `data_class`_ |
-| | - `error_bubbling`_ |
-+----------------------+-----------------------------------------------------------------------------+
-| Inherited | - `attr`_ |
-| options | - `data`_ |
-| | - `disabled`_ |
-| | - `error_mapping`_ |
-| | - `help`_ |
-| | - `help_attr`_ |
-| | - `help_html`_ |
-| | - `inherit_data`_ |
-| | - `invalid_message`_ |
-| | - `invalid_message_parameters`_ |
-| | - `mapped`_ |
-| | - `row_attr`_ |
-+----------------------+-----------------------------------------------------------------------------+
-| Parent type | FormType |
-+----------------------+-----------------------------------------------------------------------------+
-| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\TimeType` |
-+----------------------+-----------------------------------------------------------------------------+
++---------------------------+-----------------------------------------------------------------------------+
+| Underlying Data Type | can be ``DateTime``, string, timestamp, or array (see the ``input`` option) |
++---------------------------+-----------------------------------------------------------------------------+
+| Rendered as | can be various tags (see below) |
++---------------------------+-----------------------------------------------------------------------------+
+| Options | - `choice_translation_domain`_ |
+| | - `placeholder`_ |
+| | - `hours`_ |
+| | - `html5`_ |
+| | - `input`_ |
+| | - `input_format`_ |
+| | - `minutes`_ |
+| | - `model_timezone`_ |
+| | - `reference_date`_ |
+| | - `seconds`_ |
+| | - `view_timezone`_ |
+| | - `widget`_ |
+| | - `with_minutes`_ |
+| | - `with_seconds`_ |
++---------------------------+-----------------------------------------------------------------------------+
+| Overridden options | - `by_reference`_ |
+| | - `compound`_ |
+| | - `data_class`_ |
+| | - `error_bubbling`_ |
+| | - `invalid_message`_ |
++---------------------------+-----------------------------------------------------------------------------+
+| Inherited options | - `attr`_ |
+| | - `data`_ |
+| | - `disabled`_ |
+| | - `error_mapping`_ |
+| | - `help`_ |
+| | - `help_attr`_ |
+| | - `help_html`_ |
+| | - `inherit_data`_ |
+| | - `invalid_message_parameters`_ |
+| | - `mapped`_ |
+| | - `row_attr`_ |
++---------------------------+-----------------------------------------------------------------------------+
+| Default `invalid_message` | Please enter a valid time. |
++---------------------------+-----------------------------------------------------------------------------+
+| Legacy `invalid_message` | The value {{ value }} is not valid. |
++---------------------------+-----------------------------------------------------------------------------+
+| Parent type | FormType |
++---------------------------+-----------------------------------------------------------------------------+
+| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\TimeType` |
++---------------------------+-----------------------------------------------------------------------------+
.. include:: /reference/forms/types/options/_debug_form.rst.inc
@@ -220,6 +224,8 @@ error_bubbling
**default**: ``false``
+.. include:: /reference/forms/types/options/invalid_message.rst.inc
+
Inherited Options
-----------------
@@ -241,8 +247,6 @@ These options inherit from the :doc:`FormType `:
.. include:: /reference/forms/types/options/inherit_data.rst.inc
-.. include:: /reference/forms/types/options/invalid_message.rst.inc
-
.. include:: /reference/forms/types/options/invalid_message_parameters.rst.inc
.. include:: /reference/forms/types/options/mapped.rst.inc
diff --git a/reference/forms/types/timezone.rst b/reference/forms/types/timezone.rst
index c18cdbaf339..64e17890de8 100644
--- a/reference/forms/types/timezone.rst
+++ b/reference/forms/types/timezone.rst
@@ -14,45 +14,50 @@ Unlike the ``ChoiceType``, you don't need to specify a ``choices`` option as the
field type automatically uses a large list of timezones. You *can* specify the option
manually, but then you should just use the ``ChoiceType`` directly.
-+-------------+------------------------------------------------------------------------+
-| Rendered as | can be various tags (see :ref:`forms-reference-choice-tags`) |
-+-------------+------------------------------------------------------------------------+
-| Options | - `input`_ |
-| | - `intl`_ |
-+-------------+------------------------------------------------------------------------+
-| Overridden | - `choices`_ |
-| options | - `choice_translation_domain`_ |
-+-------------+------------------------------------------------------------------------+
-| Inherited | from the :doc:`ChoiceType ` |
-| options | |
-| | - `expanded`_ |
-| | - `multiple`_ |
-| | - `placeholder`_ |
-| | - `preferred_choices`_ |
-| | - `trim`_ |
-| | |
-| | from the :doc:`FormType ` |
-| | |
-| | - `attr`_ |
-| | - `data`_ |
-| | - `disabled`_ |
-| | - `empty_data`_ |
-| | - `error_bubbling`_ |
-| | - `error_mapping`_ |
-| | - `help`_ |
-| | - `help_attr`_ |
-| | - `help_html`_ |
-| | - `label`_ |
-| | - `label_attr`_ |
-| | - `label_format`_ |
-| | - `mapped`_ |
-| | - `required`_ |
-| | - `row_attr`_ |
-+-------------+------------------------------------------------------------------------+
-| Parent type | :doc:`ChoiceType ` |
-+-------------+------------------------------------------------------------------------+
-| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\TimezoneType` |
-+-------------+------------------------------------------------------------------------+
++---------------------------+------------------------------------------------------------------------+
+| Rendered as | can be various tags (see :ref:`forms-reference-choice-tags`) |
++---------------------------+------------------------------------------------------------------------+
+| Options | - `input`_ |
+| | - `intl`_ |
++---------------------------+------------------------------------------------------------------------+
+| Overridden options | - `choices`_ |
+| | - `choice_translation_domain`_ |
+| | - `invalid_message`_ |
++---------------------------+------------------------------------------------------------------------+
+| Inherited options | from the :doc:`ChoiceType ` |
+| | |
+| | - `expanded`_ |
+| | - `multiple`_ |
+| | - `placeholder`_ |
+| | - `preferred_choices`_ |
+| | - `trim`_ |
+| | |
+| | from the :doc:`FormType ` |
+| | |
+| | - `attr`_ |
+| | - `data`_ |
+| | - `disabled`_ |
+| | - `empty_data`_ |
+| | - `error_bubbling`_ |
+| | - `error_mapping`_ |
+| | - `help`_ |
+| | - `help_attr`_ |
+| | - `help_html`_ |
+| | - `label`_ |
+| | - `label_attr`_ |
+| | - `label_format`_ |
+| | - `mapped`_ |
+| | - `required`_ |
+| | - `row_attr`_ |
++---------------------------+------------------------------------------------------------------------+
+| Default `invalid_message` | Please select a valid timezone. |
++---------------------------+------------------------------------------------------------------------+
+| Legacy `invalid_message` | The value {{ value }} is not valid. |
++---------------------------+------------------------------------------------------------------------+
+| Parent type | :doc:`ChoiceType ` |
++---------------------------+------------------------------------------------------------------------+
+| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\TimezoneType` |
++---------------------------+------------------------------------------------------------------------+
.. include:: /reference/forms/types/options/_debug_form.rst.inc
@@ -107,6 +112,8 @@ The Timezone type defaults the choices to all timezones returned by
.. include:: /reference/forms/types/options/choice_translation_domain_disabled.rst.inc
+.. include:: /reference/forms/types/options/invalid_message.rst.inc
+
Inherited Options
-----------------
diff --git a/reference/forms/types/url.rst b/reference/forms/types/url.rst
index a03f1532021..e5f782ce088 100644
--- a/reference/forms/types/url.rst
+++ b/reference/forms/types/url.rst
@@ -8,32 +8,38 @@ The ``UrlType`` field is a text field that prepends the submitted value with
a given protocol (e.g. ``http://``) if the submitted value doesn't already
have a protocol.
-+-------------+-------------------------------------------------------------------+
-| Rendered as | ``input url`` field |
-+-------------+-------------------------------------------------------------------+
-| Options | - `default_protocol`_ |
-+-------------+-------------------------------------------------------------------+
-| Inherited | - `attr`_ |
-| options | - `data`_ |
-| | - `disabled`_ |
-| | - `empty_data`_ |
-| | - `error_bubbling`_ |
-| | - `error_mapping`_ |
-| | - `help`_ |
-| | - `help_attr`_ |
-| | - `help_html`_ |
-| | - `label`_ |
-| | - `label_attr`_ |
-| | - `label_format`_ |
-| | - `mapped`_ |
-| | - `required`_ |
-| | - `row_attr`_ |
-| | - `trim`_ |
-+-------------+-------------------------------------------------------------------+
-| Parent type | :doc:`TextType ` |
-+-------------+-------------------------------------------------------------------+
-| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\UrlType` |
-+-------------+-------------------------------------------------------------------+
++---------------------------+-------------------------------------------------------------------+
+| Rendered as | ``input url`` field |
++---------------------------+-------------------------------------------------------------------+
+| Options | - `default_protocol`_ |
++---------------------------+-------------------------------------------------------------------+
+| Overridden options | - `invalid_message`_ |
++---------------------------+-------------------------------------------------------------------+
+| Inherited options | - `attr`_ |
+| | - `data`_ |
+| | - `disabled`_ |
+| | - `empty_data`_ |
+| | - `error_bubbling`_ |
+| | - `error_mapping`_ |
+| | - `help`_ |
+| | - `help_attr`_ |
+| | - `help_html`_ |
+| | - `label`_ |
+| | - `label_attr`_ |
+| | - `label_format`_ |
+| | - `mapped`_ |
+| | - `required`_ |
+| | - `row_attr`_ |
+| | - `trim`_ |
++---------------------------+-------------------------------------------------------------------+
+| Default `invalid_message` | Please enter a valid URL. |
++---------------------------+-------------------------------------------------------------------+
+| Legacy `invalid_message` | The value {{ value }} is not valid. |
++---------------------------+-------------------------------------------------------------------+
+| Parent type | :doc:`TextType ` |
++---------------------------+-------------------------------------------------------------------+
+| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\UrlType` |
++---------------------------+-------------------------------------------------------------------+
.. include:: /reference/forms/types/options/_debug_form.rst.inc
@@ -49,6 +55,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.
+Overridden Options
+------------------
+
+.. include:: /reference/forms/types/options/invalid_message.rst.inc
+
Inherited Options
-----------------
diff --git a/reference/forms/types/week.rst b/reference/forms/types/week.rst
index 6967df09bb7..eb526c160af 100644
--- a/reference/forms/types/week.rst
+++ b/reference/forms/types/week.rst
@@ -10,39 +10,43 @@ This field type allows the user to modify data that represents a specific
Can be rendered as a text input or select tags. The underlying format of
the data can be a string or an array.
-+----------------------+-----------------------------------------------------------------------------+
-| Underlying Data Type | can be a string, or array (see the ``input`` option) |
-+----------------------+-----------------------------------------------------------------------------+
-| Rendered as | single text box, two text boxes or two select fields |
-+----------------------+-----------------------------------------------------------------------------+
-| Options | - `choice_translation_domain`_ |
-| | - `placeholder`_ |
-| | - `html5`_ |
-| | - `input`_ |
-| | - `widget`_ |
-| | - `weeks`_ |
-| | - `years`_ |
-+----------------------+-----------------------------------------------------------------------------+
-| Overridden options | - `compound`_ |
-| | - `empty_data`_ |
-| | - `error_bubbling`_ |
-+----------------------+-----------------------------------------------------------------------------+
-| Inherited | - `attr`_ |
-| options | - `data`_ |
-| | - `disabled`_ |
-| | - `help`_ |
-| | - `help_attr`_ |
-| | - `help_html`_ |
-| | - `inherit_data`_ |
-| | - `invalid_message`_ |
-| | - `invalid_message_parameters`_ |
-| | - `mapped`_ |
-| | - `row_attr`_ |
-+----------------------+-----------------------------------------------------------------------------+
-| Parent type | :doc:`FormType ` |
-+----------------------+-----------------------------------------------------------------------------+
-| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\WeekType` |
-+----------------------+-----------------------------------------------------------------------------+
++---------------------------+--------------------------------------------------------------------+
+| Underlying Data Type | can be a string, or array (see the ``input`` option) |
++---------------------------+--------------------------------------------------------------------+
+| Rendered as | single text box, two text boxes or two select fields |
++---------------------------+--------------------------------------------------------------------+
+| Options | - `choice_translation_domain`_ |
+| | - `placeholder`_ |
+| | - `html5`_ |
+| | - `input`_ |
+| | - `widget`_ |
+| | - `weeks`_ |
+| | - `years`_ |
++---------------------------+--------------------------------------------------------------------+
+| Overridden options | - `compound`_ |
+| | - `empty_data`_ |
+| | - `error_bubbling`_ |
+| | - `invalid_message`_ |
++---------------------------+--------------------------------------------------------------------+
+| Inherited options | - `attr`_ |
+| | - `data`_ |
+| | - `disabled`_ |
+| | - `help`_ |
+| | - `help_attr`_ |
+| | - `help_html`_ |
+| | - `inherit_data`_ |
+| | - `invalid_message_parameters`_ |
+| | - `mapped`_ |
+| | - `row_attr`_ |
++---------------------------+--------------------------------------------------------------------+
+| Default `invalid_message` | Please enter a valid week. |
++---------------------------+--------------------------------------------------------------------+
+| Legacy `invalid_message` | The value {{ value }} is not valid. |
++---------------------------+--------------------------------------------------------------------+
+| Parent type | :doc:`FormType ` |
++---------------------------+--------------------------------------------------------------------+
+| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\WeekType` |
++---------------------------+--------------------------------------------------------------------+
.. include:: /reference/forms/types/options/_debug_form.rst.inc
@@ -138,6 +142,8 @@ error_bubbling
**default**: ``false``
+.. include:: /reference/forms/types/options/invalid_message.rst.inc
+
Inherited Options
-----------------
@@ -157,8 +163,6 @@ These options inherit from the :doc:`FormType `:
.. include:: /reference/forms/types/options/inherit_data.rst.inc
-.. include:: /reference/forms/types/options/invalid_message.rst.inc
-
.. include:: /reference/forms/types/options/invalid_message_parameters.rst.inc
.. include:: /reference/forms/types/options/mapped.rst.inc
From 3daed4a14bfeafe81b4af834778b3ff81b758dfe Mon Sep 17 00:00:00 2001
From: Oskar Stark
Date: Fri, 20 Nov 2020 09:02:29 +0100
Subject: [PATCH 0152/5766] Enhancement: New rule for DOCtor-RST
---
.doctor-rst.yaml | 1 +
1 file changed, 1 insertion(+)
diff --git a/.doctor-rst.yaml b/.doctor-rst.yaml
index 52a1fc2ba4a..22269873776 100644
--- a/.doctor-rst.yaml
+++ b/.doctor-rst.yaml
@@ -20,6 +20,7 @@ rules:
no_blank_line_after_filepath_in_yaml_code_block: ~
no_brackets_in_method_directive: ~
no_composer_req: ~
+ no_directive_after_shorthand: ~
no_explicit_use_of_code_block_php: ~
no_inheritdoc: ~
no_namespace_after_use_statements: ~
From 92477a8754a84b4518234bfdd28c5fbd793a0e81 Mon Sep 17 00:00:00 2001
From: Oskar Stark
Date: Fri, 20 Nov 2020 09:13:15 +0100
Subject: [PATCH 0153/5766] Enhancement: Use actions/cache v2
cc @smoench
---
.github/workflows/ci.yaml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml
index dd7599889d0..881b171ce10 100644
--- a/.github/workflows/ci.yaml
+++ b/.github/workflows/ci.yaml
@@ -98,7 +98,7 @@ jobs:
id: extract_base_branch
- name: "Cache DOCtor-RST"
- uses: actions/cache@v1
+ uses: actions/cache@v2
with:
path: .cache
key: ${{ runner.os }}-doctor-rst-${{ steps.extract_base_branch.outputs.branch }}
From ff816cadc7ef69791ae3cff961055824df2e5c4e Mon Sep 17 00:00:00 2001
From: Oskar Stark
Date: Fri, 20 Nov 2020 09:45:20 +0100
Subject: [PATCH 0154/5766] Enhancement: New rule for DOCtor-RST
---
.doctor-rst.yaml | 1 +
1 file changed, 1 insertion(+)
diff --git a/.doctor-rst.yaml b/.doctor-rst.yaml
index 22269873776..59971c508f4 100644
--- a/.doctor-rst.yaml
+++ b/.doctor-rst.yaml
@@ -6,6 +6,7 @@ rules:
composer_dev_option_not_at_the_end: ~
correct_code_block_directive_based_on_the_content: ~
deprecated_directive_should_have_version: ~
+ ensure_exactly_one_space_between_link_definition_and_link: ~
ensure_order_of_code_blocks_in_configuration_block: ~
extend_abstract_controller: ~
extension_xlf_instead_of_xliff: ~
From 289ca7c128f4c413f75a0606cc54f9833130e5c1 Mon Sep 17 00:00:00 2001
From: Oskar Stark
Date: Fri, 20 Nov 2020 10:08:28 +0100
Subject: [PATCH 0155/5766] Fix: DOCtor-RST build
---
http_client.rst | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/http_client.rst b/http_client.rst
index 2fb102a0fcc..b46a3f7760d 100644
--- a/http_client.rst
+++ b/http_client.rst
@@ -1616,5 +1616,5 @@ Then configure Symfony to use your callback:
.. _`amphp/http-client`: https://packagist.org/packages/amphp/http-client
.. _`cURL options`: https://www.php.net/manual/en/function.curl-setopt.php
.. _`Server-sent events`: https://html.spec.whatwg.org/multipage/server-sent-events.html
-.. _`EventSource`: https://www.w3.org/TR/eventsource/#eventsource
-.. _`idempotent method`: https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Idempotent_methods_and_web_applications
+.. _`EventSource`: https://www.w3.org/TR/eventsource/#eventsource
+.. _`idempotent method`: https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Idempotent_methods_and_web_applications
From 12fff0cf5ec2a195709c5ac1ccbad8e04da6bef1 Mon Sep 17 00:00:00 2001
From: Oskar Stark
Date: Fri, 20 Nov 2020 09:45:20 +0100
Subject: [PATCH 0156/5766] Enhancement: New rule for DOCtor-RST
---
.doctor-rst.yaml | 1 +
1 file changed, 1 insertion(+)
diff --git a/.doctor-rst.yaml b/.doctor-rst.yaml
index 5c4fadeb132..94d88088d52 100644
--- a/.doctor-rst.yaml
+++ b/.doctor-rst.yaml
@@ -6,6 +6,7 @@ rules:
composer_dev_option_not_at_the_end: ~
correct_code_block_directive_based_on_the_content: ~
deprecated_directive_should_have_version: ~
+ ensure_exactly_one_space_between_link_definition_and_link: ~
ensure_order_of_code_blocks_in_configuration_block: ~
extend_abstract_controller: ~
extension_xlf_instead_of_xliff: ~
From 26dfa839ad7242522a97968096403c5801852424 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timoth=C3=A9e=20Barray?=
Date: Fri, 20 Nov 2020 14:01:55 +0100
Subject: [PATCH 0157/5766] [Messenger] Add mention about serialize in inMemory
transport dsn
---
messenger.rst | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/messenger.rst b/messenger.rst
index ac07b40c624..e5a4da76cf9 100644
--- a/messenger.rst
+++ b/messenger.rst
@@ -1295,6 +1295,15 @@ during a request::
:class:`Symfony\\Bundle\\FrameworkBundle\\Test\\KernelTestCase`
or :class:`Symfony\\Bundle\\FrameworkBundle\\Test\\WebTestCase`.
+.. tip::
+
+ Using ``in-memory://?serialize=true`` as dsn will perform message serialization as real asynchronous transport will do.
+ Useful to test an additional layer, especially when you use your own message serializer.
+
+.. versionadded:: 5.3
+
+ The ``in-memory://?serialize=true`` dsn was introduced in Symfony 5.3.
+
Amazon SQS
~~~~~~~~~~
From 0ccfa6e913782c1788e08032ebfcf14968e72b96 Mon Sep 17 00:00:00 2001
From: Javier Eguiluz
Date: Fri, 20 Nov 2020 15:55:35 +0100
Subject: [PATCH 0158/5766] Tweaks
---
forms.rst | 8 +++-----
reference/forms/types/birthday.rst | 4 ++--
reference/forms/types/checkbox.rst | 4 ++--
reference/forms/types/choice.rst | 4 ++--
reference/forms/types/collection.rst | 4 ++--
reference/forms/types/color.rst | 4 ++--
reference/forms/types/country.rst | 4 ++--
reference/forms/types/currency.rst | 4 ++--
reference/forms/types/date.rst | 4 ++--
reference/forms/types/dateinterval.rst | 4 ++--
reference/forms/types/datetime.rst | 4 ++--
reference/forms/types/email.rst | 4 ++--
reference/forms/types/file.rst | 4 ++--
reference/forms/types/form.rst | 4 ++--
reference/forms/types/hidden.rst | 4 ++--
reference/forms/types/integer.rst | 4 ++--
reference/forms/types/language.rst | 4 ++--
reference/forms/types/locale.rst | 4 ++--
reference/forms/types/money.rst | 4 ++--
reference/forms/types/number.rst | 4 ++--
reference/forms/types/password.rst | 4 ++--
reference/forms/types/percent.rst | 4 ++--
reference/forms/types/radio.rst | 4 ++--
reference/forms/types/range.rst | 4 ++--
reference/forms/types/repeated.rst | 4 ++--
reference/forms/types/search.rst | 4 ++--
reference/forms/types/tel.rst | 4 ++--
reference/forms/types/time.rst | 4 ++--
reference/forms/types/timezone.rst | 4 ++--
reference/forms/types/url.rst | 4 ++--
reference/forms/types/week.rst | 4 ++--
31 files changed, 63 insertions(+), 65 deletions(-)
diff --git a/forms.rst b/forms.rst
index 6e2c9ec5120..8635b8fedbd 100644
--- a/forms.rst
+++ b/forms.rst
@@ -555,10 +555,9 @@ learn more about the validation constraints, please refer to the
.. versionadded:: 5.2
- Validation messages for forms have been rewritten to be more user-friendly.
- These newer messages can be enabled by setting the `legacy_error_messages`
- option to "false". Details about these messages can be found in the corresponding
- form type documentation.
+ In Symfony 5.2, the form validation messages have been rewritten to be more
+ user-friendly. Set the ``legacy_error_messages`` option to ``false`` to
+ enable these new messages:
.. configuration-block::
@@ -595,7 +594,6 @@ learn more about the validation constraints, please refer to the
],
]);
-
Other Common Form Features
--------------------------
diff --git a/reference/forms/types/birthday.rst b/reference/forms/types/birthday.rst
index 127528bc774..94cff698cb4 100644
--- a/reference/forms/types/birthday.rst
+++ b/reference/forms/types/birthday.rst
@@ -49,9 +49,9 @@ option defaults to 120 years ago to the current year.
| | - `mapped`_ |
| | - `row_attr`_ |
+---------------------------+-------------------------------------------------------------------------------+
-| Default `invalid_message` | Please enter a valid birthdate. |
+| Default invalid message | Please enter a valid birthdate. |
+---------------------------+-------------------------------------------------------------------------------+
-| Legacy `invalid_message` | The value {{ value }} is not valid. |
+| Legacy invalid message | The value {{ value }} is not valid. |
+---------------------------+-------------------------------------------------------------------------------+
| Parent type | :doc:`DateType ` |
+---------------------------+-------------------------------------------------------------------------------+
diff --git a/reference/forms/types/checkbox.rst b/reference/forms/types/checkbox.rst
index 1463c542a1e..d4fdd17580c 100644
--- a/reference/forms/types/checkbox.rst
+++ b/reference/forms/types/checkbox.rst
@@ -36,9 +36,9 @@ if you want to handle submitted values like "0" or "false").
| | - `required`_ |
| | - `row_attr`_ |
+---------------------------+------------------------------------------------------------------------+
-| Default `invalid_message` | The checkbox has an invalid value. |
+| Default invalid message | The checkbox has an invalid value. |
+---------------------------+------------------------------------------------------------------------+
-| Legacy `invalid_message` | The value {{ value }} is not valid. |
+| Legacy invalid message | The value {{ value }} is not valid. |
+---------------------------+------------------------------------------------------------------------+
| Parent type | :doc:`FormType ` |
+---------------------------+------------------------------------------------------------------------+
diff --git a/reference/forms/types/choice.rst b/reference/forms/types/choice.rst
index d0c81a829bd..affcce9ab54 100644
--- a/reference/forms/types/choice.rst
+++ b/reference/forms/types/choice.rst
@@ -52,9 +52,9 @@ To use this field, you must specify *either* ``choices`` or ``choice_loader`` op
| | - `attr_translation_parameters`_ |
| | - `help_translation_parameters`_ |
+---------------------------+----------------------------------------------------------------------+
-| Default `invalid_message` | The selected choice is invalid. |
+| Default invalid message | The selected choice is invalid. |
+---------------------------+----------------------------------------------------------------------+
-| Legacy `invalid_message` | The value {{ value }} is not valid. |
+| Legacy invalid message | The value {{ value }} is not valid. |
+---------------------------+----------------------------------------------------------------------+
| Parent type | :doc:`FormType ` |
+---------------------------+----------------------------------------------------------------------+
diff --git a/reference/forms/types/collection.rst b/reference/forms/types/collection.rst
index a30cc250f6f..9e1eb170933 100644
--- a/reference/forms/types/collection.rst
+++ b/reference/forms/types/collection.rst
@@ -40,9 +40,9 @@ photos).
| | - `required`_ |
| | - `row_attr`_ |
+---------------------------+--------------------------------------------------------------------------+
-| Default `invalid_message` | The collection is invalid. |
+| Default invalid message | The collection is invalid. |
+---------------------------+--------------------------------------------------------------------------+
-| Legacy `invalid_message` | The value {{ value }} is not valid. |
+| Legacy invalid message | The value {{ value }} is not valid. |
+---------------------------+--------------------------------------------------------------------------+
| Parent type | :doc:`FormType ` |
+---------------------------+--------------------------------------------------------------------------+
diff --git a/reference/forms/types/color.rst b/reference/forms/types/color.rst
index f3d97c6cd1b..6bbc28da2a7 100644
--- a/reference/forms/types/color.rst
+++ b/reference/forms/types/color.rst
@@ -38,9 +38,9 @@ element.
| | - `row_attr`_ |
| | - `trim`_ |
+---------------------------+---------------------------------------------------------------------+
-| Default `invalid_message` | Please select a valid color. |
+| Default invalid message | Please select a valid color. |
+---------------------------+---------------------------------------------------------------------+
-| Legacy `invalid_message` | The value {{ value }} is not valid. |
+| Legacy invalid message | The value {{ value }} is not valid. |
+---------------------------+---------------------------------------------------------------------+
| Parent type | :doc:`TextType ` |
+---------------------------+---------------------------------------------------------------------+
diff --git a/reference/forms/types/country.rst b/reference/forms/types/country.rst
index a2b1527764e..10cf652947a 100644
--- a/reference/forms/types/country.rst
+++ b/reference/forms/types/country.rst
@@ -54,9 +54,9 @@ the option manually, but then you should just use the ``ChoiceType`` directly.
| | - `required`_ |
| | - `row_attr`_ |
+---------------------------+-----------------------------------------------------------------------+
-| Default `invalid_message` | Please select a valid country. |
+| Default invalid message | Please select a valid country. |
+---------------------------+-----------------------------------------------------------------------+
-| Legacy `invalid_message` | The value {{ value }} is not valid. |
+| Legacy invalid message | The value {{ value }} is not valid. |
+---------------------------+-----------------------------------------------------------------------+
| Parent type | :doc:`ChoiceType ` |
+---------------------------+-----------------------------------------------------------------------+
diff --git a/reference/forms/types/currency.rst b/reference/forms/types/currency.rst
index e8628aa3edf..e28b39c328a 100644
--- a/reference/forms/types/currency.rst
+++ b/reference/forms/types/currency.rst
@@ -45,9 +45,9 @@ manually, but then you should just use the ``ChoiceType`` directly.
| | - `required`_ |
| | - `row_attr`_ |
+---------------------------+------------------------------------------------------------------------+
-| Default `invalid_message` | Please select a valid currency. |
+| Default invalid message | Please select a valid currency. |
+---------------------------+------------------------------------------------------------------------+
-| Legacy `invalid_message` | The value {{ value }} is not valid. |
+| Legacy invalid message | The value {{ value }} is not valid. |
+---------------------------+------------------------------------------------------------------------+
| Parent type | :doc:`ChoiceType ` |
+---------------------------+------------------------------------------------------------------------+
diff --git a/reference/forms/types/date.rst b/reference/forms/types/date.rst
index fa696007803..5a12ad24b9c 100644
--- a/reference/forms/types/date.rst
+++ b/reference/forms/types/date.rst
@@ -46,9 +46,9 @@ and can understand a number of different input formats via the `input`_ option.
| | - `mapped`_ |
| | - `row_attr`_ |
+---------------------------+-----------------------------------------------------------------------------+
-| Default `invalid_message` | Please enter a valid date. |
+| Default invalid message | Please enter a valid date. |
+---------------------------+-----------------------------------------------------------------------------+
-| Legacy `invalid_message` | The value {{ value }} is not valid. |
+| Legacy invalid message | The value {{ value }} is not valid. |
+---------------------------+-----------------------------------------------------------------------------+
| Parent type | :doc:`FormType ` |
+---------------------------+-----------------------------------------------------------------------------+
diff --git a/reference/forms/types/dateinterval.rst b/reference/forms/types/dateinterval.rst
index 69147d95bee..5248ca88739 100644
--- a/reference/forms/types/dateinterval.rst
+++ b/reference/forms/types/dateinterval.rst
@@ -50,9 +50,9 @@ or an array (see `input`_).
| | - `mapped`_ |
| | - `row_attr`_ |
+---------------------------+----------------------------------------------------------------------------------+
-| Default `invalid_message` | Please choose a valid date interval. |
+| Default invalid message | Please choose a valid date interval. |
+---------------------------+----------------------------------------------------------------------------------+
-| Legacy `invalid_message` | The value {{ value }} is not valid. |
+| Legacy invalid message | The value {{ value }} is not valid. |
+---------------------------+----------------------------------------------------------------------------------+
| Parent type | :doc:`FormType ` |
+---------------------------+----------------------------------------------------------------------------------+
diff --git a/reference/forms/types/datetime.rst b/reference/forms/types/datetime.rst
index ca61be3e538..e742048fd24 100644
--- a/reference/forms/types/datetime.rst
+++ b/reference/forms/types/datetime.rst
@@ -55,9 +55,9 @@ the data can be a ``DateTime`` object, a string, a timestamp or an array.
| | - `mapped`_ |
| | - `row_attr`_ |
+---------------------------+-----------------------------------------------------------------------------+
-| Default `invalid_message` | Please enter a valid date and time. |
+| Default invalid message | Please enter a valid date and time. |
+---------------------------+-----------------------------------------------------------------------------+
-| Legacy `invalid_message` | The value {{ value }} is not valid. |
+| Legacy invalid message | The value {{ value }} is not valid. |
+---------------------------+-----------------------------------------------------------------------------+
| Parent type | :doc:`FormType ` |
+---------------------------+-----------------------------------------------------------------------------+
diff --git a/reference/forms/types/email.rst b/reference/forms/types/email.rst
index 31d6f5db90b..3dfe77db44f 100644
--- a/reference/forms/types/email.rst
+++ b/reference/forms/types/email.rst
@@ -29,9 +29,9 @@ The ``EmailType`` field is a text field that is rendered using the HTML5
| | - `row_attr`_ |
| | - `trim`_ |
+---------------------------+---------------------------------------------------------------------+
-| Default `invalid_message` | Please enter a valid email address. |
+| Default invalid message | Please enter a valid email address. |
+---------------------------+---------------------------------------------------------------------+
-| Legacy `invalid_message` | The value {{ value }} is not valid. |
+| Legacy invalid message | The value {{ value }} is not valid. |
+---------------------------+---------------------------------------------------------------------+
| Parent type | :doc:`TextType ` |
+---------------------------+---------------------------------------------------------------------+
diff --git a/reference/forms/types/file.rst b/reference/forms/types/file.rst
index f745c9bc1fd..50bc55fee88 100644
--- a/reference/forms/types/file.rst
+++ b/reference/forms/types/file.rst
@@ -30,9 +30,9 @@ The ``FileType`` represents a file input in your form.
| | - `required`_ |
| | - `row_attr`_ |
+---------------------------+--------------------------------------------------------------------+
-| Default `invalid_message` | Please select a valid file. |
+| Default invalid message | Please select a valid file. |
+---------------------------+--------------------------------------------------------------------+
-| Legacy `invalid_message` | The value {{ value }} is not valid. |
+| Legacy invalid message | The value {{ value }} is not valid. |
+---------------------------+--------------------------------------------------------------------+
| Parent type | :doc:`FormType ` |
+---------------------------+--------------------------------------------------------------------+
diff --git a/reference/forms/types/form.rst b/reference/forms/types/form.rst
index e406413bf37..9e1a5d47227 100644
--- a/reference/forms/types/form.rst
+++ b/reference/forms/types/form.rst
@@ -48,9 +48,9 @@ on all types for which ``FormType`` is the parent.
| | - `label_translation_parameters`_ |
| | - `attr_translation_parameters`_ |
+---------------------------+--------------------------------------------------------------------+
-| Default `invalid_message` | This value is not valid. |
+| Default invalid message | This value is not valid. |
+---------------------------+--------------------------------------------------------------------+
-| Legacy `invalid_message` | This value is not valid. |
+| Legacy invalid message | This value is not valid. |
+---------------------------+--------------------------------------------------------------------+
| Parent | none |
+---------------------------+--------------------------------------------------------------------+
diff --git a/reference/forms/types/hidden.rst b/reference/forms/types/hidden.rst
index f0bddfa4260..00e858303bf 100644
--- a/reference/forms/types/hidden.rst
+++ b/reference/forms/types/hidden.rst
@@ -22,9 +22,9 @@ The hidden type represents a hidden input field.
| | - `property_path`_ |
| | - `row_attr`_ |
+---------------------------+----------------------------------------------------------------------+
-| Default `invalid_message` | The hidden field is invalid. |
+| Default invalid message | The hidden field is invalid. |
+---------------------------+----------------------------------------------------------------------+
-| Legacy `invalid_message` | The value {{ value }} is not valid. |
+| Legacy invalid message | The value {{ value }} is not valid. |
+---------------------------+----------------------------------------------------------------------+
| Parent type | :doc:`FormType ` |
+---------------------------+----------------------------------------------------------------------+
diff --git a/reference/forms/types/integer.rst b/reference/forms/types/integer.rst
index 7eb32abf7f9..db774ec2ce9 100644
--- a/reference/forms/types/integer.rst
+++ b/reference/forms/types/integer.rst
@@ -39,9 +39,9 @@ integers. By default, all non-integer values (e.g. 6.78) will round down
| | - `required`_ |
| | - `row_attr`_ |
+---------------------------+-----------------------------------------------------------------------+
-| Default `invalid_message` | Please enter an integer. |
+| Default invalid message | Please enter an integer. |
+---------------------------+-----------------------------------------------------------------------+
-| Legacy `invalid_message` | The value {{ value }} is not valid. |
+| Legacy invalid message | The value {{ value }} is not valid. |
+---------------------------+-----------------------------------------------------------------------+
| Parent type | :doc:`FormType ` |
+---------------------------+-----------------------------------------------------------------------+
diff --git a/reference/forms/types/language.rst b/reference/forms/types/language.rst
index 420ab1b59a0..f74016d1a0c 100644
--- a/reference/forms/types/language.rst
+++ b/reference/forms/types/language.rst
@@ -57,9 +57,9 @@ manually, but then you should just use the ``ChoiceType`` directly.
| | - `required`_ |
| | - `row_attr`_ |
+---------------------------+------------------------------------------------------------------------+
-| Default `invalid_message` | Please select a valid language. |
+| Default invalid message | Please select a valid language. |
+---------------------------+------------------------------------------------------------------------+
-| Legacy `invalid_message` | The value {{ value }} is not valid. |
+| Legacy invalid message | The value {{ value }} is not valid. |
+---------------------------+------------------------------------------------------------------------+
| Parent type | :doc:`ChoiceType ` |
+---------------------------+------------------------------------------------------------------------+
diff --git a/reference/forms/types/locale.rst b/reference/forms/types/locale.rst
index be6dde7e950..bab466d262f 100644
--- a/reference/forms/types/locale.rst
+++ b/reference/forms/types/locale.rst
@@ -56,9 +56,9 @@ manually, but then you should just use the ``ChoiceType`` directly.
| | - `required`_ |
| | - `row_attr`_ |
+---------------------------+----------------------------------------------------------------------+
-| Default `invalid_message` | Please select a valid locale. |
+| Default invalid message | Please select a valid locale. |
+---------------------------+----------------------------------------------------------------------+
-| Legacy `invalid_message` | The value {{ value }} is not valid. |
+| Legacy invalid message | The value {{ value }} is not valid. |
+---------------------------+----------------------------------------------------------------------+
| Parent type | :doc:`ChoiceType ` |
+---------------------------+----------------------------------------------------------------------+
diff --git a/reference/forms/types/money.rst b/reference/forms/types/money.rst
index ca7a5aceac7..162d8543b20 100644
--- a/reference/forms/types/money.rst
+++ b/reference/forms/types/money.rst
@@ -41,9 +41,9 @@ how the input and output of the data is handled.
| | - `required`_ |
| | - `row_attr`_ |
+---------------------------+---------------------------------------------------------------------+
-| Default `invalid_message` | Please enter a valid money amount. |
+| Default invalid message | Please enter a valid money amount. |
+---------------------------+---------------------------------------------------------------------+
-| Legacy `invalid_message` | The value {{ value }} is not valid. |
+| Legacy invalid message | The value {{ value }} is not valid. |
+---------------------------+---------------------------------------------------------------------+
| Parent type | :doc:`FormType ` |
+---------------------------+---------------------------------------------------------------------+
diff --git a/reference/forms/types/number.rst b/reference/forms/types/number.rst
index 319c84b951e..99d80628d33 100644
--- a/reference/forms/types/number.rst
+++ b/reference/forms/types/number.rst
@@ -37,9 +37,9 @@ that you want to use for your number.
| | - `required`_ |
| | - `row_attr`_ |
+---------------------------+----------------------------------------------------------------------+
-| Default `invalid_message` | Please enter a number. |
+| Default invalid message | Please enter a number. |
+---------------------------+----------------------------------------------------------------------+
-| Legacy `invalid_message` | The value {{ value }} is not valid. |
+| Legacy invalid message | The value {{ value }} is not valid. |
+---------------------------+----------------------------------------------------------------------+
| Parent type | :doc:`FormType ` |
+---------------------------+----------------------------------------------------------------------+
diff --git a/reference/forms/types/password.rst b/reference/forms/types/password.rst
index 10b38a5ac8b..18be51b396f 100644
--- a/reference/forms/types/password.rst
+++ b/reference/forms/types/password.rst
@@ -29,9 +29,9 @@ The ``PasswordType`` field renders an input password text box.
| | - `required`_ |
| | - `row_attr`_ |
+---------------------------+------------------------------------------------------------------------+
-| Default `invalid_message` | The password is invalid. |
+| Default invalid message | The password is invalid. |
+---------------------------+------------------------------------------------------------------------+
-| Legacy `invalid_message` | The value {{ value }} is not valid. |
+| Legacy invalid message | The value {{ value }} is not valid. |
+---------------------------+------------------------------------------------------------------------+
| Parent type | :doc:`TextType ` |
+---------------------------+------------------------------------------------------------------------+
diff --git a/reference/forms/types/percent.rst b/reference/forms/types/percent.rst
index 3dd47e1d320..36ffdcc1e1b 100644
--- a/reference/forms/types/percent.rst
+++ b/reference/forms/types/percent.rst
@@ -41,9 +41,9 @@ the input.
| | - `required`_ |
| | - `row_attr`_ |
+---------------------------+-----------------------------------------------------------------------+
-| Default `invalid_message` | Please enter a percentage value. |
+| Default invalid message | Please enter a percentage value. |
+---------------------------+-----------------------------------------------------------------------+
-| Legacy `invalid_message` | The value {{ value }} is not valid. |
+| Legacy invalid message | The value {{ value }} is not valid. |
+---------------------------+-----------------------------------------------------------------------+
| Parent type | :doc:`FormType ` |
+---------------------------+-----------------------------------------------------------------------+
diff --git a/reference/forms/types/radio.rst b/reference/forms/types/radio.rst
index 579dab0bc1d..93fbe3ecfd9 100644
--- a/reference/forms/types/radio.rst
+++ b/reference/forms/types/radio.rst
@@ -40,9 +40,9 @@ If you want to have a boolean field, use :doc:`CheckboxType ` |
+---------------------------+---------------------------------------------------------------------+
diff --git a/reference/forms/types/range.rst b/reference/forms/types/range.rst
index ab3a0d15859..f8284f1b7eb 100644
--- a/reference/forms/types/range.rst
+++ b/reference/forms/types/range.rst
@@ -28,9 +28,9 @@ The ``RangeType`` field is a slider that is rendered using the HTML5
| | - `row_attr`_ |
| | - `trim`_ |
+---------------------------+---------------------------------------------------------------------+
-| Default `invalid_message` | Please choose a valid range. |
+| Default invalid message | Please choose a valid range. |
+---------------------------+---------------------------------------------------------------------+
-| Legacy `invalid_message` | The value {{ value }} is not valid. |
+| Legacy invalid message | The value {{ value }} is not valid. |
+---------------------------+---------------------------------------------------------------------+
| Parent type | :doc:`TextType ` |
+---------------------------+---------------------------------------------------------------------+
diff --git a/reference/forms/types/repeated.rst b/reference/forms/types/repeated.rst
index 7a9f6d9d9be..8c36c64ddd5 100644
--- a/reference/forms/types/repeated.rst
+++ b/reference/forms/types/repeated.rst
@@ -32,9 +32,9 @@ accuracy.
| | - `mapped`_ |
| | - `row_attr`_ |
+---------------------------+------------------------------------------------------------------------+
-| Default `invalid_message` | The values do not match. |
+| Default invalid message | The values do not match. |
+---------------------------+------------------------------------------------------------------------+
-| Legacy `invalid_message` | The value {{ value }} is not valid. |
+| Legacy invalid message | The value {{ value }} is not valid. |
+---------------------------+------------------------------------------------------------------------+
| Parent type | :doc:`FormType ` |
+---------------------------+------------------------------------------------------------------------+
diff --git a/reference/forms/types/search.rst b/reference/forms/types/search.rst
index f9c53733872..d6dceeb0264 100644
--- a/reference/forms/types/search.rst
+++ b/reference/forms/types/search.rst
@@ -30,9 +30,9 @@ Read about the input search field at `DiveIntoHTML5.info`_
| | - `row_attr`_ |
| | - `trim`_ |
+---------------------------+----------------------------------------------------------------------+
-| Default `invalid_message` | Please enter a valid search term. |
+| Default invalid message | Please enter a valid search term. |
+---------------------------+----------------------------------------------------------------------+
-| Legacy `invalid_message` | The value {{ value }} is not valid. |
+| Legacy invalid message | The value {{ value }} is not valid. |
+---------------------------+----------------------------------------------------------------------+
| Parent type | :doc:`TextType ` |
+---------------------------+----------------------------------------------------------------------+
diff --git a/reference/forms/types/tel.rst b/reference/forms/types/tel.rst
index fc45434bc4e..19847431dd3 100644
--- a/reference/forms/types/tel.rst
+++ b/reference/forms/types/tel.rst
@@ -35,9 +35,9 @@ to input phone numbers.
| | - `row_attr`_ |
| | - `trim`_ |
+---------------------------+-------------------------------------------------------------------+
-| Default `invalid_message` | Please provide a valid phone number. |
+| Default invalid message | Please provide a valid phone number. |
+---------------------------+-------------------------------------------------------------------+
-| Legacy `invalid_message` | The value {{ value }} is not valid. |
+| Legacy invalid message | The value {{ value }} is not valid. |
+---------------------------+-------------------------------------------------------------------+
| Parent type | :doc:`TextType ` |
+---------------------------+-------------------------------------------------------------------+
diff --git a/reference/forms/types/time.rst b/reference/forms/types/time.rst
index 08c3efb77f4..cac168d569e 100644
--- a/reference/forms/types/time.rst
+++ b/reference/forms/types/time.rst
@@ -48,9 +48,9 @@ stored as a ``DateTime`` object, a string, a timestamp or an array.
| | - `mapped`_ |
| | - `row_attr`_ |
+---------------------------+-----------------------------------------------------------------------------+
-| Default `invalid_message` | Please enter a valid time. |
+| Default invalid message | Please enter a valid time. |
+---------------------------+-----------------------------------------------------------------------------+
-| Legacy `invalid_message` | The value {{ value }} is not valid. |
+| Legacy invalid message | The value {{ value }} is not valid. |
+---------------------------+-----------------------------------------------------------------------------+
| Parent type | FormType |
+---------------------------+-----------------------------------------------------------------------------+
diff --git a/reference/forms/types/timezone.rst b/reference/forms/types/timezone.rst
index 64e17890de8..987f26c9036 100644
--- a/reference/forms/types/timezone.rst
+++ b/reference/forms/types/timezone.rst
@@ -50,9 +50,9 @@ manually, but then you should just use the ``ChoiceType`` directly.
| | - `required`_ |
| | - `row_attr`_ |
+---------------------------+------------------------------------------------------------------------+
-| Default `invalid_message` | Please select a valid timezone. |
+| Default invalid message | Please select a valid timezone. |
+---------------------------+------------------------------------------------------------------------+
-| Legacy `invalid_message` | The value {{ value }} is not valid. |
+| Legacy invalid message | The value {{ value }} is not valid. |
+---------------------------+------------------------------------------------------------------------+
| Parent type | :doc:`ChoiceType ` |
+---------------------------+------------------------------------------------------------------------+
diff --git a/reference/forms/types/url.rst b/reference/forms/types/url.rst
index e5f782ce088..13f425f1d70 100644
--- a/reference/forms/types/url.rst
+++ b/reference/forms/types/url.rst
@@ -32,9 +32,9 @@ have a protocol.
| | - `row_attr`_ |
| | - `trim`_ |
+---------------------------+-------------------------------------------------------------------+
-| Default `invalid_message` | Please enter a valid URL. |
+| Default invalid message | Please enter a valid URL. |
+---------------------------+-------------------------------------------------------------------+
-| Legacy `invalid_message` | The value {{ value }} is not valid. |
+| Legacy invalid message | The value {{ value }} is not valid. |
+---------------------------+-------------------------------------------------------------------+
| Parent type | :doc:`TextType ` |
+---------------------------+-------------------------------------------------------------------+
diff --git a/reference/forms/types/week.rst b/reference/forms/types/week.rst
index eb526c160af..99762f803e3 100644
--- a/reference/forms/types/week.rst
+++ b/reference/forms/types/week.rst
@@ -39,9 +39,9 @@ the data can be a string or an array.
| | - `mapped`_ |
| | - `row_attr`_ |
+---------------------------+--------------------------------------------------------------------+
-| Default `invalid_message` | Please enter a valid week. |
+| Default invalid message | Please enter a valid week. |
+---------------------------+--------------------------------------------------------------------+
-| Legacy `invalid_message` | The value {{ value }} is not valid. |
+| Legacy invalid message | The value {{ value }} is not valid. |
+---------------------------+--------------------------------------------------------------------+
| Parent type | :doc:`FormType ` |
+---------------------------+--------------------------------------------------------------------+
From 3d274edd4b86473e7eb7275c89b0731fb6067294 Mon Sep 17 00:00:00 2001
From: Javier Eguiluz
Date: Fri, 20 Nov 2020 16:13:49 +0100
Subject: [PATCH 0159/5766] Restore the quotes wraping the DATABASE_URL value
---
testing.rst | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/testing.rst b/testing.rst
index 365626ceacd..8c9550f64ca 100644
--- a/testing.rst
+++ b/testing.rst
@@ -990,7 +990,7 @@ need in your ``.env.test`` file:
.. code-block:: text
# .env.test
- DATABASE_URL=mysql://db_user:db_password@127.0.0.1:3306/db_name_test?serverVersion=5.7
+ DATABASE_URL="mysql://db_user:db_password@127.0.0.1:3306/db_name_test?serverVersion=5.7"
# use SQLITE
# DATABASE_URL="sqlite:///%kernel.project_dir%/var/app.db"
From ef0b3fb0dcd74caea20fae38896f87f010e1f3fc Mon Sep 17 00:00:00 2001
From: Javier Eguiluz
Date: Fri, 20 Nov 2020 16:39:17 +0100
Subject: [PATCH 0160/5766] Tweak
---
doctrine/dbal.rst | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/doctrine/dbal.rst b/doctrine/dbal.rst
index 4b9f26d3f7b..3ddb98d837f 100644
--- a/doctrine/dbal.rst
+++ b/doctrine/dbal.rst
@@ -35,7 +35,7 @@ Then configure the ``DATABASE_URL`` environment variable in ``.env``:
# .env (or override DATABASE_URL in .env.local to avoid committing your changes)
# customize this line!
- DATABASE_URL=mysql://db_user:db_password@127.0.0.1:3306/db_name?serverVersion=5.7
+ DATABASE_URL="mysql://db_user:db_password@127.0.0.1:3306/db_name?serverVersion=5.7"
Further things can be configured in ``config/packages/doctrine.yaml`` - see
:ref:`reference-dbal-configuration`. Remove the ``orm`` key in that file
From 90c83b214c39c26633c3f7a0d4b8541bef6c6a26 Mon Sep 17 00:00:00 2001
From: Wouter de Jong
Date: Sun, 8 Nov 2020 14:35:47 +0100
Subject: [PATCH 0161/5766] Added PHP types to the Doctrine related articles
---
doctrine.rst | 193 ++++++++++++++++----------
doctrine/associations.rst | 81 +++++++----
doctrine/dbal.rst | 4 +-
doctrine/events.rst | 16 +--
doctrine/multiple_entity_managers.rst | 9 +-
doctrine/resolve_target_entity.rst | 5 +-
6 files changed, 186 insertions(+), 122 deletions(-)
diff --git a/doctrine.rst b/doctrine.rst
index 21b14c2ae4c..8226bf22700 100644
--- a/doctrine.rst
+++ b/doctrine.rst
@@ -51,7 +51,7 @@ The database connection information is stored as an environment variable called
# to use sqlite:
# DATABASE_URL="sqlite:///%kernel.project_dir%/var/app.db"
-
+
# to use postgresql:
# DATABASE_URL="postgresql://db_user:db_password@127.0.0.1:5432/db_name?serverVersion=11&charset=utf8"
@@ -506,46 +506,60 @@ Fetching an object back out of the database is even easier. Suppose you want to
be able to go to ``/product/1`` to see your new product::
// src/Controller/ProductController.php
+ namespace App\Controller;
+
+ use App\Entity\Product;
+ use Symfony\Component\HttpFoundation\Response;
// ...
- /**
- * @Route("/product/{id}", name="product_show")
- */
- public function show($id)
+ class ProductController extends AbstractController
{
- $product = $this->getDoctrine()
- ->getRepository(Product::class)
- ->find($id);
-
- if (!$product) {
- throw $this->createNotFoundException(
- 'No product found for id '.$id
- );
- }
+ /**
+ * @Route("/product/{id}", name="product_show")
+ */
+ public function show(int $id): Response
+ {
+ $product = $this->getDoctrine()
+ ->getRepository(Product::class)
+ ->find($id);
+
+ if (!$product) {
+ throw $this->createNotFoundException(
+ 'No product found for id '.$id
+ );
+ }
- return new Response('Check out this great product: '.$product->getName());
+ return new Response('Check out this great product: '.$product->getName());
- // or render a template
- // in the template, print things with {{ product.name }}
- // return $this->render('product/show.html.twig', ['product' => $product]);
+ // or render a template
+ // in the template, print things with {{ product.name }}
+ // return $this->render('product/show.html.twig', ['product' => $product]);
+ }
}
Another possibility is to use the ``ProductRepository`` using Symfony's autowiring
and injected by the dependency injection container::
// src/Controller/ProductController.php
- // ...
+ namespace App\Controller;
+
+ use App\Entity\Product;
use App\Repository\ProductRepository;
+ use Symfony\Component\HttpFoundation\Response;
+ // ...
- /**
- * @Route("/product/{id}", name="product_show")
- */
- public function show($id, ProductRepository $productRepository)
+ class ProductController extends AbstractController
{
- $product = $productRepository
- ->find($id);
+ /**
+ * @Route("/product/{id}", name="product_show")
+ */
+ public function show(int $id, ProductRepository $productRepository): Response
+ {
+ $product = $productRepository
+ ->find($id);
- // ...
+ // ...
+ }
}
Try it out!
@@ -611,15 +625,23 @@ for you automatically! First, install the bundle in case you don't have it:
Now, simplify your controller::
// src/Controller/ProductController.php
+ namespace App\Controller;
+
use App\Entity\Product;
+ use App\Repository\ProductRepository;
+ use Symfony\Component\HttpFoundation\Response;
+ // ...
- /**
- * @Route("/product/{id}", name="product_show")
- */
- public function show(Product $product)
+ class ProductController extends AbstractController
{
- // use the Product!
- // ...
+ /**
+ * @Route("/product/{id}", name="product_show")
+ */
+ public function show(Product $product): Response
+ {
+ // use the Product!
+ // ...
+ }
}
That's it! The bundle uses the ``{id}`` from the route to query for the ``Product``
@@ -633,26 +655,37 @@ Updating an Object
Once you've fetched an object from Doctrine, you interact with it the same as
with any PHP model::
- /**
- * @Route("/product/edit/{id}")
- */
- public function update($id)
+ // src/Controller/ProductController.php
+ namespace App\Controller;
+
+ use App\Entity\Product;
+ use App\Repository\ProductRepository;
+ use Symfony\Component\HttpFoundation\Response;
+ // ...
+
+ class ProductController extends AbstractController
{
- $entityManager = $this->getDoctrine()->getManager();
- $product = $entityManager->getRepository(Product::class)->find($id);
+ /**
+ * @Route("/product/edit/{id}")
+ */
+ public function update(int $id): Response
+ {
+ $entityManager = $this->getDoctrine()->getManager();
+ $product = $entityManager->getRepository(Product::class)->find($id);
- if (!$product) {
- throw $this->createNotFoundException(
- 'No product found for id '.$id
- );
- }
+ if (!$product) {
+ throw $this->createNotFoundException(
+ 'No product found for id '.$id
+ );
+ }
- $product->setName('New product name!');
- $entityManager->flush();
+ $product->setName('New product name!');
+ $entityManager->flush();
- return $this->redirectToRoute('product_show', [
- 'id' => $product->getId()
- ]);
+ return $this->redirectToRoute('product_show', [
+ 'id' => $product->getId()
+ ]);
+ }
}
Using Doctrine to edit an existing product consists of three steps:
@@ -728,7 +761,7 @@ a new method for this to your repository::
/**
* @return Product[]
*/
- public function findAllGreaterThanPrice($price): array
+ public function findAllGreaterThanPrice(int $price): array
{
$entityManager = $this->getEntityManager();
@@ -773,25 +806,28 @@ based on PHP conditions)::
// src/Repository/ProductRepository.php
// ...
- public function findAllGreaterThanPrice($price, $includeUnavailableProducts = false): array
+ class ProductRepository extends ServiceEntityRepository
{
- // automatically knows to select Products
- // the "p" is an alias you'll use in the rest of the query
- $qb = $this->createQueryBuilder('p')
- ->where('p.price > :price')
- ->setParameter('price', $price)
- ->orderBy('p.price', 'ASC');
-
- if (!$includeUnavailableProducts) {
- $qb->andWhere('p.available = TRUE');
- }
+ public function findAllGreaterThanPrice(int $price, bool $includeUnavailableProducts = false): array
+ {
+ // automatically knows to select Products
+ // the "p" is an alias you'll use in the rest of the query
+ $qb = $this->createQueryBuilder('p')
+ ->where('p.price > :price')
+ ->setParameter('price', $price)
+ ->orderBy('p.price', 'ASC');
+
+ if (!$includeUnavailableProducts) {
+ $qb->andWhere('p.available = TRUE');
+ }
- $query = $qb->getQuery();
+ $query = $qb->getQuery();
- return $query->execute();
+ return $query->execute();
- // to get just one result:
- // $product = $query->setMaxResults(1)->getOneOrNullResult();
+ // to get just one result:
+ // $product = $query->setMaxResults(1)->getOneOrNullResult();
+ }
}
Querying with SQL
@@ -802,20 +838,23 @@ In addition, you can query directly with SQL if you need to::
// src/Repository/ProductRepository.php
// ...
- public function findAllGreaterThanPrice($price): array
+ class ProductRepository extends ServiceEntityRepository
{
- $conn = $this->getEntityManager()->getConnection();
-
- $sql = '
- SELECT * FROM product p
- WHERE p.price > :price
- ORDER BY p.price ASC
- ';
- $stmt = $conn->prepare($sql);
- $stmt->execute(['price' => $price]);
-
- // returns an array of arrays (i.e. a raw data set)
- return $stmt->fetchAllAssociative();
+ public function findAllGreaterThanPrice(int $price): array
+ {
+ $conn = $this->getEntityManager()->getConnection();
+
+ $sql = '
+ SELECT * FROM product p
+ WHERE p.price > :price
+ ORDER BY p.price ASC
+ ';
+ $stmt = $conn->prepare($sql);
+ $stmt->execute(['price' => $price]);
+
+ // returns an array of arrays (i.e. a raw data set)
+ return $stmt->fetchAllAssociative();
+ }
}
With SQL, you will get back raw data, not objects (unless you use the `NativeQuery`_
diff --git a/doctrine/associations.rst b/doctrine/associations.rst
index 8bdddab536b..4a2fafb6467 100644
--- a/doctrine/associations.rst
+++ b/doctrine/associations.rst
@@ -327,7 +327,7 @@ Now you can see this new code in action! Imagine you're inside a controller::
/**
* @Route("/product", name="product")
*/
- public function index()
+ public function index(): Response
{
$category = new Category();
$category->setName('Computer Peripherals');
@@ -378,20 +378,26 @@ When you need to fetch associated objects, your workflow looks like it did
before. First, fetch a ``$product`` object and then access its related
``Category`` object::
+ // src/Controller/ProductController.php
+ namespace App\Controller;
+
use App\Entity\Product;
// ...
- public function show($id)
+ class ProductController extends AbstractController
{
- $product = $this->getDoctrine()
- ->getRepository(Product::class)
- ->find($id);
+ public function show(int $id): Response
+ {
+ $product = $this->getDoctrine()
+ ->getRepository(Product::class)
+ ->find($id);
- // ...
+ // ...
- $categoryName = $product->getCategory()->getName();
+ $categoryName = $product->getCategory()->getName();
- // ...
+ // ...
+ }
}
In this example, you first query for a ``Product`` object based on the product's
@@ -411,15 +417,21 @@ the category (i.e. it's "lazily loaded").
Because we mapped the optional ``OneToMany`` side, you can also query in the other
direction::
- public function showProducts($id)
+ // src/Controller/ProductController.php
+
+ // ...
+ class ProductController extends AbstractController
{
- $category = $this->getDoctrine()
- ->getRepository(Category::class)
- ->find($id);
+ public function showProducts(int $id): Response
+ {
+ $category = $this->getDoctrine()
+ ->getRepository(Category::class)
+ ->find($id);
- $products = $category->getProducts();
+ $products = $category->getProducts();
- // ...
+ // ...
+ }
}
In this case, the same things occur: you first query for a single ``Category``
@@ -475,18 +487,23 @@ can avoid the second query by issuing a join in the original query. Add the
following method to the ``ProductRepository`` class::
// src/Repository/ProductRepository.php
- public function findOneByIdJoinedToCategory($productId)
+
+ // ...
+ class ProductRepository extends ServiceEntityRepository
{
- $entityManager = $this->getEntityManager();
+ public function findOneByIdJoinedToCategory(int $productId): ?Product
+ {
+ $entityManager = $this->getEntityManager();
- $query = $entityManager->createQuery(
- 'SELECT p, c
- FROM App\Entity\Product p
- INNER JOIN p.category c
- WHERE p.id = :id'
- )->setParameter('id', $productId);
+ $query = $entityManager->createQuery(
+ 'SELECT p, c
+ FROM App\Entity\Product p
+ INNER JOIN p.category c
+ WHERE p.id = :id'
+ )->setParameter('id', $productId);
- return $query->getOneOrNullResult();
+ return $query->getOneOrNullResult();
+ }
}
This will *still* return an array of ``Product`` objects. But now, when you call
@@ -495,15 +512,21 @@ This will *still* return an array of ``Product`` objects. But now, when you call
Now, you can use this method in your controller to query for a ``Product``
object and its related ``Category`` in one query::
- public function show($id)
+ // src/Controller/ProductController.php
+
+ // ...
+ class ProductController extends AbstractController
{
- $product = $this->getDoctrine()
- ->getRepository(Product::class)
- ->findOneByIdJoinedToCategory($id);
+ public function show(int $id): Response
+ {
+ $product = $this->getDoctrine()
+ ->getRepository(Product::class)
+ ->findOneByIdJoinedToCategory($id);
- $category = $product->getCategory();
+ $category = $product->getCategory();
- // ...
+ // ...
+ }
}
.. _associations-inverse-side:
diff --git a/doctrine/dbal.rst b/doctrine/dbal.rst
index 3ddb98d837f..80c145d3d6a 100644
--- a/doctrine/dbal.rst
+++ b/doctrine/dbal.rst
@@ -48,10 +48,12 @@ object::
namespace App\Controller;
use Doctrine\DBAL\Driver\Connection;
+ use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
+ use Symfony\Component\HttpFoundation\Response;
class UserController extends AbstractController
{
- public function index(Connection $connection)
+ public function index(Connection $connection): Response
{
$users = $connection->fetchAll('SELECT * FROM users');
diff --git a/doctrine/events.rst b/doctrine/events.rst
index 1ce0bfa8ac0..309d10a7e12 100644
--- a/doctrine/events.rst
+++ b/doctrine/events.rst
@@ -74,7 +74,7 @@ define a callback for the ``prePersist`` Doctrine event:
/**
* @ORM\PrePersist
*/
- public function setCreatedAtValue()
+ public function setCreatedAtValue(): void
{
$this->createdAt = new \DateTime();
}
@@ -132,7 +132,7 @@ do so, define a listener for the ``postPersist`` Doctrine event::
{
// the listener methods receive an argument which gives you access to
// both the entity object of the event and the entity manager itself
- public function postPersist(LifecycleEventArgs $args)
+ public function postPersist(LifecycleEventArgs $args): void
{
$entity = $args->getObject();
@@ -241,7 +241,7 @@ define a listener for the ``postUpdate`` Doctrine event::
{
// the entity listener methods receive two arguments:
// the entity instance and the lifecycle event
- public function postUpdate(User $user, LifecycleEventArgs $event)
+ public function postUpdate(User $user, LifecycleEventArgs $event): void
{
// ... do something to notify the changes
}
@@ -365,7 +365,7 @@ want to log all the database activity. To do so, define a subscriber for the
{
// this method can only return the event names; you cannot define a
// custom method name to execute when each event triggers
- public function getSubscribedEvents()
+ public function getSubscribedEvents(): array
{
return [
Events::postPersist,
@@ -377,22 +377,22 @@ want to log all the database activity. To do so, define a subscriber for the
// callback methods must be called exactly like the events they listen to;
// they receive an argument of type LifecycleEventArgs, which gives you access
// to both the entity object of the event and the entity manager itself
- public function postPersist(LifecycleEventArgs $args)
+ public function postPersist(LifecycleEventArgs $args): void
{
$this->logActivity('persist', $args);
}
- public function postRemove(LifecycleEventArgs $args)
+ public function postRemove(LifecycleEventArgs $args): void
{
$this->logActivity('remove', $args);
}
- public function postUpdate(LifecycleEventArgs $args)
+ public function postUpdate(LifecycleEventArgs $args): void
{
$this->logActivity('update', $args);
}
- private function logActivity(string $action, LifecycleEventArgs $args)
+ private function logActivity(string $action, LifecycleEventArgs $args): void
{
$entity = $args->getObject();
diff --git a/doctrine/multiple_entity_managers.rst b/doctrine/multiple_entity_managers.rst
index faffc480877..ba3475dbfbc 100644
--- a/doctrine/multiple_entity_managers.rst
+++ b/doctrine/multiple_entity_managers.rst
@@ -234,12 +234,11 @@ the default entity manager (i.e. ``default``) is returned::
namespace App\Controller;
// ...
-
use Doctrine\ORM\EntityManagerInterface;
class UserController extends AbstractController
{
- public function index(EntityManagerInterface $entityManager)
+ public function index(EntityManagerInterface $entityManager): Response
{
// These methods also return the default entity manager, but it's preferred
// to get it by injecting EntityManagerInterface in the action method
@@ -250,6 +249,8 @@ the default entity manager (i.e. ``default``) is returned::
// Both of these return the "customer" entity manager
$customerEntityManager = $this->getDoctrine()->getManager('customer');
$customerEntityManager = $this->get('doctrine.orm.customer_entity_manager');
+
+ // ...
}
}
@@ -268,7 +269,7 @@ The same applies to repository calls::
class UserController extends AbstractController
{
- public function index()
+ public function index(): Response
{
// Retrieves a repository managed by the "default" em
$products = $this->getDoctrine()
@@ -287,6 +288,8 @@ The same applies to repository calls::
->getRepository(Customer::class, 'customer')
->findAll()
;
+
+ // ...
}
}
diff --git a/doctrine/resolve_target_entity.rst b/doctrine/resolve_target_entity.rst
index 36038fd9f3c..765f5d187ce 100644
--- a/doctrine/resolve_target_entity.rst
+++ b/doctrine/resolve_target_entity.rst
@@ -96,10 +96,7 @@ An InvoiceSubjectInterface::
// will need to access on the subject so that you can
// be sure that you have access to those methods.
- /**
- * @return string
- */
- public function getName();
+ public function getName(): string;
}
Next, you need to configure the listener, which tells the DoctrineBundle
From aec1016d94db1de37eaedb7f8567046168d0805a Mon Sep 17 00:00:00 2001
From: Wouter de Jong
Date: Sun, 8 Nov 2020 14:57:22 +0100
Subject: [PATCH 0162/5766] Added PHP types to the Form related articles
---
form/create_custom_field_type.rst | 18 ++--
form/create_form_type_extension.rst | 8 +-
form/data_based_validation.rst | 6 +-
form/data_mappers.rst | 8 +-
form/data_transformers.rst | 28 +++---
form/direct_submit.rst | 3 +-
form/disabling_validation.rst | 2 +-
form/dynamic_form_modification.rst | 31 ++++---
form/embedded.rst | 10 +-
form/events.rst | 10 +-
form/form_collections.rst | 102 +++++++++++----------
form/form_themes.rst | 10 +-
form/inherit_data_option.rst | 12 +--
form/type_guesser.rst | 14 +--
form/use_empty_data.rst | 6 +-
form/validation_group_service_resolver.rst | 8 +-
form/validation_groups.rst | 2 +-
form/without_class.rst | 43 +++++----
forms.rst | 100 +++++++++++---------
19 files changed, 224 insertions(+), 197 deletions(-)
diff --git a/form/create_custom_field_type.rst b/form/create_custom_field_type.rst
index 58e265fd2ad..59816006041 100644
--- a/form/create_custom_field_type.rst
+++ b/form/create_custom_field_type.rst
@@ -38,7 +38,7 @@ By convention they are stored in the ``src/Form/Type/`` directory::
class ShippingType extends AbstractType
{
- public function configureOptions(OptionsResolver $resolver)
+ public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'choices' => [
@@ -49,7 +49,7 @@ By convention they are stored in the ``src/Form/Type/`` directory::
]);
}
- public function getParent()
+ public function getParent(): string
{
return ChoiceType::class;
}
@@ -82,7 +82,7 @@ Now you can add this form type when :doc:`creating Symfony forms `::
class OrderType extends AbstractType
{
- public function buildForm(FormBuilderInterface $builder, array $options)
+ public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
// ...
@@ -168,7 +168,7 @@ in the postal address. For the moment, all fields are of type ``TextType``::
{
// ...
- public function buildForm(FormBuilderInterface $builder, array $options)
+ public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->add('addressLine1', TextType::class, [
@@ -209,7 +209,7 @@ correctly rendered in any template::
class OrderType extends AbstractType
{
- public function buildForm(FormBuilderInterface $builder, array $options)
+ public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
// ...
@@ -254,7 +254,7 @@ to define, validate and process their values::
{
// ...
- public function configureOptions(OptionsResolver $resolver)
+ public function configureOptions(OptionsResolver $resolver): void
{
// this defines the available options and their default values when
// they are not configured explicitly when using the form type
@@ -293,7 +293,7 @@ Now you can configure these options when using the form type::
class OrderType extends AbstractType
{
- public function buildForm(FormBuilderInterface $builder, array $options)
+ public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
// ...
@@ -320,7 +320,7 @@ The last step is to use these options when building the form::
{
// ...
- public function buildForm(FormBuilderInterface $builder, array $options)
+ public function buildForm(FormBuilderInterface $builder, array $options): void
{
// ...
@@ -473,7 +473,7 @@ defined by the form or be completely independent::
// ...
- public function buildView(FormView $view, FormInterface $form, array $options)
+ public function buildView(FormView $view, FormInterface $form, array $options): void
{
// pass the form type option directly to the template
$view->vars['isExtendedAddress'] = $options['is_extended_address'];
diff --git a/form/create_form_type_extension.rst b/form/create_form_type_extension.rst
index 59b1c06e9fe..55d3d34776f 100644
--- a/form/create_form_type_extension.rst
+++ b/form/create_form_type_extension.rst
@@ -114,7 +114,7 @@ the database::
// ...
- public function getWebPath()
+ public function getWebPath(): string
{
// ... $webPath being the full image URL, to be used in templates
@@ -149,13 +149,13 @@ For example::
return [FileType::class];
}
- public function configureOptions(OptionsResolver $resolver)
+ public function configureOptions(OptionsResolver $resolver): void
{
// makes it legal for FileType fields to have an image_property option
$resolver->setDefined(['image_property']);
}
- public function buildView(FormView $view, FormInterface $form, array $options)
+ public function buildView(FormView $view, FormInterface $form, array $options): void
{
if (isset($options['image_property'])) {
// this will be whatever class/entity is bound to your form (e.g. Media)
@@ -221,7 +221,7 @@ next to the file field. For example::
class MediaType extends AbstractType
{
- public function buildForm(FormBuilderInterface $builder, array $options)
+ public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->add('name', TextType::class)
diff --git a/form/data_based_validation.rst b/form/data_based_validation.rst
index 383883ba91f..226284db439 100644
--- a/form/data_based_validation.rst
+++ b/form/data_based_validation.rst
@@ -12,7 +12,7 @@ to an array callback::
use Symfony\Component\OptionsResolver\OptionsResolver;
// ...
- public function configureOptions(OptionsResolver $resolver)
+ public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'validation_groups' => [
@@ -32,7 +32,7 @@ example). You can also define whole logic inline by using a ``Closure``::
use Symfony\Component\OptionsResolver\OptionsResolver;
// ...
- public function configureOptions(OptionsResolver $resolver)
+ public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'validation_groups' => function (FormInterface $form) {
@@ -56,7 +56,7 @@ of the entity as well you have to adjust the option as follows::
use Symfony\Component\OptionsResolver\OptionsResolver;
// ...
- public function configureOptions(OptionsResolver $resolver)
+ public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'validation_groups' => function (FormInterface $form) {
diff --git a/form/data_mappers.rst b/form/data_mappers.rst
index 15e66ce54b3..c14eabd7683 100644
--- a/form/data_mappers.rst
+++ b/form/data_mappers.rst
@@ -98,7 +98,7 @@ in your form type::
/**
* @param Color|null $viewData
*/
- public function mapDataToForms($viewData, $forms)
+ public function mapDataToForms($viewData, $forms): void
{
// there is no data yet, so nothing to prepopulate
if (null === $viewData) {
@@ -119,7 +119,7 @@ in your form type::
$forms['blue']->setData($viewData->getBlue());
}
- public function mapFormsToData($forms, &$viewData)
+ public function mapFormsToData($forms, &$viewData): void
{
/** @var FormInterface[] $forms */
$forms = iterator_to_array($forms);
@@ -158,7 +158,7 @@ method::
final class ColorType extends AbstractType implements DataMapperInterface
{
- public function buildForm(FormBuilderInterface $builder, array $options)
+ public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->add('red', IntegerType::class, [
@@ -177,7 +177,7 @@ method::
;
}
- public function configureOptions(OptionsResolver $resolver)
+ public function configureOptions(OptionsResolver $resolver): void
{
// when creating a new color, the initial data should be null
$resolver->setDefault('empty_data', null);
diff --git a/form/data_transformers.rst b/form/data_transformers.rst
index 4a087a0aaff..aa0e88789bf 100644
--- a/form/data_transformers.rst
+++ b/form/data_transformers.rst
@@ -40,12 +40,12 @@ Suppose you have a Task form with a tags ``text`` type::
// ...
class TaskType extends AbstractType
{
- public function buildForm(FormBuilderInterface $builder, array $options)
+ public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder->add('tags', TextType::class);
}
- public function configureOptions(OptionsResolver $resolver)
+ public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'data_class' => Task::class,
@@ -72,7 +72,7 @@ class::
class TaskType extends AbstractType
{
- public function buildForm(FormBuilderInterface $builder, array $options)
+ public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder->add('tags', TextType::class);
@@ -136,7 +136,7 @@ Start by setting up the text field like normal::
// ...
class TaskType extends AbstractType
{
- public function buildForm(FormBuilderInterface $builder, array $options)
+ public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->add('description', TextareaType::class)
@@ -144,7 +144,7 @@ Start by setting up the text field like normal::
;
}
- public function configureOptions(OptionsResolver $resolver)
+ public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'data_class' => Task::class,
@@ -188,9 +188,8 @@ to and from the issue number and the ``Issue`` object::
* Transforms an object (issue) to a string (number).
*
* @param Issue|null $issue
- * @return string
*/
- public function transform($issue)
+ public function transform($issue): string
{
if (null === $issue) {
return '';
@@ -203,10 +202,9 @@ to and from the issue number and the ``Issue`` object::
* Transforms a string (number) to an object (issue).
*
* @param string $issueNumber
- * @return Issue|null
* @throws TransformationFailedException if object (issue) is not found.
*/
- public function reverseTransform($issueNumber)
+ public function reverseTransform($issueNumber): ?Issue
{
// no issue number? It's optional, so that's ok
if (!$issueNumber) {
@@ -273,7 +271,7 @@ and type-hint the new class::
$this->transformer = $transformer;
}
- public function buildForm(FormBuilderInterface $builder, array $options)
+ public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->add('description', TextareaType::class)
@@ -306,7 +304,7 @@ end-user error message in the data transformer using the
{
// ...
- public function reverseTransform($issueNumber)
+ public function reverseTransform($issueNumber): ?Issue
{
// ...
@@ -394,19 +392,19 @@ First, create the custom field type class::
$this->transformer = $transformer;
}
- public function buildForm(FormBuilderInterface $builder, array $options)
+ public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder->addModelTransformer($this->transformer);
}
- public function configureOptions(OptionsResolver $resolver)
+ public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'invalid_message' => 'The selected issue does not exist',
]);
}
- public function getParent()
+ public function getParent(): string
{
return TextType::class;
}
@@ -427,7 +425,7 @@ As long as you're using :ref:`autowire ` and
class TaskType extends AbstractType
{
- public function buildForm(FormBuilderInterface $builder, array $options)
+ public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->add('description', TextareaType::class)
diff --git a/form/direct_submit.rst b/form/direct_submit.rst
index ef6897611ad..876ad3964b1 100644
--- a/form/direct_submit.rst
+++ b/form/direct_submit.rst
@@ -11,9 +11,10 @@ to detect when the form has been submitted. However, you can also use the
control over when exactly your form is submitted and what data is passed to it::
use Symfony\Component\HttpFoundation\Request;
+ use Symfony\Component\HttpFoundation\Response;
// ...
- public function new(Request $request)
+ public function new(Request $request): Response
{
$task = new Task();
$form = $this->createForm(TaskType::class, $task);
diff --git a/form/disabling_validation.rst b/form/disabling_validation.rst
index f23cc73dbbf..2844d0c865d 100644
--- a/form/disabling_validation.rst
+++ b/form/disabling_validation.rst
@@ -9,7 +9,7 @@ these cases you can set the ``validation_groups`` option to ``false``::
use Symfony\Component\OptionsResolver\OptionsResolver;
- public function configureOptions(OptionsResolver $resolver)
+ public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'validation_groups' => false,
diff --git a/form/dynamic_form_modification.rst b/form/dynamic_form_modification.rst
index 69339480248..279b5b4118d 100644
--- a/form/dynamic_form_modification.rst
+++ b/form/dynamic_form_modification.rst
@@ -45,13 +45,13 @@ a bare form class looks like::
class ProductType extends AbstractType
{
- public function buildForm(FormBuilderInterface $builder, array $options)
+ public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder->add('name');
$builder->add('price');
}
- public function configureOptions(OptionsResolver $resolver)
+ public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'data_class' => Product::class,
@@ -92,7 +92,7 @@ creating that particular field is delegated to an event listener::
class ProductType extends AbstractType
{
- public function buildForm(FormBuilderInterface $builder, array $options)
+ public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder->add('price');
@@ -109,7 +109,7 @@ object is new (e.g. hasn't been persisted to the database). Based on that,
the event listener might look like the following::
// ...
- public function buildForm(FormBuilderInterface $builder, array $options)
+ public function buildForm(FormBuilderInterface $builder, array $options): void
{
// ...
$builder->addEventListener(FormEvents::PRE_SET_DATA, function (FormEvent $event) {
@@ -151,14 +151,14 @@ you can also move the logic for creating the ``name`` field to an
class AddNameFieldSubscriber implements EventSubscriberInterface
{
- public static function getSubscribedEvents()
+ public static function getSubscribedEvents(): array
{
// Tells the dispatcher that you want to listen on the form.pre_set_data
// event and that the preSetData method should be called.
return [FormEvents::PRE_SET_DATA => 'preSetData'];
}
- public function preSetData(FormEvent $event)
+ public function preSetData(FormEvent $event): void
{
$product = $event->getData();
$form = $event->getForm();
@@ -179,7 +179,7 @@ Great! Now use that in your form class::
class ProductType extends AbstractType
{
- public function buildForm(FormBuilderInterface $builder, array $options)
+ public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder->add('price');
@@ -217,7 +217,7 @@ Using an event listener, your form might look like this::
class FriendMessageFormType extends AbstractType
{
- public function buildForm(FormBuilderInterface $builder, array $options)
+ public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->add('subject', TextType::class)
@@ -274,7 +274,7 @@ security helper to fill in the listener logic::
$this->security = $security;
}
- public function buildForm(FormBuilderInterface $builder, array $options)
+ public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->add('subject', TextType::class)
@@ -337,10 +337,12 @@ and :doc:`tag it ` with the ``form.type`` tag.
In a controller, create the form like normal::
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
+ use Symfony\Component\HttpFoundation\Request;
+ use Symfony\Component\HttpFoundation\Response;
class FriendMessageController extends AbstractController
{
- public function new(Request $request)
+ public function new(Request $request): Response
{
$form = $this->createForm(FriendMessageFormType::class);
@@ -351,7 +353,7 @@ In a controller, create the form like normal::
You can also embed the form type into another form::
// inside some other "form type" class
- public function buildForm(FormBuilderInterface $builder, array $options)
+ public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder->add('message', FriendMessageFormType::class);
}
@@ -384,7 +386,7 @@ sport like this::
class SportMeetupType extends AbstractType
{
- public function buildForm(FormBuilderInterface $builder, array $options)
+ public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->add('sport', EntityType::class, [
@@ -448,7 +450,7 @@ The type would now look like::
class SportMeetupType extends AbstractType
{
- public function buildForm(FormBuilderInterface $builder, array $options)
+ public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->add('sport', EntityType::class, [
@@ -515,11 +517,12 @@ your application. Assume that you have a sport meetup creation controller::
use App\Form\Type\SportMeetupType;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
+ use Symfony\Component\HttpFoundation\Response;
// ...
class MeetupController extends AbstractController
{
- public function create(Request $request)
+ public function create(Request $request): Response
{
$meetup = new SportMeetup();
$form = $this->createForm(SportMeetupType::class, $meetup);
diff --git a/form/embedded.rst b/form/embedded.rst
index 9da8104b143..787580a41d1 100644
--- a/form/embedded.rst
+++ b/form/embedded.rst
@@ -46,12 +46,12 @@ Next, add a new ``category`` property to the ``Task`` class::
// ...
- public function getCategory()
+ public function getCategory(): ?Category
{
return $this->category;
}
- public function setCategory(Category $category = null)
+ public function setCategory(?Category $category)
{
$this->category = $category;
}
@@ -76,12 +76,12 @@ create a form class so that a ``Category`` object can be modified by the user::
class CategoryType extends AbstractType
{
- public function buildForm(FormBuilderInterface $builder, array $options)
+ public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder->add('name');
}
- public function configureOptions(OptionsResolver $resolver)
+ public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'data_class' => Category::class,
@@ -97,7 +97,7 @@ class::
use App\Form\CategoryType;
use Symfony\Component\Form\FormBuilderInterface;
- public function buildForm(FormBuilderInterface $builder, array $options)
+ public function buildForm(FormBuilderInterface $builder, array $options): void
{
// ...
diff --git a/form/events.rst b/form/events.rst
index 5620ec96f46..0f2e26e2775 100644
--- a/form/events.rst
+++ b/form/events.rst
@@ -308,7 +308,7 @@ callback for better readability::
// ...
class SubscriptionType extends AbstractType
{
- public function buildForm(FormBuilderInterface $builder, array $options)
+ public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->add('username', TextType::class)
@@ -320,7 +320,7 @@ callback for better readability::
;
}
- public function onPreSetData(FormEvent $event)
+ public function onPreSetData(FormEvent $event): void
{
// ...
}
@@ -347,7 +347,7 @@ Consider the following example of a form event subscriber::
class AddEmailFieldListener implements EventSubscriberInterface
{
- public static function getSubscribedEvents()
+ public static function getSubscribedEvents(): array
{
return [
FormEvents::PRE_SET_DATA => 'onPreSetData',
@@ -355,7 +355,7 @@ Consider the following example of a form event subscriber::
];
}
- public function onPreSetData(FormEvent $event)
+ public function onPreSetData(FormEvent $event): void
{
$user = $event->getData();
$form = $event->getForm();
@@ -367,7 +367,7 @@ Consider the following example of a form event subscriber::
}
}
- public function onPreSubmit(FormEvent $event)
+ public function onPreSubmit(FormEvent $event): void
{
$user = $event->getData();
$form = $event->getForm();
diff --git a/form/form_collections.rst b/form/form_collections.rst
index 405ffed53e4..cd1f66a7a8f 100644
--- a/form/form_collections.rst
+++ b/form/form_collections.rst
@@ -15,6 +15,7 @@ Let's start by creating a ``Task`` entity::
namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection;
+ use Doctrine\Common\Collections\Collection;
class Task
{
@@ -26,17 +27,17 @@ Let's start by creating a ``Task`` entity::
$this->tags = new ArrayCollection();
}
- public function getDescription()
+ public function getDescription(): string
{
return $this->description;
}
- public function setDescription($description)
+ public function setDescription(string $description): void
{
$this->description = $description;
}
- public function getTags()
+ public function getTags(): Collection
{
return $this->tags;
}
@@ -58,12 +59,12 @@ objects::
{
private $name;
- public function getName()
+ public function getName(): string
{
return $this->name;
}
- public function setName($name)
+ public function setName(string $name): void
{
$this->name = $name;
}
@@ -81,12 +82,12 @@ Then, create a form class so that a ``Tag`` object can be modified by the user::
class TagType extends AbstractType
{
- public function buildForm(FormBuilderInterface $builder, array $options)
+ public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder->add('name');
}
- public function configureOptions(OptionsResolver $resolver)
+ public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'data_class' => Tag::class,
@@ -110,7 +111,7 @@ inside the task form itself::
class TaskType extends AbstractType
{
- public function buildForm(FormBuilderInterface $builder, array $options)
+ public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder->add('description');
@@ -120,7 +121,7 @@ inside the task form itself::
]);
}
- public function configureOptions(OptionsResolver $resolver)
+ public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'data_class' => Task::class,
@@ -138,10 +139,11 @@ In your controller, you'll create a new form from the ``TaskType``::
use App\Form\TaskType;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
+ use Symfony\Component\HttpFoundation\Response;
class TaskController extends AbstractController
{
- public function new(Request $request)
+ public function new(Request $request): Response
{
$task = new Task();
@@ -224,7 +226,7 @@ it will receive an *unknown* number of tags. Otherwise, you'll see a
// ...
- public function buildForm(FormBuilderInterface $builder, array $options)
+ public function buildForm(FormBuilderInterface $builder, array $options): void
{
// ...
@@ -367,12 +369,12 @@ for the tags in the ``Task`` class::
{
// ...
- public function addTag(Tag $tag)
+ public function addTag(Tag $tag): void
{
$this->tags->add($tag);
}
- public function removeTag(Tag $tag)
+ public function removeTag(Tag $tag): void
{
// ...
}
@@ -383,7 +385,7 @@ Next, add a ``by_reference`` option to the ``tags`` field and set it to ``false`
// src/Form/TaskType.php
// ...
- public function buildForm(FormBuilderInterface $builder, array $options)
+ public function buildForm(FormBuilderInterface $builder, array $options): void
{
// ...
@@ -484,7 +486,7 @@ you will learn about next!).
// src/Entity/Task.php
// ...
- public function addTag(Tag $tag)
+ public function addTag(Tag $tag): void
{
// for a many-to-many association:
$tag->addTask($this);
@@ -501,7 +503,7 @@ you will learn about next!).
// src/Entity/Tag.php
// ...
- public function addTask(Task $task)
+ public function addTask(Task $task): void
{
if (!$this->tasks->contains($task)) {
$this->tasks->add($task);
@@ -521,7 +523,7 @@ Start by adding the ``allow_delete`` option in the form Type::
// src/Form/TaskType.php
// ...
- public function buildForm(FormBuilderInterface $builder, array $options)
+ public function buildForm(FormBuilderInterface $builder, array $options): void
{
// ...
@@ -540,7 +542,7 @@ Now, you need to put some code into the ``removeTag()`` method of ``Task``::
{
// ...
- public function removeTag(Tag $tag)
+ public function removeTag(Tag $tag): void
{
$this->tags->removeElement($tag);
}
@@ -617,52 +619,56 @@ the relationship between the removed ``Tag`` and ``Task`` object.
is handling the "update" of your Task::
// src/Controller/TaskController.php
+
+ // ...
use App\Entity\Task;
use Doctrine\Common\Collections\ArrayCollection;
- // ...
- public function edit($id, Request $request, EntityManagerInterface $entityManager)
+ class TaskController extends AbstractController
{
- if (null === $task = $entityManager->getRepository(Task::class)->find($id)) {
- throw $this->createNotFoundException('No task found for id '.$id);
- }
+ public function edit($id, Request $request, EntityManagerInterface $entityManager): Response
+ {
+ if (null === $task = $entityManager->getRepository(Task::class)->find($id)) {
+ throw $this->createNotFoundException('No task found for id '.$id);
+ }
- $originalTags = new ArrayCollection();
+ $originalTags = new ArrayCollection();
- // Create an ArrayCollection of the current Tag objects in the database
- foreach ($task->getTags() as $tag) {
- $originalTags->add($tag);
- }
+ // Create an ArrayCollection of the current Tag objects in the database
+ foreach ($task->getTags() as $tag) {
+ $originalTags->add($tag);
+ }
- $editForm = $this->createForm(TaskType::class, $task);
+ $editForm = $this->createForm(TaskType::class, $task);
- $editForm->handleRequest($request);
+ $editForm->handleRequest($request);
- if ($editForm->isSubmitted() && $editForm->isValid()) {
- // remove the relationship between the tag and the Task
- foreach ($originalTags as $tag) {
- if (false === $task->getTags()->contains($tag)) {
- // remove the Task from the Tag
- $tag->getTasks()->removeElement($task);
+ if ($editForm->isSubmitted() && $editForm->isValid()) {
+ // remove the relationship between the tag and the Task
+ foreach ($originalTags as $tag) {
+ if (false === $task->getTags()->contains($tag)) {
+ // remove the Task from the Tag
+ $tag->getTasks()->removeElement($task);
- // if it was a many-to-one relationship, remove the relationship like this
- // $tag->setTask(null);
+ // if it was a many-to-one relationship, remove the relationship like this
+ // $tag->setTask(null);
- $entityManager->persist($tag);
+ $entityManager->persist($tag);
- // if you wanted to delete the Tag entirely, you can also do that
- // $entityManager->remove($tag);
+ // if you wanted to delete the Tag entirely, you can also do that
+ // $entityManager->remove($tag);
+ }
}
- }
- $entityManager->persist($task);
- $entityManager->flush();
+ $entityManager->persist($task);
+ $entityManager->flush();
- // redirect back to some edit page
- return $this->redirectToRoute('task_edit', ['id' => $id]);
- }
+ // redirect back to some edit page
+ return $this->redirectToRoute('task_edit', ['id' => $id]);
+ }
- // render some form template
+ // ... render some form template
+ }
}
As you can see, adding and removing the elements correctly can be tricky.
diff --git a/form/form_themes.rst b/form/form_themes.rst
index 3811b042c28..1b5a3594a2d 100644
--- a/form/form_themes.rst
+++ b/form/form_themes.rst
@@ -266,7 +266,7 @@ form. You can also define this value explicitly with the ``block_name`` option::
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
- public function buildForm(FormBuilderInterface $builder, array $options)
+ public function buildForm(FormBuilderInterface $builder, array $options): void
{
// ...
@@ -290,7 +290,7 @@ field without having to :doc:`create a custom form type add('name', TextType::class, [
'block_prefix' => 'wrapped_text',
@@ -316,7 +316,7 @@ following complex example where a ``TaskManagerType`` has a collection of
class TaskManagerType extends AbstractType
{
- public function buildForm(FormBuilderInterface $builder, array $options = [])
+ public function buildForm(FormBuilderInterface $builder, array $options = []): void
{
// ...
$builder->add('taskLists', CollectionType::class, [
@@ -328,7 +328,7 @@ following complex example where a ``TaskManagerType`` has a collection of
class TaskListType extends AbstractType
{
- public function buildForm(FormBuilderInterface $builder, array $options = [])
+ public function buildForm(FormBuilderInterface $builder, array $options = []): void
{
// ...
$builder->add('tasks', CollectionType::class, [
@@ -339,7 +339,7 @@ following complex example where a ``TaskManagerType`` has a collection of
class TaskType
{
- public function buildForm(FormBuilderInterface $builder, array $options = [])
+ public function buildForm(FormBuilderInterface $builder, array $options = []): void
{
$builder->add('name');
// ...
diff --git a/form/inherit_data_option.rst b/form/inherit_data_option.rst
index 3321ab2153a..f4161a21111 100644
--- a/form/inherit_data_option.rst
+++ b/form/inherit_data_option.rst
@@ -52,7 +52,7 @@ Start with building two forms for these entities, ``CompanyType`` and ``Customer
class CompanyType extends AbstractType
{
- public function buildForm(FormBuilderInterface $builder, array $options)
+ public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->add('name', TextType::class)
@@ -71,7 +71,7 @@ Start with building two forms for these entities, ``CompanyType`` and ``Customer
class CustomerType extends AbstractType
{
- public function buildForm(FormBuilderInterface $builder, array $options)
+ public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->add('firstName', TextType::class)
@@ -94,7 +94,7 @@ for that::
class LocationType extends AbstractType
{
- public function buildForm(FormBuilderInterface $builder, array $options)
+ public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->add('address', TextareaType::class)
@@ -103,7 +103,7 @@ for that::
->add('country', TextType::class);
}
- public function configureOptions(OptionsResolver $resolver)
+ public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'inherit_data' => true,
@@ -131,7 +131,7 @@ Finally, make this work by adding the location form to your two original forms::
use App\Entity\Company;
// ...
- public function buildForm(FormBuilderInterface $builder, array $options)
+ public function buildForm(FormBuilderInterface $builder, array $options): void
{
// ...
@@ -148,7 +148,7 @@ Finally, make this work by adding the location form to your two original forms::
use App\Entity\Customer;
// ...
- public function buildForm(FormBuilderInterface $builder, array $options)
+ public function buildForm(FormBuilderInterface $builder, array $options): void
{
// ...
diff --git a/form/type_guesser.rst b/form/type_guesser.rst
index f990aad4115..49488e524ba 100644
--- a/form/type_guesser.rst
+++ b/form/type_guesser.rst
@@ -40,22 +40,24 @@ Start by creating the class and these methods. Next, you'll learn how to fill ea
namespace App\Form\TypeGuesser;
use Symfony\Component\Form\FormTypeGuesserInterface;
+ use Symfony\Component\Form\Guess\TypeGuess;
+ use Symfony\Component\Form\Guess\ValueGuess;
class PHPDocTypeGuesser implements FormTypeGuesserInterface
{
- public function guessType($class, $property)
+ public function guessType($class, $property): ?TypeGuess
{
}
- public function guessRequired($class, $property)
+ public function guessRequired($class, $property): ?ValueGuess
{
}
- public function guessMaxLength($class, $property)
+ public function guessMaxLength($class, $property): ?ValueGuess
{
}
- public function guessPattern($class, $property)
+ public function guessPattern($class, $property): ?ValueGuess
{
}
}
@@ -94,7 +96,7 @@ With this knowledge, you can implement the ``guessType()`` method of the
class PHPDocTypeGuesser implements FormTypeGuesserInterface
{
- public function guessType($class, $property)
+ public function guessType($class, $property): ?TypeGuess
{
$annotations = $this->readPhpDocAnnotations($class, $property);
@@ -129,7 +131,7 @@ With this knowledge, you can implement the ``guessType()`` method of the
}
}
- protected function readPhpDocAnnotations($class, $property)
+ protected function readPhpDocAnnotations(string $class, string $property): array
{
$reflectionProperty = new \ReflectionProperty($class, $property);
$phpdoc = $reflectionProperty->getDocComment();
diff --git a/form/use_empty_data.rst b/form/use_empty_data.rst
index 6a567286094..c2cba15ad7f 100644
--- a/form/use_empty_data.rst
+++ b/form/use_empty_data.rst
@@ -9,7 +9,7 @@ form class. This empty data set would be used if you submit your form, but
haven't called ``setData()`` on your form or passed in data when you created
your form. For example, in a controller::
- public function index()
+ public function index(): Response
{
$blog = ...;
@@ -61,7 +61,7 @@ that constructor with no arguments::
}
// ...
- public function configureOptions(OptionsResolver $resolver)
+ public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'empty_data' => new Blog($this->someDependency),
@@ -96,7 +96,7 @@ The closure must accept a ``FormInterface`` instance as the first argument::
use Symfony\Component\OptionsResolver\OptionsResolver;
// ...
- public function configureOptions(OptionsResolver $resolver)
+ public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'empty_data' => function (FormInterface $form) {
diff --git a/form/validation_group_service_resolver.rst b/form/validation_group_service_resolver.rst
index e497a7556df..ad741fbdb3a 100644
--- a/form/validation_group_service_resolver.rst
+++ b/form/validation_group_service_resolver.rst
@@ -23,11 +23,7 @@ parameter::
$this->service2 = $service2;
}
- /**
- * @param FormInterface $form
- * @return array
- */
- public function __invoke(FormInterface $form)
+ public function __invoke(FormInterface $form): array
{
$groups = [];
@@ -56,7 +52,7 @@ Then in your form, inject the resolver and set it as the ``validation_groups``::
}
// ...
- public function configureOptions(OptionsResolver $resolver)
+ public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'validation_groups' => $this->groupResolver,
diff --git a/form/validation_groups.rst b/form/validation_groups.rst
index 2dfe2889de9..a215ed02aba 100644
--- a/form/validation_groups.rst
+++ b/form/validation_groups.rst
@@ -20,7 +20,7 @@ following to the ``configureOptions()`` method::
use Symfony\Component\OptionsResolver\OptionsResolver;
- public function configureOptions(OptionsResolver $resolver)
+ public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
// ...
diff --git a/form/without_class.rst b/form/without_class.rst
index 50efc1dbcc7..85838d77ce9 100644
--- a/form/without_class.rst
+++ b/form/without_class.rst
@@ -12,28 +12,35 @@ But sometimes, you may want to use a form without a class, and get back an
array of the submitted data. The ``getData()`` method allows you to do
exactly that::
- // make sure you've imported the Request namespace above the class
+ // src/Controller/ContactController.php
+ namespace App\Controller;
+
+ use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
+ use Symfony\Component\HttpFoundation\Response;
// ...
- public function contact(Request $request)
+ class ContactController extends AbstractController
{
- $defaultData = ['message' => 'Type your message here'];
- $form = $this->createFormBuilder($defaultData)
- ->add('name', TextType::class)
- ->add('email', EmailType::class)
- ->add('message', TextareaType::class)
- ->add('send', SubmitType::class)
- ->getForm();
-
- $form->handleRequest($request);
-
- if ($form->isSubmitted() && $form->isValid()) {
- // data is an array with "name", "email", and "message" keys
- $data = $form->getData();
+ public function contact(Request $request): Response
+ {
+ $defaultData = ['message' => 'Type your message here'];
+ $form = $this->createFormBuilder($defaultData)
+ ->add('name', TextType::class)
+ ->add('email', EmailType::class)
+ ->add('message', TextareaType::class)
+ ->add('send', SubmitType::class)
+ ->getForm();
+
+ $form->handleRequest($request);
+
+ if ($form->isSubmitted() && $form->isValid()) {
+ // data is an array with "name", "email", and "message" keys
+ $data = $form->getData();
+ }
+
+ // ... render the form
}
-
- // ... render the form
}
By default, a form actually assumes that you want to work with arrays of
@@ -85,7 +92,7 @@ but here's a short example::
use Symfony\Component\Validator\Constraints\Length;
use Symfony\Component\Validator\Constraints\NotBlank;
- public function buildForm(FormBuilderInterface $builder, array $options)
+ public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->add('firstName', TextType::class, [
diff --git a/forms.rst b/forms.rst
index 6923660a016..12013e8fbfc 100644
--- a/forms.rst
+++ b/forms.rst
@@ -49,22 +49,22 @@ following ``Task`` class::
protected $task;
protected $dueDate;
- public function getTask()
+ public function getTask(): string
{
return $this->task;
}
- public function setTask($task)
+ public function setTask(string $task): void
{
$this->task = $task;
}
- public function getDueDate()
+ public function getDueDate(): ?\DateTime
{
return $this->dueDate;
}
- public function setDueDate(\DateTime $dueDate = null)
+ public function setDueDate(?\DateTime $dueDate): void
{
$this->dueDate = $dueDate;
}
@@ -122,10 +122,11 @@ use the ``createFormBuilder()`` helper::
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\HttpFoundation\Request;
+ use Symfony\Component\HttpFoundation\Response;
class TaskController extends AbstractController
{
- public function new(Request $request)
+ public function new(Request $request): Response
{
// creates a task object and initializes some data for this example
$task = new Task();
@@ -178,7 +179,7 @@ implements the interface and provides some utilities::
class TaskType extends AbstractType
{
- public function buildForm(FormBuilderInterface $builder, array $options)
+ public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->add('task', TextType::class)
@@ -206,7 +207,7 @@ use the ``createForm()`` helper (otherwise, use the ``create()`` method of the
class TaskController extends AbstractController
{
- public function new()
+ public function new(): Response
{
// creates a task object and initializes some data for this example
$task = new Task();
@@ -241,7 +242,7 @@ the ``data_class`` option by adding the following to your form type class::
{
// ...
- public function configureOptions(OptionsResolver $resolver)
+ public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'data_class' => Task::class,
@@ -265,10 +266,11 @@ to build another object with the visual representation of the form::
use App\Form\Type\TaskType;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
+ use Symfony\Component\HttpFoundation\Response;
class TaskController extends AbstractController
{
- public function new(Request $request)
+ public function new(Request $request): Response
{
$task = new Task();
// ...
@@ -374,34 +376,39 @@ Processing a form means to translate user-submitted data back to the properties
of an object. To make this happen, the submitted data from the user must be
written into the form object::
+ // src/Controller/TaskController.php
+
// ...
use Symfony\Component\HttpFoundation\Request;
- public function new(Request $request)
+ class TaskController extends AbstractController
{
- // just setup a fresh $task object (remove the example data)
- $task = new Task();
+ public function new(Request $request): Response
+ {
+ // just setup a fresh $task object (remove the example data)
+ $task = new Task();
- $form = $this->createForm(TaskType::class, $task);
+ $form = $this->createForm(TaskType::class, $task);
- $form->handleRequest($request);
- if ($form->isSubmitted() && $form->isValid()) {
- // $form->getData() holds the submitted values
- // but, the original `$task` variable has also been updated
- $task = $form->getData();
+ $form->handleRequest($request);
+ if ($form->isSubmitted() && $form->isValid()) {
+ // $form->getData() holds the submitted values
+ // but, the original `$task` variable has also been updated
+ $task = $form->getData();
- // ... perform some action, such as saving the task to the database
- // for example, if Task is a Doctrine entity, save it!
- // $entityManager = $this->getDoctrine()->getManager();
- // $entityManager->persist($task);
- // $entityManager->flush();
+ // ... perform some action, such as saving the task to the database
+ // for example, if Task is a Doctrine entity, save it!
+ // $entityManager = $this->getDoctrine()->getManager();
+ // $entityManager->persist($task);
+ // $entityManager->flush();
- return $this->redirectToRoute('task_success');
- }
+ return $this->redirectToRoute('task_success');
+ }
- return $this->render('task/new.html.twig', [
- 'form' => $form->createView(),
- ]);
+ return $this->render('task/new.html.twig', [
+ 'form' => $form->createView(),
+ ]);
+ }
}
This controller follows a common pattern for handling forms and has three
@@ -534,7 +541,7 @@ object.
{
// ...
- public static function loadValidatorMetadata(ClassMetadata $metadata)
+ public static function loadValidatorMetadata(ClassMetadata $metadata): void
{
$metadata->addPropertyConstraint('task', new NotBlank());
@@ -571,7 +578,7 @@ argument of ``createForm()``::
class TaskController extends AbstractController
{
- public function new()
+ public function new(): Response
{
$task = new Task();
// use some PHP logic to decide if this form field is required or not
@@ -599,7 +606,7 @@ options they accept using the ``configureOptions()`` method::
{
// ...
- public function configureOptions(OptionsResolver $resolver)
+ public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
// ...,
@@ -623,7 +630,7 @@ Now you can use this new form option inside the ``buildForm()`` method::
class TaskType extends AbstractType
{
- public function buildForm(FormBuilderInterface $builder, array $options)
+ public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
// ...
@@ -699,6 +706,7 @@ use the ``setAction()`` and ``setMethod()`` methods to change this::
// src/Controller/TaskController.php
namespace App\Controller;
+ // ...
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Form\Extension\Core\Type\DateType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
@@ -706,7 +714,7 @@ use the ``setAction()`` and ``setMethod()`` methods to change this::
class TaskController extends AbstractController
{
- public function new()
+ public function new(): Response
{
// ...
@@ -727,10 +735,11 @@ When building the form in a class, pass the action and method as form options::
use App\Form\TaskType;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
+ // ...
class TaskController extends AbstractController
{
- public function new()
+ public function new(): Response
{
// ...
@@ -775,10 +784,11 @@ method::
use App\Form\TaskType;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
+ // ...
class TaskController extends AbstractController
{
- public function new()
+ public function new(): Response
{
$task = ...;
$form = $this->get('form.factory')->createNamed('my_name', TaskType::class, $task);
@@ -839,7 +849,7 @@ pass ``null`` to it, to enable Symfony's "guessing mechanism"::
class TaskType extends AbstractType
{
- public function buildForm(FormBuilderInterface $builder, array $options)
+ public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
// if you don't define field options, you can omit the second argument
@@ -897,16 +907,20 @@ If you need extra fields in the form that won't be stored in the object (for
example to add an *"I agree with these terms"* checkbox), set the ``mapped``
option to ``false`` in those fields::
+ // ...
use Symfony\Component\Form\FormBuilderInterface;
- public function buildForm(FormBuilderInterface $builder, array $options)
+ class TaskType extends AbstractType
{
- $builder
- ->add('task')
- ->add('dueDate')
- ->add('agreeTerms', CheckboxType::class, ['mapped' => false])
- ->add('save', SubmitType::class)
- ;
+ public function buildForm(FormBuilderInterface $builder, array $options): void
+ {
+ $builder
+ ->add('task')
+ ->add('dueDate')
+ ->add('agreeTerms', CheckboxType::class, ['mapped' => false])
+ ->add('save', SubmitType::class)
+ ;
+ }
}
These "unmapped fields" can be set and accessed in a controller with::
From 8f8621d99c344a3937f505ca12fade3a6e95f04a Mon Sep 17 00:00:00 2001
From: Wouter de Jong
Date: Sun, 8 Nov 2020 15:05:59 +0100
Subject: [PATCH 0163/5766] Added PHP types to the DI related articles
---
service_container.rst | 4 ++--
service_container/autowiring.rst | 19 +++++++++++--------
service_container/calls.rst | 4 ++--
service_container/compiler_passes.rst | 4 ++--
service_container/configurators.rst | 8 ++++----
service_container/factories.rst | 4 ++--
service_container/injection_types.rst | 6 +++---
service_container/optional_dependencies.rst | 2 +-
service_container/parent_services.rst | 2 +-
.../service_subscribers_locators.rst | 12 ++++++------
service_container/synthetic_services.rst | 2 +-
service_container/tags.rst | 18 ++++++++++--------
12 files changed, 45 insertions(+), 40 deletions(-)
diff --git a/service_container.rst b/service_container.rst
index ff80ac27a14..09e26cd4d0b 100644
--- a/service_container.rst
+++ b/service_container.rst
@@ -340,7 +340,7 @@ you can type-hint the new ``SiteUpdateManager`` class and use it::
// src/Controller/SiteController.php
namespace App\Controller;
-
+
// ...
use App\Service\SiteUpdateManager;
@@ -378,7 +378,7 @@ example, suppose you want to make the admin email configurable:
+ private $adminEmail;
- public function __construct(MessageGenerator $messageGenerator, MailerInterface $mailer)
- + public function __construct(MessageGenerator $messageGenerator, MailerInterface $mailer, $adminEmail)
+ + public function __construct(MessageGenerator $messageGenerator, MailerInterface $mailer, string $adminEmail)
{
// ...
+ $this->adminEmail = $adminEmail;
diff --git a/service_container/autowiring.rst b/service_container/autowiring.rst
index 167fb4562f4..04058c6b9ac 100644
--- a/service_container/autowiring.rst
+++ b/service_container/autowiring.rst
@@ -29,7 +29,7 @@ Start by creating a ROT13 transformer class::
class Rot13Transformer
{
- public function transform($value)
+ public function transform(string $value): string
{
return str_rot13($value);
}
@@ -41,6 +41,7 @@ And now a Twitter client using this transformer::
namespace App\Service;
use App\Util\Rot13Transformer;
+ // ...
class TwitterClient
{
@@ -51,7 +52,7 @@ And now a Twitter client using this transformer::
$this->transformer = $transformer;
}
- public function tweet($user, $key, $status)
+ public function tweet(User $user, string $key, string $status): void
{
$transformedStatus = $this->transformer->transform($status);
@@ -129,6 +130,8 @@ Now, you can use the ``TwitterClient`` service immediately in a controller::
use App\Service\TwitterClient;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
+ use Symfony\Component\HttpFoundation\Request;
+ use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
class DefaultController extends AbstractController
@@ -136,7 +139,7 @@ Now, you can use the ``TwitterClient`` service immediately in a controller::
/**
* @Route("/tweet", methods={"POST"})
*/
- public function tweet(TwitterClient $twitterClient)
+ public function tweet(TwitterClient $twitterClient, Request $request): Response
{
// fetch $user, $key, $status from the POST'ed data
@@ -288,7 +291,7 @@ To follow this best practice, suppose you decide to create a ``TransformerInterf
interface TransformerInterface
{
- public function transform($value);
+ public function transform(string $value): string;
}
Then, you update ``Rot13Transformer`` to implement it::
@@ -388,7 +391,7 @@ Suppose you create a second class - ``UppercaseTransformer`` that implements
class UppercaseTransformer implements TransformerInterface
{
- public function transform($value)
+ public function transform(string $value): string
{
return strtoupper($value);
}
@@ -426,7 +429,7 @@ the injection::
$this->transformer = $shoutyTransformer;
}
- public function toot($user, $key, $status)
+ public function toot(User $user, string $key, string $status): void
{
$transformedStatus = $this->transformer->transform($status);
@@ -565,12 +568,12 @@ to inject the ``logger`` service, and decide to use setter-injection::
/**
* @required
*/
- public function setLogger(LoggerInterface $logger)
+ public function setLogger(LoggerInterface $logger): void
{
$this->logger = $logger;
}
- public function transform($value)
+ public function transform(string $value): string
{
$this->logger->info('Transforming '.$value);
// ...
diff --git a/service_container/calls.rst b/service_container/calls.rst
index 00069a2ccb2..78418aadf13 100644
--- a/service_container/calls.rst
+++ b/service_container/calls.rst
@@ -22,7 +22,7 @@ example::
{
private $logger;
- public function setLogger(LoggerInterface $logger)
+ public function setLogger(LoggerInterface $logger): void
{
$this->logger = $logger;
}
@@ -97,7 +97,7 @@ instead of mutating the object they were called on::
/**
* @return static
*/
- public function withLogger(LoggerInterface $logger)
+ public function withLogger(LoggerInterface $logger): self
{
$new = clone $this;
$new->logger = $logger;
diff --git a/service_container/compiler_passes.rst b/service_container/compiler_passes.rst
index 4d959e93dc6..79f666a4237 100644
--- a/service_container/compiler_passes.rst
+++ b/service_container/compiler_passes.rst
@@ -52,7 +52,7 @@ and process the services inside the ``process()`` method::
// ...
- public function process(ContainerBuilder $container)
+ public function process(ContainerBuilder $container): void
{
// in this method you can manipulate the service container:
// for example, changing some container service:
@@ -81,7 +81,7 @@ method in the extension)::
class MyBundle extends Bundle
{
- public function build(ContainerBuilder $container)
+ public function build(ContainerBuilder $container): void
{
parent::build($container);
diff --git a/service_container/configurators.rst b/service_container/configurators.rst
index 92c1afc5794..5331d0ba7ac 100644
--- a/service_container/configurators.rst
+++ b/service_container/configurators.rst
@@ -28,7 +28,7 @@ You start defining a ``NewsletterManager`` class like this::
{
private $enabledFormatters;
- public function setEnabledFormatters(array $enabledFormatters)
+ public function setEnabledFormatters(array $enabledFormatters): void
{
$this->enabledFormatters = $enabledFormatters;
}
@@ -45,7 +45,7 @@ and also a ``GreetingCardManager`` class::
{
private $enabledFormatters;
- public function setEnabledFormatters(array $enabledFormatters)
+ public function setEnabledFormatters(array $enabledFormatters): void
{
$this->enabledFormatters = $enabledFormatters;
}
@@ -65,7 +65,7 @@ in the application::
{
// ...
- public function getEnabledFormatters()
+ public function getEnabledFormatters(): array
{
// code to configure which formatters to use
$enabledFormatters = [...];
@@ -92,7 +92,7 @@ to create a configurator class to configure these instances::
$this->formatterManager = $formatterManager;
}
- public function configure(EmailFormatterAwareInterface $emailManager)
+ public function configure(EmailFormatterAwareInterface $emailManager): void
{
$emailManager->setEnabledFormatters(
$this->formatterManager->getEnabledFormatters()
diff --git a/service_container/factories.rst b/service_container/factories.rst
index f6ccd5a1198..9f01e7dc7a6 100644
--- a/service_container/factories.rst
+++ b/service_container/factories.rst
@@ -26,7 +26,7 @@ object by calling the static ``createNewsletterManager()`` method::
class NewsletterManagerStaticFactory
{
- public static function createNewsletterManager()
+ public static function createNewsletterManager(): NewsletterManager
{
$newsletterManager = new NewsletterManager();
@@ -180,7 +180,7 @@ factory service can be used as a callback::
// ...
class InvokableNewsletterManagerFactory
{
- public function __invoke()
+ public function __invoke(): NewsletterManager
{
$newsletterManager = new NewsletterManager();
diff --git a/service_container/injection_types.rst b/service_container/injection_types.rst
index 097540bd8f6..6b7b74d1d24 100644
--- a/service_container/injection_types.rst
+++ b/service_container/injection_types.rst
@@ -130,7 +130,7 @@ by cloning the original service, this approach allows you to make a service immu
* @required
* @return static
*/
- public function withMailer(MailerInterface $mailer)
+ public function withMailer(MailerInterface $mailer): self
{
$new = clone $this;
$new->mailer = $mailer;
@@ -224,7 +224,7 @@ that accepts the dependency::
// src/Mail/NewsletterManager.php
namespace App\Mail;
-
+
// ...
class NewsletterManager
{
@@ -233,7 +233,7 @@ that accepts the dependency::
/**
* @required
*/
- public function setMailer(MailerInterface $mailer)
+ public function setMailer(MailerInterface $mailer): void
{
$this->mailer = $mailer;
}
diff --git a/service_container/optional_dependencies.rst b/service_container/optional_dependencies.rst
index ca702176341..b981877a942 100644
--- a/service_container/optional_dependencies.rst
+++ b/service_container/optional_dependencies.rst
@@ -113,7 +113,7 @@ In YAML, the special ``@?`` syntax tells the service container that the
dependency is optional. The ``NewsletterManager`` must also be rewritten by
adding a ``setLogger()`` method::
- public function setLogger(LoggerInterface $logger)
+ public function setLogger(LoggerInterface $logger): void
{
// ...
}
diff --git a/service_container/parent_services.rst b/service_container/parent_services.rst
index 561721a2a8a..de0d5658b15 100644
--- a/service_container/parent_services.rst
+++ b/service_container/parent_services.rst
@@ -26,7 +26,7 @@ you may have multiple repository classes which need the
$this->objectManager = $objectManager;
}
- public function setLogger(LoggerInterface $logger)
+ public function setLogger(LoggerInterface $logger): void
{
$this->logger = $logger;
}
diff --git a/service_container/service_subscribers_locators.rst b/service_container/service_subscribers_locators.rst
index a9579bcfcc3..2fc0ec54fb1 100644
--- a/service_container/service_subscribers_locators.rst
+++ b/service_container/service_subscribers_locators.rst
@@ -87,7 +87,7 @@ a PSR-11 ``ContainerInterface``::
$this->locator = $locator;
}
- public static function getSubscribedServices()
+ public static function getSubscribedServices(): array
{
return [
'App\FooCommand' => FooHandler::class,
@@ -130,7 +130,7 @@ service locator::
use Psr\Log\LoggerInterface;
- public static function getSubscribedServices()
+ public static function getSubscribedServices(): array
{
return [
// ...
@@ -142,7 +142,7 @@ Service types can also be keyed by a service name for internal use::
use Psr\Log\LoggerInterface;
- public static function getSubscribedServices()
+ public static function getSubscribedServices(): array
{
return [
// ...
@@ -159,7 +159,7 @@ typically happens when extending ``AbstractController``::
class MyController extends AbstractController
{
- public static function getSubscribedServices()
+ public static function getSubscribedServices(): array
{
return array_merge(parent::getSubscribedServices(), [
// ...
@@ -176,7 +176,7 @@ errors if there's no matching service found in the service container::
use Psr\Log\LoggerInterface;
- public static function getSubscribedServices()
+ public static function getSubscribedServices(): array
{
return [
// ...
@@ -395,7 +395,7 @@ will share identical locators among all the services referencing them::
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;
- public function process(ContainerBuilder $container)
+ public function process(ContainerBuilder $container): void
{
// ...
diff --git a/service_container/synthetic_services.rst b/service_container/synthetic_services.rst
index 5a3ea59d276..59869d5d7f3 100644
--- a/service_container/synthetic_services.rst
+++ b/service_container/synthetic_services.rst
@@ -18,7 +18,7 @@ from within the ``Kernel`` class::
{
// ...
- protected function initializeContainer()
+ protected function initializeContainer(): void
{
// ...
$this->container->set('kernel', $this);
diff --git a/service_container/tags.rst b/service_container/tags.rst
index bbe7df1af6b..8bddd65c795 100644
--- a/service_container/tags.rst
+++ b/service_container/tags.rst
@@ -126,7 +126,7 @@ In a Symfony application, call this method in your kernel class::
{
// ...
- protected function build(ContainerBuilder $container)
+ protected function build(ContainerBuilder $container): void
{
$container->registerForAutoconfiguration(CustomInterface::class)
->addTag('app.custom_tag')
@@ -142,7 +142,7 @@ In a Symfony bundle, call this method in the ``load()`` method of the
{
// ...
- public function load(array $configs, ContainerBuilder $container)
+ public function load(array $configs, ContainerBuilder $container): void
{
$container->registerForAutoconfiguration(CustomInterface::class)
->addTag('app.custom_tag')
@@ -178,7 +178,7 @@ To begin with, define the ``TransportChain`` class::
$this->transports = [];
}
- public function addTransport(\Swift_Transport $transport)
+ public function addTransport(\Swift_Transport $transport): void
{
$this->transports[] = $transport;
}
@@ -304,7 +304,7 @@ container for any services with the ``app.mail_transport`` tag::
class MailTransportPass implements CompilerPassInterface
{
- public function process(ContainerBuilder $container)
+ public function process(ContainerBuilder $container): void
{
// always first check if the primary service is defined
if (!$container->has(TransportChain::class)) {
@@ -341,7 +341,7 @@ or from your kernel::
{
// ...
- protected function build(ContainerBuilder $container)
+ protected function build(ContainerBuilder $container): void
{
$container->addCompilerPass(new MailTransportPass());
}
@@ -372,16 +372,18 @@ To begin with, change the ``TransportChain`` class::
$this->transports = [];
}
- public function addTransport(\Swift_Transport $transport, $alias)
+ public function addTransport(\Swift_Transport $transport, $alias): void
{
$this->transports[$alias] = $transport;
}
- public function getTransport($alias)
+ public function getTransport($alias): ?\Swift_Transport
{
if (array_key_exists($alias, $this->transports)) {
return $this->transports[$alias];
}
+
+ return null;
}
}
@@ -476,7 +478,7 @@ use this, update the compiler::
class TransportCompilerPass implements CompilerPassInterface
{
- public function process(ContainerBuilder $container)
+ public function process(ContainerBuilder $container): void
{
// ...
From 68813a00f5b3b910789b06117a45fc083f251a90 Mon Sep 17 00:00:00 2001
From: Jules Pietri
Date: Sat, 4 Apr 2020 18:06:14 +0200
Subject: [PATCH 0164/5766] [Form] Added explicit `getParent()` call in types
inheritance mechanism
---
form/create_custom_field_type.rst | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/form/create_custom_field_type.rst b/form/create_custom_field_type.rst
index 59816006041..f622d11c1e4 100644
--- a/form/create_custom_field_type.rst
+++ b/form/create_custom_field_type.rst
@@ -144,13 +144,23 @@ These are the most important methods that a form type class can define:
``configureOptions()``
It defines the options configurable when using the form type, which are also
- the options that can be used in ``buildForm()`` and ``buildView()`` methods.
+ the options that can be used in ``buildForm()`` and ``buildView()``
+ methods. Options are inherited from parent types and parent type
+ extensions, but you can create any custom option you need.
``finishView()``
When creating a form type that consists of many fields, this method allows
to modify the "view" of any of those fields. For any other use case, it's
recommended to use instead the ``buildView()`` method.
+``getParent()``
+ It returns a form type class name that is defined as the parent. All
+ the other form type methods will be called with this parent type, and
+ all its type extensions, before calling the ones defined in your custom
+ type.
+ By default, all classes extend the ``AbstractType`` class, which
+ defines the ``FormType`` as the parent type.
+
Defining the Form Type
~~~~~~~~~~~~~~~~~~~~~~
From 97c94d77f4096b140da3ad303f7f3e9fa0ecdcb0 Mon Sep 17 00:00:00 2001
From: Wouter de Jong
Date: Sat, 21 Nov 2020 17:38:17 +0100
Subject: [PATCH 0165/5766] Updated getParent() description with the why/when
(thanks javier!)
---
form/create_custom_field_type.rst | 27 ++++++++++++++-------------
1 file changed, 14 insertions(+), 13 deletions(-)
diff --git a/form/create_custom_field_type.rst b/form/create_custom_field_type.rst
index f622d11c1e4..2d13673be33 100644
--- a/form/create_custom_field_type.rst
+++ b/form/create_custom_field_type.rst
@@ -55,13 +55,10 @@ By convention they are stored in the ``src/Form/Type/`` directory::
}
}
-The ``configureOptions()`` method, which is explained later in this article,
-defines the options that can be configured for the form type and sets the
-default value of those options.
-
-The ``getParent()`` method defines which is the form type used as the base of
-this type. In this case, the type extends from ``ChoiceType`` to reuse all of
-the logic and rendering of that field type.
+The methods of the ``FormTypeInterface`` are explained in detail later in
+this article. Here, ``getParent()`` method defines the base type
+(``ChoiceType``) and ``configureOptions()`` overrides some of its options.
+The resulting form type is a choice field with predefined choices.
.. note::
@@ -154,12 +151,16 @@ These are the most important methods that a form type class can define:
recommended to use instead the ``buildView()`` method.
``getParent()``
- It returns a form type class name that is defined as the parent. All
- the other form type methods will be called with this parent type, and
- all its type extensions, before calling the ones defined in your custom
- type.
- By default, all classes extend the ``AbstractType`` class, which
- defines the ``FormType`` as the parent type.
+ If your custom type is based on another type (i.e. they share some
+ functionality) add this method to return the fully-qualified class name
+ of that original type. Do not use PHP inheritance for this.
+ Symfony will call all the form type methods (``buildForm()``,
+ ``buildView()``, etc.) of the parent type and it will call all its type
+ extensions before calling the ones defined in your custom type.
+
+ By default, the ``AbstractType`` class returns the generic
+ :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\FormType`
+ type, which is the root parent for all form types in the Form component.
Defining the Form Type
~~~~~~~~~~~~~~~~~~~~~~
From ad317c3e5c2e21bed3b2f5d60625d659b057fe54 Mon Sep 17 00:00:00 2001
From: Wouter de Jong
Date: Sat, 21 Nov 2020 20:42:21 +0100
Subject: [PATCH 0166/5766] [#14565] Minor formatting fixes
---
mailer.rst | 17 +++++++++--------
reference/configuration/framework.rst | 22 +++++++++++++++-------
2 files changed, 24 insertions(+), 15 deletions(-)
diff --git a/mailer.rst b/mailer.rst
index ebf79865a72..1472d2ce2fa 100644
--- a/mailer.rst
+++ b/mailer.rst
@@ -70,16 +70,17 @@ over SMTP by configuring the DSN in your ``.env`` file (the ``user``,
If you are migrating from Swiftmailer (and the Swiftmailer bundle), be
warned that the DSN format is different.
-Using built-in transports
+Using Built-in Transports
~~~~~~~~~~~~~~~~~~~~~~~~~
-============ ==================================== ===========
-DSN protocol Example Description
-============ ==================================== ===========
-smtp smtp://user:pass@smtp.example.com:25 Mailer uses an SMTP server to send emails
-sendmail sendmail://default Mailer uses the local sendmail binary to send emails
-============ ==================================== ===========
-
+============ ======================================== ==============================
+DSN protocol Example Description
+============ ======================================== ==============================
+smtp ``smtp://user:pass@smtp.example.com:25`` Mailer uses an SMTP server to
+ send emails
+sendmail ``sendmail://default`` Mailer uses the local sendmail
+ binary to send emails
+============ ======================================== ==============================
Using a 3rd Party Transport
~~~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/reference/configuration/framework.rst b/reference/configuration/framework.rst
index 255adc11fec..a1692037b12 100644
--- a/reference/configuration/framework.rst
+++ b/reference/configuration/framework.rst
@@ -2906,21 +2906,27 @@ Name of the lock you want to create.
mailer
~~~~~~
+.. versionadded:: 4.3
+
+ The ``mailer`` settings were introduced in Symfony 4.3.
+
.. _mailer-dsn:
dsn
...
-**type**: ``string``
+**type**: ``string`` **default**: ``null``
-The DSN used by the mailer. When several DSN may be used, use `transports` (see below) instead.
+The DSN used by the mailer. When several DSN may be used, use
+``transports`` option (see below) instead.
transports
..........
**type**: ``array``
-A :ref:`list of DSN ` that can be used by the mailer. A transport name is the key and the dsn is the value.
+A :ref:`list of DSN ` that can be used by the
+mailer. A transport name is the key and the dsn is the value.
envelope
........
@@ -2930,14 +2936,16 @@ sender
**type**: ``string``
-Sender used by the ``Mailer``. Keep in mind that this setting override a sender set in the code.
+Sender used by the ``Mailer``. Keep in mind that this setting override a
+sender set in the code.
recipients
""""""""""
**type**: ``array``
-Recipients used by the ``Mailer``. Keep in mind that this setting override recipients set in the code.
+Recipients used by the ``Mailer``. Keep in mind that this setting override
+recipients set in the code.
.. configuration-block::
@@ -2963,8 +2971,8 @@ Recipients used by the ``Mailer``. Keep in mind that this setting override recip
-