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/1045] 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 af5401a38a622e0cc55b42eca361ae7061852f9b Mon Sep 17 00:00:00 2001 From: Laurent VOULLEMIER Date: Tue, 18 Aug 2020 17:44:19 +0200 Subject: [PATCH 0002/1045] 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 0003/1045] 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 0004/1045] 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 0005/1045] 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 fbf534835fdb04609c30f6d4e887fd24e99e3e93 Mon Sep 17 00:00:00 2001 From: Yoann Chocteau Date: Wed, 30 Sep 2020 09:53:59 +0200 Subject: [PATCH 0006/1045] Update user_provider.rst ServiceEntityRepository instead of EntityRepository ( Using a Custom Query to Load the User ) --- security/user_provider.rst | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/security/user_provider.rst b/security/user_provider.rst index 04a587b2529..eb11553c8f1 100644 --- a/security/user_provider.rst +++ b/security/user_provider.rst @@ -128,23 +128,24 @@ interface only requires one method: ``loadUserByUsername($username)``:: // src/Repository/UserRepository.php namespace App\Repository; - use Doctrine\ORM\EntityRepository; + use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository; use Symfony\Bridge\Doctrine\Security\User\UserLoaderInterface; - class UserRepository extends EntityRepository implements UserLoaderInterface + class UserRepository extends ServiceEntityRepository implements UserLoaderInterface { // ... public function loadUserByUsername($usernameOrEmail) { - return $this->createQuery( + $entityManager = $this->getEntityManager(); + + return $entityManager->createQuery( 'SELECT u FROM App\Entity\User u WHERE u.username = :query OR u.email = :query' ) ->setParameter('query', $usernameOrEmail) - ->getQuery() ->getOneOrNullResult(); } } From 0553891707b6617b781377edc9edc9dd306d3389 Mon Sep 17 00:00:00 2001 From: Wouter de Jong Date: Sat, 3 Oct 2020 23:38:27 +0200 Subject: [PATCH 0007/1045] Readded ACL file permission docs --- setup/file_permissions.rst | 113 +++++++++++++++++++++++++++++++------ 1 file changed, 97 insertions(+), 16 deletions(-) diff --git a/setup/file_permissions.rst b/setup/file_permissions.rst index 4c65ac8325e..d5a7bac7e0b 100644 --- a/setup/file_permissions.rst +++ b/setup/file_permissions.rst @@ -1,19 +1,100 @@ Setting up or Fixing File Permissions ===================================== -In Symfony 3.x, you needed to do some extra work to make sure that your cache directory -was writable. But that is no longer true! In Symfony 4, everything works automatically: - -* In the ``dev`` environment, ``umask()`` is used in ``bin/console`` and ``public/index.php`` - so that any created files are writable by everyone. - -* In the ``prod`` environment (i.e. when ``APP_ENV`` is ``prod`` and ``APP_DEBUG`` - is ``0``), as long as you run ``php bin/console cache:warmup``, no cache files - will need to be written to disk at runtime. The only exception is when using - a filesystem-based cache, such as Doctrine's query result cache or Symfony's - cache with a filesystem provider configured. - -* In all environments, the log directory (``var/log/`` by default) must exist - and be writable by your web server user and terminal user. One way this can - be done is by using ``chmod -R 777 var/log/``. Be aware that your logs are - readable by any user on your production system. +The ``var/`` directory in a Symfony application is used to store generated +files (cache and logs) and file-based cache files. In the production +environment, you often need to add explicit permissions to let Symfony +write files into this directory. + +.. tip:: + + In dev environments, ``umask()`` is used in ``bin/console`` and + ``public/index.php`` to make sure the directory is writable. However, + this is not a safe method and should not be used in production. + +Setting up File Permissions in Production +----------------------------------------- + +This section describes the required permissions. See +:ref:`the next section ` on how to add the +permissions. + +* The ``var/log/`` directory must exist and must be writable by both your + web server user and the terminal user; +* The ``var/cache/`` directory must be writable by the terminal user (the + user running ``cache:warmup`` or ``cache:clear``). It must also be writable + by the web server user if you're using the + :doc:`filesystem cache provider `; + or Doctrine query result cache. + +.. _setup-file-permissions: + +Configuring File Permissions on Linux and macOS System +------------------------------------------------------ + +On Linux and macOS systems, if your web server user is different from your +command line user, you need to configure permissions properly to avoid issues. +There are several ways to achieve that: + +1. Using ACL on a System that Supports ``setfacl`` (Linux/BSD) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Using Access Control Lists (ACL) permissions is the most safe and +recommended method to make the ``var/`` directory writable. You may need to +install ``setfacl`` and `enable ACL support`_ on your disk partition before +using this method. Then, use the following script to determine your web +server user and grant the needed permissions: + +.. code-block:: terminal + + $ HTTPDUSER=$(ps axo user,comm | grep -E '[a]pache|[h]ttpd|[_]www|[w]ww-data|[n]ginx' | grep -v root | head -1 | cut -d\ -f1) + # if this doesn't work, try adding `-n` option + + # set permissions for future files and folders + $ sudo setfacl -dR -m u:"$HTTPDUSER":rwX -m u:$(whoami):rwX var + # set permissions on the existing files and folders + $ sudo setfacl -R -m u:"$HTTPDUSER":rwX -m u:$(whoami):rwX var + +Both of these commands assign permissions for the system user (the one +running these commands) and the web server user. + +.. note:: + + ``setfacl`` isn't available on NFS mount points. However, storing cache and + logs over NFS is strongly discouraged for performance reasons. + +2. Use the same User for the CLI and the Web Server +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Edit your web server configuration (commonly ``httpd.conf`` or ``apache2.conf`` +for Apache) and set its user to be the same as your CLI user (e.g. for Apache, +update the ``User`` and ``Group`` directives). + +.. caution:: + + If this solution is used in a production server, be sure this user only has + limited privileges (no access to private data or servers, execution of + unsafe binaries, etc.) as a compromised server would give to the hacker + those privileges. + +3. Without Using ACL +~~~~~~~~~~~~~~~~~~~~ + +If none of the previous methods work for you, change the ``umask`` so that the +cache and log directories are group-writable or world-writable (depending +if the web server user and the command line user are in the same group or not). +To achieve this, put the following line at the beginning of the ``bin/console``, +``web/app.php`` and ``web/app_dev.php`` files:: + + umask(0002); // This will let the permissions be 0775 + + // or + + umask(0000); // This will let the permissions be 0777 + +.. caution:: + + Changing the ``umask`` is not thread-safe, so the ACL methods are recommended + when they are available. + +.. _`enable ACL support`: https://help.ubuntu.com/community/FilePermissionsACLs From de39e50ca2ba4db7e81ef93dd407e68ff44df59e Mon Sep 17 00:00:00 2001 From: Guillaume Date: Fri, 6 Sep 2019 12:06:52 +0200 Subject: [PATCH 0008/1045] Multiple entity managers and shared entities management --- doctrine/multiple_entity_managers.rst | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/doctrine/multiple_entity_managers.rst b/doctrine/multiple_entity_managers.rst index b7f61039a1e..33e0da09cf9 100644 --- a/doctrine/multiple_entity_managers.rst +++ b/doctrine/multiple_entity_managers.rst @@ -9,6 +9,8 @@ application. This is necessary if you are using different databases or even vendors with entirely different sets of entities. In other words, one entity manager that connects to one database will handle some entities while another entity manager that connects to another database might handle the rest. +It is also possible to use multiple entity managers to manage a common set of +entities, each with their own database connection strings or separate cache configuration. .. note:: @@ -44,7 +46,6 @@ The following configuration code shows how you can configure two entity managers driver: 'pdo_mysql' server_version: '5.7' charset: utf8mb4 - orm: default_entity_manager: default entity_managers: @@ -183,7 +184,7 @@ In this case, you've defined two entity managers and called them ``default`` and ``customer``. The ``default`` entity manager manages entities in the ``src/Entity/Main`` directory, while the ``customer`` entity manager manages entities in ``src/Entity/Customer``. You've also defined two connections, one -for each entity manager. +for each entity manager, but you are free to define the same connection for both. .. caution:: @@ -283,4 +284,26 @@ The same applies to repository calls:: } } +.. caution:: + + One entity can be managed by more than one entity manager. This however + result in unexpected behavior when extending from ``ServiceEntityRepository`` + in your custom repository. The ``ServiceEntityRepository`` always + uses the configured entity manager for that entity. + + In order to fix this situation, extend ``EntityRepository`` instead and + no longer rely on autowiring:: + + // src/Repository/CustomerRepository.php + namespace App\Repository; + + use Doctrine\ORM\EntityRepository; + + class CustomerRepository extends EntityRepository + { + // ... + } + + You should now always fetch this repository using ``ManagerRegistry::getRepository()``. + .. _`several alternatives`: https://stackoverflow.com/a/11494543 From 23a102fa8bd3e4a314a96bd208b9af7d0803e862 Mon Sep 17 00:00:00 2001 From: Oskar Stark Date: Tue, 6 Oct 2020 11:28:17 +0200 Subject: [PATCH 0009/1045] Sort rules alphabetically --- .doctor-rst.yaml | 52 ++++++++++++++++++++++++------------------------ 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/.doctor-rst.yaml b/.doctor-rst.yaml index 18a34b866ae..4eed90c6226 100644 --- a/.doctor-rst.yaml +++ b/.doctor-rst.yaml @@ -1,41 +1,41 @@ rules: - no_inheritdoc: ~ + american_english: ~ avoid_repetetive_words: ~ blank_line_after_directive: ~ - short_array_syntax: ~ - no_app_console: ~ - typo: ~ - replacement: ~ + blank_line_before_directive: ~ composer_dev_option_not_at_the_end: ~ - yarn_dev_option_at_the_end: ~ - versionadded_directive_should_have_version: ~ + correct_code_block_directive_based_on_the_content: ~ deprecated_directive_should_have_version: ~ - no_composer_req: ~ - no_php_open_tag_in_code_block_php_directive: ~ - no_blank_line_after_filepath_in_php_code_block: ~ - no_blank_line_after_filepath_in_yaml_code_block: ~ - no_blank_line_after_filepath_in_xml_code_block: ~ - no_blank_line_after_filepath_in_twig_code_block: ~ - php_prefix_before_bin_console: ~ - use_deprecated_directive_instead_of_versionadded: ~ - no_space_before_self_xml_closing_tag: ~ - no_explicit_use_of_code_block_php: ~ ensure_order_of_code_blocks_in_configuration_block: ~ - american_english: ~ - valid_use_statements: ~ + extension_xlf_instead_of_xliff: ~ + indention: ~ lowercase_as_in_use_statements: ~ - ordered_use_statements: ~ - no_namespace_after_use_statements: ~ - correct_code_block_directive_based_on_the_content: ~ max_blank_lines: max: 2 + no_app_console: ~ + no_blank_line_after_filepath_in_php_code_block: ~ + no_blank_line_after_filepath_in_twig_code_block: ~ + no_blank_line_after_filepath_in_xml_code_block: ~ + no_blank_line_after_filepath_in_yaml_code_block: ~ + no_composer_req: ~ + no_explicit_use_of_code_block_php: ~ + no_inheritdoc: ~ + no_namespace_after_use_statements: ~ + no_php_open_tag_in_code_block_php_directive: ~ + no_space_before_self_xml_closing_tag: ~ + ordered_use_statements: ~ + php_prefix_before_bin_console: ~ replace_code_block_types: ~ + replacement: ~ + short_array_syntax: ~ + typo: ~ + unused_links: ~ + use_deprecated_directive_instead_of_versionadded: ~ use_https_xsd_urls: ~ - blank_line_before_directive: ~ - extension_xlf_instead_of_xliff: ~ valid_inline_highlighted_namespaces: ~ - indention: ~ - unused_links: ~ + valid_use_statements: ~ + versionadded_directive_should_have_version: ~ + yarn_dev_option_at_the_end: ~ # 3.4 versionadded_directive_major_version: From eefb4baf0c9323fec32872f8d5f0c9332ccadded Mon Sep 17 00:00:00 2001 From: Oskar Stark Date: Tue, 6 Oct 2020 11:33:38 +0200 Subject: [PATCH 0010/1045] Enhancement: New rule - no_brackets_in_method_directive --- .doctor-rst.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.doctor-rst.yaml b/.doctor-rst.yaml index 4eed90c6226..263a7100689 100644 --- a/.doctor-rst.yaml +++ b/.doctor-rst.yaml @@ -17,6 +17,7 @@ rules: no_blank_line_after_filepath_in_twig_code_block: ~ no_blank_line_after_filepath_in_xml_code_block: ~ no_blank_line_after_filepath_in_yaml_code_block: ~ + no_brackets_in_method_directive: ~ no_composer_req: ~ no_explicit_use_of_code_block_php: ~ no_inheritdoc: ~ From 49441cfb5e603960028d44e0de4d9cd25897b58a Mon Sep 17 00:00:00 2001 From: Oskar Stark Date: Tue, 6 Oct 2020 12:42:50 +0200 Subject: [PATCH 0011/1045] Minor: Whitespace --- reference/constraints/Collection.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reference/constraints/Collection.rst b/reference/constraints/Collection.rst index 80c87801356..b8283650d3a 100644 --- a/reference/constraints/Collection.rst +++ b/reference/constraints/Collection.rst @@ -94,7 +94,7 @@ following: profileData: - Collection: fields: - personal_email: + personal_email: - Email: ~ short_bio: - NotBlank: ~ From d18bb81631db154321bdc0def00d67da31309b1c Mon Sep 17 00:00:00 2001 From: Oskar Stark Date: Tue, 6 Oct 2020 12:25:35 +0200 Subject: [PATCH 0012/1045] Enhancement: New rule - SpaceBetweenLabelAndLinkInRef --- .doctor-rst.yaml | 1 + components/process.rst | 2 +- logging/channels_handlers.rst | 2 +- reference/constraints/Currency.rst | 2 +- reference/constraints/EqualTo.rst | 2 +- reference/constraints/GreaterThan.rst | 2 +- reference/constraints/GreaterThanOrEqual.rst | 2 +- reference/constraints/Iban.rst | 2 +- reference/constraints/IdenticalTo.rst | 2 +- reference/constraints/Isbn.rst | 2 +- reference/constraints/Issn.rst | 2 +- reference/constraints/LessThan.rst | 2 +- reference/constraints/LessThanOrEqual.rst | 2 +- reference/constraints/NotEqualTo.rst | 2 +- reference/constraints/NotIdenticalTo.rst | 2 +- reference/forms/types/options/constraints.rst.inc | 2 +- security/guard_authentication.rst | 2 +- 17 files changed, 17 insertions(+), 16 deletions(-) diff --git a/.doctor-rst.yaml b/.doctor-rst.yaml index 263a7100689..1c760251f18 100644 --- a/.doctor-rst.yaml +++ b/.doctor-rst.yaml @@ -29,6 +29,7 @@ rules: replace_code_block_types: ~ replacement: ~ short_array_syntax: ~ + space_between_label_and_link_in_ref: ~ typo: ~ unused_links: ~ use_deprecated_directive_instead_of_versionadded: ~ diff --git a/components/process.rst b/components/process.rst index ea626f31a38..0c3098400d4 100644 --- a/components/process.rst +++ b/components/process.rst @@ -301,7 +301,7 @@ Any asynchronous process can be stopped at any time with the :method:`Symfony\\Component\\Process\\Process::stop` method. This method takes two arguments: a timeout and a signal. Once the timeout is reached, the signal is sent to the running process. The default signal sent to a process is ``SIGKILL``. -Please read the :ref:`signal documentation below` +Please read the :ref:`signal documentation below ` to find out more about signal handling in the Process component:: $process = new Process(['ls', '-lsa']); diff --git a/logging/channels_handlers.rst b/logging/channels_handlers.rst index 92d35c073c3..a4361890bf3 100644 --- a/logging/channels_handlers.rst +++ b/logging/channels_handlers.rst @@ -122,7 +122,7 @@ Creating your own Channel You can change the channel Monolog logs to one service at a time. This is done either via the :ref:`configuration ` below -or by tagging your service with :ref:`monolog.logger` and +or by tagging your service with :ref:`monolog.logger ` and specifying which channel the service should log to. With the tag, the logger that is injected into that service is preconfigured to use the channel you've specified. diff --git a/reference/constraints/Currency.rst b/reference/constraints/Currency.rst index 397f8d76e54..24bf5dfa193 100644 --- a/reference/constraints/Currency.rst +++ b/reference/constraints/Currency.rst @@ -4,7 +4,7 @@ Currency Validates that a value is a valid `3-letter ISO 4217`_ currency name. +----------------+---------------------------------------------------------------------------+ -| Applies to | :ref:`property or method` | +| Applies to | :ref:`property or method ` | +----------------+---------------------------------------------------------------------------+ | Options | - `groups`_ | | | - `message`_ | diff --git a/reference/constraints/EqualTo.rst b/reference/constraints/EqualTo.rst index d68e074647b..dac6ce6663b 100644 --- a/reference/constraints/EqualTo.rst +++ b/reference/constraints/EqualTo.rst @@ -11,7 +11,7 @@ To force that a value is *not* equal, see :doc:`/reference/constraints/NotEqualT ``===``. +----------------+-----------------------------------------------------------------------+ -| Applies to | :ref:`property or method` | +| Applies to | :ref:`property or method ` | +----------------+-----------------------------------------------------------------------+ | Options | - `value`_ | | | - `groups`_ | diff --git a/reference/constraints/GreaterThan.rst b/reference/constraints/GreaterThan.rst index faee4be69d5..99b0563034c 100644 --- a/reference/constraints/GreaterThan.rst +++ b/reference/constraints/GreaterThan.rst @@ -7,7 +7,7 @@ force that a value is greater than or equal to another value, see than another value, see :doc:`/reference/constraints/LessThan`. +----------------+---------------------------------------------------------------------------+ -| Applies to | :ref:`property or method` | +| Applies to | :ref:`property or method ` | +----------------+---------------------------------------------------------------------------+ | Options | - `value`_ | | | - `groups`_ | diff --git a/reference/constraints/GreaterThanOrEqual.rst b/reference/constraints/GreaterThanOrEqual.rst index 2b595c40089..c40de4a0206 100644 --- a/reference/constraints/GreaterThanOrEqual.rst +++ b/reference/constraints/GreaterThanOrEqual.rst @@ -6,7 +6,7 @@ the options. To force that a value is greater than another value, see :doc:`/reference/constraints/GreaterThan`. +----------------+----------------------------------------------------------------------------------+ -| Applies to | :ref:`property or method` | +| Applies to | :ref:`property or method ` | +----------------+----------------------------------------------------------------------------------+ | Options | - `value`_ | | | - `groups`_ | diff --git a/reference/constraints/Iban.rst b/reference/constraints/Iban.rst index d7df4d9ea9a..d790352b07c 100644 --- a/reference/constraints/Iban.rst +++ b/reference/constraints/Iban.rst @@ -7,7 +7,7 @@ internationally agreed means of identifying bank accounts across national borders with a reduced risk of propagating transcription errors. +----------------+-----------------------------------------------------------------------+ -| Applies to | :ref:`property or method` | +| Applies to | :ref:`property or method ` | +----------------+-----------------------------------------------------------------------+ | Options | - `groups`_ | | | - `message`_ | diff --git a/reference/constraints/IdenticalTo.rst b/reference/constraints/IdenticalTo.rst index 200b4cb0632..a3be823a273 100644 --- a/reference/constraints/IdenticalTo.rst +++ b/reference/constraints/IdenticalTo.rst @@ -12,7 +12,7 @@ To force that a value is *not* identical, see with ``==``. +----------------+--------------------------------------------------------------------------+ -| Applies to | :ref:`property or method` | +| Applies to | :ref:`property or method ` | +----------------+--------------------------------------------------------------------------+ | Options | - `value`_ | | | - `groups`_ | diff --git a/reference/constraints/Isbn.rst b/reference/constraints/Isbn.rst index 7cb6bde4eef..21538494382 100644 --- a/reference/constraints/Isbn.rst +++ b/reference/constraints/Isbn.rst @@ -5,7 +5,7 @@ This constraint validates that an `International Standard Book Number (ISBN)`_ is either a valid ISBN-10 or a valid ISBN-13. +----------------+----------------------------------------------------------------------+ -| Applies to | :ref:`property or method` | +| Applies to | :ref:`property or method ` | +----------------+----------------------------------------------------------------------+ | Options | - `type`_ | | | - `groups`_ | diff --git a/reference/constraints/Issn.rst b/reference/constraints/Issn.rst index a27142e9c71..b217cb52f82 100644 --- a/reference/constraints/Issn.rst +++ b/reference/constraints/Issn.rst @@ -5,7 +5,7 @@ Validates that a value is a valid `International Standard Serial Number (ISSN)`_. +----------------+-----------------------------------------------------------------------+ -| Applies to | :ref:`property or method` | +| Applies to | :ref:`property or method ` | +----------------+-----------------------------------------------------------------------+ | Options | - `groups`_ | | | - `message`_ | diff --git a/reference/constraints/LessThan.rst b/reference/constraints/LessThan.rst index eec7a7054d5..3c8516ccae1 100644 --- a/reference/constraints/LessThan.rst +++ b/reference/constraints/LessThan.rst @@ -7,7 +7,7 @@ force that a value is less than or equal to another value, see than another value, see :doc:`/reference/constraints/GreaterThan`. +----------------+------------------------------------------------------------------------+ -| Applies to | :ref:`property or method` | +| Applies to | :ref:`property or method ` | +----------------+------------------------------------------------------------------------+ | Options | - `value`_ | | | - `groups`_ | diff --git a/reference/constraints/LessThanOrEqual.rst b/reference/constraints/LessThanOrEqual.rst index ccaadb824d2..968c63bc91e 100644 --- a/reference/constraints/LessThanOrEqual.rst +++ b/reference/constraints/LessThanOrEqual.rst @@ -6,7 +6,7 @@ options. To force that a value is less than another value, see :doc:`/reference/constraints/LessThan`. +----------------+-------------------------------------------------------------------------------+ -| Applies to | :ref:`property or method` | +| Applies to | :ref:`property or method ` | +----------------+-------------------------------------------------------------------------------+ | Options | - `value`_ | | | - `groups`_ | diff --git a/reference/constraints/NotEqualTo.rst b/reference/constraints/NotEqualTo.rst index 619dfb02e8e..69bf91bf45d 100644 --- a/reference/constraints/NotEqualTo.rst +++ b/reference/constraints/NotEqualTo.rst @@ -12,7 +12,7 @@ options. To force that a value is equal, see ``!==``. +----------------+-------------------------------------------------------------------------+ -| Applies to | :ref:`property or method` | +| Applies to | :ref:`property or method ` | +----------------+-------------------------------------------------------------------------+ | Options | - `value`_ | | | - `groups`_ | diff --git a/reference/constraints/NotIdenticalTo.rst b/reference/constraints/NotIdenticalTo.rst index c1db74a349f..c313e350d1c 100644 --- a/reference/constraints/NotIdenticalTo.rst +++ b/reference/constraints/NotIdenticalTo.rst @@ -12,7 +12,7 @@ the options. To force that a value is identical, see compare with ``!=``. +----------------+-----------------------------------------------------------------------------+ -| Applies to | :ref:`property or method` | +| Applies to | :ref:`property or method ` | +----------------+-----------------------------------------------------------------------------+ | Options | - `value`_ | | | - `groups`_ | diff --git a/reference/forms/types/options/constraints.rst.inc b/reference/forms/types/options/constraints.rst.inc index b06343ca990..7aab319f302 100644 --- a/reference/forms/types/options/constraints.rst.inc +++ b/reference/forms/types/options/constraints.rst.inc @@ -4,6 +4,6 @@ **type**: ``array`` or :class:`Symfony\\Component\\Validator\\Constraint` **default**: ``null`` Allows you to attach one or more validation constraints to a specific field. -For more information, see :ref:`Adding Validation`. +For more information, see :ref:`Adding Validation `. This option is added in the :class:`Symfony\\Component\\Form\\Extension\\Validator\\Type\\FormTypeValidatorExtension` form extension. diff --git a/security/guard_authentication.rst b/security/guard_authentication.rst index 371782cfaa4..745fd85a883 100644 --- a/security/guard_authentication.rst +++ b/security/guard_authentication.rst @@ -255,7 +255,7 @@ This requires you to implement several methods:: ``AuthenticatorInterface`` was introduced in Symfony 3.4. In previous Symfony versions, authenticators needed to implement ``GuardAuthenticatorInterface``. -Nice work! Each method is explained below: :ref:`The Guard Authenticator Methods`. +Nice work! Each method is explained below: :ref:`The Guard Authenticator Methods `. Step 2) Configure the Authenticator ----------------------------------- From d9e6a5ee31f3524b79fb42a267dbccce6aa8ae4d Mon Sep 17 00:00:00 2001 From: Oskar Stark Date: Tue, 6 Oct 2020 12:40:38 +0200 Subject: [PATCH 0013/1045] Enhancement: Use table like in other constraints. --- reference/constraints/UserPassword.rst | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/reference/constraints/UserPassword.rst b/reference/constraints/UserPassword.rst index abb98a11e58..2d31eb34501 100644 --- a/reference/constraints/UserPassword.rst +++ b/reference/constraints/UserPassword.rst @@ -15,14 +15,17 @@ password, but needs to enter their old password for security. In order to use this constraints, you should have installed the symfony/security-core component with Composer. -========== =================================================================== -Applies to :ref:`property or method ` -Options - `groups`_ - - `message`_ - - `payload`_ -Class :class:`Symfony\\Component\\Security\\Core\\Validator\\Constraints\\UserPassword` -Validator :class:`Symfony\\Component\\Security\\Core\\Validator\\Constraints\\UserPasswordValidator` -========== =================================================================== ++----------------+--------------------------------------------------------------------------------------------+ +| Applies to | :ref:`property or method ` | ++----------------+--------------------------------------------------------------------------------------------+ +| Options | - `groups`_ | +| | - `message`_ | +| | - `payload`_ | ++----------------+--------------------------------------------------------------------------------------------+ +| Class | :class:`Symfony\\Component\\Security\\Core\\Validator\\Constraints\\UserPassword` | ++----------------+--------------------------------------------------------------------------------------------+ +| Validator | :class:`Symfony\\Component\\Security\\Core\\Validator\\Constraints\\UserPasswordValidator` | ++----------------+--------------------------------------------------------------------------------------------+ Basic Usage ----------- From d238c22268e5281c99ef4ff9bec090a86626f904 Mon Sep 17 00:00:00 2001 From: Oskar Stark Date: Tue, 6 Oct 2020 13:17:35 +0200 Subject: [PATCH 0014/1045] Enhancement: New rule - SpaceBetweenLabelAndLinkInDoc --- .doctor-rst.yaml | 1 + best_practices/security.rst | 2 +- contributing/code_of_conduct/code_of_conduct.rst | 2 +- contributing/map.rst.inc | 6 +++--- deployment/proxies.rst | 2 +- frontend/encore/simple-example.rst | 4 ++-- reference/constraints/map.rst.inc | 2 +- reference/forms/types/options/validation_groups.rst.inc | 2 +- reference/forms/types/submit.rst | 2 +- 9 files changed, 12 insertions(+), 11 deletions(-) diff --git a/.doctor-rst.yaml b/.doctor-rst.yaml index 1c760251f18..6711c75c8f2 100644 --- a/.doctor-rst.yaml +++ b/.doctor-rst.yaml @@ -29,6 +29,7 @@ rules: replace_code_block_types: ~ replacement: ~ short_array_syntax: ~ + space_between_label_and_link_in_doc: ~ space_between_label_and_link_in_ref: ~ typo: ~ unused_links: ~ diff --git a/best_practices/security.rst b/best_practices/security.rst index 19ba9f7e330..63d95e27458 100644 --- a/best_practices/security.rst +++ b/best_practices/security.rst @@ -6,7 +6,7 @@ Authentication and Firewalls (i.e. Getting the User's Credentials) You can configure Symfony to authenticate your users using any method you want and to load user information from any source. This is a complex topic, but -the :doc:`Security guide` has a lot of information about +the :doc:`Security guide ` has a lot of information about this. Regardless of your needs, authentication is configured in ``security.yml``, diff --git a/contributing/code_of_conduct/code_of_conduct.rst b/contributing/code_of_conduct/code_of_conduct.rst index 7ecd91e8dbd..857d5437538 100644 --- a/contributing/code_of_conduct/code_of_conduct.rst +++ b/contributing/code_of_conduct/code_of_conduct.rst @@ -37,7 +37,7 @@ Examples of unacceptable behavior by participants include: Our Responsibilities -------------------- -:doc:`CoC Active Response Ensurers, or CARE`, +:doc:`CoC Active Response Ensurers, or CARE `, are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. diff --git a/contributing/map.rst.inc b/contributing/map.rst.inc index b9c9311a6cb..b495a0d76d0 100644 --- a/contributing/map.rst.inc +++ b/contributing/map.rst.inc @@ -15,9 +15,9 @@ * :doc:`Security ` * :doc:`Tests ` * :doc:`Backward Compatibility ` - * :doc:`Coding Standards` - * :doc:`Code Conventions` - * :doc:`Git` + * :doc:`Coding Standards ` + * :doc:`Code Conventions ` + * :doc:`Git ` * :doc:`License ` * **Documentation** diff --git a/deployment/proxies.rst b/deployment/proxies.rst index 6791605225c..7a130f4783c 100644 --- a/deployment/proxies.rst +++ b/deployment/proxies.rst @@ -3,7 +3,7 @@ How to Configure Symfony to Work behind a Load Balancer or a Reverse Proxy When you deploy your application, you may be behind a load balancer (e.g. an AWS Elastic Load Balancing) or a reverse proxy (e.g. Varnish for -:doc:`caching`). +:doc:`caching `). For the most part, this doesn't cause any problems with Symfony. But, when a request passes through a proxy, certain request information is sent using diff --git a/frontend/encore/simple-example.rst b/frontend/encore/simple-example.rst index aaf543a11fb..7a9800dd3b3 100644 --- a/frontend/encore/simple-example.rst +++ b/frontend/encore/simple-example.rst @@ -121,8 +121,8 @@ be executed. All the CSS files that were required will also be displayed. The ``encore_entry_link_tags()`` and ``encore_entry_script_tags()`` functions read from an ``entrypoints.json`` file that's generated by Encore to know the exact filename(s) to render. This file is *especially* useful because you can -:doc:`enable versioning` or -:doc:`point assets to a CDN` without making *any* changes to your +:doc:`enable versioning ` or +:doc:`point assets to a CDN ` without making *any* changes to your template: the paths in ``entrypoints.json`` will always be the final, correct paths. If you're *not* using Symfony, you can ignore the ``entrypoints.json`` file and diff --git a/reference/constraints/map.rst.inc b/reference/constraints/map.rst.inc index e0eae320682..6afc32008ea 100644 --- a/reference/constraints/map.rst.inc +++ b/reference/constraints/map.rst.inc @@ -20,7 +20,7 @@ String Constraints * :doc:`Url ` * :doc:`Regex ` * :doc:`Ip ` -* :doc:`Uuid` +* :doc:`Uuid ` * :doc:`UserPassword ` Comparison Constraints diff --git a/reference/forms/types/options/validation_groups.rst.inc b/reference/forms/types/options/validation_groups.rst.inc index dd9efcd8967..90f79bede75 100644 --- a/reference/forms/types/options/validation_groups.rst.inc +++ b/reference/forms/types/options/validation_groups.rst.inc @@ -49,7 +49,7 @@ the option. Symfony will then pass the form when calling it:: .. note:: When your form contains multiple submit buttons, you can change the - validation group depending on :doc:`which button is used` + validation group depending on :doc:`which button is used ` to submit the form. If you need advanced logic to determine the validation groups have diff --git a/reference/forms/types/submit.rst b/reference/forms/types/submit.rst index cd4cbe55cc7..adefa204fed 100644 --- a/reference/forms/types/submit.rst +++ b/reference/forms/types/submit.rst @@ -16,7 +16,7 @@ A submit button. | | - `translation_domain`_ | | | - `validation_groups`_ | +----------------------+----------------------------------------------------------------------+ -| Parent type | :doc:`ButtonType` | +| Parent type | :doc:`ButtonType ` | +----------------------+----------------------------------------------------------------------+ | Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\SubmitType` | +----------------------+----------------------------------------------------------------------+ From 72a2b1c93a0125f0b25a5f70239ba562f7787377 Mon Sep 17 00:00:00 2001 From: Oskar Stark Date: Tue, 6 Oct 2020 13:36:01 +0200 Subject: [PATCH 0015/1045] Minor: Fix build --- cache.rst | 2 +- configuration/secrets.rst | 2 +- contributing/code/stack_trace.rst | 2 +- mailer.rst | 2 +- profiler.rst | 2 +- reference/constraints/map.rst.inc | 2 +- security/ldap.rst | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/cache.rst b/cache.rst index a06cd0bd4c3..4fc6a4faa87 100644 --- a/cache.rst +++ b/cache.rst @@ -305,7 +305,7 @@ You can also create more customized pools: Each pool manages a set of independent cache keys: keys from different pools *never* collide, even if they share the same backend. This is achieved by prefixing keys with a namespace that's generated by hashing the name of the pool, the name -of the compiled container class and a :ref:`configurable seed` +of the compiled container class and a :ref:`configurable seed ` that defaults to the project directory. Each custom pool becomes a service whose service ID is the name of the pool diff --git a/configuration/secrets.rst b/configuration/secrets.rst index fb3b6da1578..bb89c67258f 100644 --- a/configuration/secrets.rst +++ b/configuration/secrets.rst @@ -102,7 +102,7 @@ Referencing Secrets in Configuration Files ------------------------------------------ Secret values can be referenced in the same way as -:ref:`environment variables`. Be careful that you don't +:ref:`environment variables `. Be careful that you don't accidentally define a secret *and* an environment variable with the same name: **environment variables override secrets**. diff --git a/contributing/code/stack_trace.rst b/contributing/code/stack_trace.rst index 11163b2dcd4..b0ad81c77cd 100644 --- a/contributing/code/stack_trace.rst +++ b/contributing/code/stack_trace.rst @@ -137,7 +137,7 @@ going on: If that is not the case, you can obtain a stack trace by increasing the -:doc:`verbosity level` with ``--verbose``: +:doc:`verbosity level ` with ``--verbose``: .. code-block:: terminal diff --git a/mailer.rst b/mailer.rst index cbf5027875c..025a5c43813 100644 --- a/mailer.rst +++ b/mailer.rst @@ -4,7 +4,7 @@ Sending Emails with Mailer .. versionadded:: 4.3 The Mailer component was introduced in Symfony 4.3. The previous solution, - called Swift Mailer, is still valid: :doc:`Swift Mailer`. + called Swift Mailer, is still valid: :doc:`Swift Mailer `. Installation ------------ diff --git a/profiler.rst b/profiler.rst index cb8ae679d99..c244f6413e5 100644 --- a/profiler.rst +++ b/profiler.rst @@ -201,7 +201,7 @@ the AJAX request to force the refresh of the toolbar:: Ideally this header should only be set during development and not for production. To do that, create an :doc:`event subscriber ` -and listen to the :ref:`kernel.response` +and listen to the :ref:`kernel.response ` event:: use Symfony\Component\HttpKernel\Event\ResponseEvent; diff --git a/reference/constraints/map.rst.inc b/reference/constraints/map.rst.inc index 4c2a29b9869..438338af8c4 100644 --- a/reference/constraints/map.rst.inc +++ b/reference/constraints/map.rst.inc @@ -20,7 +20,7 @@ String Constraints * :doc:`Url ` * :doc:`Regex ` * :doc:`Ip ` -* :doc:`Json` +* :doc:`Json ` * :doc:`Uuid ` * :doc:`UserPassword ` * :doc:`NotCompromisedPassword ` diff --git a/security/ldap.rst b/security/ldap.rst index 5bff1ae9925..3b5b549e7ec 100644 --- a/security/ldap.rst +++ b/security/ldap.rst @@ -8,7 +8,7 @@ Symfony provides different means to work with an LDAP server. The Security component offers: -* The ``ldap`` :doc:`user provider`, using the +* The ``ldap`` :doc:`user provider `, using the :class:`Symfony\\Component\\Ldap\\Security\\LdapUserProvider` class. Like all other user providers, it can be used with any authentication provider. From 7406c9acd9f1a22fc52e31dd5fcd5e9391ecbe75 Mon Sep 17 00:00:00 2001 From: Oskar Stark Date: Tue, 6 Oct 2020 13:55:25 +0200 Subject: [PATCH 0016/1045] Enhancement: Use the same tables across all constraints --- reference/constraints/Currency.rst | 19 ++++++-------- reference/constraints/EqualTo.rst | 24 ++++++++--------- reference/constraints/GreaterThan.rst | 23 ++++++++--------- reference/constraints/GreaterThanOrEqual.rst | 23 ++++++++--------- reference/constraints/Iban.rst | 19 ++++++-------- reference/constraints/IdenticalTo.rst | 23 ++++++++--------- reference/constraints/Isbn.rst | 27 +++++++++----------- reference/constraints/Issn.rst | 23 ++++++++--------- reference/constraints/Json.rst | 17 +++++------- reference/constraints/LessThan.rst | 23 ++++++++--------- reference/constraints/LessThanOrEqual.rst | 23 ++++++++--------- reference/constraints/NotEqualTo.rst | 23 ++++++++--------- reference/constraints/NotIdenticalTo.rst | 23 ++++++++--------- reference/constraints/Traverse.rst | 14 +++++----- reference/constraints/UserPassword.rst | 19 ++++++-------- 15 files changed, 140 insertions(+), 183 deletions(-) diff --git a/reference/constraints/Currency.rst b/reference/constraints/Currency.rst index 778f72a1bcb..901a989010b 100644 --- a/reference/constraints/Currency.rst +++ b/reference/constraints/Currency.rst @@ -3,17 +3,14 @@ Currency Validates that a value is a valid `3-letter ISO 4217`_ currency name. -+----------------+---------------------------------------------------------------------------+ -| Applies to | :ref:`property or method ` | -+----------------+---------------------------------------------------------------------------+ -| Options | - `groups`_ | -| | - `message`_ | -| | - `payload`_ | -+----------------+---------------------------------------------------------------------------+ -| Class | :class:`Symfony\\Component\\Validator\\Constraints\\Currency` | -+----------------+---------------------------------------------------------------------------+ -| Validator | :class:`Symfony\\Component\\Validator\\Constraints\\CurrencyValidator` | -+----------------+---------------------------------------------------------------------------+ +========== =================================================================== +Applies to :ref:`property or method ` +Options - `groups`_ + - `message`_ + - `payload`_ +Class :class:`Symfony\\Component\\Validator\\Constraints\\Currency` +Validator :class:`Symfony\\Component\\Validator\\Constraints\\CurrencyValidator` +========== =================================================================== Basic Usage ----------- diff --git a/reference/constraints/EqualTo.rst b/reference/constraints/EqualTo.rst index c69cea6adc5..153d13a3098 100644 --- a/reference/constraints/EqualTo.rst +++ b/reference/constraints/EqualTo.rst @@ -10,19 +10,17 @@ To force that a value is *not* equal, see :doc:`/reference/constraints/NotEqualT equal. Use :doc:`/reference/constraints/IdenticalTo` to compare with ``===``. -+----------------+-----------------------------------------------------------------------+ -| Applies to | :ref:`property or method ` | -+----------------+-----------------------------------------------------------------------+ -| Options | - `groups`_ | -| | - `message`_ | -| | - `payload`_ | -| | - `propertyPath`_ | -| | - `value`_ | -+----------------+-----------------------------------------------------------------------+ -| Class | :class:`Symfony\\Component\\Validator\\Constraints\\EqualTo` | -+----------------+-----------------------------------------------------------------------+ -| Validator | :class:`Symfony\\Component\\Validator\\Constraints\\EqualToValidator` | -+----------------+-----------------------------------------------------------------------+ + +========== =================================================================== +Applies to :ref:`property or method ` +Options - `groups`_ + - `message`_ + - `payload`_ + - `propertyPath`_ + - `value`_ +Class :class:`Symfony\\Component\\Validator\\Constraints\\EqualTo` +Validator :class:`Symfony\\Component\\Validator\\Constraints\\EqualToValidator` +========== =================================================================== Basic Usage ----------- diff --git a/reference/constraints/GreaterThan.rst b/reference/constraints/GreaterThan.rst index 5a4bcf6170b..d27017fdbe5 100644 --- a/reference/constraints/GreaterThan.rst +++ b/reference/constraints/GreaterThan.rst @@ -6,19 +6,16 @@ force that a value is greater than or equal to another value, see :doc:`/reference/constraints/GreaterThanOrEqual`. To force a value is less than another value, see :doc:`/reference/constraints/LessThan`. -+----------------+---------------------------------------------------------------------------+ -| Applies to | :ref:`property or method ` | -+----------------+---------------------------------------------------------------------------+ -| Options | - `groups`_ | -| | - `message`_ | -| | - `payload`_ | -| | - `propertyPath`_ | -| | - `value`_ | -+----------------+---------------------------------------------------------------------------+ -| Class | :class:`Symfony\\Component\\Validator\\Constraints\\GreaterThan` | -+----------------+---------------------------------------------------------------------------+ -| Validator | :class:`Symfony\\Component\\Validator\\Constraints\\GreaterThanValidator` | -+----------------+---------------------------------------------------------------------------+ +========== =================================================================== +Applies to :ref:`property or method ` +Options - `groups`_ + - `message`_ + - `payload`_ + - `propertyPath`_ + - `value`_ +Class :class:`Symfony\\Component\\Validator\\Constraints\\GreaterThan` +Validator :class:`Symfony\\Component\\Validator\\Constraints\\GreaterThanValidator` +========== =================================================================== Basic Usage ----------- diff --git a/reference/constraints/GreaterThanOrEqual.rst b/reference/constraints/GreaterThanOrEqual.rst index a17a0782718..8a054e6bbb9 100644 --- a/reference/constraints/GreaterThanOrEqual.rst +++ b/reference/constraints/GreaterThanOrEqual.rst @@ -5,19 +5,16 @@ Validates that a value is greater than or equal to another value, defined in the options. To force that a value is greater than another value, see :doc:`/reference/constraints/GreaterThan`. -+----------------+----------------------------------------------------------------------------------+ -| Applies to | :ref:`property or method ` | -+----------------+----------------------------------------------------------------------------------+ -| Options | - `groups`_ | -| | - `message`_ | -| | - `payload`_ | -| | - `propertyPath`_ | -| | - `value`_ | -+----------------+----------------------------------------------------------------------------------+ -| Class | :class:`Symfony\\Component\\Validator\\Constraints\\GreaterThanOrEqual` | -+----------------+----------------------------------------------------------------------------------+ -| Validator | :class:`Symfony\\Component\\Validator\\Constraints\\GreaterThanOrEqualValidator` | -+----------------+----------------------------------------------------------------------------------+ +========== =================================================================== +Applies to :ref:`property or method ` +Options - `groups`_ + - `message`_ + - `payload`_ + - `propertyPath`_ + - `value`_ +Class :class:`Symfony\\Component\\Validator\\Constraints\\GreaterThanOrEqual` +Validator :class:`Symfony\\Component\\Validator\\Constraints\\GreaterThanOrEqualValidator` +========== =================================================================== Basic Usage ----------- diff --git a/reference/constraints/Iban.rst b/reference/constraints/Iban.rst index 69843db415a..aa3caeb67f8 100644 --- a/reference/constraints/Iban.rst +++ b/reference/constraints/Iban.rst @@ -6,17 +6,14 @@ format of an `International Bank Account Number (IBAN)`_. IBAN is an internationally agreed means of identifying bank accounts across national borders with a reduced risk of propagating transcription errors. -+----------------+-----------------------------------------------------------------------+ -| Applies to | :ref:`property or method ` | -+----------------+-----------------------------------------------------------------------+ -| Options | - `groups`_ | -| | - `message`_ | -| | - `payload`_ | -+----------------+-----------------------------------------------------------------------+ -| Class | :class:`Symfony\\Component\\Validator\\Constraints\\Iban` | -+----------------+-----------------------------------------------------------------------+ -| Validator | :class:`Symfony\\Component\\Validator\\Constraints\\IbanValidator` | -+----------------+-----------------------------------------------------------------------+ +========== =================================================================== +Applies to :ref:`property or method ` +Options - `groups`_ + - `message`_ + - `payload`_ +Class :class:`Symfony\\Component\\Validator\\Constraints\\Iban` +Validator :class:`Symfony\\Component\\Validator\\Constraints\\IbanValidator` +========== =================================================================== Basic Usage ----------- diff --git a/reference/constraints/IdenticalTo.rst b/reference/constraints/IdenticalTo.rst index 89f3372b323..10f1fb52342 100644 --- a/reference/constraints/IdenticalTo.rst +++ b/reference/constraints/IdenticalTo.rst @@ -11,19 +11,16 @@ To force that a value is *not* identical, see considered equal. Use :doc:`/reference/constraints/EqualTo` to compare with ``==``. -+----------------+--------------------------------------------------------------------------+ -| Applies to | :ref:`property or method ` | -+----------------+--------------------------------------------------------------------------+ -| Options | - `groups`_ | -| | - `message`_ | -| | - `payload`_ | -| | - `propertyPath`_ | -| | - `value`_ | -+----------------+--------------------------------------------------------------------------+ -| Class | :class:`Symfony\\Component\\Validator\\Constraints\\IdenticalTo` | -+----------------+--------------------------------------------------------------------------+ -| Validator | :class:`Symfony\\Component\\Validator\\Constraints\\IdenticalToValidator`| -+----------------+--------------------------------------------------------------------------+ +========== =================================================================== +Applies to :ref:`property or method ` +Options - `groups`_ + - `message`_ + - `payload`_ + - `propertyPath`_ + - `value`_ +Class :class:`Symfony\\Component\\Validator\\Constraints\\IdenticalTo` +Validator :class:`Symfony\\Component\\Validator\\Constraints\\IdenticalToValidator` +========== =================================================================== Basic Usage ----------- diff --git a/reference/constraints/Isbn.rst b/reference/constraints/Isbn.rst index c96e3f94c55..d2ad1e2c909 100644 --- a/reference/constraints/Isbn.rst +++ b/reference/constraints/Isbn.rst @@ -4,21 +4,18 @@ Isbn This constraint validates that an `International Standard Book Number (ISBN)`_ is either a valid ISBN-10 or a valid ISBN-13. -+----------------+----------------------------------------------------------------------+ -| Applies to | :ref:`property or method ` | -+----------------+----------------------------------------------------------------------+ -| Options | - `bothIsbnMessage`_ | -| | - `groups`_ | -| | - `isbn10Message`_ | -| | - `isbn13Message`_ | -| | - `message`_ | -| | - `payload`_ | -| | - `type`_ | -+----------------+----------------------------------------------------------------------+ -| Class | :class:`Symfony\\Component\\Validator\\Constraints\\Isbn` | -+----------------+----------------------------------------------------------------------+ -| Validator | :class:`Symfony\\Component\\Validator\\Constraints\\IsbnValidator` | -+----------------+----------------------------------------------------------------------+ +========== =================================================================== +Applies to :ref:`property or method ` +Options - `bothIsbnMessage`_ + - `groups`_ + - `isbn10Message`_ + - `isbn13Message`_ + - `message`_ + - `payload`_ + - `type`_ +Class :class:`Symfony\\Component\\Validator\\Constraints\\Isbn` +Validator :class:`Symfony\\Component\\Validator\\Constraints\\IsbnValidator` +========== =================================================================== Basic Usage ----------- diff --git a/reference/constraints/Issn.rst b/reference/constraints/Issn.rst index 5c85dea8652..374cc7d2751 100644 --- a/reference/constraints/Issn.rst +++ b/reference/constraints/Issn.rst @@ -4,19 +4,16 @@ Issn Validates that a value is a valid `International Standard Serial Number (ISSN)`_. -+----------------+-----------------------------------------------------------------------+ -| Applies to | :ref:`property or method ` | -+----------------+-----------------------------------------------------------------------+ -| Options | - `caseSensitive`_ | -| | - `groups`_ | -| | - `message`_ | -| | - `payload`_ | -| | - `requireHyphen`_ | -+----------------+-----------------------------------------------------------------------+ -| Class | :class:`Symfony\\Component\\Validator\\Constraints\\Issn` | -+----------------+-----------------------------------------------------------------------+ -| Validator | :class:`Symfony\\Component\\Validator\\Constraints\\IssnValidator` | -+----------------+-----------------------------------------------------------------------+ +========== =================================================================== +Applies to :ref:`property or method ` +Options - `caseSensitive`_ + - `groups`_ + - `message`_ + - `payload`_ + - `requireHyphen`_ +Class :class:`Symfony\\Component\\Validator\\Constraints\\Issn` +Validator :class:`Symfony\\Component\\Validator\\Constraints\\IssnValidator` +========== =================================================================== Basic Usage ----------- diff --git a/reference/constraints/Json.rst b/reference/constraints/Json.rst index beac690c4f9..6e8318077da 100644 --- a/reference/constraints/Json.rst +++ b/reference/constraints/Json.rst @@ -3,16 +3,13 @@ Json Validates that a value has valid `JSON`_ syntax. -+----------------+-----------------------------------------------------------------------+ -| Applies to | :ref:`property or method ` | -+----------------+-----------------------------------------------------------------------+ -| Options | - `message`_ | -| | - `payload`_ | -+----------------+-----------------------------------------------------------------------+ -| Class | :class:`Symfony\\Component\\Validator\\Constraints\\Json` | -+----------------+-----------------------------------------------------------------------+ -| Validator | :class:`Symfony\\Component\\Validator\\Constraints\\JsonValidator` | -+----------------+-----------------------------------------------------------------------+ +========== =================================================================== +Applies to :ref:`property or method ` +Options - `message`_ + - `payload`_ +Class :class:`Symfony\\Component\\Validator\\Constraints\\Json` +Validator :class:`Symfony\\Component\\Validator\\Constraints\\JsonValidator` +========== =================================================================== Basic Usage ----------- diff --git a/reference/constraints/LessThan.rst b/reference/constraints/LessThan.rst index 701f5660f5e..abd0aab721c 100644 --- a/reference/constraints/LessThan.rst +++ b/reference/constraints/LessThan.rst @@ -6,19 +6,16 @@ force that a value is less than or equal to another value, see :doc:`/reference/constraints/LessThanOrEqual`. To force a value is greater than another value, see :doc:`/reference/constraints/GreaterThan`. -+----------------+------------------------------------------------------------------------+ -| Applies to | :ref:`property or method ` | -+----------------+------------------------------------------------------------------------+ -| Options | - `groups`_ | -| | - `message`_ | -| | - `payload`_ | -| | - `propertyPath`_ | -| | - `value`_ | -+----------------+------------------------------------------------------------------------+ -| Class | :class:`Symfony\\Component\\Validator\\Constraints\\LessThan` | -+----------------+------------------------------------------------------------------------+ -| Validator | :class:`Symfony\\Component\\Validator\\Constraints\\LessThanValidator` | -+----------------+------------------------------------------------------------------------+ +========== =================================================================== +Applies to :ref:`property or method ` +Options - `groups`_ + - `message`_ + - `payload`_ + - `propertyPath`_ + - `value`_ +Class :class:`Symfony\\Component\\Validator\\Constraints\\LessThan` +Validator :class:`Symfony\\Component\\Validator\\Constraints\\LessThanValidator` +========== =================================================================== Basic Usage ----------- diff --git a/reference/constraints/LessThanOrEqual.rst b/reference/constraints/LessThanOrEqual.rst index f26a3295e59..42ec3e939e5 100644 --- a/reference/constraints/LessThanOrEqual.rst +++ b/reference/constraints/LessThanOrEqual.rst @@ -5,19 +5,16 @@ Validates that a value is less than or equal to another value, defined in the options. To force that a value is less than another value, see :doc:`/reference/constraints/LessThan`. -+----------------+-------------------------------------------------------------------------------+ -| Applies to | :ref:`property or method ` | -+----------------+-------------------------------------------------------------------------------+ -| Options | - `groups`_ | -| | - `message`_ | -| | - `payload`_ | -| | - `propertyPath`_ | -| | - `value`_ | -+----------------+-------------------------------------------------------------------------------+ -| Class | :class:`Symfony\\Component\\Validator\\Constraints\\LessThanOrEqual` | -+----------------+-------------------------------------------------------------------------------+ -| Validator | :class:`Symfony\\Component\\Validator\\Constraints\\LessThanOrEqualValidator` | -+----------------+-------------------------------------------------------------------------------+ +========== =================================================================== +Applies to :ref:`property or method ` +Options - `groups`_ + - `message`_ + - `payload`_ + - `propertyPath`_ + - `value`_ +Class :class:`Symfony\\Component\\Validator\\Constraints\\LessThanOrEqual` +Validator :class:`Symfony\\Component\\Validator\\Constraints\\LessThanOrEqualValidator` +========== =================================================================== Basic Usage ----------- diff --git a/reference/constraints/NotEqualTo.rst b/reference/constraints/NotEqualTo.rst index 0dbaf200739..e1436657ae8 100644 --- a/reference/constraints/NotEqualTo.rst +++ b/reference/constraints/NotEqualTo.rst @@ -11,19 +11,16 @@ options. To force that a value is equal, see equal. Use :doc:`/reference/constraints/NotIdenticalTo` to compare with ``!==``. -+----------------+-------------------------------------------------------------------------+ -| Applies to | :ref:`property or method ` | -+----------------+-------------------------------------------------------------------------+ -| Options | - `groups`_ | -| | - `message`_ | -| | - `payload`_ | -| | - `propertyPath`_ | -| | - `value`_ | -+----------------+-------------------------------------------------------------------------+ -| Class | :class:`Symfony\\Component\\Validator\\Constraints\\NotEqualTo` | -+----------------+-------------------------------------------------------------------------+ -| Validator | :class:`Symfony\\Component\\Validator\\Constraints\\NotEqualToValidator`| -+----------------+-------------------------------------------------------------------------+ +========== =================================================================== +Applies to :ref:`property or method ` +Options - `groups`_ + - `message`_ + - `payload`_ + - `propertyPath`_ + - `value`_ +Class :class:`Symfony\\Component\\Validator\\Constraints\\NotEqualTo` +Validator :class:`Symfony\\Component\\Validator\\Constraints\\NotEqualToValidator` +========== =================================================================== Basic Usage ----------- diff --git a/reference/constraints/NotIdenticalTo.rst b/reference/constraints/NotIdenticalTo.rst index 764885e1573..66ccb871670 100644 --- a/reference/constraints/NotIdenticalTo.rst +++ b/reference/constraints/NotIdenticalTo.rst @@ -11,19 +11,16 @@ the options. To force that a value is identical, see considered not equal. Use :doc:`/reference/constraints/NotEqualTo` to compare with ``!=``. -+----------------+-----------------------------------------------------------------------------+ -| Applies to | :ref:`property or method ` | -+----------------+-----------------------------------------------------------------------------+ -| Options | - `groups`_ | -| | - `message`_ | -| | - `payload`_ | -| | - `propertyPath`_ | -| | - `value`_ | -+----------------+-----------------------------------------------------------------------------+ -| Class | :class:`Symfony\\Component\\Validator\\Constraints\\NotIdenticalTo` | -+----------------+-----------------------------------------------------------------------------+ -| Validator | :class:`Symfony\\Component\\Validator\\Constraints\\NotIdenticalToValidator`| -+----------------+-----------------------------------------------------------------------------+ +========== =================================================================== +Applies to :ref:`property or method ` +Options - `groups`_ + - `message`_ + - `payload`_ + - `propertyPath`_ + - `value`_ +Class :class:`Symfony\\Component\\Validator\\Constraints\\NotIdenticalTo` +Validator :class:`Symfony\\Component\\Validator\\Constraints\\NotIdenticalToValidator` +========== =================================================================== Basic Usage ----------- diff --git a/reference/constraints/Traverse.rst b/reference/constraints/Traverse.rst index 7c6e5aefaa8..852f17cdd01 100644 --- a/reference/constraints/Traverse.rst +++ b/reference/constraints/Traverse.rst @@ -6,14 +6,12 @@ public or having public accessor methods (e.g. a public getter). If your object needs to be traversed to validate its data, you can use this constraint. -+----------------+-------------------------------------------------------------------------------------+ -| Applies to | :ref:`class ` | -+----------------+-------------------------------------------------------------------------------------+ -| Options | - `payload`_ | -| | - :ref:`traverse ` | -+----------------+-------------------------------------------------------------------------------------+ -| Class | :class:`Symfony\\Component\\Validator\\Constraints\\Traverse` | -+----------------+-------------------------------------------------------------------------------------+ +========== =================================================================== +Applies to :ref:`class ` +Options - `payload`_ + - :ref:`traverse ` +Class :class:`Symfony\\Component\\Validator\\Constraints\\Traverse` +========== =================================================================== Basic Usage ----------- diff --git a/reference/constraints/UserPassword.rst b/reference/constraints/UserPassword.rst index 897f809208c..9655380bf95 100644 --- a/reference/constraints/UserPassword.rst +++ b/reference/constraints/UserPassword.rst @@ -15,17 +15,14 @@ password, but needs to enter their old password for security. In order to use this constraints, you should have installed the symfony/security-core component with Composer. -+----------------+--------------------------------------------------------------------------------------------+ -| Applies to | :ref:`property or method ` | -+----------------+--------------------------------------------------------------------------------------------+ -| Options | - `groups`_ | -| | - `message`_ | -| | - `payload`_ | -+----------------+--------------------------------------------------------------------------------------------+ -| Class | :class:`Symfony\\Component\\Security\\Core\\Validator\\Constraints\\UserPassword` | -+----------------+--------------------------------------------------------------------------------------------+ -| Validator | :class:`Symfony\\Component\\Security\\Core\\Validator\\Constraints\\UserPasswordValidator` | -+----------------+--------------------------------------------------------------------------------------------+ +========== =================================================================== +Applies to :ref:`property or method ` +Options - `groups`_ + - `message`_ + - `payload`_ +Class :class:`Symfony\\Component\\Validator\\Constraints\\UserPassword` +Validator :class:`Symfony\\Component\\Validator\\Constraints\\UserPasswordValidator` +========== =================================================================== Basic Usage ----------- From 37540f22df726f0799f551b091ad1531b7fa1de6 Mon Sep 17 00:00:00 2001 From: gary houbre Date: Mon, 5 Oct 2020 16:08:16 +0200 Subject: [PATCH 0017/1045] Missing Namespace and comment form validation context --- validation/custom_constraint.rst | 6 ++++++ validation/sequence_provider.rst | 3 +++ validation/translations.rst | 3 +++ 3 files changed, 12 insertions(+) diff --git a/validation/custom_constraint.rst b/validation/custom_constraint.rst index faee09778b9..d2e7e148266 100644 --- a/validation/custom_constraint.rst +++ b/validation/custom_constraint.rst @@ -115,6 +115,8 @@ You can use custom validators like the ones provided by Symfony itself: .. code-block:: php-annotations // src/Entity/AcmeEntity.php + namespace App\Entity; + use App\Validator\Constraints as AcmeAssert; use Symfony\Component\Validator\Constraints as Assert; @@ -159,6 +161,8 @@ You can use custom validators like the ones provided by Symfony itself: .. code-block:: php // src/Entity/AcmeEntity.php + namespace App\Entity; + use App\Validator\Constraints\ContainsAlphanumeric; use Symfony\Component\Validator\Constraints\NotBlank; use Symfony\Component\Validator\Mapping\ClassMetadata; @@ -249,6 +253,8 @@ not to the property: .. code-block:: php // src/Entity/AcmeEntity.php + namespace App\Entity; + use App\Validator\Constraints\ProtocolClass; use Symfony\Component\Validator\Mapping\ClassMetadata; diff --git a/validation/sequence_provider.rst b/validation/sequence_provider.rst index 98a9389212f..11edc43a7e0 100644 --- a/validation/sequence_provider.rst +++ b/validation/sequence_provider.rst @@ -149,6 +149,9 @@ that group are valid, the second group, ``Strict``, will be validated. You can also define a group sequence in the ``validation_groups`` form option:: + // src/Form/MyType.php + namespace App\Form; + use Symfony\Component\Form\AbstractType; use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Component\Validator\Constraints\GroupSequence; diff --git a/validation/translations.rst b/validation/translations.rst index 33d7afdf384..5c22f9362c3 100644 --- a/validation/translations.rst +++ b/validation/translations.rst @@ -28,6 +28,8 @@ property is not empty, add the following: .. code-block:: php-annotations // src/Entity/Author.php + namespace App\Entity; + use Symfony\Component\Validator\Constraints as Assert; class Author @@ -67,6 +69,7 @@ property is not empty, add the following: .. code-block:: php // src/Entity/Author.php + namespace App\Entity; // ... use Symfony\Component\Validator\Constraints\NotBlank; From 1e202b89308a6b35a389d9d24afb4a5fe9d6e545 Mon Sep 17 00:00:00 2001 From: gary houbre Date: Mon, 5 Oct 2020 15:58:13 +0200 Subject: [PATCH 0018/1045] Missing Namespace --- event_dispatcher.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/event_dispatcher.rst b/event_dispatcher.rst index b162fe035f1..c7fa7b7d905 100644 --- a/event_dispatcher.rst +++ b/event_dispatcher.rst @@ -289,6 +289,8 @@ This alias mapping can be extended for custom events by registering the compiler pass ``AddEventAliasesPass``:: // src/Kernel.php + namespace App; + use App\Event\MyCustomEvent; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\EventDispatcher\DependencyInjection\AddEventAliasesPass; From 533ea5799570e6e87584e44cc4c3b1c361b6a473 Mon Sep 17 00:00:00 2001 From: gary houbre Date: Mon, 5 Oct 2020 16:55:50 +0200 Subject: [PATCH 0019/1045] Missing Namespace and comment from service container and testing context --- service_container/3.3-di-changes.rst | 7 +++++++ service_container/autowiring.rst | 10 ++++++++++ service_container/calls.rst | 2 ++ service_container/factories.rst | 9 +++++++++ service_container/injection_types.rst | 7 +++++++ service_container/request.rst | 1 + service_container/service_decoration.rst | 1 + testing/profiling.rst | 3 +++ 8 files changed, 40 insertions(+) diff --git a/service_container/3.3-di-changes.rst b/service_container/3.3-di-changes.rst index eccdc590db4..d57be2c0e5b 100644 --- a/service_container/3.3-di-changes.rst +++ b/service_container/3.3-di-changes.rst @@ -264,6 +264,8 @@ 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 @@ -388,6 +390,9 @@ 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 @@ -417,6 +422,8 @@ this file. For example, suppose you want to create an event subscriber. First, y create the class:: // src/EventSubscriber/SetHeaderSusbcriber.php + namespace App\EventSubscriber; + // ... use Symfony\Component\EventDispatcher\EventSubscriberInterface; diff --git a/service_container/autowiring.rst b/service_container/autowiring.rst index bf17f0db369..167fb4562f4 100644 --- a/service_container/autowiring.rst +++ b/service_container/autowiring.rst @@ -24,6 +24,7 @@ the alphabet. Start by creating a ROT13 transformer class:: + // src/Util/Rot13Transformer.php namespace App\Util; class Rot13Transformer @@ -36,6 +37,7 @@ Start by creating a ROT13 transformer class:: And now a Twitter client using this transformer:: + // src/Service/TwitterClient.php namespace App\Service; use App\Util\Rot13Transformer; @@ -122,6 +124,7 @@ both services: Now, you can use the ``TwitterClient`` service immediately in a controller:: + // src/Controller/DefaultController.php namespace App\Controller; use App\Service\TwitterClient; @@ -153,6 +156,9 @@ Autowiring Logic Explained Autowiring works by reading the ``Rot13Transformer`` *type-hint* in ``TwitterClient``:: + // src/Service/TwitterClient.php + namespace App\Service; + // ... use App\Util\Rot13Transformer; @@ -277,6 +283,7 @@ of concrete classes as it replaces your dependencies with other objects. To follow this best practice, suppose you decide to create a ``TransformerInterface``:: + // src/Util/TransformerInterface.php namespace App\Util; interface TransformerInterface @@ -376,6 +383,7 @@ Dealing with Multiple Implementations of the Same Type Suppose you create a second class - ``UppercaseTransformer`` that implements ``TransformerInterface``:: + // src/Util/UppercaseTransformer.php namespace App\Util; class UppercaseTransformer implements TransformerInterface @@ -404,6 +412,7 @@ create a *named autowiring alias* from a special string containing the interface followed by a variable name matching the one you use when doing the injection:: + // src/Service/MastodonClient.php namespace App\Service; use App\Util\TransformerInterface; @@ -546,6 +555,7 @@ When autowiring is enabled for a service, you can *also* configure the container to call methods on your class when it's instantiated. For example, suppose you want to inject the ``logger`` service, and decide to use setter-injection:: + // src/Util/Rot13Transformer.php namespace App\Util; class Rot13Transformer diff --git a/service_container/calls.rst b/service_container/calls.rst index c3797cb8917..00069a2ccb2 100644 --- a/service_container/calls.rst +++ b/service_container/calls.rst @@ -13,6 +13,7 @@ Usually, you'll want to inject your dependencies via the constructor. But someti especially if a dependency is optional, you may want to use "setter injection". For example:: + // src/Service/MessageGenerator.php namespace App\Service; use Psr\Log\LoggerInterface; @@ -84,6 +85,7 @@ To provide immutable services, some classes implement immutable setters. Such setters return a new instance of the configured class instead of mutating the object they were called on:: + // src/Service/MessageGenerator.php namespace App\Service; use Psr\Log\LoggerInterface; diff --git a/service_container/factories.rst b/service_container/factories.rst index 91c37df7ca5..f6ccd5a1198 100644 --- a/service_container/factories.rst +++ b/service_container/factories.rst @@ -19,6 +19,11 @@ Static Factories Suppose you have a factory that configures and returns a new ``NewsletterManager`` object by calling the static ``createNewsletterManager()`` method:: + // src/Email\NewsletterManagerStaticFactory.php + namespace App\Email; + + // ... + class NewsletterManagerStaticFactory { public static function createNewsletterManager() @@ -169,6 +174,10 @@ Invokable Factories Suppose you now change your factory method to ``__invoke()`` so that your factory service can be used as a callback:: + // src/Email/InvokableNewsletterManagerFactory.php + namespace App\Email; + + // ... class InvokableNewsletterManagerFactory { public function __invoke() diff --git a/service_container/injection_types.rst b/service_container/injection_types.rst index ceb586b02b3..097540bd8f6 100644 --- a/service_container/injection_types.rst +++ b/service_container/injection_types.rst @@ -19,6 +19,7 @@ The most common way to inject dependencies is via a class's constructor. To do this you need to add an argument to the constructor signature to accept the dependency:: + // src/Mail/NewsletterManager.php namespace App\Mail; // ... @@ -115,6 +116,9 @@ Immutable-setter Injection Another possible injection is to use a method which returns a separate instance by cloning the original service, this approach allows you to make a service immutable:: + // src/Mail/NewsletterManager.php + namespace App\Mail; + // ... use Symfony\Component\Mailer\MailerInterface; @@ -218,6 +222,9 @@ Setter Injection Another possible injection point into a class is by adding a setter method that accepts the dependency:: + // src/Mail/NewsletterManager.php + namespace App\Mail; + // ... class NewsletterManager { diff --git a/service_container/request.rst b/service_container/request.rst index 10637e7feac..d72a533507b 100644 --- a/service_container/request.rst +++ b/service_container/request.rst @@ -11,6 +11,7 @@ add it as an argument to the methods that need the request or inject the :method:`Symfony\\Component\\HttpFoundation\\RequestStack::getCurrentRequest` method:: + // src/Newsletter/NewsletterManager.php namespace App\Newsletter; use Symfony\Component\HttpFoundation\RequestStack; diff --git a/service_container/service_decoration.rst b/service_container/service_decoration.rst index c8293a5ca55..70572c4e77a 100644 --- a/service_container/service_decoration.rst +++ b/service_container/service_decoration.rst @@ -378,6 +378,7 @@ Three different behaviors are available: When using ``null``, you may have to update the decorator constructor in order to make decorated dependency nullable:: + // src/Service/DecoratorService.php namespace App\Service; use Acme\OptionalBundle\Service\OptionalService; diff --git a/testing/profiling.rst b/testing/profiling.rst index 882d2bdbf15..d3fa71f8e76 100644 --- a/testing/profiling.rst +++ b/testing/profiling.rst @@ -69,6 +69,9 @@ The data collected by the Symfony Profiler can be used to check the number of database calls, the time spent in the framework, etc. All this information is provided by the collectors obtained through the ``$client->getProfile()`` call:: + // tests/Controller/LuckyControllerTest.php + namespace App\Tests\Controller; + use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; class LuckyControllerTest extends WebTestCase From 2fbe60d8f7c1fc6a3748e72c35d05aeea06a1e13 Mon Sep 17 00:00:00 2001 From: Youssef Benhssaien Date: Sun, 4 Oct 2020 09:08:31 +0200 Subject: [PATCH 0020/1045] Multiple PHP class per file not allowed Since `AnnotationFileLoader` from `Routing` component parses and loads only one class per file while ignoring others class if declared in the same file, it is good to let know people about this behaviour to not be surprised. --- routing.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/routing.rst b/routing.rst index 117fd75bded..bd256fca9b5 100644 --- a/routing.rst +++ b/routing.rst @@ -46,6 +46,10 @@ following configuration file: This configuration tells Symfony to look for routes defined as annotations in any PHP class stored in the ``src/Controller/`` directory. +.. caution:: + + If you define multiple PHP class per file, only the first declared class can be loaded, try to define one PHP class per file instead, visit `PSR-4 `_ for more details. + 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:: From 064c10665bcdeaf8e2012013ff21f2d6cd4edfe5 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Wed, 7 Oct 2020 09:58:21 +0200 Subject: [PATCH 0021/1045] Tweak --- routing.rst | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/routing.rst b/routing.rst index bd256fca9b5..9bd09e531cc 100644 --- a/routing.rst +++ b/routing.rst @@ -46,10 +46,6 @@ following configuration file: This configuration tells Symfony to look for routes defined as annotations in any PHP class stored in the ``src/Controller/`` directory. -.. caution:: - - If you define multiple PHP class per file, only the first declared class can be loaded, try to define one PHP class per file instead, visit `PSR-4 `_ for more details. - 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:: @@ -80,6 +76,11 @@ the ``list()`` method of the ``BlogController`` class. example, URLs like ``/blog?foo=bar`` and ``/blog?foo=bar&bar=foo`` will also match the ``blog_list`` route. +.. caution:: + + If you define multiple PHP classes in the same file, Symfony only loads the + routes of the first class, ignoring all the other routes. + The route name (``blog_list``) is not important for now, but it will be essential later when :ref:`generating URLs `. You only have to keep in mind that each route name must be unique in the application. From fc847c4a580f16743d79583b10db0436923cadeb Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Mon, 9 Sep 2019 13:10:02 +0200 Subject: [PATCH 0022/1045] [Stopwatch] Move component docs into framework guides --- _build/redirection_map | 1 + components/phpunit_bridge.rst | 4 +- components/stopwatch.rst | 126 ---------------------------- page_creation.rst | 2 + performance.rst | 152 +++++++++++++++++++++++++++++----- profiler.rst | 20 +---- reference/twig_reference.rst | 8 +- 7 files changed, 145 insertions(+), 168 deletions(-) delete mode 100644 components/stopwatch.rst diff --git a/_build/redirection_map b/_build/redirection_map index 75b0c28da2b..66fc6db1b47 100644 --- a/_build/redirection_map +++ b/_build/redirection_map @@ -507,3 +507,4 @@ /components/http_client /http_client /components/mailer /mailer /messenger/message-recorder messenger/dispatch_after_current_bus +/components/stopwatch https://github.com/symfony/stopwatch diff --git a/components/phpunit_bridge.rst b/components/phpunit_bridge.rst index 095a4840d64..31d5de1759b 100644 --- a/components/phpunit_bridge.rst +++ b/components/phpunit_bridge.rst @@ -477,8 +477,8 @@ If you have this kind of time-related tests:: } } -You used the :doc:`Symfony Stopwatch Component ` to -calculate the duration time of your process, here 10 seconds. However, depending +You calculated the duration time of your process using the Stopwatch utilities to +:ref:`profile Symfony applications `. However, depending on the load of the server or the processes running on your local machine, the ``$duration`` could for example be ``10.000023s`` instead of ``10s``. diff --git a/components/stopwatch.rst b/components/stopwatch.rst deleted file mode 100644 index e6e11d9c53e..00000000000 --- a/components/stopwatch.rst +++ /dev/null @@ -1,126 +0,0 @@ -.. index:: - single: Stopwatch - single: Components; Stopwatch - -The Stopwatch Component -======================= - - The Stopwatch component provides a way to profile code. - -Installation ------------- - -.. code-block:: terminal - - $ composer require symfony/stopwatch - -.. include:: /components/require_autoload.rst.inc - -Usage ------ - -The Stopwatch component provides a consistent way to measure execution -time of certain parts of code so that you don't constantly have to parse -:phpfunction:`microtime` by yourself. Instead, use the -:class:`Symfony\\Component\\Stopwatch\\Stopwatch` class:: - - use Symfony\Component\Stopwatch\Stopwatch; - - $stopwatch = new Stopwatch(); - - // starts event named 'eventName' - $stopwatch->start('eventName'); - - // ... run your code here - - $event = $stopwatch->stop('eventName'); - // you can convert $event into a string for a quick summary - // e.g. (string) $event = '4.50 MiB - 26 ms' - -The :class:`Symfony\\Component\\Stopwatch\\StopwatchEvent` object can be retrieved -from the :method:`Symfony\\Component\\Stopwatch\\Stopwatch::start`, -:method:`Symfony\\Component\\Stopwatch\\Stopwatch::stop`, -:method:`Symfony\\Component\\Stopwatch\\Stopwatch::lap` and -:method:`Symfony\\Component\\Stopwatch\\Stopwatch::getEvent` methods. -The latter should be used when you need to retrieve the duration of an event -while it is still running. - -.. tip:: - - By default, the stopwatch truncates any sub-millisecond time measure to ``0``, - so you can't measure microseconds or nanoseconds. If you need more precision, - pass ``true`` to the ``Stopwatch`` class constructor to enable full precision:: - - $stopwatch = new Stopwatch(true); - -The stopwatch can be reset to its original state at any given time with the -:method:`Symfony\\Component\\Stopwatch\\Stopwatch::reset` method, which deletes -all the data measured so far. - -You can also provide a category name to an event:: - - $stopwatch->start('eventName', 'categoryName'); - -You can consider categories as a way of tagging events. For example, the -Symfony Profiler tool uses categories to nicely color-code different events. - -.. tip:: - - Read :ref:`this article ` to learn more about - integrating the Stopwatch component into the Symfony profiler. - -Periods -------- - -As you know from the real world, all stopwatches come with two buttons: -one to start and stop the stopwatch, and another to measure the lap time. -This is exactly what the :method:`Symfony\\Component\\Stopwatch\\Stopwatch::lap` -method does:: - - $stopwatch = new Stopwatch(); - // starts event named 'foo' - $stopwatch->start('foo'); - // ... some code goes here - $stopwatch->lap('foo'); - // ... some code goes here - $stopwatch->lap('foo'); - // ... some other code goes here - $event = $stopwatch->stop('foo'); - -Lap information is stored as "periods" within the event. To get lap information -call:: - - $event->getPeriods(); - -In addition to periods, you can get other useful information from the event object. -For example:: - - $event->getCategory(); // returns the category the event was started in - $event->getOrigin(); // returns the event start time in milliseconds - $event->ensureStopped(); // stops all periods not already stopped - $event->getStartTime(); // returns the start time of the very first period - $event->getEndTime(); // returns the end time of the very last period - $event->getDuration(); // returns the event duration, including all periods - $event->getMemory(); // returns the max memory usage of all periods - -Sections --------- - -Sections are a way to logically split the timeline into groups. You can see -how Symfony uses sections to nicely visualize the framework lifecycle in the -Symfony Profiler tool. Here is a basic usage example using sections:: - - $stopwatch = new Stopwatch(); - - $stopwatch->openSection(); - $stopwatch->start('parsing_config_file', 'filesystem_operations'); - $stopwatch->stopSection('routing'); - - $events = $stopwatch->getSectionEvents('routing'); - -You can reopen a closed section by calling the :method:`Symfony\\Component\\Stopwatch\\Stopwatch::openSection` -method and specifying the id of the section to be reopened:: - - $stopwatch->openSection('routing'); - $stopwatch->start('building_config_tree'); - $stopwatch->stopSection('routing'); diff --git a/page_creation.rst b/page_creation.rst index 0e82596dfac..1835308804e 100644 --- a/page_creation.rst +++ b/page_creation.rst @@ -176,6 +176,8 @@ the debugging routes in the next section. You'll learn about many more commands as you continue! +.. _web-debug-toolbar: + The Web Debug Toolbar: Debugging Dream -------------------------------------- diff --git a/performance.rst b/performance.rst index 2356bd18911..ec9d44e5610 100644 --- a/performance.rst +++ b/performance.rst @@ -8,14 +8,24 @@ Symfony is fast, right out of the box. However, you can make it faster if you optimize your servers and your applications as explained in the following performance checklists. -Symfony Application Checklist ------------------------------ +Performance Checklists +---------------------- -These are the code and configuration changes that you can make in your Symfony -application to improve its performance: +Use these checklists to verify that your application and server are configured +for maximum performance: -#. :ref:`Install APCu Polyfill if your server uses APC ` -#. :ref:`Dump the service container into a single file ` +* **Symfony Application Checklist**: + + #. :ref:`Install APCu Polyfill if your server uses APC ` + +* **Production Server Checklist**: + + #. :ref:`Dump the service container into a single file ` + #. :ref:`Use the OPcache byte code cache ` + #. :ref:`Configure OPcache for maximum performance ` + #. :ref:`Don't check PHP files timestamps ` + #. :ref:`Configure the PHP realpath Cache ` + #. :ref:`Optimize Composer Autoloader ` .. _performance-install-apcu-polyfill: @@ -72,19 +82,6 @@ container into a single file, which could improve performance when using // ... $container->setParameter('container.dumper.inline_factories', true); -Production Server Checklist ---------------------------- - -These are the changes that you can make in your production server to improve -performance when running Symfony applications: - -#. :ref:`Use the OPcache byte code cache ` -#. :ref:`Use the OPcache class preloading ` -#. :ref:`Configure OPcache for maximum performance ` -#. :ref:`Don't check PHP files timestamps ` -#. :ref:`Configure the PHP realpath Cache ` -#. :ref:`Optimize Composer Autoloader ` - .. _performance-use-opcache: Use the OPcache Byte Code Cache @@ -212,6 +209,120 @@ deployment process too): used in your application and prevents Composer from scanning the file system for classes that are not found in the class map. (see: `Composer's autoloader optimization`_). +.. _profiling-applications: + +Profiling Applications +---------------------- + +`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. + +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`_. + +When using :ref:`autowiring `, type-hint any controller or +service argument with the :class:`Symfony\\Component\\Stopwatch\\Stopwatch` class +and Symfony will inject the ``debug.stopwatch`` service:: + + use Symfony\Component\Stopwatch\Stopwatch; + + class DataExporter + { + private $stopwatch; + + public function __construct(Stopwatch $stopwatch) + { + $this->stopwatch = $stopwatch; + } + + public function export() + { + // the argument is the name of the "profiling event" + $this->stopwatch->start('export-data'); + + // ...do things to export data... + + // reset the stopwatch to delete all the data measured so far + // $this->stopwatch->reset(); + + $this->stopwatch->stop('export-data'); + } + } + +If the request calls this service during its execution, you'll see a new +event called ``export-data`` in the Symfony profiler. + +The ``start()``, ``stop()`` and ``getEvent()`` methods return a +:class:`Symfony\\Component\\Stopwatch\\StopwatchEvent` object that provides +information about the current event, even while it's still running. This +object can be converted to a string for a quick summary:: + + // ... + dump((string) $this->stopwatch->getEvent()); // dumps e.g. '4.50 MiB - 26 ms' + +You can also profile your template code with the :ref:`stopwatch Twig tag `: + +.. code-block:: twig + + {% stopwatch 'render-blog-posts' %} + {% for post in blog_posts%} + {# ... #} + {% endfor %} + {% endstopwatch %} + +Profiling Categories +.................... + +Use the second optional argument of the ``start()`` method to define the +category or tag of the event. This helps keep events organized by type:: + + $this->stopwatch->start('export-data', 'export'); + +Profiling Periods +................. + +A `real-world stopwatch`_ not only includes the start/stop button but also a +"lap button" to measure each partial lap. This is exactly what the ``lap()`` +method does, which stops an event and then restarts it immediately:: + + $this->stopwatch->start('process-data-records', 'export'); + + foreach ($records as $record) { + // ... some code goes here + $this->stopwatch->lap('process-data-records'); + } + + $event = $this->stopwatch->stop('process-data-records'); + // $event->getDuration(), $event->getMemory(), etc. + + // Lap information is stored as "periods" within the event: + // $event->getPeriods(); + +Profiling Sections +.................. + +Sections are a way to split the profile timeline into groups. Example:: + + $this->stopwatch->openSection(); + $this->stopwatch->start('validating-file', 'validation'); + $this->stopwatch->stopSection('parsing'); + + $events = $this->stopwatch->getSectionEvents('parsing'); + + // later you can reopen a section passing its name to the openSection() method + $this->stopwatch->openSection('parsing'); + $this->stopwatch->start('processing-file'); + $this->stopwatch->stopSection('parsing'); + Learn more ---------- @@ -225,3 +336,6 @@ Learn more .. _`APCu PHP functions`: https://www.php.net/manual/en/ref.apcu.php .. _`cachetool`: https://github.com/gordalina/cachetool .. _`open_basedir`: https://www.php.net/manual/ini.core.php#ini.open-basedir +.. _`Blackfire`: https://blackfire.io/docs/introduction?utm_source=symfony&utm_medium=symfonycom_docs&utm_campaign=performance +.. _`Stopwatch component`: https://symfony.com/components/Stopwatch +.. _`real-world stopwatch`: https://en.wikipedia.org/wiki/Stopwatch diff --git a/profiler.rst b/profiler.rst index cb8ae679d99..4946ad4ac8a 100644 --- a/profiler.rst +++ b/profiler.rst @@ -98,23 +98,8 @@ Timing the Execution of the Application --------------------------------------- If you want to measure the time some tasks take in your application, there's no -need to create a custom data collector. Instead, use the `Stopwatch component`_ -which provides utilities to profile code and displays the results on the -"Performance" panel of the Profiler web interface. - -When using :ref:`autowiring `, type-hint any argument with -the :class:`Symfony\\Component\\Stopwatch\\Stopwatch` class and Symfony will -inject the Stopwatch service. Then, use the ``start()``, ``lap()`` and -``stop()`` methods to measure time:: - - // a user signs up and the timer starts... - $stopwatch->start('user-sign-up'); - - // ...do things to sign up the user... - $stopwatch->lap('user-sign-up'); - - // ...the sign up process is finished - $stopwatch->stop('user-sign-up'); +need to create a custom data collector. Instead, use the built-in utilities to +:ref:`profile Symfony applications `. .. tip:: @@ -229,5 +214,4 @@ event:: profiler/data_collector .. _`Single-page applications`: https://en.wikipedia.org/wiki/Single-page_application -.. _`Stopwatch component`: https://symfony.com/components/Stopwatch .. _`Blackfire`: https://blackfire.io/docs/introduction?utm_source=symfony&utm_medium=symfonycom_docs&utm_campaign=profiler diff --git a/reference/twig_reference.rst b/reference/twig_reference.rst index 84e52b0cd35..f44f5043d92 100644 --- a/reference/twig_reference.rst +++ b/reference/twig_reference.rst @@ -601,15 +601,17 @@ trans_default_domain This will set the default domain in the current template. +.. _reference-twig-tag-stopwatch: + stopwatch ~~~~~~~~~ .. code-block:: twig - {% stopwatch 'name' %}...{% endstopwatch %} + {% stopwatch 'event_name' %}...{% endstopwatch %} -This will time the run time of the code inside it and put that on the timeline -of the WebProfilerBundle. +This measures the time and memory used to execute some code in the template and +displays it in the Symfony profiler. See :ref:`how to profile Symfony applications `. .. _reference-twig-tests: From 16550e7c2675693bf01af7be7406acdf0afc3cfa Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Wed, 7 Oct 2020 10:55:39 +0200 Subject: [PATCH 0023/1045] Minor tweak --- doctrine/multiple_entity_managers.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doctrine/multiple_entity_managers.rst b/doctrine/multiple_entity_managers.rst index 33e0da09cf9..132dbaac4ba 100644 --- a/doctrine/multiple_entity_managers.rst +++ b/doctrine/multiple_entity_managers.rst @@ -287,7 +287,7 @@ The same applies to repository calls:: .. caution:: One entity can be managed by more than one entity manager. This however - result in unexpected behavior when extending from ``ServiceEntityRepository`` + results in unexpected behavior when extending from ``ServiceEntityRepository`` in your custom repository. The ``ServiceEntityRepository`` always uses the configured entity manager for that entity. From ff086e944c08f9eb49129371c384cb4d238d6c91 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Wed, 7 Oct 2020 12:35:48 +0200 Subject: [PATCH 0024/1045] Rewords --- setup/file_permissions.rst | 38 +++++++++++++++++--------------------- 1 file changed, 17 insertions(+), 21 deletions(-) diff --git a/setup/file_permissions.rst b/setup/file_permissions.rst index d5a7bac7e0b..f3e250fbb9f 100644 --- a/setup/file_permissions.rst +++ b/setup/file_permissions.rst @@ -1,36 +1,32 @@ Setting up or Fixing File Permissions ===================================== -The ``var/`` directory in a Symfony application is used to store generated -files (cache and logs) and file-based cache files. In the production -environment, you often need to add explicit permissions to let Symfony -write files into this directory. +Symfony generates certain files in the ``var/`` directory of your project when +running the application. In the ``dev`` :ref:`environment `, +the ``bin/console`` and ``public/index.php`` files use ``umask()`` to make sure +that the directory is writable. This means that you don't need to configure +permissions when developing the application in your local machine. -.. tip:: +However, using ``umask()`` is not considered safe in production. That's why you +often need to configure some permissions explicitly in your production servers +as explained in this article. - In dev environments, ``umask()`` is used in ``bin/console`` and - ``public/index.php`` to make sure the directory is writable. However, - this is not a safe method and should not be used in production. +Permissions Required by Symfony Applications +-------------------------------------------- -Setting up File Permissions in Production ------------------------------------------ - -This section describes the required permissions. See -:ref:`the next section ` on how to add the -permissions. +These are the permissions required to run Symfony applications: * The ``var/log/`` directory must exist and must be writable by both your web server user and the terminal user; * The ``var/cache/`` directory must be writable by the terminal user (the - user running ``cache:warmup`` or ``cache:clear``). It must also be writable - by the web server user if you're using the - :doc:`filesystem cache provider `; - or Doctrine query result cache. + user running ``cache:warmup`` or ``cache:clear`` commands); +* The ``var/cache/`` directory must be writable by the web server user if you use + a :doc:`filesystem-based cache `. .. _setup-file-permissions: -Configuring File Permissions on Linux and macOS System ------------------------------------------------------- +Configuring Permissions for Symfony Applications +------------------------------------------------ On Linux and macOS systems, if your web server user is different from your command line user, you need to configure permissions properly to avoid issues. @@ -84,7 +80,7 @@ If none of the previous methods work for you, change the ``umask`` so that the cache and log directories are group-writable or world-writable (depending if the web server user and the command line user are in the same group or not). To achieve this, put the following line at the beginning of the ``bin/console``, -``web/app.php`` and ``web/app_dev.php`` files:: +and ``public/index.php`` files:: umask(0002); // This will let the permissions be 0775 From 70c96fbd581ae767883d8a4bf684c5bc34466561 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Wed, 7 Oct 2020 13:22:09 +0200 Subject: [PATCH 0025/1045] Updated caution message --- logging/monolog_email.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/logging/monolog_email.rst b/logging/monolog_email.rst index 5d172ca0428..7822de7c58c 100644 --- a/logging/monolog_email.rst +++ b/logging/monolog_email.rst @@ -6,8 +6,8 @@ How to Configure Monolog to Email Errors .. caution:: - This feature is not compatible yet with the new :doc:`Symfony mailer `, - so it requires using SwiftMailer. + This feature is compatible with the new :doc:`Symfony mailer ` + starting from Symfony 5.1. All previous versions require using SwiftMailer. `Monolog`_ can be configured to send an email when an error occurs within an application. The configuration for this requires a few nested handlers From b9b89c0d851132ea2932e37036ca11795e9a7c30 Mon Sep 17 00:00:00 2001 From: gary houbre Date: Tue, 6 Oct 2020 09:11:40 +0200 Subject: [PATCH 0026/1045] Fix wording and add missing wording --- controller/argument_value_resolver.rst | 1 + controller/error_pages.rst | 2 +- controller/service.rst | 4 ++++ controller/soap_web_service.rst | 1 + controller/upload_file.rst | 2 ++ deployment/fortrabbit.rst | 2 +- doctrine/associations.rst | 1 + doctrine/dbal.rst | 3 +++ doctrine/events.rst | 2 ++ doctrine/multiple_entity_managers.rst | 6 ++++++ doctrine/resolve_target_entity.rst | 22 +++++++++++----------- form/create_custom_field_type.rst | 6 ++++++ form/create_form_type_extension.rst | 2 ++ form/dynamic_form_modification.rst | 2 ++ form/inherit_data_option.rst | 4 ++++ form/type_guesser.rst | 3 ++- form/use_empty_data.rst | 1 + http_cache/esi.rst | 3 ++- http_cache/ssi.rst | 3 ++- logging/monolog_console.rst | 3 +++ logging/processors.rst | 1 + messenger/dispatch_after_current_bus.rst | 2 ++ reference/configuration/kernel.rst | 4 ++++ 23 files changed, 64 insertions(+), 16 deletions(-) diff --git a/controller/argument_value_resolver.rst b/controller/argument_value_resolver.rst index da209a731df..90763c591c0 100644 --- a/controller/argument_value_resolver.rst +++ b/controller/argument_value_resolver.rst @@ -76,6 +76,7 @@ In the next example, you'll create a value resolver to inject the object that represents the current user whenever a controller method type-hints an argument with the ``User`` class:: + // src/Controller/UserController.php namespace App\Controller; use App\Entity\User; diff --git a/controller/error_pages.rst b/controller/error_pages.rst index 613a245ef8d..f3c8256e453 100644 --- a/controller/error_pages.rst +++ b/controller/error_pages.rst @@ -208,7 +208,7 @@ JSON/XML/CSV/YAML encoders. When your application throws an exception, Symfony can output it in one of those formats. If you want to change the output contents, create a new Normalizer that supports the ``FlattenException`` input:: - # src/App/Serializer/MyCustomProblemNormalizer.php + # src/Serializer/MyCustomProblemNormalizer.php namespace App\Serializer; use Symfony\Component\ErrorHandler\Exception\FlattenException; diff --git a/controller/service.rst b/controller/service.rst index 18ee56ee707..ca2f09b5d70 100644 --- a/controller/service.rst +++ b/controller/service.rst @@ -26,6 +26,8 @@ a service like: ``App\Controller\HelloController::index``: .. code-block:: php-annotations // src/Controller/HelloController.php + namespace App\Controller; + use Symfony\Component\Routing\Annotation\Route; class HelloController @@ -87,6 +89,8 @@ which is a common practice when following the `ADR pattern`_ .. code-block:: php-annotations // src/Controller/Hello.php + namespace App\Controller; + use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Annotation\Route; diff --git a/controller/soap_web_service.rst b/controller/soap_web_service.rst index 8d1f7ae1f0a..37c72316878 100644 --- a/controller/soap_web_service.rst +++ b/controller/soap_web_service.rst @@ -57,6 +57,7 @@ Finally, below is an example of a controller that is capable of handling a SOAP request. Because ``index()`` is accessible via ``/soap``, the WSDL document can be retrieved via ``/soap?wsdl``:: + // src/Controller/HelloServiceController.php namespace App\Controller; use App\Service\HelloService; diff --git a/controller/upload_file.rst b/controller/upload_file.rst index a50368e9f93..dad80ee957d 100644 --- a/controller/upload_file.rst +++ b/controller/upload_file.rst @@ -327,6 +327,8 @@ Then, define a service for this class: Now you're ready to use this service in the controller:: // src/Controller/ProductController.php + namespace App\Controller; + use App\Service\FileUploader; use Symfony\Component\HttpFoundation\Request; diff --git a/deployment/fortrabbit.rst b/deployment/fortrabbit.rst index f13bf4f0ad4..d2aedab9598 100644 --- a/deployment/fortrabbit.rst +++ b/deployment/fortrabbit.rst @@ -9,4 +9,4 @@ Deploying to fortrabbit For details on deploying to fortrabbit, see their official documentation: `Install Symfony`_ -.. _`Install Symfony`: https://help.fortrabbit.com/install-symfony-3-uni +.. _`Install Symfony`: https://help.fortrabbit.com/install-symfony-5-uni diff --git a/doctrine/associations.rst b/doctrine/associations.rst index 017f5903391..8bdddab536b 100644 --- a/doctrine/associations.rst +++ b/doctrine/associations.rst @@ -548,6 +548,7 @@ What about *removing* a ``Product`` from a ``Category``? The ``make:entity`` com also generated a ``removeProduct()`` method:: // src/Entity/Category.php + namespace App\Entity; // ... class Category diff --git a/doctrine/dbal.rst b/doctrine/dbal.rst index 8487ffdce91..3d451fb4af6 100644 --- a/doctrine/dbal.rst +++ b/doctrine/dbal.rst @@ -44,6 +44,9 @@ if you *don't* want to use the Doctrine ORM. You can then access the Doctrine DBAL connection by autowiring the ``Connection`` object:: + // src/Controller/UserController.php + namespace App\Controller; + use Doctrine\DBAL\Driver\Connection; class UserController extends AbstractController diff --git a/doctrine/events.rst b/doctrine/events.rst index 9b44b35cba1..1ce0bfa8ac0 100644 --- a/doctrine/events.rst +++ b/doctrine/events.rst @@ -56,6 +56,8 @@ define a callback for the ``prePersist`` Doctrine event: .. code-block:: php-annotations // src/Entity/Product.php + namespace App\Entity; + use Doctrine\ORM\Mapping as ORM; // When using annotations, don't forget to add @ORM\HasLifecycleCallbacks() diff --git a/doctrine/multiple_entity_managers.rst b/doctrine/multiple_entity_managers.rst index 132dbaac4ba..faffc480877 100644 --- a/doctrine/multiple_entity_managers.rst +++ b/doctrine/multiple_entity_managers.rst @@ -230,6 +230,9 @@ When working with multiple entity managers to generate migrations: If you *do* omit the entity manager's name when asking for it, the default entity manager (i.e. ``default``) is returned:: + // src/Controller/UserController.php + namespace App\Controller; + // ... use Doctrine\ORM\EntityManagerInterface; @@ -256,6 +259,9 @@ entity manager to persist and fetch its entities. The same applies to repository calls:: + // src/Controller/UserController.php + namespace App\Controller; + use AcmeStoreBundle\Entity\Customer; use AcmeStoreBundle\Entity\Product; // ... diff --git a/doctrine/resolve_target_entity.rst b/doctrine/resolve_target_entity.rst index a60dfe3e604..36038fd9f3c 100644 --- a/doctrine/resolve_target_entity.rst +++ b/doctrine/resolve_target_entity.rst @@ -42,8 +42,8 @@ A Customer entity:: // src/Entity/Customer.php namespace App\Entity; - use Acme\CustomerBundle\Entity\Customer as BaseCustomer; - use Acme\InvoiceBundle\Model\InvoiceSubjectInterface; + use App\Entity\CustomerInterface as BaseCustomer; + use App\Model\InvoiceSubjectInterface; use Doctrine\ORM\Mapping as ORM; /** @@ -58,10 +58,10 @@ A Customer entity:: An Invoice entity:: - // src/Acme/InvoiceBundle/Entity/Invoice.php - namespace Acme\InvoiceBundle\Entity; + // src/Entity/Invoice.php + namespace App\Entity; - use Acme\InvoiceBundle\Model\InvoiceSubjectInterface; + use App\Model\InvoiceSubjectInterface; use Doctrine\ORM\Mapping as ORM; /** @@ -73,7 +73,7 @@ An Invoice entity:: class Invoice { /** - * @ORM\ManyToOne(targetEntity="Acme\InvoiceBundle\Model\InvoiceSubjectInterface") + * @ORM\ManyToOne(targetEntity="App\Model\InvoiceSubjectInterface") * @var InvoiceSubjectInterface */ protected $subject; @@ -81,8 +81,8 @@ An Invoice entity:: An InvoiceSubjectInterface:: - // src/Acme/InvoiceBundle/Model/InvoiceSubjectInterface.php - namespace Acme\InvoiceBundle\Model; + // src/Model/InvoiceSubjectInterface.php + namespace App\Model; /** * An interface that the invoice Subject object should implement. @@ -115,7 +115,7 @@ about the replacement: orm: # ... resolve_target_entities: - Acme\InvoiceBundle\Model\InvoiceSubjectInterface: App\Entity\Customer + App\Model\InvoiceSubjectInterface: App\Entity\Customer .. code-block:: xml @@ -132,7 +132,7 @@ about the replacement: - App\Entity\Customer + App\Entity\Customer @@ -140,8 +140,8 @@ about the replacement: .. code-block:: php // config/packages/doctrine.php - use Acme\InvoiceBundle\Model\InvoiceSubjectInterface; use App\Entity\Customer; + use App\Model\InvoiceSubjectInterface; $container->loadFromExtension('doctrine', [ 'orm' => [ diff --git a/form/create_custom_field_type.rst b/form/create_custom_field_type.rst index b17add4b3d7..58e265fd2ad 100644 --- a/form/create_custom_field_type.rst +++ b/form/create_custom_field_type.rst @@ -287,6 +287,8 @@ to define, validate and process their values:: Now you can configure these options when using the form type:: // src/Form/Type/OrderType.php + namespace App\Form\Type; + // ... class OrderType extends AbstractType @@ -310,6 +312,8 @@ Now you can configure these options when using the form type:: The last step is to use these options when building the form:: // src/Form/Type/PostalAddressType.php + namespace App\Form\Type; + // ... class PostalAddressType extends AbstractType @@ -453,6 +457,8 @@ defined by the form or be completely independent:: // src/Form/Type/PostalAddressType.php + namespace App\Form\Type; + use Doctrine\ORM\EntityManagerInterface; // ... diff --git a/form/create_form_type_extension.rst b/form/create_form_type_extension.rst index fb1cd2e02b2..59b1c06e9fe 100644 --- a/form/create_form_type_extension.rst +++ b/form/create_form_type_extension.rst @@ -251,6 +251,8 @@ may not be applied to it. Another option is to return multiple form types in the ``getExtendedTypes()`` method to extend all of them:: + // src/Form/Extension/DateTimeExtension.php + namespace App\Form\Extension; // ... use Symfony\Component\Form\Extension\Core\Type\DateTimeType; use Symfony\Component\Form\Extension\Core\Type\DateType; diff --git a/form/dynamic_form_modification.rst b/form/dynamic_form_modification.rst index f2b37cb07c5..69339480248 100644 --- a/form/dynamic_form_modification.rst +++ b/form/dynamic_form_modification.rst @@ -255,6 +255,8 @@ Now that you have all the basics in place you can use the features of the security helper to fill in the listener logic:: // src/Form/Type/FriendMessageFormType.php + namespace App\Form\Type; + use App\Entity\User; use Doctrine\ORM\EntityRepository; use Symfony\Bridge\Doctrine\Form\Type\EntityType; diff --git a/form/inherit_data_option.rst b/form/inherit_data_option.rst index 113e66d6381..3321ab2153a 100644 --- a/form/inherit_data_option.rst +++ b/form/inherit_data_option.rst @@ -126,6 +126,8 @@ access the properties of the ``Customer`` instance instead. Convenient, eh? Finally, make this work by adding the location form to your two original forms:: // src/Form/Type/CompanyType.php + namespace App\Form\Type; + use App\Entity\Company; // ... @@ -141,6 +143,8 @@ Finally, make this work by adding the location form to your two original forms:: .. code-block:: php // src/Form/Type/CustomerType.php + namespace App\Form\Type; + use App\Entity\Customer; // ... diff --git a/form/type_guesser.rst b/form/type_guesser.rst index b842e12a9ad..f990aad4115 100644 --- a/form/type_guesser.rst +++ b/form/type_guesser.rst @@ -82,6 +82,7 @@ The ``TypeGuess`` constructor requires three options: With this knowledge, you can implement the ``guessType()`` method of the ``PHPDocTypeGuesser``:: + // src/Form/TypeGuesser/PHPDocTypeGuesser.php namespace App\Form\TypeGuesser; use Symfony\Component\Form\Extension\Core\Type\CheckboxType; @@ -221,7 +222,7 @@ and tag it with ``form.type_guesser``: :method:`Symfony\\Component\\Form\\FormFactoryBuilder::addTypeGuessers` of the ``FormFactoryBuilder`` to register new type guessers:: - use Acme\Form\PHPDocTypeGuesser; + use App\Form\TypeGuesser\PHPDocTypeGuesser; use Symfony\Component\Form\Forms; $formFactory = Forms::createFormFactoryBuilder() diff --git a/form/use_empty_data.rst b/form/use_empty_data.rst index c186396f8e4..6a567286094 100644 --- a/form/use_empty_data.rst +++ b/form/use_empty_data.rst @@ -44,6 +44,7 @@ that takes arguments. Remember, the default ``data_class`` option calls that constructor with no arguments:: // src/Form/Type/BlogType.php + namespace App\Form\Type; // ... use App\Entity\Blog; diff --git a/http_cache/esi.rst b/http_cache/esi.rst index 31b4c354e37..621f604ea95 100644 --- a/http_cache/esi.rst +++ b/http_cache/esi.rst @@ -98,7 +98,8 @@ ticker at the bottom of the content. With ESI, you can cache the news ticker independently of the rest of the page:: // src/Controller/DefaultController.php - + namespace App\Controller; + // ... class DefaultController extends AbstractController { diff --git a/http_cache/ssi.rst b/http_cache/ssi.rst index 7397c7b0a5e..94bab702db4 100644 --- a/http_cache/ssi.rst +++ b/http_cache/ssi.rst @@ -85,7 +85,8 @@ to cache a static GDPR content block. With SSI, you can add some expiration on this block and keep the page private:: // src/Controller/ProfileController.php - + namespace App\Controller; + // ... class ProfileController extends AbstractController { diff --git a/logging/monolog_console.rst b/logging/monolog_console.rst index 9eb8b28b062..5c0263c5349 100644 --- a/logging/monolog_console.rst +++ b/logging/monolog_console.rst @@ -35,6 +35,9 @@ the current log level and the console verbosity. The example above could then be rewritten as:: + // src/Command/YourCommand.php + namespace App\Command; + use Psr\Log\LoggerInterface; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; diff --git a/logging/processors.rst b/logging/processors.rst index f2b889461ec..9f46326ddaa 100644 --- a/logging/processors.rst +++ b/logging/processors.rst @@ -16,6 +16,7 @@ Sometimes it is hard to tell which entries in the log belong to which session and/or request. The following example will add a unique token for each request using a processor:: + // src/Logger/SessionRequestProcessor.php namespace App\Logger; use Symfony\Component\HttpFoundation\Session\SessionInterface; diff --git a/messenger/dispatch_after_current_bus.rst b/messenger/dispatch_after_current_bus.rst index c2b85c2aaad..e382f49eed3 100644 --- a/messenger/dispatch_after_current_bus.rst +++ b/messenger/dispatch_after_current_bus.rst @@ -44,6 +44,7 @@ are dispatched by a handler once that handler has fully finished. This can be by using the ``DispatchAfterCurrentBusMiddleware`` and adding a ``DispatchAfterCurrentBusStamp`` stamp to :ref:`the message Envelope `:: + // src/Messenger/CommandHandler/RegisterUserHandler.php namespace App\Messenger\CommandHandler; use App\Entity\User; @@ -85,6 +86,7 @@ using the ``DispatchAfterCurrentBusMiddleware`` and adding a .. code-block:: php + // src/Messenger/EventSubscriber/WhenUserRegisteredThenSendWelcomeEmail.php namespace App\Messenger\EventSubscriber; use App\Entity\User; diff --git a/reference/configuration/kernel.rst b/reference/configuration/kernel.rst index 5852927e7ad..6b0ac4279ad 100644 --- a/reference/configuration/kernel.rst +++ b/reference/configuration/kernel.rst @@ -33,6 +33,8 @@ To change this value, override the ``getCharset()`` method and return another charset:: // src/Kernel.php + namespace App; + use Symfony\Component\HttpKernel\Kernel as BaseKernel; // ... @@ -89,6 +91,8 @@ override the :method:`Symfony\\Component\\HttpKernel\\Kernel::getProjectDir` method to return the right project directory:: // src/Kernel.php + namespace App; + use Symfony\Component\HttpKernel\Kernel as BaseKernel; // ... From 81316eec981b6cbafb50faddda9d58b0c819f2c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Deruss=C3=A9?= Date: Wed, 7 Oct 2020 11:39:00 +0200 Subject: [PATCH 0027/1045] Add documentation about serializing lock --- components/lock.rst | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/components/lock.rst b/components/lock.rst index 45237fed221..f2f26806987 100644 --- a/components/lock.rst +++ b/components/lock.rst @@ -73,6 +73,33 @@ method can be safely called repeatedly, even if the lock is already acquired. across several requests. To disable the automatic release behavior, set the third argument of the ``createLock()`` method to ``false``. +Serializing Locks +------------------ + +The ``Key`` contains the state of the ``Lock`` and can be serialized. This +allows the user to begin a long job in a process by acquiring the lock, and +to continue the job in an other process within the same lock.:: + + use Symfony\Component\Lock\Key; + use Symfony\Component\Lock\Lock; + + $key = new Key('article.'.$article->getId()); + $lock = new Lock($key, $this->store, 300, false); + $lock->acquire(true); + + $this->bus->dispatch(new RefreshTaxonomy($article, $key)); + +.. note:: + + Don't forget to disable the autoRelease to avoid releasing the lock when + the destructor will be called. + +All stores are not compatible with serialization and cross-process locking: +For instance the kernel will automatically releases Semaphores acquires by the +:ref:`SemaphoreStore ` store. +Wen a lock is acquired with such store, and hte application try to serialize +the key, and exception will be thrown + .. _lock-blocking-locks: Blocking Locks From 61e30b36e444e37c2798f602663c1a1061b61b0b Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Thu, 8 Oct 2020 17:17:54 +0200 Subject: [PATCH 0028/1045] Tweaks --- components/lock.rst | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/components/lock.rst b/components/lock.rst index f2f26806987..891fdc64818 100644 --- a/components/lock.rst +++ b/components/lock.rst @@ -76,9 +76,9 @@ method can be safely called repeatedly, even if the lock is already acquired. Serializing Locks ------------------ -The ``Key`` contains the state of the ``Lock`` and can be serialized. This +The ``Key`` contains the state of the ``Lock`` and can be serialized. This allows the user to begin a long job in a process by acquiring the lock, and -to continue the job in an other process within the same lock.:: +continue the job in an other process using the same lock:: use Symfony\Component\Lock\Key; use Symfony\Component\Lock\Lock; @@ -92,13 +92,12 @@ to continue the job in an other process within the same lock.:: .. note:: Don't forget to disable the autoRelease to avoid releasing the lock when - the destructor will be called. + the destructor is called. -All stores are not compatible with serialization and cross-process locking: -For instance the kernel will automatically releases Semaphores acquires by the -:ref:`SemaphoreStore ` store. -Wen a lock is acquired with such store, and hte application try to serialize -the key, and exception will be thrown +Not all stores are compatible with serialization and cross-process locking: +for example, the kernel will automatically release semaphores acquired by the +:ref:`SemaphoreStore ` store. If you use an incompatible +store, an exception will be thrown when the application tries to serialize the key. .. _lock-blocking-locks: From 728f89f040692aad54dc3a5c94ad2a7a9c75d27f Mon Sep 17 00:00:00 2001 From: Nyholm Date: Thu, 8 Oct 2020 18:31:04 +0200 Subject: [PATCH 0029/1045] [Messenger] Update the list of stamp --- components/messenger.rst | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/components/messenger.rst b/components/messenger.rst index b0bcb785aa7..157d3f79d6a 100644 --- a/components/messenger.rst +++ b/components/messenger.rst @@ -148,21 +148,26 @@ through the transport layer, use the ``SerializerStamp`` stamp:: ])) ); -At the moment, the Symfony Messenger has the following built-in envelope stamps: +Here are some important envelope stamps that are shipped with the Symfony Messenger: -#. :class:`Symfony\\Component\\Messenger\\Stamp\\SerializerStamp`, - to configure the serialization groups used by the transport. -#. :class:`Symfony\\Component\\Messenger\\Stamp\\ValidationStamp`, - to configure the validation groups used when the validation middleware is enabled. +#. :class:`Symfony\\Component\\Messenger\\Stamp\\DelayStamp`, + to delay handling of an asynchronous message. +#. :class:`Symfony\\Component\\Messenger\\Stamp\\DispatchAfterCurrentBusStamp`, + to make the message be handled after the current bus has executed. Read more + at :doc:`/messenger/dispatch_after_current_bus`. +#. :class:`Symfony\\Component\\Messenger\\Stamp\\HandledStamp`, + a stamp that marks the message as handled by a specific handler. + Allows accessing the handler returned value and the handler name. #. :class:`Symfony\\Component\\Messenger\\Stamp\\ReceivedStamp`, an internal stamp that marks the message as received from a transport. #. :class:`Symfony\\Component\\Messenger\\Stamp\\SentStamp`, a stamp that marks the message as sent by a specific sender. Allows accessing the sender FQCN and the alias if available from the :class:`Symfony\\Component\\Messenger\\Transport\\Sender\\SendersLocator`. -#. :class:`Symfony\\Component\\Messenger\\Stamp\\HandledStamp`, - a stamp that marks the message as handled by a specific handler. - Allows accessing the handler returned value and the handler name. +#. :class:`Symfony\\Component\\Messenger\\Stamp\\SerializerStamp`, + to configure the serialization groups used by the transport. +#. :class:`Symfony\\Component\\Messenger\\Stamp\\ValidationStamp`, + to configure the validation groups used when the validation middleware is enabled. Instead of dealing directly with the messages in the middleware you receive the envelope. Hence you can inspect the envelope content and its stamps, or add any:: From 4c6e527587ed52a6e907bb39c87843bfd63f4d73 Mon Sep 17 00:00:00 2001 From: Nyholm Date: Fri, 9 Oct 2020 09:56:17 +0200 Subject: [PATCH 0030/1045] Super minor syntax fix --- http_client.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/http_client.rst b/http_client.rst index 1112743d4f0..4db3784f853 100644 --- a/http_client.rst +++ b/http_client.rst @@ -810,6 +810,7 @@ following methods:: // returns info coming from the transport layer, such as "response_headers", // "redirect_count", "start_time", "redirect_url", etc. $httpInfo = $response->getInfo(); + // you can get individual info too $startTime = $response->getInfo('start_time'); From 77f4d41caa26f6b87ac0d33c792370ac9116ed15 Mon Sep 17 00:00:00 2001 From: Nyholm Date: Fri, 9 Oct 2020 09:53:08 +0200 Subject: [PATCH 0031/1045] Configuration reference: Improve example of http_client::headers --- reference/configuration/framework.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reference/configuration/framework.rst b/reference/configuration/framework.rst index 62d68a5b929..f388b5c9eb5 100644 --- a/reference/configuration/framework.rst +++ b/reference/configuration/framework.rst @@ -873,7 +873,7 @@ headers **type**: ``array`` An associative array of the HTTP headers added before making the request. This -value must use the format ``['header-name' => header-value, ...]``. +value must use the format ``['header-name' => 'value0, value1, ...']``. http_version ............ From 9f2e934b839b0d0e46365ec59187af7f0dcf52c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Morel?= Date: Mon, 21 Sep 2020 12:40:45 -0700 Subject: [PATCH 0032/1045] Add a mention to COMPOSE_FILE and COMPOSE_PROJECT_NAME vars --- setup/symfony_server.rst | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/setup/symfony_server.rst b/setup/symfony_server.rst index d0f0b6e3e4d..47699eb2edc 100644 --- a/setup/symfony_server.rst +++ b/setup/symfony_server.rst @@ -361,6 +361,25 @@ When Docker services are running, browse a page of your Symfony application and check the "Symfony Server" section in the web debug toolbar; you'll see that "Docker Compose" is "Up". +If your Docker Compose file is not at the root of the project, you can pass that information +to the Symfony Server. It works exactly the same as for ``docker-compose``. + +Let's say you have your ``docker-compose.yaml`` file under a ``docker/`` directory. +You start your containers like this: + +.. code-block:: bash + + COMPOSE_FILE=docker/docker-compose.yaml COMPOSE_PROJECT_NAME=project_name docker-compose up -d + +And if you are using the same environment variables with the Symfony CLI, things will work. For instance: + +.. code-block:: bash + + COMPOSE_FILE=docker/docker-compose.yaml COMPOSE_PROJECT_NAME=project_name symfony var:export + +If you have more than one docker-compose files you can provide them all separated by ``:`` +more information here: https://docs.docker.com/compose/reference/envvars/ + SymfonyCloud Integration ------------------------ From 527c6ea08f00412e0e08d0efb019819309421df4 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Fri, 9 Oct 2020 13:39:25 +0200 Subject: [PATCH 0033/1045] Reword --- setup/symfony_server.rst | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/setup/symfony_server.rst b/setup/symfony_server.rst index 47699eb2edc..5a1c408efa6 100644 --- a/setup/symfony_server.rst +++ b/setup/symfony_server.rst @@ -361,24 +361,22 @@ When Docker services are running, browse a page of your Symfony application and check the "Symfony Server" section in the web debug toolbar; you'll see that "Docker Compose" is "Up". -If your Docker Compose file is not at the root of the project, you can pass that information -to the Symfony Server. It works exactly the same as for ``docker-compose``. - -Let's say you have your ``docker-compose.yaml`` file under a ``docker/`` directory. -You start your containers like this: +If your Docker Compose file is not at the root of the project, use the +``COMPOSE_FILE`` and ``COMPOSE_PROJECT_NAME`` environment variables to define +its location, same as for ``docker-compose``: .. code-block:: bash + # start your containers: COMPOSE_FILE=docker/docker-compose.yaml COMPOSE_PROJECT_NAME=project_name docker-compose up -d -And if you are using the same environment variables with the Symfony CLI, things will work. For instance: - -.. code-block:: bash - + # run any Symfony CLI command: COMPOSE_FILE=docker/docker-compose.yaml COMPOSE_PROJECT_NAME=project_name symfony var:export -If you have more than one docker-compose files you can provide them all separated by ``:`` -more information here: https://docs.docker.com/compose/reference/envvars/ +.. note:: + + If you have more than one docker-compose files you can provide them all + separated by ``:``, as explained in the `Docker compose CLI env var reference`_. SymfonyCloud Integration ------------------------ @@ -400,3 +398,4 @@ debug any issues. .. _`Proxy settings in macOS`: https://support.apple.com/guide/mac-help/enter-proxy-server-settings-on-mac-mchlp2591/mac .. _`Proxy settings in Ubuntu`: https://help.ubuntu.com/stable/ubuntu-help/net-proxy.html.en .. _`is treated differently`: https://ec.haxx.se/usingcurl/usingcurl-proxies#http_proxy-in-lower-case-only +.. _`Docker compose CLI env var reference`: https://docs.docker.com/compose/reference/envvars/ From fa569bd38e82b3babb88b32fb3e1938c6743be36 Mon Sep 17 00:00:00 2001 From: Nyholm Date: Sun, 11 Oct 2020 10:49:45 +0200 Subject: [PATCH 0034/1045] Make sure we install FrameworkExtra bundle and not just doctrine/annotations --- routing.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/routing.rst b/routing.rst index 9bd09e531cc..60f5c8aa664 100644 --- a/routing.rst +++ b/routing.rst @@ -27,7 +27,7 @@ Run this command once in your application to add support for annotations: .. code-block:: terminal - $ composer require doctrine/annotations + $ composer require annotations In addition to installing the needed dependencies, this command creates the following configuration file: From 34bacb5488e729fb1d9d88f2e92c80ae10f8d9ff Mon Sep 17 00:00:00 2001 From: tikoutare Date: Sun, 4 Oct 2020 22:24:49 +0200 Subject: [PATCH 0035/1045] Update user_provider.rst Fix provider name `backend_users` instead of `backend` --- security/user_provider.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/security/user_provider.rst b/security/user_provider.rst index 51a2fea56ed..13e6a8dfb49 100644 --- a/security/user_provider.rst +++ b/security/user_provider.rst @@ -332,7 +332,7 @@ providers until the user is found: all_users: chain: - providers: ['legacy_users', 'users', 'backend'] + providers: ['legacy_users', 'users', 'backend_users'] .. _custom-user-provider: From a8448a78ec082ec8fcc76be70ba316647b68c6db Mon Sep 17 00:00:00 2001 From: Christiaan Baartse Date: Tue, 13 Oct 2020 08:55:34 +0200 Subject: [PATCH 0036/1045] Do not promote deprecated message_bus service use The message_bus service is deprecated and messenger.default_bus should be used instead. --- messenger.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/messenger.rst b/messenger.rst index 7a4a9afccc2..e68234be838 100644 --- a/messenger.rst +++ b/messenger.rst @@ -83,7 +83,7 @@ Dispatching the Message ----------------------- You're ready! To dispatch the message (and call the handler), inject the -``message_bus`` service (via the ``MessageBusInterface``), like in a controller:: +``messenger.default_bus`` service (via the ``MessageBusInterface``), like in a controller:: // src/Controller/DefaultController.php namespace App\Controller; From 87d67189f54f8ca2b829906ee90d7c72f39236fa Mon Sep 17 00:00:00 2001 From: Lubo Grozdanov Date: Tue, 13 Oct 2020 15:20:17 +0300 Subject: [PATCH 0037/1045] Wrong services path and addition services_environment-name --- configuration.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/configuration.rst b/configuration.rst index 8ab1d99dceb..9e17b2f2f08 100644 --- a/configuration.rst +++ b/configuration.rst @@ -387,7 +387,8 @@ set in the previous ones): #. ``config/packages/*.yaml`` (and ``*.xml`` and ``*.php`` files too); #. ``config/packages//*.yaml`` (and ``*.xml`` and ``*.php`` files too); -#. ``config/packages/services.yaml`` (and ``services.xml`` and ``services.php`` files too); +#. ``config/services.yaml`` (and ``services.xml`` and ``services.php`` files too); +#. ``config/services_.yaml`` (and ``services_environment-name.xml`` and ``services_environment-name.php`` files too); Take the ``framework`` package, installed by default, as an example: From 7a89d40780f775277a188aded3dc6c2afc88a4ec Mon Sep 17 00:00:00 2001 From: Simon Rolland Date: Tue, 13 Oct 2020 15:01:05 +0200 Subject: [PATCH 0038/1045] 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 cb0c5260c3f8f04a3e24762541588cfc15b99de9 Mon Sep 17 00:00:00 2001 From: Nyholm Date: Tue, 13 Oct 2020 17:37:06 +0200 Subject: [PATCH 0039/1045] Remove Michelle from the CARE team --- contributing/code_of_conduct/care_team.rst | 6 ------ 1 file changed, 6 deletions(-) diff --git a/contributing/code_of_conduct/care_team.rst b/contributing/code_of_conduct/care_team.rst index ae342b89999..8f32d5befd1 100644 --- a/contributing/code_of_conduct/care_team.rst +++ b/contributing/code_of_conduct/care_team.rst @@ -29,12 +29,6 @@ of them at once by emailing **care@symfony.com**: * *Twitter*: `@EmilieLorenzo `_ * *SymfonyConnect*: `emilielorenzo `_ -* **Michelle Sanver** - - * *E-mail*: michelle [at] liip.ch - * *Twitter*: `@michellesanver `_ - * *SymfonyConnect*: `michellesanver `_ - * **Tobias Nyholm** * *E-mail*: tobias.nyholm [at] gmail.com From 1c994710dad7642c8d7c70d97a8080d58a98c5f5 Mon Sep 17 00:00:00 2001 From: Lubo Grozdanov Date: Wed, 14 Oct 2020 09:01:47 +0300 Subject: [PATCH 0040/1045] Update front_controllers_and_kernel.rst --- configuration/front_controllers_and_kernel.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/configuration/front_controllers_and_kernel.rst b/configuration/front_controllers_and_kernel.rst index 090abb86e55..fe3c8179ed0 100644 --- a/configuration/front_controllers_and_kernel.rst +++ b/configuration/front_controllers_and_kernel.rst @@ -244,15 +244,15 @@ the directory of the environment you're using (most commonly ``dev/`` while developing and debugging). While it can vary, the ``var/cache/dev/`` directory includes the following: -``appDevDebugProjectContainer.php`` +``srcApp_KernelDevDebugContainer.php`` The cached "service container" that represents the cached application configuration. -``appDevUrlGenerator.php`` +``UrlGenerator.php`` The PHP class generated from the routing configuration and used when generating URLs. -``appDevUrlMatcher.php`` +``UrlMatcher.php`` The PHP class used for route matching - look here to see the compiled regular expression logic used to match incoming URLs to different routes. From ff8c0adf6880c73fcbdd0ec29dfdfee3a51ba8a3 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Wed, 14 Oct 2020 09:08:40 +0200 Subject: [PATCH 0041/1045] tweak paragraph about multiple Docker Composer files --- setup/symfony_server.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup/symfony_server.rst b/setup/symfony_server.rst index 5a1c408efa6..70155de0637 100644 --- a/setup/symfony_server.rst +++ b/setup/symfony_server.rst @@ -375,8 +375,8 @@ its location, same as for ``docker-compose``: .. note:: - If you have more than one docker-compose files you can provide them all - separated by ``:``, as explained in the `Docker compose CLI env var reference`_. + 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`_. SymfonyCloud Integration ------------------------ From 6a74ba61f5f07b02c8048a5b0095ecb62f5d8ae5 Mon Sep 17 00:00:00 2001 From: Nyholm Date: Tue, 13 Oct 2020 10:55:37 +0200 Subject: [PATCH 0042/1045] You need doctrine/annotations for route annotation support. --- routing.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/routing.rst b/routing.rst index 60f5c8aa664..9bd09e531cc 100644 --- a/routing.rst +++ b/routing.rst @@ -27,7 +27,7 @@ Run this command once in your application to add support for annotations: .. code-block:: terminal - $ composer require annotations + $ composer require doctrine/annotations In addition to installing the needed dependencies, this command creates the following configuration file: From c41f88cc6fc29a0ed816d743c810893ebf069aa6 Mon Sep 17 00:00:00 2001 From: Thomas Landauer Date: Wed, 25 Mar 2020 11:57:31 +0100 Subject: [PATCH 0043/1045] Added missing security.yaml config --- security/guard_authentication.rst | 65 +++++++++++++++++++++++++++++-- 1 file changed, 61 insertions(+), 4 deletions(-) diff --git a/security/guard_authentication.rst b/security/guard_authentication.rst index b229fe733af..e5a65958ef3 100644 --- a/security/guard_authentication.rst +++ b/security/guard_authentication.rst @@ -49,6 +49,63 @@ Don't forget to generate and execute the migration: $ php bin/console make:migration $ php bin/console doctrine:migrations:migrate +Next, configure your "user provider" to use this new ``apiToken`` property: + +.. configuration-block:: + + .. code-block:: yaml + + # config/packages/security.yaml + security: + # ... + + providers: + your_db_provider: + entity: + class: App\Entity\User + property: apiToken + + # ... + + .. code-block:: xml + + + + + + + + + + + + + + + + + .. code-block:: php + + // config/packages/security.php + $container->loadFromExtension('security', [ + // ... + + 'providers' => [ + 'your_db_provider' => [ + 'entity' => [ + 'class' => 'App\Entity\User', + 'property' => 'apiToken', + ], + ], + ], + + // ... + ]); + Step 2) Create the Authenticator Class -------------------------------------- @@ -108,10 +165,10 @@ This requires you to implement several methods:: return null; } - // if a User is returned, checkCredentials() is called - return $this->em->getRepository(User::class) - ->findOneBy(['apiToken' => $credentials]) - ; + // The "username" in this case is the apiToken, see the key `property` + // of `your_db_provider` in `security.yaml`. + // If this returns a user, checkCredentials() is called next: + return $userProvider->loadUserByUsername($apiToken); } public function checkCredentials($credentials, UserInterface $user) From 23164fea42245d658e0c6ac5860931d3244610cd Mon Sep 17 00:00:00 2001 From: Ivan Date: Mon, 12 Oct 2020 09:42:37 +0500 Subject: [PATCH 0044/1045] Enclose a value with ampersands in single quotes --- components/phpunit_bridge.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/phpunit_bridge.rst b/components/phpunit_bridge.rst index 31d5de1759b..d1888cd4f6e 100644 --- a/components/phpunit_bridge.rst +++ b/components/phpunit_bridge.rst @@ -234,7 +234,7 @@ You can have even finer-grained control by using other keys of the ``max`` array, which are ``self``, ``direct``, and ``indirect``. The ``SYMFONY_DEPRECATIONS_HELPER`` environment variable accepts a URL-encoded string, meaning you can combine thresholds and any other configuration setting, -like this: ``SYMFONY_DEPRECATIONS_HELPER=max[total]=42&max[self]=0&verbose=0`` +like this: ``SYMFONY_DEPRECATIONS_HELPER='max[total]=42&max[self]=0&verbose=0'`` Internal deprecations ..................... From 25012dac9e7daaa3ebd8503719a9ee72802e88b2 Mon Sep 17 00:00:00 2001 From: Jannik Date: Wed, 14 Oct 2020 14:00:01 +0200 Subject: [PATCH 0045/1045] Fix invalid variable name --- security/guard_authentication.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/security/guard_authentication.rst b/security/guard_authentication.rst index 945d9deccc8..edbd6f122ee 100644 --- a/security/guard_authentication.rst +++ b/security/guard_authentication.rst @@ -168,7 +168,7 @@ This requires you to implement several methods:: // The "username" in this case is the apiToken, see the key `property` // of `your_db_provider` in `security.yaml`. // If this returns a user, checkCredentials() is called next: - return $userProvider->loadUserByUsername($apiToken); + return $userProvider->loadUserByUsername($credentials); } public function checkCredentials($credentials, UserInterface $user) From 35361bece161701505cdedac1fd4196991971fdb Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Wed, 14 Oct 2020 17:37:40 +0200 Subject: [PATCH 0046/1045] Add new core team members --- contributing/code/core_team.rst | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/contributing/code/core_team.rst b/contributing/code/core_team.rst index 1c6c64bbc98..47fba9c2d94 100644 --- a/contributing/code/core_team.rst +++ b/contributing/code/core_team.rst @@ -67,12 +67,17 @@ Active Core Members * **Robin Chalas** (`chalasr`_); * **Maxime Steinhausser** (`ogizanagi`_); * **Samuel Rozé** (`sroze`_); - * **Yonel Ceruto** (`yceruto`_). + * **Yonel Ceruto** (`yceruto`_); + * **Tobias Nyholm** (`Nyholm`_); + * **Wouter De Jong** (`wouterj`_); + * **Alexander M. Turek** (`derrabus`_); + * **Jérémy Derussé** (`jderusse`_). * **Security Team** (``@symfony/security`` on GitHub): * **Fabien Potencier** (`fabpot`_); - * **Michael Cullum** (`michaelcullum`_). + * **Michael Cullum** (`michaelcullum`_); + * **Jérémy Derussé** (`jderusse`_). * **Recipes Team**: @@ -200,3 +205,5 @@ discretion of the **Project Leader**. .. _`OskarStark`: https://github.com/OskarStark .. _`romainneutron`: https://github.com/romainneutron .. _`lsmith77`: https://github.com/lsmith77/ +.. _`derrabus`: https://github.com/derrabus/ +.. _`jderusse`: https://github.com/jderusse/ From 31617f97b2e60b99cc7f33781b5e4f57722315a6 Mon Sep 17 00:00:00 2001 From: noniagriconomie Date: Thu, 15 Oct 2020 10:02:49 +0200 Subject: [PATCH 0047/1045] Improve/fix container doc --- service_container.rst | 70 ++++++++++++++++++++++++------------------- testing.rst | 2 +- 2 files changed, 40 insertions(+), 32 deletions(-) diff --git a/service_container.rst b/service_container.rst index ec3b67215c4..ff80ac27a14 100644 --- a/service_container.rst +++ b/service_container.rst @@ -32,15 +32,16 @@ service's class or interface name. Want to :doc:`log ` something? No p namespace App\Controller; use Psr\Log\LoggerInterface; + use Symfony\Component\HttpFoundation\Response; class ProductController { /** * @Route("/products") */ - public function list(LoggerInterface $logger) + public function list(LoggerInterface $logger): Response { - $logger->info('Look! I just used a service'); + $logger->info('Look, I just used a service!'); // ... } @@ -101,7 +102,7 @@ it can't be re-used. Instead, you decide to create a new class:: class MessageGenerator { - public function getHappyMessage() + public function getHappyMessage(): string { $messages = [ 'You did it! You updated the system! Amazing!', @@ -118,9 +119,14 @@ it can't be re-used. Instead, you decide to create a new class:: Congratulations! You've created your first service class! You can use it immediately inside your controller:: + // src/Controller/ProductController.php use App\Service\MessageGenerator; + use Symfony\Component\HttpFoundation\Response; - public function new(MessageGenerator $messageGenerator) + /** + * @Route("/products/new") + */ + public function new(MessageGenerator $messageGenerator): Response { // thanks to the type-hint, the container will instantiate a // new MessageGenerator and pass it to you! @@ -241,7 +247,7 @@ and use it later:: $this->logger = $logger; } - public function getHappyMessage() + public function getHappyMessage(): string { $this->logger->info('About to find a happy message!'); // ... @@ -291,8 +297,8 @@ Handling Multiple Services Suppose you also want to email a site administrator each time a site update is made. To do that, you create a new class:: - // src/Updates/SiteUpdateManager.php - namespace App\Updates; + // src/Service/SiteUpdateManager.php + namespace App\Service; use App\Service\MessageGenerator; use Symfony\Component\Mailer\MailerInterface; @@ -309,7 +315,7 @@ made. To do that, you create a new class:: $this->mailer = $mailer; } - public function notifyOfSiteUpdate() + public function notifyOfSiteUpdate(): bool { $happyMessage = $this->messageGenerator->getHappyMessage(); @@ -322,6 +328,8 @@ made. To do that, you create a new class:: $this->mailer->send($email); // ... + + return true; } } @@ -334,7 +342,7 @@ you can type-hint the new ``SiteUpdateManager`` class and use it:: namespace App\Controller; // ... - use App\Updates\SiteUpdateManager; + use App\Service\SiteUpdateManager; public function new(SiteUpdateManager $siteUpdateManager) { @@ -361,7 +369,7 @@ example, suppose you want to make the admin email configurable: .. code-block:: diff - // src/Updates/SiteUpdateManager.php + // src/Service/SiteUpdateManager.php // ... class SiteUpdateManager @@ -369,21 +377,21 @@ example, suppose you want to make the admin email configurable: // ... + private $adminEmail; - - public function __construct(MessageGenerator $messageGenerator, \Swift_Mailer $mailer) - + public function __construct(MessageGenerator $messageGenerator, \Swift_Mailer $mailer, $adminEmail) + - public function __construct(MessageGenerator $messageGenerator, MailerInterface $mailer) + + public function __construct(MessageGenerator $messageGenerator, MailerInterface $mailer, $adminEmail) { // ... + $this->adminEmail = $adminEmail; } - public function notifyOfSiteUpdate() + public function notifyOfSiteUpdate(): bool { // ... - $message = \Swift_Message::newInstance() + $email = (new Email()) // ... - - ->setTo('manager@example.com') - + ->setTo($this->adminEmail) + - ->to('manager@example.com') + + ->to($this->adminEmail) // ... ; // ... @@ -392,7 +400,7 @@ example, suppose you want to make the admin email configurable: If you make this change and refresh, you'll see an error: - Cannot autowire service "App\Updates\SiteUpdateManager": argument "$adminEmail" + Cannot autowire service "App\Service\SiteUpdateManager": argument "$adminEmail" of method "__construct()" must have a type-hint or be given a value explicitly. That makes sense! There is no way that the container knows what value you want to @@ -412,7 +420,7 @@ pass here. No problem! In your configuration, you can explicitly set this argume exclude: '../src/{DependencyInjection,Entity,Migrations,Tests,Kernel.php}' # explicitly configure the service - App\Updates\SiteUpdateManager: + App\Service\SiteUpdateManager: arguments: $adminEmail: 'manager@example.com' @@ -436,7 +444,7 @@ pass here. No problem! In your configuration, you can explicitly set this argume /> - + manager@example.com @@ -447,7 +455,7 @@ pass here. No problem! In your configuration, you can explicitly set this argume // config/services.php namespace Symfony\Component\DependencyInjection\Loader\Configurator; - use App\Updates\SiteUpdateManager; + use App\Service\SiteUpdateManager; return function(ContainerConfigurator $configurator) { // ... @@ -877,7 +885,7 @@ But, if you *do* need to make a service public, override the ``public`` setting: # ... same code as before # explicitly configure the service - Acme\PublicService: + App\Service\PublicService: public: true .. code-block:: xml @@ -893,7 +901,7 @@ But, if you *do* need to make a service public, override the ``public`` setting: - + @@ -902,13 +910,13 @@ But, if you *do* need to make a service public, override the ``public`` setting: // config/services.php namespace Symfony\Component\DependencyInjection\Loader\Configurator; - use Acme\PublicService; + use App\Service\PublicService; return function(ContainerConfigurator $configurator) { // ... same as code before // explicitly configure the service - $services->set(PublicService::class) + $services->set(Service\PublicService::class) ->public() ; }; @@ -1087,7 +1095,7 @@ admin email. In this case, each needs to have a unique service id: # this is the service's id site_update_manager.superadmin: - class: App\Updates\SiteUpdateManager + class: App\Service\SiteUpdateManager # you CAN still use autowiring: we just want to show what it looks like without autowire: false # manually wire all arguments @@ -1097,7 +1105,7 @@ admin email. In this case, each needs to have a unique service id: - 'superadmin@example.com' site_update_manager.normal_users: - class: App\Updates\SiteUpdateManager + class: App\Service\SiteUpdateManager autowire: false arguments: - '@App\Service\MessageGenerator' @@ -1106,7 +1114,7 @@ admin email. In this case, each needs to have a unique service id: # Create an alias, so that - by default - if you type-hint SiteUpdateManager, # the site_update_manager.superadmin will be used - App\Updates\SiteUpdateManager: '@site_update_manager.superadmin' + App\Service\SiteUpdateManager: '@site_update_manager.superadmin' .. code-block:: xml @@ -1120,19 +1128,19 @@ admin email. In this case, each needs to have a unique service id: - + superadmin@example.com - + contact@example.com - + @@ -1142,7 +1150,7 @@ admin email. In this case, each needs to have a unique service id: namespace Symfony\Component\DependencyInjection\Loader\Configurator; use App\Service\MessageGenerator; - use App\Updates\SiteUpdateManager; + use App\Service\SiteUpdateManager; return function(ContainerConfigurator $configurator) { // ... diff --git a/testing.rst b/testing.rst index 98dde991f9a..4b64d504631 100644 --- a/testing.rst +++ b/testing.rst @@ -599,7 +599,7 @@ it via that alias: namespace Symfony\Component\DependencyInjection\Loader\Configurator; use App\Service\MessageGenerator; - use App\Updates\SiteUpdateManager; + use App\Service\SiteUpdateManager; return function(ContainerConfigurator $configurator) { // ... From c6b99a0013825e682716c1c5ae4f1d4022e61d38 Mon Sep 17 00:00:00 2001 From: Ruben Jacobs Date: Thu, 15 Oct 2020 20:59:31 +0200 Subject: [PATCH 0048/1045] Fix small typo --- reference/forms/types/options/choice_name.rst.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reference/forms/types/options/choice_name.rst.inc b/reference/forms/types/options/choice_name.rst.inc index a01341b5418..ed39bad5e9c 100644 --- a/reference/forms/types/options/choice_name.rst.inc +++ b/reference/forms/types/options/choice_name.rst.inc @@ -5,7 +5,7 @@ Controls the internal field name of the choice. You normally don't care about this, but in some advanced cases, you might. For example, this "name" becomes the index -of the choice views in the template and is used as part o the field name +of the choice views in the template and is used as part of the field name attribute. This can be a callable or a property path. See `choice_label`_ for similar usage. From 3892e26df91cd69892c9564571073a58b0a94a41 Mon Sep 17 00:00:00 2001 From: Wouter de Jong Date: Sun, 9 Aug 2020 16:20:30 +0200 Subject: [PATCH 0049/1045] 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 bde45969dbaf2316055a1104fa9c9948dce33ada Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Deruss=C3=A9?= Date: Fri, 16 Oct 2020 09:30:37 +0200 Subject: [PATCH 0050/1045] Fix example in lock --- lock.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lock.rst b/lock.rst index 72fb36dc779..51f375adc33 100644 --- a/lock.rst +++ b/lock.rst @@ -198,7 +198,7 @@ processes asking for the same ``$version``:: namespace App\Controller; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; - use Symfony\Component\Lock\LockInterface; + use Symfony\Component\Lock\LockFactory; class PdfController extends AbstractController { From a5d1355a9bdf468f17b81a1e46de036b5c51eb78 Mon Sep 17 00:00:00 2001 From: Denis Brumann Date: Fri, 16 Oct 2020 14:14:25 +0200 Subject: [PATCH 0051/1045] Add context for json encoding/decoding. --- components/serializer.rst | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/components/serializer.rst b/components/serializer.rst index 345642c9770..62752ebbb1b 100644 --- a/components/serializer.rst +++ b/components/serializer.rst @@ -810,7 +810,13 @@ The ``JsonEncoder`` ~~~~~~~~~~~~~~~~~~~ The ``JsonEncoder`` encodes to and decodes from JSON strings, based on the PHP -:phpfunction:`json_encode` and :phpfunction:`json_decode` functions. +:phpfunction:`json_encode` and :phpfunction:`json_decode` functions. It can be +useful to modify how these functions operate in certain instances by providing +options such as ``JSON_PRESERVE_ZERO_FRACTION``. You can use the serialization +context to pass in these options using the key ``json_encode_options`` or +``json_decode_options`` respectively:: + + $this->serializer->serialize($data, 'json', ['json_encode_options' => \JSON_PRESERVE_ZERO_FRACTION]); The ``CsvEncoder`` ~~~~~~~~~~~~~~~~~~~ From 8e1af9d7303d2c8e7fc7e84686df7c6f782f33fc Mon Sep 17 00:00:00 2001 From: Matthew Smeets Date: Thu, 15 Oct 2020 20:16:16 +0200 Subject: [PATCH 0052/1045] 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 0053/1045] 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 7e1d00dd3ff98c81ffe29fd9e6bdcade4c62874c Mon Sep 17 00:00:00 2001 From: Leo Date: Sat, 17 Oct 2020 14:27:52 +0200 Subject: [PATCH 0054/1045] Update doctrine.rts Query example in documentation has a missing `;` --- doctrine.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doctrine.rst b/doctrine.rst index 9a2ee33db89..bb27ad91bfa 100644 --- a/doctrine.rst +++ b/doctrine.rst @@ -780,7 +780,7 @@ based on PHP conditions):: ->orderBy('p.price', 'ASC'); if (!$includeUnavailableProducts) { - $qb->andWhere('p.available = TRUE') + $qb->andWhere('p.available = TRUE'); } $query = $qb->getQuery(); From 7b441a21ec1484849783b831daaee1689dd5d579 Mon Sep 17 00:00:00 2001 From: Ahmed bhs Date: Sat, 17 Oct 2020 18:29:43 +0200 Subject: [PATCH 0055/1045] Update messenger.rst --- messenger.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/messenger.rst b/messenger.rst index 7a4a9afccc2..a3510ba2af8 100644 --- a/messenger.rst +++ b/messenger.rst @@ -472,7 +472,7 @@ On production, there are a few important things to think about: process control system like :ref:`Supervisor `. **Don't Let Workers Run Forever** - Some services (like Doctrine's EntityManager) will consume more memory + Some services (like Doctrine's ``EntityManager``) will consume more memory over time. So, instead of allowing your worker to run forever, use a flag like ``messenger:consume --limit=10`` to tell your worker to only handle 10 messages before exiting (then Supervisor will create a new process). There From f1443d40d9baf703408efddc5dc925b60eb598ed Mon Sep 17 00:00:00 2001 From: Ahmed bhs Date: Sat, 17 Oct 2020 19:25:22 +0200 Subject: [PATCH 0056/1045] Update dumping-workflows.rst --- workflow/dumping-workflows.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/workflow/dumping-workflows.rst b/workflow/dumping-workflows.rst index 5b087fc405b..d1749603155 100644 --- a/workflow/dumping-workflows.rst +++ b/workflow/dumping-workflows.rst @@ -309,6 +309,6 @@ The PlantUML image will look like this: .. image:: /_images/components/workflow/pull_request_puml_styled.png -.. _`Graphviz`: http://www.graphviz.org +.. _`Graphviz`: https://www.graphviz.org .. _`PlantUML`: https://plantuml.com/ .. _`PlantUML's color list`: https://plantuml.com/color From a0b063b4a56670aa1c4f2e785f711d78a2d1ed3a Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Sun, 18 Oct 2020 18:34:59 +0200 Subject: [PATCH 0057/1045] Tweaks --- configuration.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/configuration.rst b/configuration.rst index 9e17b2f2f08..6efd3283733 100644 --- a/configuration.rst +++ b/configuration.rst @@ -388,7 +388,8 @@ set in the previous ones): #. ``config/packages/*.yaml`` (and ``*.xml`` and ``*.php`` files too); #. ``config/packages//*.yaml`` (and ``*.xml`` and ``*.php`` files too); #. ``config/services.yaml`` (and ``services.xml`` and ``services.php`` files too); -#. ``config/services_.yaml`` (and ``services_environment-name.xml`` and ``services_environment-name.php`` files too); +#. ``config/services_.yaml`` (and ``services_.xml`` + and ``services_.php`` files too). Take the ``framework`` package, installed by default, as an example: From 7e0a916092227a74bb113de8b320efdd08b7966c Mon Sep 17 00:00:00 2001 From: Marvin Hinz <35603466+marvinhinz@users.noreply.github.com> Date: Sun, 18 Oct 2020 21:08:44 +0200 Subject: [PATCH 0058/1045] Fix spelling in NotCompromisedPassword.rst --- reference/constraints/NotCompromisedPassword.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/reference/constraints/NotCompromisedPassword.rst b/reference/constraints/NotCompromisedPassword.rst index ffa9fe99d8d..1eded1463f9 100644 --- a/reference/constraints/NotCompromisedPassword.rst +++ b/reference/constraints/NotCompromisedPassword.rst @@ -83,7 +83,7 @@ The following constraint ensures that the ``rawPassword`` property of the In order to make the password validation, this constraint doesn't send the raw password value to the ``haveibeenpwned.com`` API. Instead, it follows a secure -process known as `k-anonimity password validation`_. +process known as `k-anonymity password validation`_. In practice, the raw password is hashed using SHA-1 and only the first bytes of the hash are sent. Then, the ``haveibeenpwned.com`` API compares those bytes @@ -134,4 +134,4 @@ publicly to consider it compromised. Think carefully before setting this option to a higher value because it could decrease the security of your application. .. _`haveibeenpwned.com`: https://haveibeenpwned.com/ -.. _`k-anonimity password validation`: https://blog.cloudflare.com/validating-leaked-passwords-with-k-anonymity/ +.. _`k-anonymity password validation`: https://blog.cloudflare.com/validating-leaked-passwords-with-k-anonymity/ From 6662660eb425865d8bc96828305478c8b16a491d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Backhaus?= Date: Mon, 19 Oct 2020 15:18:37 +0200 Subject: [PATCH 0059/1045] Adjust wording at Generating URLs At "Generating URLs in JavaScript" the Twig escape filter is called a escape function. However in context of Twig this is a filter and I guess it should use the right wording also in the Symfony docs. --- routing.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/routing.rst b/routing.rst index 9bd09e531cc..75755c31d40 100644 --- a/routing.rst +++ b/routing.rst @@ -1917,7 +1917,7 @@ Generating URLs in JavaScript If your JavaScript code is included in a Twig template, you can use the ``path()`` and ``url()`` Twig functions to generate the URLs and store them in -JavaScript variables. The ``escape()`` function is needed to escape any +JavaScript variables. The ``escape()`` filter is needed to escape any non-JavaScript-safe values: .. code-block:: html+twig From 1dee4f8abbd2325d2f5c3972de61025dfc1b34da Mon Sep 17 00:00:00 2001 From: Andrew Cherabaev Date: Mon, 19 Oct 2020 18:39:45 +0400 Subject: [PATCH 0060/1045] Update custom_constraint.rst Usage of self::class instead of get_class($this) --- validation/custom_constraint.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/validation/custom_constraint.rst b/validation/custom_constraint.rst index d2e7e148266..eebfd087fb0 100644 --- a/validation/custom_constraint.rst +++ b/validation/custom_constraint.rst @@ -45,7 +45,7 @@ has this default logic:: // in the base Symfony\Component\Validator\Constraint class public function validatedBy() { - return \get_class($this).'Validator'; + return static::class.'Validator'; } In other words, if you create a custom ``Constraint`` (e.g. ``MyConstraint``), From d13d6a7fd365e19281af536eb1a4bf7b1b35bba8 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Tue, 15 Oct 2019 11:15:25 +0200 Subject: [PATCH 0061/1045] Tweaked the middleware example in the Messenger component --- messenger.rst | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/messenger.rst b/messenger.rst index 66b7c376623..2999db21334 100644 --- a/messenger.rst +++ b/messenger.rst @@ -1544,12 +1544,15 @@ middleware and *only* include your own: messenger: buses: messenger.bus.default: + # disable the default middleware + default_middleware: false + + # and/or add your own middleware: # service ids that implement Symfony\Component\Messenger\Middleware\MiddlewareInterface - 'App\Middleware\MyMiddleware' - 'App\Middleware\AnotherMiddleware' - #default_middleware: false .. code-block:: xml @@ -1565,9 +1568,12 @@ middleware and *only* include your own: + + + + - @@ -1579,11 +1585,14 @@ middleware and *only* include your own: 'messenger' => [ 'buses' => [ 'messenger.bus.default' => [ + // disable the default middleware + 'default_middleware' => false, + + // and/or add your own 'middleware' => [ 'App\Middleware\MyMiddleware', 'App\Middleware\AnotherMiddleware', ], - 'default_middleware' => false, ], ], ], From 4155cc270069850a6281c5cb4566aa3d03d94bbd Mon Sep 17 00:00:00 2001 From: michel v Date: Tue, 20 Oct 2020 10:43:45 +0200 Subject: [PATCH 0062/1045] 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 b905b571fa8368f1b01600aaf337ae750a4d4956 Mon Sep 17 00:00:00 2001 From: Cristi Contiu Date: Sat, 8 Feb 2020 21:47:34 +0200 Subject: [PATCH 0063/1045] 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 0064/1045] 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 0065/1045] 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 0066/1045] [#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 526012ed7a9a1c1aac7c829fcb6f68e2aea67d93 Mon Sep 17 00:00:00 2001 From: Andrii Popov Date: Mon, 21 Oct 2019 21:00:22 +0300 Subject: [PATCH 0067/1045] [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 0068/1045] 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 0069/1045] 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 b56568416ffc59993c83007343c0750de519e935 Mon Sep 17 00:00:00 2001 From: Matthias Gutjahr Date: Wed, 21 Oct 2020 11:59:21 +0200 Subject: [PATCH 0070/1045] 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 ded882526e23c22d14455d2e6c191c93e979f5a6 Mon Sep 17 00:00:00 2001 From: Wouter de Jong Date: Wed, 21 Oct 2020 23:36:00 +0200 Subject: [PATCH 0071/1045] [#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 0072/1045] 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 f40ec08e5f39763dc62d8035fc228210605970c5 Mon Sep 17 00:00:00 2001 From: Oskar Stark Date: Thu, 22 Oct 2020 09:29:38 +0200 Subject: [PATCH 0073/1045] 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 0074/1045] 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 0075/1045] 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 0076/1045] =?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 0077/1045] [#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 0078/1045] 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 0079/1045] 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 0080/1045] 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 864cefbc7a34d3b313019f2c415e2a27d81ff4bd Mon Sep 17 00:00:00 2001 From: Zairig Imad Date: Tue, 9 Jun 2020 22:46:45 +0200 Subject: [PATCH 0081/1045] 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 0082/1045] 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 0083/1045] 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 745af3cc386fa7efd71a95f6d605138f692f8c21 Mon Sep 17 00:00:00 2001 From: Przemek Maszczynski Date: Thu, 22 Oct 2020 22:46:13 +0200 Subject: [PATCH 0084/1045] 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 3194c224966f6764057d166f7bf9997e689d77b5 Mon Sep 17 00:00:00 2001 From: Robin Chalas Date: Fri, 23 Oct 2020 13:51:30 +0200 Subject: [PATCH 0085/1045] [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 436e2fc6183b80a5f39300d329b654f607ad25d0 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Fri, 14 Aug 2020 15:06:43 +0200 Subject: [PATCH 0086/1045] [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 38da641b42976ddeef37903c4a0ddd64226f1bab Mon Sep 17 00:00:00 2001 From: Takashi Kanemoto Date: Sat, 24 Oct 2020 18:50:56 +0900 Subject: [PATCH 0087/1045] 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 0088/1045] 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 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 0089/1045] 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 0090/1045] 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 792968b78e2257368c6fb1dc3346d931a85c95fb Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Thu, 22 Oct 2020 13:02:02 +0200 Subject: [PATCH 0091/1045] 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 0092/1045] 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 0093/1045] 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 0094/1045] [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 0095/1045] 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 0096/1045] 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 d8658352e0cc152aa3ec1f5c9e006a3a1c54ca3f Mon Sep 17 00:00:00 2001 From: Quentin Dequippe Date: Thu, 29 Oct 2020 15:34:43 +0100 Subject: [PATCH 0097/1045] 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 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 0098/1045] [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 0099/1045] 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 0100/1045] 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 0101/1045] 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 0102/1045] 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 0103/1045] =?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 0104/1045] [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 0105/1045] 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 0106/1045] 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 0107/1045] 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 0108/1045] 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 0109/1045] 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 0110/1045] - --- 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 0111/1045] 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 0112/1045] 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 0113/1045] 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 958aeafd32cb4bd44aefb540efb59442911d3e1e Mon Sep 17 00:00:00 2001 From: Florian Hermann Date: Tue, 3 Nov 2020 16:47:40 +0100 Subject: [PATCH 0114/1045] 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 3abecebd33c11c0373a775f0b9de1d0c491798e4 Mon Sep 17 00:00:00 2001 From: Thibaut Cheymol Date: Sun, 4 Oct 2020 22:53:49 +0200 Subject: [PATCH 0115/1045] [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 0116/1045] [#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 9176faa6375ed46433c14487f9753425b75f1cef Mon Sep 17 00:00:00 2001 From: LucileDT Date: Wed, 13 May 2020 17:56:48 +0200 Subject: [PATCH 0117/1045] 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 0118/1045] 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 d397c38b43ba4fddcc49326ae1d415049e805d69 Mon Sep 17 00:00:00 2001 From: Wouter de Jong Date: Thu, 5 Nov 2020 18:47:02 +0100 Subject: [PATCH 0119/1045] 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 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 0120/1045] [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 66491462f0cc583c4b4fab40c7901bd3dcf84d51 Mon Sep 17 00:00:00 2001 From: Greg Suraci Date: Tue, 10 Nov 2020 08:11:38 +0100 Subject: [PATCH 0121/1045] 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 beea71cbcbac5af0104886aee217968981bfc1a2 Mon Sep 17 00:00:00 2001 From: Kamil P Date: Mon, 9 Nov 2020 09:09:22 +0100 Subject: [PATCH 0122/1045] 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')) %}

          Welcome {{ username }}!

          {# ... #} {% endapply %} From 2062d4aba76006465689198102bbe69f8d69c68f Mon Sep 17 00:00:00 2001 From: Oskar Stark Date: Thu, 12 Nov 2020 09:58:52 +0100 Subject: [PATCH 0123/1045] Minor: Fix namespace --- mailer.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mailer.rst b/mailer.rst index ac83f41fe1e..025a5c43813 100644 --- a/mailer.rst +++ b/mailer.rst @@ -586,7 +586,7 @@ arguments to the filter: .. code-block:: html+twig - {% apply inline_css(source('@styles/email.css')) %} + {% apply inline_css(source('@css/email.css')) %}

          Welcome {{ username }}!

          {# ... #} {% endapply %} From b3ef599517f14edf6be9ec602faa3c97f51512ac Mon Sep 17 00:00:00 2001 From: Youssef Benhssaien Date: Wed, 11 Nov 2020 08:44:53 +0100 Subject: [PATCH 0124/1045] 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 0125/1045] 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 0126/1045] 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 0127/1045] 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 0128/1045] 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 da74408ae32e30e55f527915feb48bec6b5bd724 Mon Sep 17 00:00:00 2001 From: Oskar Stark Date: Thu, 12 Nov 2020 14:37:29 +0100 Subject: [PATCH 0129/1045] 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 0130/1045] 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 0131/1045] 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 0132/1045] [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 2496ee7b29ea29da22f3da1b2dec6ea062c38dfe Mon Sep 17 00:00:00 2001 From: Arman Hosseini Date: Sun, 15 Nov 2020 02:16:52 +0330 Subject: [PATCH 0133/1045] 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 0134/1045] [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 0135/1045] 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 0136/1045] 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 4129e8ece169f80d10741eb2baf2b7ab5af1fb6a Mon Sep 17 00:00:00 2001 From: jmsche Date: Mon, 16 Nov 2020 11:20:31 +0100 Subject: [PATCH 0137/1045] [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 0138/1045] [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 0139/1045] 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 0140/1045] 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 0141/1045] 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 0142/1045] 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 c5dbbd7c07e9c852a3bba6f0edc6fb9bac9612f6 Mon Sep 17 00:00:00 2001 From: Wouter de Jong Date: Wed, 18 Nov 2020 10:54:29 +0100 Subject: [PATCH 0143/1045] [#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 035335cb0ec35b73034f624cb7f9837486efc00d Mon Sep 17 00:00:00 2001 From: Wouter de Jong Date: Wed, 18 Nov 2020 12:59:08 +0100 Subject: [PATCH 0144/1045] 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 b47ccb91e9e27ea02a5ca52fdd09f90fcb4adf8d Mon Sep 17 00:00:00 2001 From: Abdouni Abdelkarim Date: Thu, 19 Nov 2020 01:59:09 +0100 Subject: [PATCH 0145/1045] 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 0146/1045] 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"> bar string @@ -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 0147/1045] 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 0148/1045] 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 6e2a758b75744cca019edeab55fd651800236fd0 Mon Sep 17 00:00:00 2001 From: Romain Monteil Date: Thu, 19 Nov 2020 17:29:25 +0100 Subject: [PATCH 0149/1045] 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/1045] 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 3daed4a14bfeafe81b4af834778b3ff81b758dfe Mon Sep 17 00:00:00 2001 From: Oskar Stark Date: Fri, 20 Nov 2020 09:02:29 +0100 Subject: [PATCH 0151/1045] 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 0152/1045] 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 0153/1045] 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 3d274edd4b86473e7eb7275c89b0731fb6067294 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Fri, 20 Nov 2020 16:13:49 +0100 Subject: [PATCH 0154/1045] 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 0155/1045] 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 0156/1045] 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 0157/1045] 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 0158/1045] 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 0159/1045] [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 0160/1045] 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 0161/1045] [#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 - admin@symfony.com - lead@symfony.com + admin@symfony.com + lead@symfony.com From 34ad0b779d7a2fde362d86a0032732defb0e1539 Mon Sep 17 00:00:00 2001 From: Wouter de Jong Date: Sat, 21 Nov 2020 20:47:25 +0100 Subject: [PATCH 0162/1045] [#14083] Revert mailer.headers option in 4.4 - 5.1 --- reference/configuration/framework.rst | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/reference/configuration/framework.rst b/reference/configuration/framework.rst index a1692037b12..e61e0e1365d 100644 --- a/reference/configuration/framework.rst +++ b/reference/configuration/framework.rst @@ -160,8 +160,6 @@ Configuration * `sender`_ * `recipients`_ - * :ref:`headers ` - * `php_errors`_ * `log`_ @@ -2996,16 +2994,6 @@ recipients set in the code. ]); }; -.. _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 5e21b791992e8534ac28c94df453fda0e0a6c621 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Sat, 21 Nov 2020 19:45:29 +0100 Subject: [PATCH 0163/1045] Added a new troubleshooting section in the maintainer guide --- _build/maintainer_guide.rst | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/_build/maintainer_guide.rst b/_build/maintainer_guide.rst index 7eff3143941..f5913a8e811 100644 --- a/_build/maintainer_guide.rst +++ b/_build/maintainer_guide.rst @@ -335,6 +335,23 @@ in the tree as follows: $ git push origin $ git push upstream +Merging in the wrong branch +........................... + +A Pull Request was made against ``5.x`` but it should be merged in ``5.1`` and you +forgot to merge as ``gh merge NNNNN -s 5.1`` to change the merge branch. Solution: + +.. code-block:: terminal + + $ git checkout 5.1 + $ git cherry-pick -m 1 + $ git checkout 5.x + $ git revert -m 1 + # now continue with the normal "upmerging" + $ git checkout 5.2 + $ git merge 5.1 + $ ... + .. _`symfony/symfony-docs`: https://github.com/symfony/symfony-docs .. _`Symfony Docs team`: https://github.com/orgs/symfony/teams/team-symfony-docs .. _`Symfony's respectful review comments`: https://symfony.com/doc/current/contributing/community/review-comments.html From 444072509418d6e63acee31efbc18477eb8e5d2b Mon Sep 17 00:00:00 2001 From: Youssef Benhssaien Date: Sun, 15 Nov 2020 22:18:17 +0100 Subject: [PATCH 0164/1045] Section method only in ConsoleOutputInterface --- console.rst | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/console.rst b/console.rst index ad9bb8c16e6..f49296cd47f 100644 --- a/console.rst +++ b/console.rst @@ -181,8 +181,18 @@ which returns an instance of { protected function execute(InputInterface $input, OutputInterface $output) { + // The section() method is only available in classes that implement ConsoleOutputInterface + if (!$output instanceof ConsoleOutputInterface) { + throw new LogicException(sprintf( + 'This command accepts only an instance of "%s", an instance of "%s" is given', + ConsoleOutputInterface::class, + \get_class($output) + )); + } + $section1 = $output->section(); $section2 = $output->section(); + $section1->writeln('Hello'); $section2->writeln('World!'); // Output displays "Hello\nWorld!\n" From 73f02f17d5e0ea2044e83f393dddd48f4d5a6711 Mon Sep 17 00:00:00 2001 From: Wouter de Jong Date: Sun, 22 Nov 2020 12:51:16 +0100 Subject: [PATCH 0165/1045] [#14550] Reduce nr of lines used for exception --- console.rst | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/console.rst b/console.rst index f49296cd47f..f14765ce624 100644 --- a/console.rst +++ b/console.rst @@ -173,21 +173,19 @@ called "output sections". Create one or more of these sections when you need to clear and overwrite the output information. Sections are created with the -:method:`Symfony\\Component\\Console\\Output\\ConsoleOutput::section` method, -which returns an instance of +:method:`ConsoleOutput::section() ` +method, which returns an instance of :class:`Symfony\\Component\\Console\\Output\\ConsoleSectionOutput`:: + // ... + use Symfony\Component\Console\Output\ConsoleOutputInterface; + class MyCommand extends Command { protected function execute(InputInterface $input, OutputInterface $output) { - // The section() method is only available in classes that implement ConsoleOutputInterface if (!$output instanceof ConsoleOutputInterface) { - throw new LogicException(sprintf( - 'This command accepts only an instance of "%s", an instance of "%s" is given', - ConsoleOutputInterface::class, - \get_class($output) - )); + throw new \LogicException('This command accepts only an instance of "ConsoleOutputInterface".'); } $section1 = $output->section(); From 62c7f2b6ba2ff1a229dc62c3b8b831cdb2378dd9 Mon Sep 17 00:00:00 2001 From: Martin Hujer Date: Thu, 21 Nov 2019 22:17:29 +0100 Subject: [PATCH 0166/1045] Security: add example code which Maker Bundle generated See #11265 --- security.rst | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 53 insertions(+), 1 deletion(-) diff --git a/security.rst b/security.rst index ebeca1b9b5b..070c18b687c 100644 --- a/security.rst +++ b/security.rst @@ -96,7 +96,59 @@ optional features, like :doc:`remember me ` and :doc:`impersonation `. Fortunately, the ``make:user`` command already configured one for you in your -``security.yaml`` file under the ``providers`` key. +``security.yaml`` file under the ``providers`` key: + +.. configuration-block:: + + .. code-block:: yaml + + # config/packages/security.yaml + security: + # ... + + providers: + # used to reload user from session & other features (e.g. switch_user) + app_user_provider: + entity: + class: App\Entity\User + property: email + + .. code-block:: xml + + + + + + + + + + + + + + .. code-block:: php + + // config/packages/security.php + use App\Entity\User; + + $container->loadFromExtension('security', [ + // ... + + 'providers' => [ + // used to reload user from session & other features (e.g. switch_user) + 'app_user_provider' => [ + 'entity' => [ + 'class' => User::class, + 'property' => 'email', + ], + ], + ], + ]); If your ``User`` class is an entity, you don't need to do anything else. But if your class is *not* an entity, then ``make:user`` will also have generated a From d291a99ee339d3b4b0fb33c825f2a76b6ce867be Mon Sep 17 00:00:00 2001 From: CvekCoding <36374606+CvekCoding@users.noreply.github.com> Date: Mon, 24 Feb 2020 21:16:59 +0300 Subject: [PATCH 0167/1045] Bus restricting with Interfaces Proposed more flexible way to restrict handlers with buses - use interfaces for this. --- messenger/multiple_buses.rst | 79 +++++++++++++++++++++--------------- service_container/tags.rst | 2 + 2 files changed, 48 insertions(+), 33 deletions(-) diff --git a/messenger/multiple_buses.rst b/messenger/multiple_buses.rst index 5136553dac2..c79aeb7b2b7 100644 --- a/messenger/multiple_buses.rst +++ b/messenger/multiple_buses.rst @@ -150,30 +150,30 @@ you can restrict each handler to a specific bus using the ``messenger.message_ha This way, the ``App\MessageHandler\SomeCommandHandler`` handler will only be known by the ``command.bus`` bus. -You can also automatically add this tag to a number of classes by following -a naming convention and registering all of the handler services by name with -the correct tag: +You can also automatically add this tag to a number of classes by using +the :ref:`_instanceof service configuration `. Using this, +you can determine the message bus based on an implemented interface: .. configuration-block:: .. code-block:: yaml # config/services.yaml + services: + # ... + + _instanceof: + # all services implementing the CommandHandlerInterface + # will be registered on the command.bus bus + App\MessageHandler\CommandHandlerInterface: + tags: + - { name: messenger.message_handler, bus: command.bus } - # put this after the "App\" line that registers all your services - command_handlers: - namespace: App\MessageHandler\ - resource: '%kernel.project_dir%/src/MessageHandler/*CommandHandler.php' - autoconfigure: false - tags: - - { name: messenger.message_handler, bus: command.bus } - - query_handlers: - namespace: App\MessageHandler\ - resource: '%kernel.project_dir%/src/MessageHandler/*QueryHandler.php' - autoconfigure: false - tags: - - { name: messenger.message_handler, bus: query.bus } + # while those implementing QueryHandlerInterface will be + # registered on the query.bus bus + App\MessageHandler\QueryHandlerInterface: + tags: + - { name: messenger.message_handler, bus: query.bus } .. code-block:: xml @@ -185,32 +185,45 @@ the correct tag: https://symfony.com/schema/dic/services/services-1.0.xsd"> - - + + + + - - - + + + + - + .. code-block:: php // config/services.php + namespace Symfony\Component\DependencyInjection\Loader\Configurator; - // Command handlers - $container->services() - ->load('App\MessageHandler\\', '%kernel.project_dir%/src/MessageHandler/*CommandHandler.php') - ->autoconfigure(false) - ->tag('messenger.message_handler', ['bus' => 'command.bus']); + use App\MessageHandler\CommandHandlerInterface; + use App\MessageHandler\QueryHandlerInterface; - // Query handlers - $container->services() - ->load('App\MessageHandler\\', '%kernel.project_dir%/src/MessageHandler/*QueryHandler.php') - ->autoconfigure(false) - ->tag('messenger.message_handler', ['bus' => 'query.bus']); + return function(ContainerConfigurator $configurator) { + $services = $configurator->services(); + + // ... + + // all services implementing the CommandHandlerInterface + // will be registered on the command.bus bus + $services->instanceof(CommandHandlerInterface::class) + ->tag('messenger.message_handler', ['bus' => 'command.bus']); + + // while those implementing QueryHandlerInterface will be + // registered on the query.bus bus + $services->instanceof(QueryHandlerInterface::class) + ->tag('messenger.message_handler', ['bus' => 'query.bus']); + }; Debugging the Buses ------------------- diff --git a/service_container/tags.rst b/service_container/tags.rst index 8bddd65c795..2f60f369b97 100644 --- a/service_container/tags.rst +++ b/service_container/tags.rst @@ -60,6 +60,8 @@ and many tags require additional arguments (beyond the ``name`` parameter). **For most users, this is all you need to know**. If you want to go further and learn how to create your own custom tags, keep reading. +.. _di-instanceof: + Autoconfiguring Tags -------------------- From e059c5b1cff73ed25b0a0cba22402001b11b0959 Mon Sep 17 00:00:00 2001 From: Ben Davies Date: Mon, 10 Feb 2020 13:11:49 +0000 Subject: [PATCH 0168/1045] GitHub Actions: use docker container for CI build --- .github/workflows/ci.yaml | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 881b171ce10..8dbda8b72d8 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -14,30 +14,22 @@ jobs: runs-on: ubuntu-latest + container: python:3.7-alpine + steps: - name: "Checkout" uses: actions/checkout@v2 - - name: "Set up Python 3.7" - uses: actions/setup-python@v1 - with: - python-version: '3.7' # Semantic version range syntax or exact version of a Python version - - name: "Display Python version" run: python -c "import sys; print(sys.version)" - - name: "Install Sphinx dependencies" - run: sudo apt-get install python-dev build-essential + - name: "Install Sphinx" + run: pip install --user sphinx - - name: "Cache pip" - uses: actions/cache@v2 - with: - path: ~/.cache/pip - key: ${{ runner.os }}-pip-${{ hashFiles('_build/.requirements.txt') }} - restore-keys: | - ${{ runner.os }}-pip- + - name: "Install dependencies" + run: apk add --no-cache git make - - name: "Install Sphinx + requirements via pip" + - name: "Install custom requirements via pip" run: pip install -r _build/.requirements.txt - name: "Build documentation" From 935fa86e7b21988dd8bfc17ad9afc6d0605cdfff Mon Sep 17 00:00:00 2001 From: Oskar Stark Date: Mon, 23 Nov 2020 08:57:58 +0100 Subject: [PATCH 0169/1045] Enhancement: Streamline workflow --- .github/workflows/ci.yaml | 72 +++++++++++++++++++-------------------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 8dbda8b72d8..f6cc2cff17d 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -1,3 +1,5 @@ +name: CI + on: push: branches-ignore: @@ -6,11 +8,9 @@ on: branches-ignore: - 'github-comments' -name: CI - jobs: - build: - name: Build + sphinx-build: + name: Build (Sphinx) runs-on: ubuntu-latest @@ -35,46 +35,46 @@ jobs: - name: "Build documentation" run: make -C _build SPHINXOPTS="-nqW -j auto" html - build-php: - name: Symfony doc builder + symfony-docs-builder-build: + name: Build (symfony/docs-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 + - 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 + name: Lint (DOCtor-RST) runs-on: ubuntu-latest From 17f9fbf0481b68cb8c87011fbb3c3aa5b08fd464 Mon Sep 17 00:00:00 2001 From: concilioinvest Date: Mon, 23 Nov 2020 22:22:25 +0100 Subject: [PATCH 0170/1045] Update event_dispatcher.rst It must be the `tag` method. --- event_dispatcher.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/event_dispatcher.rst b/event_dispatcher.rst index 3462659efb5..2b95a637e28 100644 --- a/event_dispatcher.rst +++ b/event_dispatcher.rst @@ -109,7 +109,7 @@ using a special "tag": use App\EventListener\ExceptionListener; $container->register(ExceptionListener::class) - ->addTag('kernel.event_listener', ['event' => 'kernel.exception']) + ->tag('kernel.event_listener', ['event' => 'kernel.exception']) ; Symfony follows this logic to decide which method to call inside the event From 322ce95fbfbcebbac88f06572518326ece0249a2 Mon Sep 17 00:00:00 2001 From: Fabien Salathe Date: Tue, 24 Nov 2020 11:58:07 +0100 Subject: [PATCH 0171/1045] Remove wrong "method" tag Method tag is not needed when the processor is invokable, here it would call `processRecord` which doesn't exist --- logging/processors.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/logging/processors.rst b/logging/processors.rst index 9f46326ddaa..5f1e27834b5 100644 --- a/logging/processors.rst +++ b/logging/processors.rst @@ -103,7 +103,7 @@ information: $container ->register(SessionRequestProcessor::class) - ->addTag('monolog.processor', ['method' => 'processRecord']); + ->addTag('monolog.processor'); Finally, set the formatter to be used on whatever handler you want: From 691ed5fb2d94c775f08b7feece3833d1ba4f0dd7 Mon Sep 17 00:00:00 2001 From: Antoine Makdessi Date: Tue, 24 Nov 2020 17:08:33 +0100 Subject: [PATCH 0172/1045] Update event_dispatcher.rst --- 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 0344acf4e8e..ef0392e6dfc 100644 --- a/components/event_dispatcher.rst +++ b/components/event_dispatcher.rst @@ -313,7 +313,7 @@ order. Start by creating this custom event class and documenting it:: $this->order = $order; } - public function getOrder() + public function getOrder(): Order { return $this->order; } From 1aabce3c0d09b63ca8a6fb8c73dda47ce0a47ac9 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Sat, 21 Nov 2020 11:56:23 +0100 Subject: [PATCH 0173/1045] Add a note about exposing env vars for unrecognized Docker services --- setup/symfony_server.rst | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/setup/symfony_server.rst b/setup/symfony_server.rst index 0f4d88904d6..bd3a6718664 100644 --- a/setup/symfony_server.rst +++ b/setup/symfony_server.rst @@ -299,6 +299,9 @@ project. It understands that this is a MySQL service and creates environment variables accordingly with the service name (``database``) as a prefix: ``DATABASE_URL``, ``DATABASE_HOST``, ... +If the service is not in the supported list below, generic environment +variables are set: ``PORT``, ``IP``, and ``HOST``. + If the ``docker-compose.yaml`` names do not match Symfony's conventions, add a label to override the environment variables prefix: @@ -361,6 +364,20 @@ When Docker services are running, browse a page of your Symfony application and check the "Symfony Server" section in the web debug toolbar; you'll see that "Docker Compose" is "Up". +.. note:: + + If you don't want environment variables to be exposed for a service, set + the ``com.symfony.server.service-ignore`` label to ``true``: + + .. code-block:: yaml + + # docker-compose.yaml + services: + db: + ports: [3306] + labels: + com.symfony.server.service-ignore: true + If your Docker Compose file is not at the root of the project, use the ``COMPOSE_FILE`` and ``COMPOSE_PROJECT_NAME`` environment variables to define its location, same as for ``docker-compose``: From a18ef8d7c1aef993f69e76bca3423d245bbc932f Mon Sep 17 00:00:00 2001 From: postal Date: Wed, 25 Nov 2020 11:52:14 +0100 Subject: [PATCH 0174/1045] A method call is reversed The order of the methods is reversed. The method "advance()" must be called after the "setMessage()". --- components/console/helpers/progressbar.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/console/helpers/progressbar.rst b/components/console/helpers/progressbar.rst index 1aa4dbfc6e2..c8ef2f25a1f 100644 --- a/components/console/helpers/progressbar.rst +++ b/components/console/helpers/progressbar.rst @@ -362,8 +362,8 @@ placeholder before displaying the progress bar:: $progressBar->start(); // 0/100 -- Start - $progressBar->advance(); $progressBar->setMessage('Task is in progress...'); + $progressBar->advance(); // 1/100 -- Task is in progress... Messages can be combined with custom placeholders too. In this example, the From be63d709faaef0afde617d18a000b2b1b9fe7023 Mon Sep 17 00:00:00 2001 From: Oskar Stark Date: Wed, 25 Nov 2020 15:59:25 +0100 Subject: [PATCH 0175/1045] Enhancement: Add /me to the CODEOWNERS file for GithubActions workflows --- .github/CODEOWNERS | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 51ce53a1a89..9eb5d91783b 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1,3 +1,6 @@ +# GithubActions workflows +/.github/workflows* @OskarStark + # Console /console* @chalasr /components/console* @chalasr From 6b4bee4d17742e7c606f42685c7400531fca0110 Mon Sep 17 00:00:00 2001 From: Steven DUBOIS Date: Wed, 25 Nov 2020 16:41:57 +0100 Subject: [PATCH 0176/1045] Update events.rst --- doctrine/events.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doctrine/events.rst b/doctrine/events.rst index 309d10a7e12..c98be25d736 100644 --- a/doctrine/events.rst +++ b/doctrine/events.rst @@ -16,7 +16,7 @@ on other common tasks (e.g. ``loadClassMetadata``, ``onClear``). There are different ways to listen to these Doctrine events: -* **Lifecycle callbacks**, they are defined as methods on the entity classes and +* **Lifecycle callbacks**, they are defined as public methods on the entity classes and they are called when the events are triggered; * **Lifecycle listeners and subscribers**, they are classes with callback methods for one or more events and they are called for all entities; @@ -46,7 +46,7 @@ to learn everything about them. Doctrine Lifecycle Callbacks ---------------------------- -Lifecycle callbacks are defined as methods inside the entity you want to modify. +Lifecycle callbacks are defined as public methods inside the entity you want to modify. For example, suppose you want to set a ``createdAt`` date column to the current date, but only when the entity is first persisted (i.e. inserted). To do so, define a callback for the ``prePersist`` Doctrine event: From deec89a9352a62842553264327619c1ce32c3ab8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Malte=20Schlu=CC=88ter?= Date: Thu, 26 Nov 2020 00:20:46 +0100 Subject: [PATCH 0177/1045] Delete duplicated words --- 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 2f60f369b97..db648334625 100644 --- a/service_container/tags.rst +++ b/service_container/tags.rst @@ -788,7 +788,7 @@ indexed by the ``key`` attribute: After compilation the ``HandlerCollection`` is able to iterate over your application handlers. To retrieve a specific service by it's ``key`` attribute -from the iterator, we can use ``iterator_to_array`` and retrieve the ``handler_two``: +from the iterator, we can use ``iterator_to_array`` to get an array and then retrieve the ``handler_two`` handler:: // src/Handler/HandlerCollection.php From f1f44c4eaed18edc03e2f7b7360f7a5ad4cf6276 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Thu, 26 Nov 2020 10:55:19 +0100 Subject: [PATCH 0178/1045] Tweaks --- service_container/tags.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/service_container/tags.rst b/service_container/tags.rst index db648334625..23dd6472422 100644 --- a/service_container/tags.rst +++ b/service_container/tags.rst @@ -787,9 +787,9 @@ indexed by the ``key`` attribute: }; After compilation the ``HandlerCollection`` is able to iterate over your -application handlers. To retrieve a specific service by it's ``key`` attribute -from the iterator, we can use ``iterator_to_array`` -to get an array and then retrieve the ``handler_two`` handler:: +application handlers. To retrieve a specific service from the iterator, call the +``iterator_to_array()`` function and then use the ``key`` attribute to get the +array element. For example, to retrieve the ``handler_two`` handler:: // src/Handler/HandlerCollection.php namespace App\Handler; From dd8afa5117cf762f65c6333e09111976116c246b Mon Sep 17 00:00:00 2001 From: Antoine Makdessi Date: Thu, 26 Nov 2020 11:09:04 +0100 Subject: [PATCH 0179/1045] Update performance.rst --- performance.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/performance.rst b/performance.rst index de0d7883a04..8d3eb05d2c0 100644 --- a/performance.rst +++ b/performance.rst @@ -209,6 +209,8 @@ deployment process too): used in your application and prevents Composer from scanning the file system for classes that are not found in the class map. (see: `Composer's autoloader optimization`_). +You can also use the ``--classmap-authoritative`` option with the ``composer install`` command. + .. _profiling-applications: Profiling Symfony Applications From 7c9ffd764ec1d5a9071ade291543935220cd0f6e Mon Sep 17 00:00:00 2001 From: Thomas Landauer Date: Fri, 27 Nov 2020 00:11:24 +0100 Subject: [PATCH 0180/1045] Fixing uppercase typo --- validation/custom_constraint.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/validation/custom_constraint.rst b/validation/custom_constraint.rst index eebfd087fb0..72bd3d17599 100644 --- a/validation/custom_constraint.rst +++ b/validation/custom_constraint.rst @@ -1,7 +1,7 @@ .. index:: single: Validation; Custom constraints -How to Create a custom Validation Constraint +How to Create a Custom Validation Constraint ============================================ You can create a custom constraint by extending the base constraint class, From 1ffc0f7208d11859b78257ec9a22ae56b80b5250 Mon Sep 17 00:00:00 2001 From: Abdouni Abdelkarim Date: Fri, 27 Nov 2020 09:52:07 +0100 Subject: [PATCH 0181/1045] Update database.rst hello, i add missing quotes. --- testing/database.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/database.rst b/testing/database.rst index d2e0b18f24c..7e3acfd1db7 100644 --- a/testing/database.rst +++ b/testing/database.rst @@ -15,7 +15,7 @@ your project and define the new value for the ``DATABASE_URL`` env var: .. code-block:: bash # .env.test.local - DATABASE_URL=mysql://USERNAME:PASSWORD@127.0.0.1:3306/DB_NAME?serverVersion=5.7 + DATABASE_URL="mysql://USERNAME:PASSWORD@127.0.0.1:3306/DB_NAME?serverVersion=5.7" .. tip:: From 36b380cae21ef5bd0a572f49653ba904d7a71f93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Malte=20Schl=C3=BCter?= Date: Fri, 27 Nov 2020 12:08:18 +0100 Subject: [PATCH 0182/1045] Fix code example In the code example is a colon instead of semicolon at the end of line --- 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 23dd6472422..bf8f6959db4 100644 --- a/service_container/tags.rst +++ b/service_container/tags.rst @@ -800,7 +800,7 @@ array element. For example, to retrieve the ``handler_two`` handler:: { $handlers = iterator_to_array($handlers); - $handlerTwo = $handlers['handler_two']: + $handlerTwo = $handlers['handler_two']; } } From b407b347fca1692a83204a6e310b56abea424ffb Mon Sep 17 00:00:00 2001 From: Thomas Landauer Date: Fri, 27 Nov 2020 00:56:38 +0100 Subject: [PATCH 0183/1045] [Validator] Removing the recommended `Constraints` subdirectory --- validation/custom_constraint.rst | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/validation/custom_constraint.rst b/validation/custom_constraint.rst index eebfd087fb0..26a447042ad 100644 --- a/validation/custom_constraint.rst +++ b/validation/custom_constraint.rst @@ -14,8 +14,8 @@ Creating the Constraint Class First you need to create a Constraint class and extend :class:`Symfony\\Component\\Validator\\Constraint`:: - // src/Validator/Constraints/ContainsAlphanumeric.php - namespace App\Validator\Constraints; + // src/Validator/ContainsAlphanumeric.php + namespace App\Validator; use Symfony\Component\Validator\Constraint; @@ -54,8 +54,8 @@ when actually performing the validation. The validator class only has one required method ``validate()``:: - // src/Validator/Constraints/ContainsAlphanumericValidator.php - namespace App\Validator\Constraints; + // src/Validator/ContainsAlphanumericValidator.php + namespace App\Validator; use Symfony\Component\Validator\Constraint; use Symfony\Component\Validator\ConstraintValidator; @@ -71,7 +71,7 @@ The validator class only has one required method ``validate()``:: } // custom constraints should ignore null and empty values to allow - // other constraints (NotBlank, NotNull, etc.) take care of that + // other constraints (NotBlank, NotNull, etc.) to take care of that if (null === $value || '' === $value) { return; } @@ -117,7 +117,7 @@ You can use custom validators like the ones provided by Symfony itself: // src/Entity/AcmeEntity.php namespace App\Entity; - use App\Validator\Constraints as AcmeAssert; + use App\Validator as AcmeAssert; use Symfony\Component\Validator\Constraints as Assert; class AcmeEntity @@ -140,7 +140,7 @@ You can use custom validators like the ones provided by Symfony itself: properties: name: - NotBlank: ~ - - App\Validator\Constraints\ContainsAlphanumeric: ~ + - App\Validator\ContainsAlphanumeric: ~ .. code-block:: xml @@ -153,7 +153,7 @@ You can use custom validators like the ones provided by Symfony itself: - + @@ -163,7 +163,7 @@ You can use custom validators like the ones provided by Symfony itself: // src/Entity/AcmeEntity.php namespace App\Entity; - use App\Validator\Constraints\ContainsAlphanumeric; + use App\Validator\ContainsAlphanumeric; use Symfony\Component\Validator\Constraints\NotBlank; use Symfony\Component\Validator\Mapping\ClassMetadata; @@ -241,13 +241,13 @@ not to the property: # config/validator/validation.yaml App\Entity\AcmeEntity: constraints: - - App\Validator\Constraints\ProtocolClass: ~ + - App\Validator\ProtocolClass: ~ .. code-block:: xml - + .. code-block:: php @@ -255,7 +255,7 @@ not to the property: // src/Entity/AcmeEntity.php namespace App\Entity; - use App\Validator\Constraints\ProtocolClass; + use App\Validator\ProtocolClass; use Symfony\Component\Validator\Mapping\ClassMetadata; class AcmeEntity From 6ba56354f37add74088b4d1a4edc058ce12c941d Mon Sep 17 00:00:00 2001 From: sebpacz <74934099+sebpacz@users.noreply.github.com> Date: Fri, 27 Nov 2020 15:09:54 +0100 Subject: [PATCH 0184/1045] Update index.rst This is a very small change. I suggest replacing "function" with "functions" because each of these helpers offer more than one function. The word "functions" seems more appropriate. --- components/console/helpers/index.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/console/helpers/index.rst b/components/console/helpers/index.rst index 87c62ca7629..5f328d47472 100644 --- a/components/console/helpers/index.rst +++ b/components/console/helpers/index.rst @@ -15,6 +15,6 @@ The Console Helpers debug_formatter The Console component comes with some useful helpers. These helpers contain -function to ease some common tasks. +functions to ease some common tasks. .. include:: map.rst.inc From 74e2a7fb64bbdf7bffcc76688f6aae7fb27b2b93 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Fri, 27 Nov 2020 17:37:01 +0100 Subject: [PATCH 0185/1045] Rewords --- performance.rst | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/performance.rst b/performance.rst index 8d3eb05d2c0..46ed5b9c7f8 100644 --- a/performance.rst +++ b/performance.rst @@ -189,14 +189,14 @@ such as Symfony projects, should use at least these values: Optimize Composer Autoloader ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -The class loader used while developing the application is optimized to find -new and changed classes. In production servers, PHP files should never change, +The class loader used while developing the application is optimized to find new +and changed classes. In production servers, PHP files should never change, unless a new application version is deployed. That's why you can optimize -Composer's autoloader to scan the entire application once and build a "class map", -which is a big array of the locations of all the classes and it's stored -in ``vendor/composer/autoload_classmap.php``. +Composer's autoloader to scan the entire application once and build an +optimized "class map", which is a big array of the locations of all the classes +and it's stored in ``vendor/composer/autoload_classmap.php``. -Execute this command to generate the class map (and make it part of your +Execute this command to generate the new class map (and make it part of your deployment process too): .. code-block:: terminal @@ -209,8 +209,6 @@ deployment process too): used in your application and prevents Composer from scanning the file system for classes that are not found in the class map. (see: `Composer's autoloader optimization`_). -You can also use the ``--classmap-authoritative`` option with the ``composer install`` command. - .. _profiling-applications: Profiling Symfony Applications From cc151fc41aaae8e91387f7d28d3bf8c37d35a3ee Mon Sep 17 00:00:00 2001 From: Ivan Ternovtsiy Date: Tue, 1 Dec 2020 11:13:09 +0200 Subject: [PATCH 0186/1045] Remove incorrect opcache preload instructions --- performance.rst | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/performance.rst b/performance.rst index 46ed5b9c7f8..afd5295a9e3 100644 --- a/performance.rst +++ b/performance.rst @@ -109,9 +109,7 @@ During container compilation (e.g. when running the ``cache:clear`` command), Symfony generates a file called ``preload.php`` in the ``config/`` directory with the list of classes to preload. -The only requirement is that you need to set both ``container.dumper.inline_factories`` -and ``container.dumper.inline_class_loader`` parameters to ``true``. Then, you -can configure PHP to use this preload file: +You can configure PHP to use this preload file: .. code-block:: ini From 9b1e113dbb34e3739ba298a3f476652f8375c685 Mon Sep 17 00:00:00 2001 From: Sebastian Paczkowski <74934099+sebpacz@users.noreply.github.com> Date: Tue, 1 Dec 2020 22:59:55 +0100 Subject: [PATCH 0187/1045] [Console] Update questionhelper.rst I noticed that the link to the ask method redirects to Symfony\Component\Console\Command\Command instead of Symfony\Component\Console\Helper\QuestionHelper. --- components/console/helpers/questionhelper.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/console/helpers/questionhelper.rst b/components/console/helpers/questionhelper.rst index de1aefd2cfa..2174550a0cd 100644 --- a/components/console/helpers/questionhelper.rst +++ b/components/console/helpers/questionhelper.rst @@ -12,7 +12,7 @@ helper set, which you can get by calling $helper = $this->getHelper('question'); The Question Helper has a single method -:method:`Symfony\\Component\\Console\\Command\\Command::ask` that needs an +:method:`Symfony\\Component\\Console\\Helper\\QuestionHelper::ask` that needs an :class:`Symfony\\Component\\Console\\Input\\InputInterface` instance as the first argument, an :class:`Symfony\\Component\\Console\\Output\\OutputInterface` instance as the second argument and a From 2537437a54de9de1ac2fcb8399fe34a4f6d36021 Mon Sep 17 00:00:00 2001 From: Al-Saleh KEITA <28827545+askeita@users.noreply.github.com> Date: Mon, 30 Nov 2020 18:49:48 +0100 Subject: [PATCH 0188/1045] Update http_cache.rst Replaced "two" by "three" on line 313. --- http_cache.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/http_cache.rst b/http_cache.rst index 971679d5f82..0bd62b30c8e 100644 --- a/http_cache.rst +++ b/http_cache.rst @@ -315,7 +315,7 @@ Safe Methods: Only caching GET or HEAD requests ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ HTTP caching only works for "safe" HTTP methods (like GET and HEAD). This means -two things: +three things: * Don't try to cache PUT or DELETE requests. It won't work and with good reason. These methods are meant to be used when mutating the state of your application From 886a3ef480a29b92735b3ee73b083e6efafdeb9a Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Thu, 3 Dec 2020 07:44:23 +0100 Subject: [PATCH 0189/1045] Add Titouan in the core team --- contributing/code/core_team.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/contributing/code/core_team.rst b/contributing/code/core_team.rst index 47fba9c2d94..9ff45966cbb 100644 --- a/contributing/code/core_team.rst +++ b/contributing/code/core_team.rst @@ -71,7 +71,8 @@ Active Core Members * **Tobias Nyholm** (`Nyholm`_); * **Wouter De Jong** (`wouterj`_); * **Alexander M. Turek** (`derrabus`_); - * **Jérémy Derussé** (`jderusse`_). + * **Jérémy Derussé** (`jderusse`_); + * **Titouan Galopin** (`tgalopin`_). * **Security Team** (``@symfony/security`` on GitHub): @@ -207,3 +208,4 @@ discretion of the **Project Leader**. .. _`lsmith77`: https://github.com/lsmith77/ .. _`derrabus`: https://github.com/derrabus/ .. _`jderusse`: https://github.com/jderusse/ +.. _`tgalopin`: https://github.com/tgalopin/ From a874705308eb708e6277ae30e5c539459313fc61 Mon Sep 17 00:00:00 2001 From: Antoine Makdessi Date: Thu, 3 Dec 2020 14:13:06 +0100 Subject: [PATCH 0190/1045] Update lockable_trait.rst --- console/lockable_trait.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/console/lockable_trait.rst b/console/lockable_trait.rst index 7f751d09012..74c4c2a5870 100644 --- a/console/lockable_trait.rst +++ b/console/lockable_trait.rst @@ -38,6 +38,8 @@ that adds two convenient methods to lock and release commands:: // if not released explicitly, Symfony releases the lock // automatically when the execution of the command ends $this->release(); + + return 0; } } From 41418b7dad20e9f73aacdd00fe30f0a4a8e707b5 Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Thu, 3 Dec 2020 11:25:15 -0500 Subject: [PATCH 0191/1045] Prefer sass over node-sass --- frontend/encore/simple-example.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/frontend/encore/simple-example.rst b/frontend/encore/simple-example.rst index 6ddcd5bdbd8..d4f74989aa1 100644 --- a/frontend/encore/simple-example.rst +++ b/frontend/encore/simple-example.rst @@ -311,15 +311,15 @@ Encore. When you do, you'll see an error! .. code-block:: terminal - > Error: Install sass-loader & node-sass to use enableSassLoader() - > yarn add sass-loader@^8.0.0 node-sass --dev + > Error: Install sass-loader & sass to use enableSassLoader() + > yarn add sass-loader@^10.0.0 sass --dev Encore supports many features. But, instead of forcing all of them on you, when you need a feature, Encore will tell you what you need to install. Run: .. code-block:: terminal - $ yarn add sass-loader@^8.0.0 node-sass --dev + $ yarn add sass-loader@^10.0.0 sass --dev $ yarn encore dev --watch Your app now supports Sass. Encore also supports LESS and Stylus. See From f2a3cf57488bb80b08b519358d458e74a52a930e Mon Sep 17 00:00:00 2001 From: Laurent VOULLEMIER Date: Sat, 5 Dec 2020 18:03:19 +0100 Subject: [PATCH 0192/1045] Minor modification about the .meta file contents The explanation about the `.meta` file contents is not totally true. Only `ComposerResource` stores timestamps (for `installed.json` files). For project source and configuration files involved in the generation of a file in the cache, the `filemtime` is directly used to retrieve the resource timestamp and to compare it with the `filemtime` of the generated file. Source: https://github.com/symfony/symfony/blob/21ef411cc96459d0d87ac3e1d565aca4bba1cb21/src/Symfony/Component/Config/Resource/FileResource.php#L65 --- components/dependency_injection/compilation.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/dependency_injection/compilation.rst b/components/dependency_injection/compilation.rst index 8f50b2b0d0c..55725be8da0 100644 --- a/components/dependency_injection/compilation.rst +++ b/components/dependency_injection/compilation.rst @@ -564,8 +564,8 @@ Now the cached dumped container is used regardless of whether debug mode is on or not. The difference is that the ``ConfigCache`` is set to debug mode with its second constructor argument. When the cache is not in debug mode the cached container will always be used if it exists. In debug mode, -an additional metadata file is written with the timestamps of all the resource -files. These are then checked to see if the files have changed, if they +an additional metadata file is written with all the involved resource +files. These are then checked to see if their timestamps have changed, if they have the cache will be considered stale. .. note:: From 955674651cd6d2d5b0a09b56971c579917914cb5 Mon Sep 17 00:00:00 2001 From: Abdouni Abdelkarim Date: Mon, 16 Nov 2020 11:22:04 +0100 Subject: [PATCH 0193/1045] Update import.rst --- service_container/import.rst | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/service_container/import.rst b/service_container/import.rst index f38c2a33525..b37c8360388 100644 --- a/service_container/import.rst +++ b/service_container/import.rst @@ -80,7 +80,8 @@ a relative or absolute path to the imported file: # config/services.yaml imports: - { resource: services/mailer.yaml } - + # If you want to import a whole directory: + - { resource: services/ } services: _defaults: autowire: true @@ -103,6 +104,8 @@ a relative or absolute path to the imported file: + + @@ -122,6 +125,8 @@ a relative or absolute path to the imported file: return function(ContainerConfigurator $configurator) { $configurator->import('services/mailer.php'); + // If you want to import a whole directory: + $configurator->import('services/'); $services = $configurator->services() ->defaults() From eef382cf8e70e69b481ee04feebe179a2de637e7 Mon Sep 17 00:00:00 2001 From: gary houbre Date: Mon, 26 Oct 2020 12:49:33 +0100 Subject: [PATCH 0194/1045] More explication for return into execute command function --- console.rst | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/console.rst b/console.rst index ad9bb8c16e6..663fafbfd9a 100644 --- a/console.rst +++ b/console.rst @@ -45,9 +45,16 @@ want a command to create a user:: protected function execute(InputInterface $input, OutputInterface $output) { - // ... + // ... put here the code to run in your command + + // this method must return an integer number with the "exit status code" + // of the command. + // return this if there was no problem running the command return 0; + + // or return this if some error happened during the execution + // return 1; } } From 7a7cef829e307c27b48ebde8a7c135851a368329 Mon Sep 17 00:00:00 2001 From: Oskar Stark Date: Mon, 7 Dec 2020 11:51:31 +0100 Subject: [PATCH 0195/1045] minor. #14488 --- console.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/console.rst b/console.rst index 5df984705b6..9611ce94bfd 100644 --- a/console.rst +++ b/console.rst @@ -45,7 +45,7 @@ want a command to create a user:: protected function execute(InputInterface $input, OutputInterface $output) { - // ... put here the code to run in your command + // ... put here the code to create the user // this method must return an integer number with the "exit status code" // of the command. From 33a699015263a9dac48c9ca77eb08bb426e0f9a8 Mon Sep 17 00:00:00 2001 From: Oskar Stark Date: Mon, 7 Dec 2020 12:11:08 +0100 Subject: [PATCH 0196/1045] remove whitespaces --- console/lockable_trait.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/console/lockable_trait.rst b/console/lockable_trait.rst index 74c4c2a5870..36cd393907c 100644 --- a/console/lockable_trait.rst +++ b/console/lockable_trait.rst @@ -38,7 +38,7 @@ that adds two convenient methods to lock and release commands:: // if not released explicitly, Symfony releases the lock // automatically when the execution of the command ends $this->release(); - + return 0; } } From 9408dd85c1f546095a539ab4188d4cb8cd441485 Mon Sep 17 00:00:00 2001 From: noniagriconomie Date: Tue, 8 Dec 2020 10:49:50 +0100 Subject: [PATCH 0197/1045] Improve README --- README.markdown | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/README.markdown b/README.markdown index b993cd45ed4..f65392efba3 100644 --- a/README.markdown +++ b/README.markdown @@ -1,7 +1,20 @@ -Symfony Documentation -===================== - -This documentation is rendered online at https://symfony.com/doc/current/ +

          + +

          + +

          + The official Symfony Documentation +

          + +

          + + Online version + + | + + Screencasts + +

          Contributing ------------ @@ -11,8 +24,8 @@ 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 **4.4** branch, -> unless you're documenting a feature that was introduced *after* Symfony 4.4 +> All pull requests must be based on the ``4.4`` branch, +> unless you are documenting a feature that was introduced *after* Symfony 4.4 > (e.g. in Symfony 5.2), **not** the ``5.x`` or older branches. SymfonyCloud @@ -24,7 +37,7 @@ server where Pull Requests are built and can be reviewed by contributors. Docker ------ -You can build the doc locally with these commands: +You can build the documentation project locally with these commands: ```bash # build the image... From 5238fff27e1b9740a3c85ef47c41915656e00d2a Mon Sep 17 00:00:00 2001 From: Antoine Makdessi Date: Mon, 7 Dec 2020 16:00:29 +0100 Subject: [PATCH 0198/1045] [PHPUnitBridge] Document the "symfony/deprecation-contracts" --- components/phpunit_bridge.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/components/phpunit_bridge.rst b/components/phpunit_bridge.rst index d1888cd4f6e..284dae4d816 100644 --- a/components/phpunit_bridge.rst +++ b/components/phpunit_bridge.rst @@ -165,6 +165,9 @@ Deprecation notices can be triggered by using:: @trigger_error('Your deprecation message', E_USER_DEPRECATED); +You can also require the ``symfony/deprecation-contracts`` package that provides +a global ``trigger_deprecation()`` function for this usage. + Without the `@-silencing operator`_, users would need to opt-out from deprecation notices. Silencing by default swaps this behavior and allows users to opt-in when they are ready to cope with them (by adding a custom error handler like the From fd12a43e00a94743a2047cf4e7c15b3362fbc8be Mon Sep 17 00:00:00 2001 From: Sebastian Paczkowski <74934099+sebpacz@users.noreply.github.com> Date: Thu, 3 Dec 2020 08:34:50 +0100 Subject: [PATCH 0199/1045] [Console] Update table.rst The Symfony\Component\Console\Helper\TableStyle class doesn't have the setDefaultCrossingChars method, but there is the setCrossingChars method. The setCrossingChars method takes at least 9 parameters, so I think it would be difficult to present it in the example instead of the setDefaultCrossingChars method. In this commit, I removed all references to the method that doesn't exist. --- components/console/helpers/table.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/console/helpers/table.rst b/components/console/helpers/table.rst index bc680cc5ad0..0e8df0d1031 100644 --- a/components/console/helpers/table.rst +++ b/components/console/helpers/table.rst @@ -233,7 +233,7 @@ If the built-in styles do not fit your need, define your own:: // customizes the style $tableStyle - ->setDefaultCrossingChars('|') + ->setHorizontalBorderChars('|') ->setVerticalBorderChars('-') ->setDefaultCrossingChar(' ') ; @@ -244,7 +244,7 @@ If the built-in styles do not fit your need, define your own:: Here is a full list of things you can customize: * :method:`Symfony\\Component\\Console\\Helper\\TableStyle::setPaddingChar` -* :method:`Symfony\\Component\\Console\\Helper\\TableStyle::setDefaultCrossingChars` +* :method:`Symfony\\Component\\Console\\Helper\\TableStyle::setHorizontalBorderChars` * :method:`Symfony\\Component\\Console\\Helper\\TableStyle::setVerticalBorderChars` * :method:`Symfony\\Component\\Console\\Helper\\TableStyle::setCrossingChars` * :method:`Symfony\\Component\\Console\\Helper\\TableStyle::setDefaultCrossingChar` From a741c9ce46f60e4d57e4d648d11525164956da31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20SURACI?= Date: Wed, 9 Dec 2020 15:15:47 +0100 Subject: [PATCH 0200/1045] [Service Container] Fix Service parameters typo in services.yml --- service_container.rst | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/service_container.rst b/service_container.rst index ff80ac27a14..a33dbdfb786 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; @@ -500,13 +500,14 @@ parameter and in PHP config use the ``ref`` function: # config/services.yaml services: App\Service\MessageGenerator: - # this is not a string, but a reference to a service called 'logger' - arguments: ['@logger'] + arguments: + # this is not a string, but a reference to a service called 'logger' + - '@logger' - # if the value of a string parameter starts with '@', you need to escape - # it by adding another '@' so Symfony doesn't consider it a service - # (this will be parsed as the string '@securepassword') - mailer_password: '@@securepassword' + # if the value of a string argument starts with '@', you need to escape + # it by adding another '@' so Symfony doesn't consider it a service + # the following example would be parsed as the string '@securepassword' + # - '@@securepassword' .. code-block:: xml From 81a020857cb1ece2e70f30752fa19a1b284b5a95 Mon Sep 17 00:00:00 2001 From: Wouter de Jong Date: Thu, 10 Dec 2020 15:08:44 +0100 Subject: [PATCH 0201/1045] Change order in Set-up article --- setup.rst | 58 +++++++++++++++++++++++++++---------------------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/setup.rst b/setup.rst index 2f39564d40c..a93d157b371 100644 --- a/setup.rst +++ b/setup.rst @@ -81,6 +81,35 @@ started. In other words, your new application is ready! and ``/var/log/``) must be writable by the web server. If you have any issue, read how to :doc:`set up permissions for Symfony applications `. +.. _install-existing-app: + +Setting up an Existing Symfony Project +-------------------------------------- + +In addition to creating new Symfony projects, you will also work on projects +already created by other developers. In that case, you only need to get the +project code and install the dependencies with Composer. Assuming your team uses +Git, setup your project with the following commands: + +.. code-block:: terminal + + # clone the project to download its contents + $ cd projects/ + $ git clone ... + + # make Composer install the project's dependencies into vendor/ + $ cd my-project/ + $ composer install + +You'll probably also need to customize your :ref:`.env file ` +and do a few other project-specific tasks (e.g. creating a database). When +working on a existing Symfony application for the first time, it may be useful +to run this command which displays information about the project: + +.. code-block:: terminal + + $ php bin/console about + Running Symfony Applications ---------------------------- @@ -112,35 +141,6 @@ the server by pressing ``Ctrl+C`` from your terminal. The web server works with any PHP application, not only Symfony projects, so it's a very useful generic development tool. -.. _install-existing-app: - -Setting up an Existing Symfony Project --------------------------------------- - -In addition to creating new Symfony projects, you will also work on projects -already created by other developers. In that case, you only need to get the -project code and install the dependencies with Composer. Assuming your team uses -Git, setup your project with the following commands: - -.. code-block:: terminal - - # clone the project to download its contents - $ cd projects/ - $ git clone ... - - # make Composer install the project's dependencies into vendor/ - $ cd my-project/ - $ composer install - -You'll probably also need to customize your :ref:`.env file ` -and do a few other project-specific tasks (e.g. creating a database). When -working on a existing Symfony application for the first time, it may be useful -to run this command which displays information about the project: - -.. code-block:: terminal - - $ php bin/console about - .. _symfony-flex: Installing Packages From f81211422a3ba96a428bdfda062e6f22b1ed043c Mon Sep 17 00:00:00 2001 From: Youssef Benhssaien Date: Thu, 3 Dec 2020 07:25:17 +0100 Subject: [PATCH 0202/1045] Lock - replace getExpiringDate by getRemainingLifetime As the method `getExpiringDate` doesn't exist, replace it by `getRemainingLifetime` which returns the remaining time to live in seconds --- components/lock.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/lock.rst b/components/lock.rst index 891fdc64818..55ddcf377b3 100644 --- a/components/lock.rst +++ b/components/lock.rst @@ -196,8 +196,8 @@ to reset the TTL to its original value:: $lock->refresh(600); This component also provides two useful methods related to expiring locks: -``getExpiringDate()`` (which returns ``null`` or a ``\DateTimeImmutable`` -object) and ``isExpired()`` (which returns a boolean). +``getRemainingLifetime()`` (which returns ``null`` or a ``float`` +as seconds) and ``isExpired()`` (which returns a boolean). The Owner of The Lock --------------------- From f5ebf4229f7f24e371dc749fdd9b6c543ff68fab Mon Sep 17 00:00:00 2001 From: Sebastian Paczkowski <74934099+sebpacz@users.noreply.github.com> Date: Sun, 13 Dec 2020 17:27:25 +0100 Subject: [PATCH 0203/1045] Update the Nginx example MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When I was looking through the Nginx configuration recipe for Symfony 4.x I discovered an important comment that isn’t included in the example in the Nginx section. I think this tip may be useful for those who create their environment using docker containers. In this PR I added the missing comment, which is taken from the recipe on this page: https://www.nginx.com/resources/wiki/start/topics/recipes/symfony/#secure-symfony-4-x. --- setup/web_server_configuration.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/setup/web_server_configuration.rst b/setup/web_server_configuration.rst index e4fef9b3d99..603a0ba3bbd 100644 --- a/setup/web_server_configuration.rst +++ b/setup/web_server_configuration.rst @@ -333,6 +333,9 @@ The **minimum configuration** to get your application running under Nginx is: # Otherwise, PHP's OPcache may not properly detect changes to # your PHP files (see https://github.com/zendtech/ZendOptimizerPlus/issues/126 # for more information). + # Caveat: When PHP-FPM is hosted on a different machine from nginx + # $realpath_root may not resolve as you expect! In this case try using + # $document_root instead. fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name; fastcgi_param DOCUMENT_ROOT $realpath_root; # Prevents URIs that include the front controller. This will 404: From 159da027be25c9013a101f723c87cbdecd50e545 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maxime=20H=C3=A9lias?= Date: Thu, 12 Nov 2020 15:32:14 +0100 Subject: [PATCH 0204/1045] Add missing options context --- components/serializer.rst | 87 +++++++++++++++++++++++++++++++++------ 1 file changed, 74 insertions(+), 13 deletions(-) diff --git a/components/serializer.rst b/components/serializer.rst index 20d31fa8c0c..b2cf03b2192 100644 --- a/components/serializer.rst +++ b/components/serializer.rst @@ -691,7 +691,24 @@ When serializing, you can set a callback to format a specific object property:: Normalizers ----------- -There are several types of normalizers available: +Normalizers turn **object** into **array** and vice versa. They implement +::class:`Symfony\\Component\\Serializer\\Normalizer\\NormalizableInterface` +for normalize (object to array) and +:class:`Symfony\\Component\\Serializer\\Normalizer\\DenormalizableInterface` for denormalize +(array to object). + +You can add new normalizers to a Serializer instance by using its first constructor argument:: + + use Symfony\Component\Serializer\Normalizer\ObjectNormalizer; + use Symfony\Component\Serializer\Serializer; + + $normalizers = [new ObjectNormalizer()]; + $serializer = new Serializer($normalizers, []); + +Built-in Normalizers +~~~~~~~~~~~~~~~~~~~~ + +The Serializer component provides several built-in normalizers: :class:`Symfony\\Component\\Serializer\\Normalizer\\ObjectNormalizer` This normalizer leverages the :doc:`PropertyAccess Component ` @@ -765,6 +782,14 @@ There are several types of normalizers available: :class:`Symfony\\Component\\Serializer\\Normalizer\\ProblemNormalizer` Normalizes errors according to the API Problem spec `RFC 7807`_. +.. note:: + + You can also create your own Normalizer to use another structure. Read more at + :doc:`/serializer/custom_normalizer`. + +All these normalizers are enabled by default when using the Serializer component +in a Symfony application. + .. _component-serializer-encoders: Encoders @@ -803,6 +828,11 @@ The Serializer component provides several built-in encoders: :class:`Symfony\\Component\\Serializer\\Encoder\\CsvEncoder` This encoder encodes and decodes data in `CSV`_. +.. note:: + + You can also create your own Encoder to use another structure. Read more at + :doc:`/serializer/custom_encoders`. + All these encoders are enabled by default when using the Serializer component in a Symfony application. @@ -923,18 +953,29 @@ which defines the configuration options for the XmlEncoder an associative array: These are the options available: -====================== ==================================================== ========================== -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 -====================== ==================================================== ========================== +============================== ================================================= ========================== +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_type_cast_attributes`` This provides the ability to forgot the attribute ``true`` + type casting +``xml_root_node_name`` Sets the root node name (default: ``response``). +``as_collection`` Always returns results as a collection, even if + only one line is decoded +``decoder_ignored_node_types`` Sets nodes to be ignored in the decode ``[\XML_PI_NODE, \XML_COMMENT_NODE]`` +``encoder_ignored_node_types`` Sets nodes to be ignored in the encode ``[]`` +``load_options`` XML loading `options with libxml`_ ``\LIBXML_NONET | \LIBXML_NOBLANKS`` +``remove_empty_tags`` If set to true, removes all empty tags in the ``false`` + generated XML +============================== ================================================= ========================== + +.. versionadded:: 4.2 + + The ``decoder_ignored_node_types`` & ``encoder_ignored_node_types`` options was introduced in Symfony 4.2. The ``YamlEncoder`` ~~~~~~~~~~~~~~~~~~~ @@ -942,6 +983,25 @@ The ``YamlEncoder`` This encoder requires the :doc:`Yaml Component ` and transforms from and to Yaml. +The ``YamlEncoder`` Context Options +................................... + +The ``encode()`` method, like other encoder, uses ``context`` to set +configuration options for the YamlEncoder an associative array:: + + $xmlEncoder->encode($array, 'xml', $context); + +These are the options available: + +=============== ======================================================== ========================== +Option Description Default +=============== ======================================================== ========================== +``yaml_inline`` The level where you switch to inline YAML ``0`` +``yaml_indent`` The level of indentation (used internally) ``0`` +``yaml_flags`` A bit field of ``Yaml::DUMP_*`` / ``PARSE_*`` constants ``0`` + to customize the encoding / decoding YAML string +=============== ======================================================== ========================== + Skipping ``null`` Values ------------------------ @@ -1508,6 +1568,7 @@ Learn more .. _`PSR-1 standard`: https://www.php-fig.org/psr/psr-1/ .. _`JMS serializer`: https://github.com/schmittjoh/serializer .. _RFC3339: https://tools.ietf.org/html/rfc3339#section-5.8 +.. _`options with libxml`: https://www.php.net/manual/en/libxml.constants.php .. _JSON: http://www.json.org/ .. _XML: https://www.w3.org/XML/ .. _YAML: https://yaml.org/ From 8e2e7de46658db06b8809c6e0036c9ad1cdde104 Mon Sep 17 00:00:00 2001 From: Alexander Schranz Date: Wed, 9 Dec 2020 17:33:46 +0100 Subject: [PATCH 0205/1045] Add documentation about redis cache configuration --- components/cache/adapters/redis_adapter.rst | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/components/cache/adapters/redis_adapter.rst b/components/cache/adapters/redis_adapter.rst index c97ab697831..e9d1fec6237 100644 --- a/components/cache/adapters/redis_adapter.rst +++ b/components/cache/adapters/redis_adapter.rst @@ -201,6 +201,18 @@ In order to use tag-based invalidation, you can wrap your adapter in :class:`Sym $client = RedisAdapter::createConnection('redis://localhost'); $cache = new RedisTagAwareAdapter($client); +Configuring Redis +~~~~~~~~~~~~~~~~~ + +When using Redis as cache, you should configure the `maxmemory` and `maxmemory-policy` settings. +Read more about this topic in the offical `Redis LRU Cache Documentation`_. +By setting `maxmemory`, you limit how much memory Redis is allowed to consume. If the amount is too low, Redis will drop entries that would still be useful and you benefit less from your cache. Setting the `maxmemory-policy` to +`allkeys-lru` tells Redis that it is ok to drop data when it runs out of memory, and to first drop the oldest entries (least +recently used). If you do not allow Redis to drop entries, it will return an error when you try to add data when no +memory is available. An example setting could look as follows: + + maxmemory 100mb + maxmemory-policy allkeys-lru .. _`Data Source Name (DSN)`: https://en.wikipedia.org/wiki/Data_source_name .. _`Redis server`: https://redis.io/ @@ -211,3 +223,4 @@ In order to use tag-based invalidation, you can wrap your adapter in :class:`Sym .. _`Predis Connection Parameters`: https://github.com/nrk/predis/wiki/Connection-Parameters#list-of-connection-parameters .. _`TCP-keepalive`: https://redis.io/topics/clients#tcp-keepalive .. _`Redis Sentinel`: https://redis.io/topics/sentinel +.. _`Redis LRU Cache Documentation`: https://redis.io/topics/lru-cache From ead414bfbcd3fd1212498f05aaded72c45b6c700 Mon Sep 17 00:00:00 2001 From: Oskar Stark Date: Wed, 16 Dec 2020 14:43:05 +0100 Subject: [PATCH 0206/1045] minor. refs #14683 --- components/cache/adapters/redis_adapter.rst | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/components/cache/adapters/redis_adapter.rst b/components/cache/adapters/redis_adapter.rst index e9d1fec6237..935afcd9f92 100644 --- a/components/cache/adapters/redis_adapter.rst +++ b/components/cache/adapters/redis_adapter.rst @@ -204,16 +204,21 @@ In order to use tag-based invalidation, you can wrap your adapter in :class:`Sym Configuring Redis ~~~~~~~~~~~~~~~~~ -When using Redis as cache, you should configure the `maxmemory` and `maxmemory-policy` settings. -Read more about this topic in the offical `Redis LRU Cache Documentation`_. -By setting `maxmemory`, you limit how much memory Redis is allowed to consume. If the amount is too low, Redis will drop entries that would still be useful and you benefit less from your cache. Setting the `maxmemory-policy` to -`allkeys-lru` tells Redis that it is ok to drop data when it runs out of memory, and to first drop the oldest entries (least -recently used). If you do not allow Redis to drop entries, it will return an error when you try to add data when no -memory is available. An example setting could look as follows: +When using Redis as cache, you should configure the ``maxmemory`` and ``maxmemory-policy`` +settings. By setting ``maxmemory``, you limit how much memory Redis is allowed to consume. +If the amount is too low, Redis will drop entries that would still be useful and you benefit +less from your cache. Setting the ``maxmemory-policy`` to ``allkeys-lru`` tells Redis that +it is ok to drop data when it runs out of memory, and to first drop the oldest entries (least +recently used). If you do not allow Redis to drop entries, it will return an error when you +try to add data when no memory is available. An example setting could look as follows: + +.. code-block:: ini maxmemory 100mb maxmemory-policy allkeys-lru +Read more about this topic in the offical `Redis LRU Cache Documentation`_. + .. _`Data Source Name (DSN)`: https://en.wikipedia.org/wiki/Data_source_name .. _`Redis server`: https://redis.io/ .. _`Redis`: https://github.com/phpredis/phpredis From 134df97392feb4ce78293595ea28eee35ed6348e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rathgeber=20St=C3=A9phane?= Date: Wed, 16 Dec 2020 18:53:48 +0100 Subject: [PATCH 0207/1045] Remove white space --- quick_tour/the_architecture.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/quick_tour/the_architecture.rst b/quick_tour/the_architecture.rst index 69883859d53..d88bb5d32ed 100644 --- a/quick_tour/the_architecture.rst +++ b/quick_tour/the_architecture.rst @@ -155,7 +155,7 @@ difference is that it's done in the constructor: { // ... - + $this->logger->info('Using the greeting: '.$greeting); + + $this->logger->info('Using the greeting: '.$greeting); return $greeting; } From 1c0c7ae267a3c598ef9f5a78e12f6f1f5e40caf3 Mon Sep 17 00:00:00 2001 From: Sebastian Paczkowski <74934099+sebpacz@users.noreply.github.com> Date: Thu, 17 Dec 2020 21:48:23 +0100 Subject: [PATCH 0208/1045] Replace unavailable dependency in Symfony 4 --- setup/unstable_versions.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup/unstable_versions.rst b/setup/unstable_versions.rst index 27036493fd4..5e11526b20e 100644 --- a/setup/unstable_versions.rst +++ b/setup/unstable_versions.rst @@ -68,7 +68,7 @@ Symfony version has deprecated some of its features. $ cd projects/my_project/ $ git checkout -b testing_new_symfony # ... update composer.json configuration - $ composer update symfony/symfony + $ composer update "symfony/*" # ... after testing the new Symfony version $ git checkout master From 2dbe568d4575e3472e0337757e134f7821c8c831 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Korczewski?= Date: Fri, 18 Dec 2020 02:50:05 +0100 Subject: [PATCH 0209/1045] Fixed typo --- form/without_class.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/form/without_class.rst b/form/without_class.rst index 85838d77ce9..5f565ebfb52 100644 --- a/form/without_class.rst +++ b/form/without_class.rst @@ -79,7 +79,7 @@ you want to use. See :doc:`/validation` for more details. .. _form-option-constraints: -But if the form is not mapped to an object and you instead want to retrieve a +But if the form is not mapped to an object and you instead want to retrieve an array of your submitted data, how can you add constraints to the data of your form? From 1e1ff71f20d292072dd5c18f4bf0794739e2f39d Mon Sep 17 00:00:00 2001 From: Nyholm Date: Fri, 18 Dec 2020 11:33:45 +0100 Subject: [PATCH 0210/1045] Support JWT v4 --- mercure.rst | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/mercure.rst b/mercure.rst index 9dd6fe205b9..e4bc11d911f 100644 --- a/mercure.rst +++ b/mercure.rst @@ -408,7 +408,7 @@ And here is the controller:: // src/Controller/DiscoverController.php namespace App\Controller; - use Lcobucci\JWT\Builder; + use Lcobucci\JWT\Configuration; use Lcobucci\JWT\Signer\Hmac\Sha256; use Lcobucci\JWT\Signer\Key; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; @@ -423,10 +423,13 @@ And here is the controller:: $hubUrl = $this->getParameter('mercure.default_hub'); $this->addLink($request, new Link('mercure', $hubUrl)); - $token = (new Builder()) - // set other appropriate JWT claims, such as an expiration date + $key = Key\InMemory::plainText('mercure_secret_key'); // don't forget to set this parameter! Test value: !ChangeMe! + $configuration = Configuration::forSymmetricSigner(new Sha256(), $key); + + $token = $configuration->builder() ->withClaim('mercure', ['subscribe' => ["http://example.com/books/1"]]) // can also be a URI template, or * - ->getToken(new Sha256(), new Key($this->getParameter('mercure_secret_key'))); // don't forget to set this parameter! Test value: !ChangeMe! + ->getToken($configuration->signer(), $configuration->signingKey()) + ->toString(); $response = $this->json(['@id' => '/demo/books/1', 'availability' => 'https://schema.org/InStock']); $response->headers->set( From d4358eb4295728074b913f98a66a021a41aeacea Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Fri, 18 Dec 2020 16:58:36 +0100 Subject: [PATCH 0211/1045] Mention a possible way of reusing the same form --- forms.rst | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/forms.rst b/forms.rst index 12013e8fbfc..1654aa3deba 100644 --- a/forms.rst +++ b/forms.rst @@ -449,6 +449,16 @@ possible paths: data is passed to it, you can :doc:`use the submit() method to handle form submissions `. +.. tip:: + + If you need to render and process the same form in different templates, + use the ``render()`` function to :ref:`embed the controller ` + that processes the form: + + .. code-block:: twig + + {{ render(controller('App\\Controller\\TaskController::new')) }} + .. _validating-forms: Validating Forms From 0e925a0993bd16ecac6f8560e4686cc63d322418 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Fri, 18 Dec 2020 17:21:19 +0100 Subject: [PATCH 0212/1045] Reword the introduction about using Bootstrap and Encore --- frontend/encore/bootstrap.rst | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/frontend/encore/bootstrap.rst b/frontend/encore/bootstrap.rst index ff281f588ac..fedb5153cac 100644 --- a/frontend/encore/bootstrap.rst +++ b/frontend/encore/bootstrap.rst @@ -1,9 +1,9 @@ Using Bootstrap CSS & JS ======================== -Want to use Bootstrap (or something similar) in your project? No problem! -First, install it. To be able to customize things further, we'll install -``bootstrap``: +This article explains how to install and integrate the `Bootstrap CSS framework`_ +in your Symfony application using :doc:`Webpack Encore `. +First, to be able to customize things further, we'll install ``bootstrap``: .. code-block:: terminal @@ -79,3 +79,5 @@ and CSS like normal: // require 2 CSS files needed require('bootstrap-star-rating/css/star-rating.css'); require('bootstrap-star-rating/themes/krajee-svg/theme.css'); + +.. _`Bootstrap CSS framework`: https://getbootstrap.com/ From b2c66b145971b0f8cae7b3c318361814c98ae2dc Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Fri, 18 Dec 2020 11:12:51 +0100 Subject: [PATCH 0213/1045] [DependencyInjection] Add ServiceLocatorArgument to generate array-based locators --- .../service_subscribers_locators.rst | 92 ++++++++++++++++--- 1 file changed, 78 insertions(+), 14 deletions(-) diff --git a/service_container/service_subscribers_locators.rst b/service_container/service_subscribers_locators.rst index 2fc0ec54fb1..fc702a52f27 100644 --- a/service_container/service_subscribers_locators.rst +++ b/service_container/service_subscribers_locators.rst @@ -246,9 +246,80 @@ service type to a service. Defining a Service Locator -------------------------- -To manually define a service locator, create a new service definition and add -the ``container.service_locator`` tag to it. Use the first argument of the -service definition to pass a collection of services to the service locator: +To manually define a service locator and inject it to another service, create an +argument of type ``service_locator``: + +.. configuration-block:: + + .. code-block:: yaml + + # config/services.yaml + services: + App\CommandBus: + arguments: + !service_locator + App\FooCommand: '@app.command_handler.foo' + App\BarCommand: '@app.command_handler.bar' + + .. code-block:: xml + + + + + + + + + + + + + + + + + + .. code-block:: php + + // config/services.php + namespace Symfony\Component\DependencyInjection\Loader\Configurator; + + use App\CommandBus; + + return function(ContainerConfigurator $configurator) { + $services = $configurator->services(); + + $services->set(CommandBus::class) + ->args([service_locator([ + 'App\FooCommand' => ref('app.command_handler.foo'), + 'App\BarCommand' => ref('app.command_handler.bar'), + // if the element has no key, the ID of the original service is used + ref('app.command_handler.baz'), + ])]); + }; + +.. versionadded:: 4.2 + + The ability to add services without specifying an array key was introduced + in Symfony 4.2. + +.. versionadded:: 4.2 + + The ``service_locator`` argument type was introduced in Symfony 4.2. + +As shown in the previous sections, the constructor of the ``CommandBus`` class +must type-hint its argument with ``ContainerInterface``. Then, you can get any of +the service locator services via their ID (e.g. ``$this->locator->get('App\FooCommand')``). + +Reusing a Service Locator in Multiple Services +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +If you inject the same service locator in several services, it's better to +define the service locator as a stand-alone service and then inject it in the +other services. To do so, create a new service definition using the +``ServiceLocator`` class: .. configuration-block:: @@ -334,17 +405,7 @@ service definition to pass a collection of services to the service locator: previous Symfony versions you always needed to add the ``container.service_locator`` tag explicitly. -.. versionadded:: 4.2 - - The ability to add services without specifying their id was introduced in - Symfony 4.2. - -.. note:: - - The services defined in the service locator argument must include keys, - which later become their unique identifiers inside the locator. - -Now you can use the service locator by injecting it in any other service: +Now you can inject the service locator in any other services: .. configuration-block:: @@ -386,6 +447,9 @@ Now you can use the service locator by injecting it in any other service: ->args([ref('app.command_handler_locator')]); }; +Using Service Locators in Compiler Passes +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + In :doc:`compiler passes ` it's recommended to use the :method:`Symfony\\Component\\DependencyInjection\\Compiler\\ServiceLocatorTagPass::register` method to create the service locators. This will save you some boilerplate and From d66cc136e35bd62b20cc97b0c5ed6723ad847ae1 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Fri, 18 Dec 2020 16:09:26 +0100 Subject: [PATCH 0214/1045] Added a short guide about contributing code translations --- best_practices.rst | 2 + contributing/index.rst | 1 + contributing/translations/index.rst | 103 ++++++++++++++++++++++++++++ 3 files changed, 106 insertions(+) create mode 100644 contributing/translations/index.rst diff --git a/best_practices.rst b/best_practices.rst index 02434a7c812..2880c1014e5 100644 --- a/best_practices.rst +++ b/best_practices.rst @@ -320,6 +320,8 @@ are two of the main tasks when handling forms. Both are too similar (most of the times, almost identical), so it's much simpler to let a single controller action handle both. +.. _best-practice-internationalization: + Internationalization -------------------- diff --git a/contributing/index.rst b/contributing/index.rst index 923a4e48ed4..d76b4a8e037 100644 --- a/contributing/index.rst +++ b/contributing/index.rst @@ -7,6 +7,7 @@ Contributing code_of_conduct/index code/index documentation/index + translations/index community/index diversity/index diff --git a/contributing/translations/index.rst b/contributing/translations/index.rst new file mode 100644 index 00000000000..d865111f0cf --- /dev/null +++ b/contributing/translations/index.rst @@ -0,0 +1,103 @@ +Contributing Translations +========================= + +Some Symfony Components include certain messages that must be translated to +different languages. For example, if a user submits a form with a wrong value in +a :doc:`TimezoneType ` field, Symfony shows the +following error message by default: "This value is not a valid timezone." + +These messages are translated into tens of languages thanks to the Symfony +community. Symfony adds new messages on a regular basis, so this is an ongoing +translation process and you can help us providing the missing translations. + +How to Contribute a Translation +------------------------------- + +Imagine that you can speak both English and Swedish and want to check if there's +some missing Swedish translations to contribute them. + +**Step 1.** Translations are contributed to the oldest maintained branch of the +Symfony repository. Visit the `Symfony Releases`_ page to find out which is the +current oldest maintained branch. + +Then, you need to either download or browse that Symfony version contents: + +* If you know Git and prefer the command console, clone the Symfony repository + and check out the oldest maintained branch (read the + :doc:`Symfony Documentation contribution guide ` + if you want to learn about this process); +* If you prefer to use a web based interface, visit + `https://github.com/symfony/symfony `_ + and switch to the oldest maintained branch. + +**Step 2.** Check out if there's some missing translation in your language by +checking these directories: + +* ``src/Symfony/Component/Form/Resources/translations/`` +* ``src/Symfony/Component/Security/Core/Resources/translations/`` +* ``src/Symfony/Component/Validator/Resources/translations/`` + +Symfony uses the :ref:`XLIFF format ` to +store translations. In this example, you are looking for missing Swedish +translations, so you should look for files called ``*.sv.xlf``. + +.. note:: + + If there's no XLIFF file for your language yet, create it yourself + duplicating the original English file (e.g. ``validators.en.xlf``). + +**Step 3.** Contribute the missing translations. To do that, compare the file +in your language to the equivalent file in English. + +Imagine that you open the ``validators.sv.xlf`` and see this at the end of the file: + +.. code-block:: xml + + + + + + This value should be either negative or zero. + Detta värde bör vara antingen negativt eller noll. + + + This value is not a valid timezone. + Detta värde är inte en giltig tidszon. + + +If you open the equivalent ``validators.en.xlf`` file, you can see that the +English file has more messages to translate: + +.. code-block:: xml + + + + + + This value should be either negative or zero. + This value should be either negative or zero. + + + This value is not a valid timezone. + This value is not a valid timezone. + + + This password has been leaked in a data breach, it must not be used. Please use another password. + This password has been leaked in a data breach, it must not be used. Please use another password. + + + This value should be between {{ min }} and {{ max }}. + This value should be between {{ min }} and {{ max }}. + + +The messages with ``id=93`` and ``id=94`` are missing in the Swedish file. +Copy and paste the messages from the English file, translate the content +inside the ```` tag and save the changes. + +**Step 4.** Make the pull request against the +`https://github.com/symfony/symfony `_ repository. +If you need help, check the other Symfony guides about +:doc:`contributing code or docs ` because the process is +the same. + +.. _`Symfony Releases`: https://symfony.com/releases From 35eee2edc5c27824a23fcb5d2e6b1ee904b535eb Mon Sep 17 00:00:00 2001 From: Maks Rafalko Date: Mon, 21 Dec 2020 13:51:59 +0300 Subject: [PATCH 0215/1045] Add missed word --- messenger/dispatch_after_current_bus.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/messenger/dispatch_after_current_bus.rst b/messenger/dispatch_after_current_bus.rst index e382f49eed3..7daaaebc676 100644 --- a/messenger/dispatch_after_current_bus.rst +++ b/messenger/dispatch_after_current_bus.rst @@ -40,7 +40,7 @@ DispatchAfterCurrentBusMiddleware Middleware -------------------------------------------- For many applications, the desired behavior is to *only* handle messages that -are dispatched by a handler once that handler has fully finished. This can be by +are dispatched by a handler once that handler has fully finished. This can be done by using the ``DispatchAfterCurrentBusMiddleware`` and adding a ``DispatchAfterCurrentBusStamp`` stamp to :ref:`the message Envelope `:: From 3a01e25523530fa9ebeaeb40f93cf69427acf517 Mon Sep 17 00:00:00 2001 From: Bruno Baguette <1922257+Levure@users.noreply.github.com> Date: Fri, 29 May 2020 12:33:32 +0200 Subject: [PATCH 0216/1045] Added tip for files input rendering Added a tip about files input rendering in order to enable the display of the selected file. --- form/bootstrap4.rst | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/form/bootstrap4.rst b/form/bootstrap4.rst index e96db1afb3b..10ad6c254e3 100644 --- a/form/bootstrap4.rst +++ b/form/bootstrap4.rst @@ -94,6 +94,14 @@ Checkboxes and Radios For a checkbox/radio field, calling ``form_label()`` doesn't render anything. Due to Bootstrap internals, the label is already rendered by ``form_widget()``. +File inputs +----------- + +Files input are rendered using the Bootstrap "custom-file" class. + +Due to Bootstrap internals, the rendered field does not display the selected filename. +To fix that missing display, you can use the "`bs-custom-file-input`_" plugin (vanilla javascript), as recommended by `Bootstrap Forms documentation`_. + Accessibility ------------- @@ -126,6 +134,8 @@ Symfony Form ``RadioType`` and ``CheckboxType`` by adding some classes to the la {{ form_row(form.myCheckbox, {label_attr: {class: 'switch-custom'} }) }} .. _`WCAG 2.0 standard`: https://www.w3.org/TR/WCAG20/ +.. _`bs-custom-file-input`: https://www.npmjs.com/package/bs-custom-file-input +.. _`Bootstrap Forms documentation`: https://getbootstrap.com/docs/4.4/components/forms/#file-browser .. _`custom forms`: https://getbootstrap.com/docs/4.4/components/forms/#custom-forms .. _`custom radio`: https://getbootstrap.com/docs/4.4/components/forms/#radios .. _`custom checkbox`: https://getbootstrap.com/docs/4.4/components/forms/#checkboxes From 75194ae111a0415682d0d3f51291233940122b87 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Tue, 22 Dec 2020 15:47:32 +0100 Subject: [PATCH 0217/1045] Tweaks --- form/bootstrap4.rst | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/form/bootstrap4.rst b/form/bootstrap4.rst index 10ad6c254e3..ccf4659738c 100644 --- a/form/bootstrap4.rst +++ b/form/bootstrap4.rst @@ -97,10 +97,9 @@ Due to Bootstrap internals, the label is already rendered by ``form_widget()``. File inputs ----------- -Files input are rendered using the Bootstrap "custom-file" class. - -Due to Bootstrap internals, the rendered field does not display the selected filename. -To fix that missing display, you can use the "`bs-custom-file-input`_" plugin (vanilla javascript), as recommended by `Bootstrap Forms documentation`_. +File inputs are rendered using the Bootstrap "custom-file" class, which hides +the name of the selected file. To fix that, use the `bs-custom-file-input`_ +JavaScript plugin, as recommended by `Bootstrap Forms documentation`_. Accessibility ------------- From b51618ff97b9aab131f0f3bb80463349d1ee3b58 Mon Sep 17 00:00:00 2001 From: Thomas Landauer Date: Fri, 24 Jul 2020 17:03:38 +0200 Subject: [PATCH 0218/1045] [Mailer] Update mailer.rst --- mailer.rst | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/mailer.rst b/mailer.rst index 97a3dca00d7..31039f91ec0 100644 --- a/mailer.rst +++ b/mailer.rst @@ -163,12 +163,13 @@ both strings or address objects:: :class:`Symfony\\Component\\Mailer\\Event\\MessageEvent` event to set the same ``From`` email to all messages. -Multiple addresses are defined with the ``addXXX()`` methods:: +Multiple addresses can be set with ``addTo()``, ``addCc()``, or ``addBcc()``:: $email = (new Email()) ->to('foo@example.com') ->addTo('bar@example.com') - ->addTo('baz@example.com') + ->cc('cc@example.com') + ->addCc('cc2@example.com') // ... ; @@ -178,7 +179,7 @@ Alternatively, you can pass multiple addresses to each method:: $toAddresses = ['foo@example.com', new Address('bar@example.com')]; $email = (new Email()) - ->to(...$toAddresses) + ->to(...$toAddresses) // use the splat operator if you have an array ->cc('cc1@example.com', 'cc2@example.com') // ... From fb7df00f8f50c27ac3c355f06d99f1d2af323f7c Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Tue, 22 Dec 2020 15:54:52 +0100 Subject: [PATCH 0219/1045] Tweaks --- mailer.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mailer.rst b/mailer.rst index 2d4b2819de6..fa19d77d849 100644 --- a/mailer.rst +++ b/mailer.rst @@ -274,7 +274,7 @@ both strings or address objects:: :class:`Symfony\\Component\\Mailer\\Event\\MessageEvent` event to set the same ``From`` email to all messages. -Multiple addresses can be set with ``addTo()``, ``addCc()``, or ``addBcc()``:: +Use ``addTo()``, ``addCc()``, or ``addBcc()`` methods to add more addresses:: $email = (new Email()) ->to('foo@example.com') @@ -290,7 +290,7 @@ Alternatively, you can pass multiple addresses to each method:: $toAddresses = ['foo@example.com', new Address('bar@example.com')]; $email = (new Email()) - ->to(...$toAddresses) // use the splat operator if you have an array + ->to(...$toAddresses) ->cc('cc1@example.com', 'cc2@example.com') // ... From e9cc299e2a16df478d9e8804eed575fd9cc6d2b7 Mon Sep 17 00:00:00 2001 From: Thomas Landauer Date: Sat, 4 Apr 2020 11:26:06 +0200 Subject: [PATCH 0220/1045] [Form] Renaming the article --- form/form_collections.rst | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/form/form_collections.rst b/form/form_collections.rst index cd1f66a7a8f..fa4210b6709 100644 --- a/form/form_collections.rst +++ b/form/form_collections.rst @@ -1,15 +1,18 @@ .. index:: single: Form; Embed collection of forms -How to Embed a Collection of Forms -================================== +Edit Related Entities in a Single Form +====================================== -In this article, you'll learn how to create a form that embeds a collection -of many other forms. This could be useful, for example, if you had a ``Task`` -class and you wanted to edit/create/remove many ``Tag`` objects related to -that Task, right inside the same form. +To edit associated entities in the same form, Symfony has the concept of +Form "Collections". Think of it as a series of sub-forms, embedded into +the main form. -Let's start by creating a ``Task`` entity:: +The example used in this article is a ``Task`` entity that relates to +a ``Tag`` entitiy. The goal is to create a single form for tasks, that +also allows to edit/create/remove many tags associated with that task. + +Here's the ``Task`` and the ``Tag`` entity:: // src/Entity/Task.php namespace App\Entity; @@ -45,12 +48,10 @@ Let's start by creating a ``Task`` entity:: .. note:: - The ``ArrayCollection`` is specific to Doctrine and is basically the - same as using an ``array`` (but it must be an ``ArrayCollection`` if - you're using Doctrine). + The `ArrayCollection`_ is specific to Doctrine and is basically the + same as using an ``array``. -Now, create a ``Tag`` class. As you saw above, a ``Task`` can have many ``Tag`` -objects:: +.. code-block:: php // src/Entity/Tag.php namespace App\Entity; @@ -688,3 +689,4 @@ the relationship between the removed ``Tag`` and ``Task`` object. .. _`JSFiddle`: http://jsfiddle.net/847Kf/4/ .. _`@a2lix/symfony-collection`: https://github.com/a2lix/symfony-collection .. _`symfony-collection`: https://github.com/ninsuo/symfony-collection +.. _`ArrayCollection`: https://www.doctrine-project.org/projects/doctrine-collections/en/1.6/index.html From ca151cec146c4d16e2e3c8168231c37d9e837356 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Tue, 22 Dec 2020 16:55:55 +0100 Subject: [PATCH 0221/1045] Tweaks --- form/form_collections.rst | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/form/form_collections.rst b/form/form_collections.rst index fa4210b6709..30215b0a37d 100644 --- a/form/form_collections.rst +++ b/form/form_collections.rst @@ -1,18 +1,15 @@ .. index:: single: Form; Embed collection of forms -Edit Related Entities in a Single Form -====================================== +How to Embed a Collection of Forms +================================== -To edit associated entities in the same form, Symfony has the concept of -Form "Collections". Think of it as a series of sub-forms, embedded into -the main form. +Symfony Forms can embed a collection of many other forms, which is useful to +edit related entities in a single form. In this article, you'll create a form to +edit a ``Task`` class and, right inside the same form, you'll be able to edit, +create and remove many ``Tag`` objects related to that Task. -The example used in this article is a ``Task`` entity that relates to -a ``Tag`` entitiy. The goal is to create a single form for tasks, that -also allows to edit/create/remove many tags associated with that task. - -Here's the ``Task`` and the ``Tag`` entity:: +Let's start by creating a ``Task`` entity:: // src/Entity/Task.php namespace App\Entity; @@ -48,8 +45,11 @@ Here's the ``Task`` and the ``Tag`` entity:: .. note:: - The `ArrayCollection`_ is specific to Doctrine and is basically the - same as using an ``array``. + The `ArrayCollection`_ is specific to Doctrine and is similar to a PHP array + but provides many utility methods. + +Now, create a ``Tag`` class. As you saw above, a ``Task`` can have many ``Tag`` +objects:: .. code-block:: php From 2b1f063ea379fffb2c42e527aaceba2d3553ba67 Mon Sep 17 00:00:00 2001 From: Wim Molenberghs Date: Mon, 2 Nov 2020 08:54:22 +0100 Subject: [PATCH 0222/1045] Add DirectoryIndex to fallback for resources When DirectoryIndex is set FallbackResource disabled will do nothing because apache falls back to DirectoryIndex --- setup/web_server_configuration.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/setup/web_server_configuration.rst b/setup/web_server_configuration.rst index e4fef9b3d99..710a2f89dc6 100644 --- a/setup/web_server_configuration.rst +++ b/setup/web_server_configuration.rst @@ -127,6 +127,7 @@ and increase web server performance: # which will allow Apache to return a 404 error when files are # not found instead of passing the request to Symfony + DirectoryIndex disabled FallbackResource disabled ErrorLog /var/log/apache2/project_error.log From 84ac5b201a4209113fe32e54d16b49dcb08fc0e6 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Tue, 22 Dec 2020 17:03:51 +0100 Subject: [PATCH 0223/1045] Tweak doc around proxy manager bridge --- service_container/lazy_services.rst | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/service_container/lazy_services.rst b/service_container/lazy_services.rst index 936316bb029..7b33bcdfcac 100644 --- a/service_container/lazy_services.rst +++ b/service_container/lazy_services.rst @@ -93,9 +93,9 @@ To check if your proxy works you can check the interface of the received object: .. note:: - If you don't install the `ProxyManager bridge`_ and the - `ocramius/proxy-manager`_, the container will skip over the ``lazy`` - flag and directly instantiate the service as it would normally do. + If you don't install the `ProxyManager bridge`_ , the container will skip + over the ``lazy`` flag and directly instantiate the service as it would + normally do. Additional Resources -------------------- @@ -106,5 +106,4 @@ in the `documentation of ProxyManager`_. .. _`ProxyManager bridge`: https://github.com/symfony/symfony/tree/master/src/Symfony/Bridge/ProxyManager .. _`proxy`: https://en.wikipedia.org/wiki/Proxy_pattern .. _`documentation of ProxyManager`: https://github.com/Ocramius/ProxyManager/blob/master/docs/lazy-loading-value-holder.md -.. _`ocramius/proxy-manager`: https://github.com/Ocramius/ProxyManager .. _`final`: https://www.php.net/manual/en/language.oop5.final.php From c8a0a723ab2565d3d24ba32f18c850f3e102aa36 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Tue, 22 Dec 2020 17:06:46 +0100 Subject: [PATCH 0224/1045] Fixed doc syntax --- form/form_collections.rst | 2 -- 1 file changed, 2 deletions(-) diff --git a/form/form_collections.rst b/form/form_collections.rst index 30215b0a37d..e7502432a16 100644 --- a/form/form_collections.rst +++ b/form/form_collections.rst @@ -51,8 +51,6 @@ Let's start by creating a ``Task`` entity:: Now, create a ``Tag`` class. As you saw above, a ``Task`` can have many ``Tag`` objects:: -.. code-block:: php - // src/Entity/Tag.php namespace App\Entity; From dc072c4d98b3d79494e9fcb12b4314b67bde4674 Mon Sep 17 00:00:00 2001 From: Pavel Nemchenko Date: Wed, 23 Dec 2020 00:03:08 +0200 Subject: [PATCH 0225/1045] [Service Container] Fix typo in tag default index method name --- 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 bf8f6959db4..6783ef06d4e 100644 --- a/service_container/tags.rst +++ b/service_container/tags.rst @@ -807,7 +807,7 @@ array element. For example, to retrieve the ``handler_two`` handler:: .. tip:: Just like the priority, you can also implement a static - ``getDefaultIndexAttributeName()`` method in the handlers and omit the + ``getDefaultIndexName()`` method in the handlers and omit the index attribute (``key``):: // src/Handler/One.php From eaaceec65766e176acd0dfcc58d445fa38c08bfc Mon Sep 17 00:00:00 2001 From: Victor Bocharsky Date: Wed, 23 Dec 2020 13:13:35 +0200 Subject: [PATCH 0226/1045] Minor: Remove extra space in the config example --- mailer.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mailer.rst b/mailer.rst index fa19d77d849..86683f365c1 100644 --- a/mailer.rst +++ b/mailer.rst @@ -962,7 +962,7 @@ you have a transport called ``async``, you can route the message there: async: "%env(MESSENGER_TRANSPORT_DSN)%" routing: - 'Symfony\Component\Mailer\Messenger\SendEmailMessage': async + 'Symfony\Component\Mailer\Messenger\SendEmailMessage': async .. code-block:: xml From 78de6f66628019b7feaee639c69ef6d907745931 Mon Sep 17 00:00:00 2001 From: Simon Date: Wed, 23 Dec 2020 12:49:07 +0100 Subject: [PATCH 0227/1045] Minor: Fix quotes style(serializer): Fix quotes --- components/serializer.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/serializer.rst b/components/serializer.rst index 20d31fa8c0c..5c498cbf593 100644 --- a/components/serializer.rst +++ b/components/serializer.rst @@ -627,7 +627,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"), 'json'); + $serialized = $serializer->serialize(new Person('Kévin'), 'json'); // {"customer_name": "Kévin"} Serializing Boolean Attributes From ccc128974d522b6708b512112e6efa31ef453755 Mon Sep 17 00:00:00 2001 From: Nyholm Date: Sun, 27 Dec 2020 12:36:11 +0100 Subject: [PATCH 0228/1045] [FrameworkBundle][WebLink] Config reference for the WebLink component --- reference/configuration/framework.rst | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/reference/configuration/framework.rst b/reference/configuration/framework.rst index e61e0e1365d..cb128f73d02 100644 --- a/reference/configuration/framework.rst +++ b/reference/configuration/framework.rst @@ -272,6 +272,7 @@ Configuration * `strict_email`_ * `translation_domain`_ +* `web_link`_ * `workflows`_ * :ref:`enabled ` @@ -2994,6 +2995,17 @@ recipients set in the code. ]); }; + +web_link +~~~~~~~~ + +enabled +....... + +**type**: ``boolean`` **default**: ``true`` or ``false`` depending on your installation + +Adds a Link HTTP header to the response. + workflows ~~~~~~~~~ From 6a758a514621b4c7e2c42e9068ead0ba4448443c Mon Sep 17 00:00:00 2001 From: Sebastian Paczkowski <74934099+sebpacz@users.noreply.github.com> Date: Sun, 27 Dec 2020 20:46:46 +0100 Subject: [PATCH 0229/1045] Remove white space --- configuration/using_parameters_in_dic.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configuration/using_parameters_in_dic.rst b/configuration/using_parameters_in_dic.rst index 730043af714..c81fcf7fa14 100644 --- a/configuration/using_parameters_in_dic.rst +++ b/configuration/using_parameters_in_dic.rst @@ -106,7 +106,7 @@ be injected with this parameter via the extension as follows:: { private $debug; - public function __construct($debug) + public function __construct($debug) { $this->debug = (bool) $debug; } From d922ed43b736892edb4be7c7bbd11ec5a30f1501 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Dunglas?= Date: Sat, 26 Dec 2020 11:48:48 +0100 Subject: [PATCH 0230/1045] [Process] add docs for ExecutableFinder --- components/process.rst | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/components/process.rst b/components/process.rst index 5b1ee2ca420..b7845145ca3 100644 --- a/components/process.rst +++ b/components/process.rst @@ -483,10 +483,32 @@ Use :method:`Symfony\\Component\\Process\\Process::disableOutput` and However, it is possible to pass a callback to the ``start``, ``run`` or ``mustRun`` methods to handle process output in a streaming fashion. + +Finding an Executable +--------------------- + +The Process component provides a utility class called +:class:`Symfony\\Component\\Process\\ExecutableFinder` which finds +and returns the absolute path of an executable:: + + use Symfony\Component\Process\ExecutableFinder; + + $executableFinder = new ExecutableFinder(); + $chromedriverPath = $executableFinder->find('chromedriver'); + // $chromedriverPath = '/usr/local/bin/chromedriver' (the result will be different on your computer) + +The :method:`Symfony\\Component\\Process\\ExecutableFinder::find` method also takes extra parameters to specify a default value +to return and extra directories where to look for the executable:: + + use Symfony\Component\Process\ExecutableFinder; + + $executableFinder = new ExecutableFinder(); + $chromedriverPath = $executableFinder->find('chromedriver', '/path/to/chromedriver', ['local-bin/']); + Finding the Executable PHP Binary --------------------------------- -This component also provides a utility class called +This component also provides a special utility class called :class:`Symfony\\Component\\Process\\PhpExecutableFinder` which returns the absolute path of the executable PHP binary available on your server:: From c2500f9ebff40287335a64e03abae42f434965a3 Mon Sep 17 00:00:00 2001 From: Nyholm Date: Sun, 27 Dec 2020 12:10:45 +0100 Subject: [PATCH 0231/1045] [FrameworkBundle] Config reference for Secrets --- reference/configuration/framework.rst | 31 +++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/reference/configuration/framework.rst b/reference/configuration/framework.rst index e61e0e1365d..4ca47e58768 100644 --- a/reference/configuration/framework.rst +++ b/reference/configuration/framework.rst @@ -197,6 +197,12 @@ Configuration * `utf8`_ * `secret`_ +* `secrets`_ + + * `decryption_env_var`_ + * `local_dotenv_file`_ + * `vault_directory`_ + * `serializer`_ * :ref:`circular_reference_handler ` @@ -2483,6 +2489,31 @@ annotation changes). For performance reasons, it is recommended to disable debug mode in production, which will happen automatically if you use the default value. + +secrets +~~~~~~~ + +decryption_env_var +.................. + +**type**: ``string`` **default**: ``base64:default::SYMFONY_DECRYPTION_SECRET`` + +The environment variable that contains the decryption key. + +local_dotenv_file +................. + +**type**: ``string`` **default**: ``%kernel.project_dir%/.env.%kernel.environment%.local`` + +Path to an dotenv file that holds secrets. This is primarily used for testing. + +vault_directory +............... + +**type**: ``string`` **default**: ``%kernel.project_dir%/config/secrets/%kernel.environment%`` + +The directory where the vault of secrets is stored. + .. _configuration-framework-serializer: serializer From 136b2aa1056b2a7b770fe9c804c24b55263a5252 Mon Sep 17 00:00:00 2001 From: Wouter de Jong Date: Mon, 28 Dec 2020 11:57:43 +0100 Subject: [PATCH 0232/1045] Added redirections to specific anchors for removed Templating articles --- _build/redirection_map | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/_build/redirection_map b/_build/redirection_map index 6c49dc6bed6..4954ce471fa 100644 --- a/_build/redirection_map +++ b/_build/redirection_map @@ -448,15 +448,15 @@ /reference/requirements /setup /bundles/inheritance /bundles/override /templating /templates -/templating/escaping /templates -/templating/syntax /templates -/templating/debug /templates -/templating/render_without_controller /templates -/templating/app_variable /templates +/templating/escaping /templates#output-escaping +/templating/syntax /templates#linting-twig-templates +/templating/debug /templates#the-dump-twig-utilities +/templating/render_without_controller /templates#rendering-a-template-directly-from-a-route +/templating/app_variable /templates#the-app-global-variable /templating/formats /templates -/templating/namespaced_paths /templates -/templating/embedding_controllers /templates -/templating/inheritance /templates +/templating/namespaced_paths /templates#template-namespaces +/templating/embedding_controllers /templates#embedding-controllers +/templating/inheritance /templates#template-inheritance-and-layouts /testing/doctrine /testing/database /doctrine/lifecycle_callbacks /doctrine/events /doctrine/event_listeners_subscribers /doctrine/events From 5570ab83867190d892679ad5e0c5f8d3b6396ba3 Mon Sep 17 00:00:00 2001 From: Nyholm Date: Tue, 22 Dec 2020 23:34:14 +0100 Subject: [PATCH 0233/1045] [Session] Update incorrect default value for session.handler_id --- reference/configuration/framework.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/reference/configuration/framework.rst b/reference/configuration/framework.rst index e61e0e1365d..7a7fad45029 100644 --- a/reference/configuration/framework.rst +++ b/reference/configuration/framework.rst @@ -1251,11 +1251,11 @@ alias will be set to this service id. This class has to implement handler_id .......... -**type**: ``string`` **default**: ``null`` +**type**: ``string`` **default**: ``'session.handler.native_file'`` -The service id used for session storage. The default ``null`` value means to use -the native PHP session mechanism. Set it to ``'session.handler.native_file'`` to -let Symfony manage the sessions itself using files to store the session metadata. +The service id used for session storage. The default value ``'session.handler.native_file'`` +will let Symfony manage the sessions itself using files to store the session metadata. +Set it to ``null`` to use the native PHP session mechanism. You can also :doc:`store sessions in a database `. .. _name: From f0344be19e7c0f18b36957fd19e3fed901df215a Mon Sep 17 00:00:00 2001 From: Rhodri Pugh Date: Thu, 24 Dec 2020 11:51:20 +0000 Subject: [PATCH 0234/1045] remove mention of master branch, no longer exists --- contributing/documentation/overview.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/contributing/documentation/overview.rst b/contributing/documentation/overview.rst index f7d1e4e8a03..be7d3418c6e 100644 --- a/contributing/documentation/overview.rst +++ b/contributing/documentation/overview.rst @@ -121,7 +121,7 @@ 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 ``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. +``upstream/3.1``. **Step 5.** Now make your changes in the documentation. Add, tweak, reword and even remove any content and do your best to comply with the @@ -295,12 +295,12 @@ Please be patient. It can take up to several days before your pull request can be fully reviewed. After merging the changes, it could take again several hours before your changes appear on the Symfony website. -Why Should I Use the Oldest Maintained Branch Instead of the Master Branch? +Why Should I Use the Oldest Maintained Branch Instead of the Latest Branch? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Consistent with Symfony's source code, the documentation repository is split into multiple branches, corresponding to the different versions of Symfony itself. -The ``master`` branch holds the documentation for the development branch of +The latest (e.g. ``5.x``) branch holds the documentation for the development branch of the code. Unless you're documenting a feature that was introduced after Symfony 4.4, From d5990bec534699ceaaeb211f3a2b0d3704036793 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Mon, 28 Dec 2020 15:42:38 +0100 Subject: [PATCH 0235/1045] Added a link to the related RFC --- reference/configuration/framework.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/reference/configuration/framework.rst b/reference/configuration/framework.rst index fb29e6c83d3..83b1cd90abb 100644 --- a/reference/configuration/framework.rst +++ b/reference/configuration/framework.rst @@ -3035,7 +3035,7 @@ enabled **type**: ``boolean`` **default**: ``true`` or ``false`` depending on your installation -Adds a Link HTTP header to the response. +Adds a `Link HTTP header`_ to the response. workflows ~~~~~~~~~ @@ -3210,3 +3210,4 @@ to know their differences. .. _`session.cache-limiter`: https://www.php.net/manual/en/session.configuration.php#ini.session.cache-limiter .. _`Microsoft NTLM authentication protocol`: https://docs.microsoft.com/en-us/windows/win32/secauthn/microsoft-ntlm .. _`utf-8 modifier`: https://www.php.net/reference.pcre.pattern.modifiers +.. _`Link HTTP header`: https://tools.ietf.org/html/rfc5988 From 88130c10135ecdb2b92a5f6a530b564dffe9b41e Mon Sep 17 00:00:00 2001 From: Oskar Stark Date: Wed, 30 Dec 2020 10:04:06 +0100 Subject: [PATCH 0236/1045] Use max_colons rule for DOCtor-RST --- .doctor-rst.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.doctor-rst.yaml b/.doctor-rst.yaml index 59971c508f4..949ad80f3bf 100644 --- a/.doctor-rst.yaml +++ b/.doctor-rst.yaml @@ -14,6 +14,7 @@ rules: lowercase_as_in_use_statements: ~ max_blank_lines: max: 2 + max_colons: ~ no_app_console: ~ no_blank_line_after_filepath_in_php_code_block: ~ no_blank_line_after_filepath_in_twig_code_block: ~ From 44d5818f19872d4f7fd41640ebd2e39b82959ed9 Mon Sep 17 00:00:00 2001 From: Marco Date: Tue, 29 Dec 2020 20:10:35 +0100 Subject: [PATCH 0237/1045] Minor fix to colon Mostly not worth a PR but I wanted to change it either way. Changed the display output from `::` to `:` as it is in the rest of the document. --- routing.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/routing.rst b/routing.rst index 5fd4ad30225..86defd2bafc 100644 --- a/routing.rst +++ b/routing.rst @@ -1874,7 +1874,7 @@ use the ``generateUrl()`` helper:: If you pass to the ``generateUrl()`` method some parameters that are not part of the route definition, they are included in the generated URL as a - query string::: + query string:: $this->generateUrl('blog', ['page' => 2, 'category' => 'Symfony']); // the 'blog' route only defines the 'page' parameter; the generated URL is: From 6fa2894b27067ca623fbc345f6df04da9258e8bf Mon Sep 17 00:00:00 2001 From: Sebastian Paczkowski <74934099+sebpacz@users.noreply.github.com> Date: Wed, 30 Dec 2020 10:19:59 +0100 Subject: [PATCH 0238/1045] Replace link to getConfiguration method In my opinion, the link should redirect to the class where we can preview the method that must be overridden. --- bundles/configuration.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bundles/configuration.rst b/bundles/configuration.rst index 25f8d76e76f..40eaf331d4f 100644 --- a/bundles/configuration.rst +++ b/bundles/configuration.rst @@ -334,7 +334,7 @@ As long as your bundle's configuration is located in the standard location (``YourBundle\DependencyInjection\Configuration``) and does not have a constructor it will work automatically. If you have something different, your ``Extension`` class must override the -:method:`Extension::getConfiguration() ` +:method:`Extension::getConfiguration() ` method and return an instance of your ``Configuration``. Supporting XML From 853dfb082a0dadb9ee50625eb4b2350de92f1ec2 Mon Sep 17 00:00:00 2001 From: Thomas Landauer Date: Wed, 30 Dec 2020 14:35:32 +0100 Subject: [PATCH 0239/1045] Shortening the text and adding link to jQuery As a separate PR, as recommended by https://github.com/symfony/symfony-docs/pull/13450#issuecomment-722413038 --- form/form_collections.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/form/form_collections.rst b/form/form_collections.rst index e7502432a16..9e74e0d2895 100644 --- a/form/form_collections.rst +++ b/form/form_collections.rst @@ -280,9 +280,8 @@ On the rendered page, the result will look something like this: the ``data-prototype`` attribute is automatically added to the containing ``div``, 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 the "Add a tag" button. -This example uses jQuery and assumes you have it included somewhere on your page. +Now we need some JavaScript to read this attribute and dynamically add new tag forms +when the user clicks an "Add a tag" link. This example uses `jQuery`_. 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" @@ -684,6 +683,7 @@ the relationship between the removed ``Tag`` and ``Task`` object. the `symfony-collection`_ package based on jQuery for the rest of browsers. .. _`Owning Side and Inverse Side`: https://www.doctrine-project.org/projects/doctrine-orm/en/current/reference/unitofwork-associations.html +.. _`jQuery`: http://jquery.com/ .. _`JSFiddle`: http://jsfiddle.net/847Kf/4/ .. _`@a2lix/symfony-collection`: https://github.com/a2lix/symfony-collection .. _`symfony-collection`: https://github.com/ninsuo/symfony-collection From dc794b9947f9a6139aee08a564e1d14429fa9ae3 Mon Sep 17 00:00:00 2001 From: Thomas Landauer Date: Wed, 30 Dec 2020 15:03:42 +0100 Subject: [PATCH 0240/1045] Shortening the text some more As a separate PR, as recommended by https://github.com/symfony/symfony-docs/pull/13450#issuecomment-722413038 * Reason for deleting "Add a script tag somewhere on your page...": Lenghthy text that didn't say much ;-) * Reason for deleting the `note`: The JavaScript code is shown in itself; not inside some HTML ;-) * --- form/form_collections.rst | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/form/form_collections.rst b/form/form_collections.rst index e7502432a16..89c27960adf 100644 --- a/form/form_collections.rst +++ b/form/form_collections.rst @@ -245,7 +245,7 @@ the following ``data-prototype`` attribute to the existing ``
            `` in your temp
              -Now add a button just next to the ``
                `` to dynamically add a new tag +Now add a button just next to the ``
                  `` to dynamically add a new tag: .. code-block:: html+twig @@ -284,9 +284,7 @@ The goal of this section will be to use JavaScript to read this attribute 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. 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): +Now add the required functionality with JavaScript: .. code-block:: javascript @@ -344,11 +342,6 @@ one example: $collectionHolder.append($newFormLi) } -.. note:: - - It is better to separate your JavaScript in real JavaScript files than - to write it inside the HTML as is done here. - Now, each time a user clicks the ``Add a tag`` link, a new sub form will appear on the page. When the form is submitted, any new tag forms will be converted into new ``Tag`` objects and added to the ``tags`` property of the ``Task`` object. From d015c96640903093ae003b4a368c950d3b919cb0 Mon Sep 17 00:00:00 2001 From: Thomas Landauer Date: Wed, 30 Dec 2020 15:13:50 +0100 Subject: [PATCH 0241/1045] Rewording As a separate PR, as recommended by https://github.com/symfony/symfony-docs/pull/13450#issuecomment-722413038 Note: `addTagForm` was the wrong function name, it's now called `addFormToCollection()` --- form/form_collections.rst | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/form/form_collections.rst b/form/form_collections.rst index e7502432a16..0812c2dac93 100644 --- a/form/form_collections.rst +++ b/form/form_collections.rst @@ -304,14 +304,10 @@ button so you can add a new tag form (``addFormToCollection()`` will be show nex }) }); -The ``addTagForm()`` function's job will be to use the ``data-prototype`` attribute -to dynamically add a new form when this link is clicked. The ``data-prototype`` -HTML contains the tag ``text`` input element with a name of ``task[tags][__name__][name]`` -and id of ``task_tags___name___name``. The ``__name__`` is a little "placeholder", -which you'll replace with a unique, incrementing number (e.g. ``task[tags][3][name]``). - -The actual code needed to make this all work can vary quite a bit, but here's -one example: +The ``data-prototype`` HTML contains the tag's ``text`` input element with a name of +``task[tags][__name__][name]`` and id of ``task_tags___name___name``. The ``__name__`` +part is a "placeholder", which is replaced by a unique, incrementing number +(e.g. ``task[tags][3][name]``). .. code-block:: javascript From 0bd38f6ba51e04e1a67eed30d6221206d8a37c43 Mon Sep 17 00:00:00 2001 From: Thomas Landauer Date: Wed, 30 Dec 2020 15:17:12 +0100 Subject: [PATCH 0242/1045] Fixing function name --- form/form_collections.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/form/form_collections.rst b/form/form_collections.rst index e7502432a16..cceffb6b6b1 100644 --- a/form/form_collections.rst +++ b/form/form_collections.rst @@ -572,7 +572,7 @@ First, add a "delete this tag" link to each tag form: // ... the rest of the block from above }); - function addTagForm() { + function addFormToCollection() { // ... // add a delete link to the new form From ec51ca97c3540f7c3351451f7c63baea546404a2 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Wed, 30 Dec 2020 16:26:15 +0100 Subject: [PATCH 0243/1045] Rewords and reverts --- form/form_collections.rst | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/form/form_collections.rst b/form/form_collections.rst index 9e74e0d2895..9be2b6fa6c2 100644 --- a/form/form_collections.rst +++ b/form/form_collections.rst @@ -280,8 +280,10 @@ On the rendered page, the result will look something like this: the ``data-prototype`` attribute is automatically added to the containing ``div``, and you need to adjust the following JavaScript accordingly. -Now we need some JavaScript to read this attribute and dynamically add new tag forms -when the user clicks an "Add a tag" link. This example uses `jQuery`_. +The goal of this section will be to use JavaScript to read this attribute +and dynamically add new tag forms when the user clicks the "Add a tag" link. +This example uses `jQuery`_ and assumes you have it included somewhere on your +page (e.g. using Symfony's :doc:`Webpack Encore `). 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" From 033f36473fb6b69e019c60e380a40631e86ab50f Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Wed, 30 Dec 2020 16:32:29 +0100 Subject: [PATCH 0244/1045] Minor tweak --- form/form_collections.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/form/form_collections.rst b/form/form_collections.rst index c3a78e93ac0..b60e5efc47f 100644 --- a/form/form_collections.rst +++ b/form/form_collections.rst @@ -285,7 +285,8 @@ and dynamically add new tag forms when the user clicks the "Add a tag" link. This example uses `jQuery`_ and assumes you have it included somewhere on your page (e.g. using Symfony's :doc:`Webpack Encore `). -Now add the required functionality with JavaScript: +Add a `` + + See note below about the "defer" attribute --> {% endblock %} - + + + .. _encore-entrypointsjson-simple-description: @@ -135,11 +135,14 @@ If you're *not* using Symfony, you can ignore the ``entrypoints.json`` file and point to the final, built file directly. ``entrypoints.json`` is only required for some optional features. -.. versionadded:: 0.21.0 +.. versionadded:: 1.9.0 - The ``encore_entry_link_tags()`` comes from WebpackEncoreBundle and relies - on a feature in Encore that was first introduced in version 0.21.0. Previously, - the ``asset()`` function was used to point directly to the file. + The ``defer`` attribute on the ``script`` tags delays the execution of the + JavaScript until the page loads (similar to putting the ``script`` at the + bottom of the page). The ability to always add this attribute was introduced + in WebpackEncoreBundle 1.9.0 and is automatically enabled in that bundle's + recipe in the ``config/packages/webpack_encore.yaml`` file. See + `WebpackEncoreBundle Configuration`_ for more details. Requiring JavaScript Modules ---------------------------- @@ -355,3 +358,4 @@ Encore supports many more features! For a full list of what you can do, see .. _`Encore's index.js file`: https://github.com/symfony/webpack-encore/blob/master/index.js .. _`ECMAScript 6 modules`: https://hacks.mozilla.org/2015/08/es6-in-depth-modules/ +.. _`WebpackEncoreBundle Configuration`: https://github.com/symfony/webpack-encore-bundle#configuration diff --git a/introduction/from_flat_php_to_symfony.rst b/introduction/from_flat_php_to_symfony.rst index 40a421f85dd..bae9ee9a8dc 100644 --- a/introduction/from_flat_php_to_symfony.rst +++ b/introduction/from_flat_php_to_symfony.rst @@ -609,10 +609,10 @@ The ``layout.php`` file is nearly identical: {% block title %}Welcome!{% endblock %} {% block stylesheets %}{% endblock %} + {% block javascripts %}{% endblock %} {% block body %}{% endblock %} - {% block javascripts %}{% endblock %} From 5dba6e69b3ee57a6bb3375b4ee304688269d6c4f Mon Sep 17 00:00:00 2001 From: Al-Saleh KEITA <28827545+askeita@users.noreply.github.com> Date: Fri, 15 Jan 2021 22:40:21 +0100 Subject: [PATCH 0288/1045] Update testing.rst Replaced "an" by "a" (line 66) --- testing.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing.rst b/testing.rst index c3dd66c7f9c..130ed0ab2ae 100644 --- a/testing.rst +++ b/testing.rst @@ -63,7 +63,7 @@ If you want to test an entire feature of your application (e.g. registering as a user or generating an invoice), see the section about :ref:`Functional Tests `. Writing Symfony unit tests is no different from writing standard PHPUnit -unit tests. Suppose, for example, that you have an class called ``Calculator`` +unit tests. Suppose, for example, that you have a class called ``Calculator`` in the ``src/Util/`` directory of the app:: // src/Util/Calculator.php From bd610d3ac0f42d8a0255d86cc5bc2b2a70a7f092 Mon Sep 17 00:00:00 2001 From: Johnny Peck Date: Fri, 15 Jan 2021 21:49:53 -0500 Subject: [PATCH 0289/1045] Update lock.rst Small grammar change. --- components/lock.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/lock.rst b/components/lock.rst index 55ddcf377b3..7b2c131947d 100644 --- a/components/lock.rst +++ b/components/lock.rst @@ -158,7 +158,7 @@ method, the resource will stay locked until the timeout:: .. tip:: - To avoid letting the lock in a locking state, it's recommended to wrap the + To avoid leaving the lock in a locked state, it's recommended to wrap the job in a try/catch/finally block to always try to release the expiring lock. In case of long-running tasks, it's better to start with a not too long TTL and From 08a07c917f672bcf17f5e4bbfe070a7100ceacc6 Mon Sep 17 00:00:00 2001 From: YaFou <33806646+YaFou@users.noreply.github.com> Date: Mon, 18 Jan 2021 19:33:41 +0100 Subject: [PATCH 0290/1045] [Security] Clarify the DeauthenticatedEvent --- components/security/authentication.rst | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/components/security/authentication.rst b/components/security/authentication.rst index 4cb87975e08..1f75b433c6c 100644 --- a/components/security/authentication.rst +++ b/components/security/authentication.rst @@ -276,15 +276,15 @@ Authentication Events The security component provides the following authentication events: -=============================== ================================================================= ============================================================================== -Name Event Constant Argument Passed to the Listener -=============================== ================================================================= ============================================================================== -security.authentication.success ``AuthenticationEvents::AUTHENTICATION_SUCCESS`` :class:`Symfony\\Component\\Security\\Core\\Event\\AuthenticationSuccessEvent` -security.authentication.failure ``AuthenticationEvents::AUTHENTICATION_FAILURE`` :class:`Symfony\\Component\\Security\\Core\\Event\\AuthenticationFailureEvent` -security.interactive_login ``SecurityEvents::INTERACTIVE_LOGIN`` :class:`Symfony\\Component\\Security\\Http\\Event\\InteractiveLoginEvent` -security.switch_user ``SecurityEvents::SWITCH_USER`` :class:`Symfony\\Component\\Security\\Http\\Event\\SwitchUserEvent` -security.logout_on_change ``Symfony\Component\Security\Http\Event\DeauthenticatedEvent`` :class:`Symfony\\Component\\Security\\Http\\Event\\DeauthenticatedEvent` -=============================== ================================================================= ============================================================================== +=============================== ======================================================================== ============================================================================== +Name Event Constant Argument Passed to the Listener +=============================== ======================================================================== ============================================================================== +security.authentication.success ``AuthenticationEvents::AUTHENTICATION_SUCCESS`` :class:`Symfony\\Component\\Security\\Core\\Event\\AuthenticationSuccessEvent` +security.authentication.failure ``AuthenticationEvents::AUTHENTICATION_FAILURE`` :class:`Symfony\\Component\\Security\\Core\\Event\\AuthenticationFailureEvent` +security.interactive_login ``SecurityEvents::INTERACTIVE_LOGIN`` :class:`Symfony\\Component\\Security\\Http\\Event\\InteractiveLoginEvent` +security.switch_user ``SecurityEvents::SWITCH_USER`` :class:`Symfony\\Component\\Security\\Http\\Event\\SwitchUserEvent` +security.logout_on_change ``Symfony\Component\Security\Http\Event\DeauthenticatedEvent::class`` :class:`Symfony\\Component\\Security\\Http\\Event\\DeauthenticatedEvent` +=============================== ======================================================================== ============================================================================== Authentication Success and Failure Events ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -317,7 +317,7 @@ The ``security.switch_user`` event is triggered every time you activate the ``switch_user`` firewall listener. The ``Symfony\Component\Security\Http\Event\DeauthenticatedEvent`` event is triggered when a token has been deauthenticated -because of a user change, it can help you doing some clean-up task when a logout has been triggered. +because of a user change, it can help you doing some clean-up task. .. versionadded:: 4.3 From 00db43a4f034ff0f8412953fc4766a01e8fba791 Mon Sep 17 00:00:00 2001 From: Thomas Landauer Date: Tue, 19 Jan 2021 23:16:46 +0100 Subject: [PATCH 0291/1045] Just moving this note upwards MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reasons: * It's a *general* thing, has nothing to do with "Handlers that Modify Log Entries". * Since this is uncommon in Symfony, it should be explained as early as possible. * Fits quite well after this sentence: > This defines a stack of handlers and each handler is called in the order that it’s defined. --- logging.rst | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/logging.rst b/logging.rst index 0b3481a738f..d4ed95189ba 100644 --- a/logging.rst +++ b/logging.rst @@ -159,6 +159,13 @@ to write logs using the :phpfunction:`syslog` function: This defines a *stack* of handlers and each handler is called in the order that it's defined. +.. note:: + + If you want to override the ``monolog`` configuration via another config + file, you will need to redefine the entire ``handlers`` stack. The configuration + from the two files cannot be merged because the order matters and a merge does + not allow to control the order. + Handlers that Modify Log Entries ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -263,13 +270,6 @@ debugging much easier! The handler named "file_log" will not be included in the stack itself as it is used as a nested handler of the ``fingers_crossed`` handler. -.. note:: - - If you want to override the ``monolog`` configuration via another config - file, you will need to redefine the entire ``handlers`` stack. The configuration - from the two files cannot be merged because the order matters and a merge does - not allow to control the order. - All Built-in Handlers --------------------- From 8379ea8be9f200ac4415fd6a678bfc1462066d9f Mon Sep 17 00:00:00 2001 From: Oskar Stark Date: Thu, 21 Jan 2021 21:19:23 +0100 Subject: [PATCH 0292/1045] Update messenger.rst --- messenger.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/messenger.rst b/messenger.rst index 2999db21334..2947f18cb68 100644 --- a/messenger.rst +++ b/messenger.rst @@ -214,7 +214,7 @@ you can configure them to be sent to a transport: routing: # async is whatever name you gave your transport above - 'App\Message\SmsNotification': async + 'App\Message\SmsNotification': async .. code-block:: xml From 465da94d215a21cdfb362c592730c89704557ea4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Dunglas?= Date: Tue, 22 Dec 2020 20:04:03 +0100 Subject: [PATCH 0293/1045] [Mercure] Update docs for v0.11 --- mercure.rst | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/mercure.rst b/mercure.rst index e4bc11d911f..527833e2f7e 100644 --- a/mercure.rst +++ b/mercure.rst @@ -68,11 +68,20 @@ clients. An official and open source (AGPL) implementation of a Hub can be downloaded as a static binary from `Mercure.rocks`_. -Run the following command to start it: +If you use `Symfony Docker`_, +a Mercure Hub is already included and you can skip straight to the next section. -.. code-block:: terminal +On Linux and Mac, run the following command to start it: + +.. rst-class:: command-linux + + $ SERVER_NAME=:3000 MERCURE_PUBLISHER_JWT_KEY="!ChangeMe!" MERCURE_SUBSCRIBER_JWT_KEY="!ChangeMe!" ./mercure run -config Caddyfile.dev + +On Windows run: + +.. rst-class: command-windows - $ ./mercure --jwt-key='!ChangeMe!' --addr='localhost:3000' --allow-anonymous --cors-allowed-origins='*' + > $env:SERVER_NAME=':3000'; $env:MERCURE_PUBLISHER_JWT_KEY='!ChangeMe!'; $env:MERCURE_SUBSCRIBER_JWT_KEY='!ChangeMe!'; .\mercure.exe run -config Caddyfile.dev .. note:: @@ -175,8 +184,8 @@ the **topic** being updated. This topic should be an `IRI`_ of the resource being dispatched. Usually, this parameter contains the original URL of the resource -transmitted to the client, but it can be any valid `IRI`_, it doesn't -have to be a URL that exists (similarly to XML namespaces). +transmitted to the client, but it can be any string or `IRI`_, +and it doesn't have to be a URL that exists (similarly to XML namespaces). The second parameter of the constructor is the content of the update. It can be anything, stored in any format. @@ -630,6 +639,7 @@ Enable the panel in your configuration, as follows: .. _`high-level implementations`: https://mercure.rocks/docs/ecosystem/awesome .. _`In this recording`: https://www.youtube.com/watch?v=UI1l0JOjLeI .. _`Mercure.rocks`: https://mercure.rocks +.. _`Symfony Docker`: https://github.com/dunglas/symfony-docker/ .. _`API Platform distribution`: https://api-platform.com/docs/distribution/ .. _`JSON Web Token`: https://tools.ietf.org/html/rfc7519 .. _`example JWT`: https://jwt.io/#debugger-io?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJtZXJjdXJlIjp7InB1Ymxpc2giOlsiKiJdfX0.iHLdpAEjX4BqCsHJEegxRmO-Y6sMxXwNATrQyRNt3GY From 0f95e076b5529d5507444f55a130946865647d1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Marcin=20Brzuchalski?= Date: Tue, 19 Jan 2021 17:54:47 +0100 Subject: [PATCH 0294/1045] Require preprocessor env name fix used in PHP snippet --- configuration/env_var_processors.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configuration/env_var_processors.rst b/configuration/env_var_processors.rst index 710ce3da6b6..7b134067bef 100644 --- a/configuration/env_var_processors.rst +++ b/configuration/env_var_processors.rst @@ -394,7 +394,7 @@ Symfony provides the following env var processors: // config/packages/framework.php $container->setParameter('env(PHP_FILE)', '../config/.runtime-evaluated.php'); $container->loadFromExtension('app', [ - 'auth' => '%env(require:AUTH_FILE)%', + 'auth' => '%env(require:PHP_FILE)%', ]); .. versionadded:: 4.3 From 3d560c3059e18ad7eecb4e45eeda1887cbee3e2c Mon Sep 17 00:00:00 2001 From: Thomas Landauer Date: Wed, 20 Jan 2021 16:23:39 +0100 Subject: [PATCH 0295/1045] Listing possible values of storage_id --- reference/configuration/framework.rst | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/reference/configuration/framework.rst b/reference/configuration/framework.rst index 83b1cd90abb..4515077d1d7 100644 --- a/reference/configuration/framework.rst +++ b/reference/configuration/framework.rst @@ -1249,9 +1249,14 @@ storage_id **type**: ``string`` **default**: ``'session.storage.native'`` -The service id used for session storage. The ``session.storage`` service -alias will be set to this service id. This class has to implement +The service ID used for storing the session. The ``session.storage`` service +alias will be set to this service. The class has to implement :class:`Symfony\\Component\\HttpFoundation\\Session\\Storage\\SessionStorageInterface`. +To see a list of all available storages, run: + +.. code-block:: terminal + + $ php bin/console debug:container session.storage. .. _config-framework-session-handler-id: From 706222e14f34905949e077001cfd25be8dc74488 Mon Sep 17 00:00:00 2001 From: Ian Gilfillan Date: Tue, 12 Jan 2021 22:47:34 +0200 Subject: [PATCH 0296/1045] Mention MariaDB as well --- session/database.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/session/database.rst b/session/database.rst index badd1412145..6430517c647 100644 --- a/session/database.rst +++ b/session/database.rst @@ -166,11 +166,11 @@ parallel and only the first one stored the CSRF token in the session. If you use Memcached instead of Redis, follow a similar approach but replace ``RedisSessionHandler`` by :class:`Symfony\\Component\\HttpFoundation\\Session\\Storage\\Handler\\MemcachedSessionHandler`. -Store Sessions in a Relational Database (MySQL, PostgreSQL) +Store Sessions in a Relational Database (MariaDB, MySQL, PostgreSQL) ----------------------------------------------------------- Symfony includes a :class:`Symfony\\Component\\HttpFoundation\\Session\\Storage\\Handler\\PdoSessionHandler` -to store sessions in relational databases like MySQL and PostgreSQL. To use it, +to store sessions in relational databases like MariaDB, MySQL and PostgreSQL. To use it, first register a new handler service with your database credentials: .. configuration-block:: @@ -379,8 +379,8 @@ file and run the migration with the following command: $ php bin/console doctrine:migrations:migrate -MySQL -..... +MariaDB/MySQL +............. .. code-block:: sql From 794de34c0063736b057c6d666569d350618f3522 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Fri, 22 Jan 2021 15:12:02 +0100 Subject: [PATCH 0297/1045] Tweaks --- session/database.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/session/database.rst b/session/database.rst index 6430517c647..a0fb1b3d4a6 100644 --- a/session/database.rst +++ b/session/database.rst @@ -167,7 +167,7 @@ parallel and only the first one stored the CSRF token in the session. ``RedisSessionHandler`` by :class:`Symfony\\Component\\HttpFoundation\\Session\\Storage\\Handler\\MemcachedSessionHandler`. Store Sessions in a Relational Database (MariaDB, MySQL, PostgreSQL) ------------------------------------------------------------ +-------------------------------------------------------------------- Symfony includes a :class:`Symfony\\Component\\HttpFoundation\\Session\\Storage\\Handler\\PdoSessionHandler` to store sessions in relational databases like MariaDB, MySQL and PostgreSQL. To use it, @@ -379,6 +379,8 @@ file and run the migration with the following command: $ php bin/console doctrine:migrations:migrate +.. _mysql: + MariaDB/MySQL ............. From 5d8a9e25130e6d46da32084b2aa5ce64bba8cc63 Mon Sep 17 00:00:00 2001 From: CaDJoU <46056722+cadjou@users.noreply.github.com> Date: Tue, 19 Jan 2021 23:40:48 +0100 Subject: [PATCH 0298/1045] [Mailer] Update mailer.rst --- mailer.rst | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/mailer.rst b/mailer.rst index 90472439eb5..bef7cef866e 100644 --- a/mailer.rst +++ b/mailer.rst @@ -65,6 +65,13 @@ over SMTP by configuring the DSN in your ``.env`` file (the ``user``, ]); }; +.. caution:: + + If the username, password or host contain any character considered special in a + URI (such as ``+``, ``@``, ``$``, ``#``, ``/``, ``:``, ``*``, ``!``), you must + encode them. See `RFC 3986`_ for the full list of reserved characters or use the + :phpfunction:`urlencode` function to encode them. + .. caution:: If you are migrating from Swiftmailer (and the Swiftmailer bundle), be From 58ddc5fd32a66765980d686b00ab1b6fdd2d7105 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Fri, 22 Jan 2021 15:17:24 +0100 Subject: [PATCH 0299/1045] Added missing reference link --- mailer.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/mailer.rst b/mailer.rst index bef7cef866e..58531bf85f3 100644 --- a/mailer.rst +++ b/mailer.rst @@ -1120,3 +1120,4 @@ a specific address, instead of the *real* address: .. _`S/MIME`: https://en.wikipedia.org/wiki/S/MIME .. _`OpenSSL PHP extension`: https://www.php.net/manual/en/book.openssl.php .. _`PEM encoded`: https://en.wikipedia.org/wiki/Privacy-Enhanced_Mail +.. _`RFC 3986`: https://www.ietf.org/rfc/rfc3986.txt From 6987db2dd8e984775d26058f611a321ab28693fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vincent=20Brout=C3=A9?= Date: Fri, 8 Jan 2021 18:08:31 +0100 Subject: [PATCH 0300/1045] Update configuration.rst Fix PHP configuration sample for setting default parameter bindings. --- configuration.rst | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/configuration.rst b/configuration.rst index e25e18efd5b..1b5c2eef31f 100644 --- a/configuration.rst +++ b/configuration.rst @@ -881,18 +881,15 @@ whenever a service/controller defines a ``$projectDir`` argument, use this: namespace Symfony\Component\DependencyInjection\Loader\Configurator; use App\Controller\LuckyController; - use Psr\Log\LoggerInterface; - use Symfony\Component\DependencyInjection\Reference; return static function (ContainerConfigurator $container) { - $container->services() - ->set(LuckyController::class) - ->public() - ->args([ - // pass this value to any $projectDir argument for any service - // that's created in this file (including controller arguments) - '$projectDir' => '%kernel.project_dir%', - ]); + $services = $container->services() + ->defaults() + // pass this value to any $projectDir argument for any service + // that's created in this file (including controller arguments) + ->bind('$projectDir', '%kernel.project_dir%'); + + // ... }; .. seealso:: From b72cfde11a1a6b53860b4c42e65573ac0db97d91 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Fri, 22 Jan 2021 15:34:09 +0100 Subject: [PATCH 0301/1045] Tweak --- configuration.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configuration.rst b/configuration.rst index 1b5c2eef31f..ecc34b99ddc 100644 --- a/configuration.rst +++ b/configuration.rst @@ -883,7 +883,7 @@ whenever a service/controller defines a ``$projectDir`` argument, use this: use App\Controller\LuckyController; return static function (ContainerConfigurator $container) { - $services = $container->services() + $container->services() ->defaults() // pass this value to any $projectDir argument for any service // that's created in this file (including controller arguments) From 425495b63061147b8c6f3e160f747c5991bde682 Mon Sep 17 00:00:00 2001 From: Souhail Date: Fri, 22 Jan 2021 17:01:50 +0100 Subject: [PATCH 0302/1045] Update serializer.rst Update CsvEncoder's default values --- components/serializer.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/serializer.rst b/components/serializer.rst index d6c19a10cd3..f554ed7cf76 100644 --- a/components/serializer.rst +++ b/components/serializer.rst @@ -869,7 +869,7 @@ Option Description D ``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_escape_char`` Sets the escape character (at most one character) empty string ``csv_key_separator`` Sets the separator for array's keys during its ``.`` flattening ``csv_headers`` Sets the order of the header and data columns @@ -879,7 +879,7 @@ Option Description D ``a,b,c\n1,2,3`` ``[]``, 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 +``as_collection`` Always returns results as a collection, even if only ``true`` 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`` From b40bfae8215c1e4d7615270a334c2ce0eae0f09a Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Fri, 22 Jan 2021 17:41:56 +0100 Subject: [PATCH 0303/1045] [Workflow] Added initialization docs --- components/workflow.rst | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/components/workflow.rst b/components/workflow.rst index a35602f1ac2..493b4230124 100644 --- a/components/workflow.rst +++ b/components/workflow.rst @@ -94,6 +94,20 @@ you can retrieve a workflow from it and use it as follows:: $workflow->can($blogPost, 'publish'); // True $workflow->getEnabledTransitions($blogPost); // $blogPost can perform transition "publish" or "reject" +Initialization +-------------- + +If the property of your object is ``null`` and you want to set it with the +``initial_marking`` from the configuration, you can call the ``getMarking()`` +method to initialize the object property:: + + // ... + $blogPost = new BlogPost(); + $workflow = $registry->get($blogPost); + + // initiate workflow + $workflow->getMarking($blogPost); + Learn more ---------- From 29a254533cf8ad5253fc7b68a8652bba4ba6ebba Mon Sep 17 00:00:00 2001 From: wkania <57155526+wkania@users.noreply.github.com> Date: Sat, 23 Jan 2021 14:37:04 +0100 Subject: [PATCH 0304/1045] [Validator] Use double quotes instead of single --- reference/constraints/IsFalse.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reference/constraints/IsFalse.rst b/reference/constraints/IsFalse.rst index 861072a1250..e476fb25387 100644 --- a/reference/constraints/IsFalse.rst +++ b/reference/constraints/IsFalse.rst @@ -97,7 +97,7 @@ method returns **false**: public static function loadValidatorMetadata(ClassMetadata $metadata) { $metadata->addGetterConstraint('stateInvalid', new Assert\IsFalse([ - 'message' => 'You've entered an invalid state.', + 'message' => "You've entered an invalid state.", ])); } } From 86b2834fe361656f83972527d2082e16b398431b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Barto=C5=A1?= Date: Mon, 25 Jan 2021 23:40:14 +0100 Subject: [PATCH 0305/1045] Fix select & plural message format --- translation/message_format.rst | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/translation/message_format.rst b/translation/message_format.rst index 218d479d795..4e637a4335e 100644 --- a/translation/message_format.rst +++ b/translation/message_format.rst @@ -256,27 +256,24 @@ Usage of this string is the same as with variables and select:: .. code-block:: text {gender_of_host, select, - female { - {num_guests, plural, offset:1 + female {{num_guests, plural, offset:1 =0 {{host} does not give a party.} =1 {{host} invites {guest} to her party.} =2 {{host} invites {guest} and one other person to her party.} - other {{host} invites {guest} and # other people to her party.}} - } - male { - {num_guests, plural, offset:1 + other {{host} invites {guest} and # other people to her party.} + }} + male {{num_guests, plural, offset:1 =0 {{host} does not give a party.} =1 {{host} invites {guest} to his party.} =2 {{host} invites {guest} and one other person to his party.} - other {{host} invites {guest} and # other people to his party.}} - } - other { - {num_guests, plural, offset:1 + other {{host} invites {guest} and # other people to his party.} + }} + other {{num_guests, plural, offset:1 =0 {{host} does not give a party.} =1 {{host} invites {guest} to their party.} =2 {{host} invites {guest} and one other person to their party.} - other {{host} invites {guest} and # other people to their party.}} - } + other {{host} invites {guest} and # other people to their party.} + }} } .. sidebar:: Using Ranges in Messages From 62a317b2a52e1d11036992aeb69518ae12d107d5 Mon Sep 17 00:00:00 2001 From: Sebastian Paczkowski <74934099+sebpacz@users.noreply.github.com> Date: Wed, 27 Jan 2021 16:55:14 +0100 Subject: [PATCH 0306/1045] [Lock] Fix grammar issue --- components/lock.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/lock.rst b/components/lock.rst index 7b2c131947d..16049101e10 100644 --- a/components/lock.rst +++ b/components/lock.rst @@ -676,7 +676,7 @@ can be two running containers in parallel. .. caution:: All concurrent processes must use the same machine. Before starting a - concurrent process on a new machine, check that other process are stopped + concurrent process on a new machine, check that other processes are stopped on the old one. .. caution:: From 584396620e9a269f63493ada18e372941d123a42 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Fri, 29 Jan 2021 14:22:21 +0100 Subject: [PATCH 0307/1045] Fix Connect URL --- contributing/documentation/overview.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contributing/documentation/overview.rst b/contributing/documentation/overview.rst index be7d3418c6e..460f1b62589 100644 --- a/contributing/documentation/overview.rst +++ b/contributing/documentation/overview.rst @@ -338,7 +338,7 @@ definitely don't want you to waste your time! .. _`GitHub`: https://github.com/ .. _`fork the repository`: https://help.github.com/github/getting-started-with-github/fork-a-repo .. _`Symfony Documentation Contributors`: https://symfony.com/contributors/doc -.. _`SymfonyConnect`: https://connect.symfony.com/ +.. _`SymfonyConnect`: https://symfony.com/connect/login .. _`Symfony Documentation Badge`: https://connect.symfony.com/badge/36/symfony-documentation-contributor .. _`SymfonyCloud`: https://symfony.com/cloud .. _`roadmap`: https://symfony.com/releases From 78e5a5dc084f50ffad3a928798923d70f2693a18 Mon Sep 17 00:00:00 2001 From: wkania <57155526+wkania@users.noreply.github.com> Date: Sun, 31 Jan 2021 13:59:10 +0100 Subject: [PATCH 0308/1045] [Validator] Use seealso instead of tip for File In other constraints when there is a suggestion to use another constraint: https://symfony.com/doc/4.4/reference/constraints/Unique.html https://symfony.com/doc/4.4/reference/constraints/UniqueEntity.html https://symfony.com/doc/4.4/reference/constraints/Collection.html --- reference/constraints/File.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reference/constraints/File.rst b/reference/constraints/File.rst index 8c77fb008cb..a865349f913 100644 --- a/reference/constraints/File.rst +++ b/reference/constraints/File.rst @@ -11,7 +11,7 @@ Validates that a value is a valid "file", which can be one of the following: This constraint is commonly used in forms with the :doc:`FileType ` form field. -.. tip:: +.. seealso:: If the file you're validating is an image, try the :doc:`Image ` constraint. From 891f771ca9bb5356ca4aea8a4a84b69a77124fd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20Michael=20O=2E=20Hegg=C3=B8?= Date: Sun, 31 Jan 2021 17:43:45 +0100 Subject: [PATCH 0309/1045] [http_client] Fix default headers --- http_client.rst | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/http_client.rst b/http_client.rst index 91122c00961..c7f31ec40f6 100644 --- a/http_client.rst +++ b/http_client.rst @@ -511,9 +511,10 @@ requests and the specific headers for each request: # config/packages/framework.yaml framework: - http_client: - headers: - 'User-Agent': 'My Fancy App' + default_options: + http_client: + headers: + 'User-Agent': 'My Fancy App' .. code-block:: xml @@ -528,7 +529,9 @@ requests and the specific headers for each request: - My Fancy App + + My Fancy App + @@ -538,8 +541,10 @@ requests and the specific headers for each request: // config/packages/framework.php $container->loadFromExtension('framework', [ 'http_client' => [ - 'headers' => [ - 'User-Agent' => 'My Fancy App', + 'default_options' => [ + 'headers' => [ + 'User-Agent' => 'My Fancy App', + ], ], ], ]); From 141a7234193c1887cec9aff680c8dce0bc455a46 Mon Sep 17 00:00:00 2001 From: Nyholm Date: Thu, 21 Jan 2021 12:20:48 +0100 Subject: [PATCH 0310/1045] Update care team members --- contributing/code_of_conduct/care_team.rst | 27 ++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/contributing/code_of_conduct/care_team.rst b/contributing/code_of_conduct/care_team.rst index 8f32d5befd1..f0120fe7115 100644 --- a/contributing/code_of_conduct/care_team.rst +++ b/contributing/code_of_conduct/care_team.rst @@ -23,17 +23,36 @@ Here are all the members of the CARE team (in alphabetic order). You can contact any of them directly using the contact details below or you can also contact all of them at once by emailing **care@symfony.com**: -* **Emilie Lorenzo** +* **Timo Bakx** - * *E-mail*: emilie.lorenzo [at] symfony.com - * *Twitter*: `@EmilieLorenzo `_ - * *SymfonyConnect*: `emilielorenzo `_ + * *E-mail*: timobakx [at] gmail.com + * *Twitter*: `@TimoBakx `_ + * *SymfonyConnect*: `timobakx `_ + * *SymfonySlack*: `@Timo Bakx `_ + +* **Zan Baldwin** + + * *E-mail*: hello [at] zanbaldwin.com + * *Twitter*: `@ZanBaldwin `_ + * *SymfonyConnect*: `zanbaldwin `_ + +* **Valentine Boineau** + + * *E-mail*: valentine.boineau [at] gmail.com + * *Twitter*: `@BoineauV `_ + +* **Magali Milbergue** + + * *E-mail*: magali.milbergue [at] gmail.com + * *Twitter*: `@magalimilbergue `_ + * *SymfonyConnect*: `magali_milbergue `_ * **Tobias Nyholm** * *E-mail*: tobias.nyholm [at] gmail.com * *Twitter*: `@tobiasnyholm `_ * *SymfonyConnect*: `tobias `_ + * *SymfonySlack*: `@Tobias Nyholm `_ About the CARE Team ------------------- From f1c43df622f32546b1d9f17ba97a32689438b8b0 Mon Sep 17 00:00:00 2001 From: Zan Baldwin Date: Mon, 1 Feb 2021 20:38:36 +0100 Subject: [PATCH 0311/1045] Add Slack Link to CARE Team Member --- contributing/code_of_conduct/care_team.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/contributing/code_of_conduct/care_team.rst b/contributing/code_of_conduct/care_team.rst index f0120fe7115..d740fcfbba4 100644 --- a/contributing/code_of_conduct/care_team.rst +++ b/contributing/code_of_conduct/care_team.rst @@ -35,6 +35,7 @@ of them at once by emailing **care@symfony.com**: * *E-mail*: hello [at] zanbaldwin.com * *Twitter*: `@ZanBaldwin `_ * *SymfonyConnect*: `zanbaldwin `_ + * *SymfonySlack*: `@Zan `_ * **Valentine Boineau** From c9f807259fc0f00ff6634e64bdd0eb7c859b0de2 Mon Sep 17 00:00:00 2001 From: Sebastian Paczkowski <74934099+sebpacz@users.noreply.github.com> Date: Tue, 2 Feb 2021 23:10:05 +0100 Subject: [PATCH 0312/1045] [Messenger] Replace comma with full stop --- components/messenger.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/messenger.rst b/components/messenger.rst index 157d3f79d6a..0772293eab1 100644 --- a/components/messenger.rst +++ b/components/messenger.rst @@ -56,7 +56,7 @@ Concepts which means they can tweak the envelope, by adding stamps to it or even replacing it, as well as interrupt the middleware chain. Middleware are called both when a message is originally dispatched and again later when a message - is received from a transport, + is received from a transport. **Envelope**: Messenger specific concept, it gives full flexibility inside the message bus, From 17071880c4968fba91eaff73b7c73e52a6f49c9a Mon Sep 17 00:00:00 2001 From: wickedOne Date: Thu, 4 Feb 2021 09:18:34 +0100 Subject: [PATCH 0313/1045] role_names instead of roles corrected wrong attribute name relates to symfony/symfony#40087 --- security/expressions.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/security/expressions.rst b/security/expressions.rst index 2013d6656d7..6ea9d56a5d6 100644 --- a/security/expressions.rst +++ b/security/expressions.rst @@ -42,6 +42,10 @@ Inside the expression, you have access to a number of variables: The array of roles the user has. This array includes any roles granted indirectly via the :ref:`role hierarchy ` but it does not include the ``IS_AUTHENTICATED_*`` attributes (see the functions below). +``role_names`` + A string representation of the roles the user has. This array includes any roles granted + indirectly via the :ref:`role hierarchy ` but it + does not include the ``IS_AUTHENTICATED_*`` attributes (see the functions below). ``object`` The object (if any) that's passed as the second argument to ``isGranted()``. ``token`` From bc6ca521abf3472abd70f92eb68498aa55b3f752 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Fri, 5 Feb 2021 13:01:32 +0100 Subject: [PATCH 0314/1045] Minor tweak --- security/expressions.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/security/expressions.rst b/security/expressions.rst index 6ea9d56a5d6..91454691d5f 100644 --- a/security/expressions.rst +++ b/security/expressions.rst @@ -43,8 +43,8 @@ Inside the expression, you have access to a number of variables: indirectly via the :ref:`role hierarchy ` but it does not include the ``IS_AUTHENTICATED_*`` attributes (see the functions below). ``role_names`` - A string representation of the roles the user has. This array includes any roles granted - indirectly via the :ref:`role hierarchy ` but it + An array with the string representation of the roles the user has. This array + includes any roles granted indirectly via the :ref:`role hierarchy ` but it does not include the ``IS_AUTHENTICATED_*`` attributes (see the functions below). ``object`` The object (if any) that's passed as the second argument to ``isGranted()``. From 451168397cdd0fa609bd1d68b7a8bbab22e66692 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Fri, 5 Feb 2021 13:10:36 +0100 Subject: [PATCH 0315/1045] Mention the "subject" expression language variable --- security/expressions.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/security/expressions.rst b/security/expressions.rst index 91454691d5f..2ed16878ff2 100644 --- a/security/expressions.rst +++ b/security/expressions.rst @@ -48,6 +48,8 @@ Inside the expression, you have access to a number of variables: does not include the ``IS_AUTHENTICATED_*`` attributes (see the functions below). ``object`` The object (if any) that's passed as the second argument to ``isGranted()``. +``subject`` + It stores the same value as ``object``, so they are equivalent. ``token`` The token object. ``trust_resolver`` From 4539584ba51b3716ec7fabca591037a6341db82d Mon Sep 17 00:00:00 2001 From: Alexandre Mallet Date: Thu, 4 Feb 2021 16:03:52 +0100 Subject: [PATCH 0316/1045] Change deprecated psr 2 to psr 12 from doc PSR 2 => PSR 12 --- contributing/code/standards.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contributing/code/standards.rst b/contributing/code/standards.rst index 586a868aae2..0371a518632 100644 --- a/contributing/code/standards.rst +++ b/contributing/code/standards.rst @@ -5,7 +5,7 @@ Symfony code is contributed by thousands of developers around the world. To make every piece of code look and feel familiar, Symfony defines some coding standards that all contributions must follow. -These Symfony coding standards are based on the `PSR-1`_, `PSR-2`_ and `PSR-4`_ +These Symfony coding standards are based on the `PSR-1`_, `PSR-12`_ and `PSR-4`_ standards, so you may already know most of them. Making your Code Follow the Coding Standards From 2c7042fe4abe6c64b94a69372a558d1dc354cba4 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Fri, 5 Feb 2021 16:49:16 +0100 Subject: [PATCH 0317/1045] Added the missing reference --- contributing/code/standards.rst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/contributing/code/standards.rst b/contributing/code/standards.rst index 0371a518632..1ee3c5380ed 100644 --- a/contributing/code/standards.rst +++ b/contributing/code/standards.rst @@ -5,8 +5,8 @@ Symfony code is contributed by thousands of developers around the world. To make every piece of code look and feel familiar, Symfony defines some coding standards that all contributions must follow. -These Symfony coding standards are based on the `PSR-1`_, `PSR-12`_ and `PSR-4`_ -standards, so you may already know most of them. +These Symfony coding standards are based on the `PSR-1`_, `PSR-2`_, `PSR-4`_ +and `PSR-12`_ standards, so you may already know most of them. Making your Code Follow the Coding Standards -------------------------------------------- @@ -287,6 +287,7 @@ License .. _`PSR-1`: https://www.php-fig.org/psr/psr-1/ .. _`PSR-2`: https://www.php-fig.org/psr/psr-2/ .. _`PSR-4`: https://www.php-fig.org/psr/psr-4/ +.. _`PSR-12`: https://www.php-fig.org/psr/psr-12/ .. _`identical comparison`: https://www.php.net/manual/en/language.operators.comparison.php .. _`Yoda conditions`: https://en.wikipedia.org/wiki/Yoda_conditions .. _`camelCase`: https://en.wikipedia.org/wiki/Camel_case From 648bd07c2fd9bfdaba54590da94ca3d610880ec8 Mon Sep 17 00:00:00 2001 From: Wojciech Kania Date: Sat, 6 Feb 2021 12:50:36 +0100 Subject: [PATCH 0318/1045] [Validator] Use correct single quotes for a string --- reference/constraints/IsFalse.rst | 2 +- reference/constraints/IsTrue.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/reference/constraints/IsFalse.rst b/reference/constraints/IsFalse.rst index e476fb25387..5b2597d8657 100644 --- a/reference/constraints/IsFalse.rst +++ b/reference/constraints/IsFalse.rst @@ -3,7 +3,7 @@ IsFalse Validates that a value is ``false``. Specifically, this checks to see if the value is exactly ``false``, exactly the integer ``0``, or exactly the -string "``0``". +string ``'0'``. Also see :doc:`IsTrue `. diff --git a/reference/constraints/IsTrue.rst b/reference/constraints/IsTrue.rst index 2066b6d4e73..d9d53b04f82 100644 --- a/reference/constraints/IsTrue.rst +++ b/reference/constraints/IsTrue.rst @@ -2,7 +2,7 @@ IsTrue ====== Validates that a value is ``true``. Specifically, this checks if the value is -exactly ``true``, exactly the integer ``1``, or exactly the string ``"1"``. +exactly ``true``, exactly the integer ``1``, or exactly the string ``'1'``. Also see :doc:`IsFalse `. From 91ecbdab13bcc81144dfdabfc866c9c0351a5e24 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Sun, 7 Feb 2021 17:09:18 +0100 Subject: [PATCH 0319/1045] Clarify the role of http_method_override --- forms.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/forms.rst b/forms.rst index 1654aa3deba..17cd593d416 100644 --- a/forms.rst +++ b/forms.rst @@ -777,7 +777,8 @@ to the ``form()`` or the ``form_start()`` helper functions: that stores this method. The form will be submitted in a normal ``POST`` request, but :doc:`Symfony's routing ` is capable of detecting the ``_method`` parameter and will interpret it as a ``PUT``, ``PATCH`` or - ``DELETE`` request. See the :ref:`configuration-framework-http_method_override` option. + ``DELETE`` request. The :ref:`configuration-framework-http_method_override` + option must be enabled for this to work. Changing the Form Name ~~~~~~~~~~~~~~~~~~~~~~ From 3b1c006d0d60fe4bb00fefff93cbbbc17cb63d4b Mon Sep 17 00:00:00 2001 From: Sebastian Paczkowski <74934099+sebpacz@users.noreply.github.com> Date: Sun, 7 Feb 2021 18:36:19 +0100 Subject: [PATCH 0320/1045] [CS] Add comma after last array item in multi-line array --- messenger.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/messenger.rst b/messenger.rst index 2947f18cb68..83b7d59dff4 100644 --- a/messenger.rst +++ b/messenger.rst @@ -188,7 +188,7 @@ that uses this configuration: // or expanded to configure more options 'async' => [ 'dsn' => '%env(MESSENGER_TRANSPORT_DSN)%', - 'options' => [] + 'options' => [], ], ], ], From 98d97b0a575c67dcd30e1f77117aca446d376511 Mon Sep 17 00:00:00 2001 From: Sebastian Paczkowski <74934099+sebpacz@users.noreply.github.com> Date: Tue, 9 Feb 2021 19:56:46 +0100 Subject: [PATCH 0321/1045] [Messenger][CS] Add missing commas in PHP configurations --- messenger.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/messenger.rst b/messenger.rst index 83b7d59dff4..7f13eb0f4b0 100644 --- a/messenger.rst +++ b/messenger.rst @@ -975,8 +975,8 @@ The transport has a number of options: 'async_priority_low' => [ 'dsn' => '%env(MESSENGER_TRANSPORT_DSN)%', 'options' => [ - 'queue_name' => 'normal_priority' - ] + 'queue_name' => 'normal_priority', + ], ], ], ], @@ -1445,8 +1445,8 @@ Then, make sure to "route" your message to *both* transports: 'image_transport' => '...', ], 'routing' => [ - 'App\Message\UploadedImage' => ['image_transport', 'async_priority_normal'] - ] + 'App\Message\UploadedImage' => ['image_transport', 'async_priority_normal'], + ], ], ]); From 336d8ae4d028b2e3b4967924d737d7b11f965cbc Mon Sep 17 00:00:00 2001 From: wkania Date: Tue, 9 Feb 2021 19:57:07 +0100 Subject: [PATCH 0322/1045] [Validator] Use single quotes for a string --- validation.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/validation.rst b/validation.rst index ab81c528462..55d0c6aaed5 100644 --- a/validation.rst +++ b/validation.rst @@ -298,7 +298,7 @@ rules). In order to validate an object, simply map one or more constraints to its class and then pass it to the ``validator`` service. Behind the scenes, a constraint is simply a PHP object that makes an assertive -statement. In real life, a constraint could be: 'The cake must not be burned'. +statement. In real life, a constraint could be: ``'The cake must not be burned'``. In Symfony, constraints are similar: they are assertions that a condition is true. Given a value, a constraint will tell you if that value adheres to the rules of the constraint. @@ -342,7 +342,7 @@ literature genre mostly associated with the author, which can be set to either { /** * @Assert\Choice( - * choices = { "fiction", "non-fiction" }, + * choices = {"fiction", "non-fiction"}, * message = "Choose a valid genre." * ) */ @@ -509,7 +509,7 @@ of the form fields:: $builder ->add('myField', TextType::class, [ 'required' => true, - 'constraints' => [new Length(['min' => 3])] + 'constraints' => [new Length(['min' => 3])], ]) ; } @@ -606,7 +606,7 @@ class to have at least 3 characters. $metadata->addPropertyConstraint('firstName', new Assert\NotBlank()); $metadata->addPropertyConstraint( 'firstName', - new Assert\Length(["min" => 3]) + new Assert\Length(['min' => 3]) ); } } From 918671aebe8e95e75de35ddb0f963c5e915ca5f7 Mon Sep 17 00:00:00 2001 From: wkania Date: Tue, 9 Feb 2021 20:02:25 +0100 Subject: [PATCH 0323/1045] [Validator] Add a comma after the last array item in a multi-line array --- validation/raw_values.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/validation/raw_values.rst b/validation/raw_values.rst index cd25bec0653..8cee65108b8 100644 --- a/validation/raw_values.rst +++ b/validation/raw_values.rst @@ -88,7 +88,7 @@ Validation of arrays is possible using the ``Collection`` constraint:: new Assert\Collection([ 'slug' => [ new Assert\NotBlank(), - new Assert\Type(['type' => 'string']) + new Assert\Type(['type' => 'string']), ], 'label' => [ new Assert\NotBlank(), From 30f7d5f28754a7ab5d83eaec76e7bafca5c1caff Mon Sep 17 00:00:00 2001 From: wkania Date: Tue, 9 Feb 2021 20:12:31 +0100 Subject: [PATCH 0324/1045] [Validator] Add a missing namespace and use --- validation/custom_constraint.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/validation/custom_constraint.rst b/validation/custom_constraint.rst index 3cebc7a0c72..5ebd2f659d1 100644 --- a/validation/custom_constraint.rst +++ b/validation/custom_constraint.rst @@ -228,6 +228,11 @@ not to the property: .. code-block:: php-annotations + // src/Entity/AcmeEntity.php + namespace App\Entity; + + use App\Validator as AcmeAssert; + /** * @AcmeAssert\ProtocolClass */ From de411c431119a81afa63af5e804329810de16d14 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Thu, 11 Feb 2021 13:30:01 +0100 Subject: [PATCH 0325/1045] [Session] Remove some unneeded example --- session.rst | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/session.rst b/session.rst index 8d465516a58..fb9bb81cd8a 100644 --- a/session.rst +++ b/session.rst @@ -196,22 +196,6 @@ the existence of data in the session. This may hurt your application performance because all users will receive a session cookie. In order to prevent that, you must *completely* avoid accessing the session. -For example, if your templates include some code to display the -:ref:`flash messages `, sessions will start even if the user -is not logged in and even if you haven't created any flash messages. To avoid -this behavior, add a check before trying to access the flash messages: - -.. code-block:: html+twig - - {# this check prevents starting a session when there are no flash messages #} - {% if app.request.hasPreviousSession %} - {% for message in app.flashes('notice') %} -
                  - {{ message }} -
                  - {% endfor %} - {% endif %} - More about Sessions ------------------- From 5b04647263b09dc888edb0bff2ff7717ff3cc497 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Dunglas?= Date: Thu, 11 Feb 2021 18:39:58 +0100 Subject: [PATCH 0326/1045] [Mercure] Make the command compatible with ZSH --- mercure.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mercure.rst b/mercure.rst index 527833e2f7e..f32e8eee6a8 100644 --- a/mercure.rst +++ b/mercure.rst @@ -75,7 +75,7 @@ On Linux and Mac, run the following command to start it: .. rst-class:: command-linux - $ SERVER_NAME=:3000 MERCURE_PUBLISHER_JWT_KEY="!ChangeMe!" MERCURE_SUBSCRIBER_JWT_KEY="!ChangeMe!" ./mercure run -config Caddyfile.dev + $ SERVER_NAME=:3000 MERCURE_PUBLISHER_JWT_KEY='!ChangeMe!' MERCURE_SUBSCRIBER_JWT_KEY='!ChangeMe!' ./mercure run -config Caddyfile.dev On Windows run: From 036d01bdcdd847d4503ae4647833b8c02ecfb52e Mon Sep 17 00:00:00 2001 From: Sebastian Paczkowski <74934099+sebpacz@users.noreply.github.com> Date: Thu, 11 Feb 2021 18:39:53 +0100 Subject: [PATCH 0327/1045] [Messenger][CS] Add missing commas I discovered two more examples where a comma is missing after the last array item in a multi-line array. --- messenger.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/messenger.rst b/messenger.rst index 7f13eb0f4b0..0ee914216ca 100644 --- a/messenger.rst +++ b/messenger.rst @@ -859,7 +859,7 @@ your Envelope:: $attributes = []; $bus->dispatch(new SmsNotification(), [ - new AmqpStamp('custom-routing-key', AMQP_NOPARAM, $attributes) + new AmqpStamp('custom-routing-key', AMQP_NOPARAM, $attributes), ]); .. caution:: @@ -1483,12 +1483,12 @@ to your message:: { $bus->dispatch(new SmsNotification('...'), [ // wait 5 seconds before processing - new DelayStamp(5000) + new DelayStamp(5000), ]); // or explicitly create an Envelope $bus->dispatch(new Envelope(new SmsNotification('...'), [ - new DelayStamp(5000) + new DelayStamp(5000), ])); // ... From 2cb0c9e53eed0730dfa2cb5e81825e9468c8a99c Mon Sep 17 00:00:00 2001 From: wkania Date: Sat, 13 Feb 2021 12:20:08 +0100 Subject: [PATCH 0328/1045] [Validator] Change Range and Legth description formatting --- reference/constraints/Length.rst | 4 ++-- reference/constraints/Range.rst | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/reference/constraints/Length.rst b/reference/constraints/Length.rst index 11ae53ae6b9..7e790efeee7 100644 --- a/reference/constraints/Length.rst +++ b/reference/constraints/Length.rst @@ -23,8 +23,8 @@ Validator :class:`Symfony\\Component\\Validator\\Constraints\\LengthValidator` Basic Usage ----------- -To verify that the ``firstName`` field length of a class is between "2" -and "50", you might add the following: +To verify that the ``firstName`` field length of a class is between ``2`` +and ``50``, you might add the following: .. configuration-block:: diff --git a/reference/constraints/Range.rst b/reference/constraints/Range.rst index 5743d8d04ef..d07bc0445f4 100644 --- a/reference/constraints/Range.rst +++ b/reference/constraints/Range.rst @@ -22,7 +22,7 @@ Validator :class:`Symfony\\Component\\Validator\\Constraints\\RangeValidator` Basic Usage ----------- -To verify that the "height" field of a class is between "120" and "180", +To verify that the ``height`` field of a class is between ``120`` and ``180``, you might add the following: .. configuration-block:: From 6f1a420a567338648e66a788927b0ef02df8460b Mon Sep 17 00:00:00 2001 From: Wojciech Kania Date: Sun, 14 Feb 2021 10:09:45 +0100 Subject: [PATCH 0329/1045] [Validator] Improve Valid constraint description --- reference/constraints/Valid.rst | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/reference/constraints/Valid.rst b/reference/constraints/Valid.rst index 1cb992128ac..b052cab38b4 100644 --- a/reference/constraints/Valid.rst +++ b/reference/constraints/Valid.rst @@ -243,6 +243,13 @@ the validation of the ``Address`` fields failed. App\Entity\Author.address.zipCode: This value is too long. It should have 5 characters or less. +.. include:: /reference/constraints/_empty-values-are-valid.rst.inc + +.. note:: + + This constraint is not aware what sub-object must be associated with it, a common solution is to combine this constraint + with :doc:`Type `. + Options ------- From ad5a890da80c79eefff709a62ce78362c99eaee7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20Schl=C3=A4pfer?= Date: Thu, 11 Feb 2021 18:06:33 +0100 Subject: [PATCH 0330/1045] improve documentation for mailer failover and round-robin transports --- mailer.rst | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/mailer.rst b/mailer.rst index 58531bf85f3..ff567eab3bc 100644 --- a/mailer.rst +++ b/mailer.rst @@ -186,9 +186,9 @@ A failover transport is configured with two or more transports and the MAILER_DSN="failover(postmark+api://ID@default sendgrid+smtp://KEY@default)" -The mailer will start using the first transport. If the sending fails, the -mailer won't retry it with the other transports, but it will switch to the next -transport automatically for the following deliveries. +The failover-transport starts using the first transport and if it fails, it +will retry the same delivery with the next transports until one of them succeeds +(or until all of them fail). Load Balancing ~~~~~~~~~~~~~~ @@ -203,9 +203,12 @@ A round-robin transport is configured with two or more transports and the MAILER_DSN="roundrobin(postmark+api://ID@default sendgrid+smtp://KEY@default)" -The mailer will start using the first transport and if it fails, it will retry -the same delivery with the next transports until one of them succeeds (or until -all of them fail). +The round-robin transport starts with a *randomly* selected transport and +then switches to the next available transport for each subsequent email. + +As with the failover transport, round-robin retries deliveries until +a transport succeeds (or all fail). In contrast to the failover transport, +it *spreads* the load across all its transports. Creating & Sending Messages --------------------------- From 6c8bbd602c018997171fa5152e342de29d9c7770 Mon Sep 17 00:00:00 2001 From: Mohameth Date: Sat, 13 Feb 2021 21:06:29 +0100 Subject: [PATCH 0331/1045] Update lock documentation for more clarity In response to https://github.com/symfony/symfony-docs/issues/9367, I also had some understanding the meaning. --- components/lock.rst | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/components/lock.rst b/components/lock.rst index 16049101e10..7651dd19caf 100644 --- a/components/lock.rst +++ b/components/lock.rst @@ -62,9 +62,10 @@ method can be safely called repeatedly, even if the lock is already acquired. .. note:: Unlike other implementations, the Lock Component distinguishes locks - instances even when they are created for the same resource. If a lock has - to be used by several services, they should share the same ``Lock`` instance - returned by the ``LockFactory::createLock`` method. + instances even when they are created for the same resource. It means that for + a given scope and resource one lock instance can be acquired multiple times. + If a lock has to be used by several services, they should share the same ``Lock`` + instance returned by the ``LockFactory::createLock`` method. .. tip:: From ce5d6693b6715a00c461d50a5c35f827b8290f66 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Mon, 15 Feb 2021 10:56:38 +0100 Subject: [PATCH 0332/1045] Tweak --- components/lock.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/lock.rst b/components/lock.rst index 7651dd19caf..8e83fed5c9d 100644 --- a/components/lock.rst +++ b/components/lock.rst @@ -61,7 +61,7 @@ method can be safely called repeatedly, even if the lock is already acquired. .. note:: - Unlike other implementations, the Lock Component distinguishes locks + Unlike other implementations, the Lock Component distinguishes lock instances even when they are created for the same resource. It means that for a given scope and resource one lock instance can be acquired multiple times. If a lock has to be used by several services, they should share the same ``Lock`` From f085b3262ec80df720768dbd30cd17de846fdd5c Mon Sep 17 00:00:00 2001 From: wkania Date: Tue, 16 Feb 2021 20:17:39 +0100 Subject: [PATCH 0333/1045] [Validator] Use single quotes for a string --- validation/groups.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/validation/groups.rst b/validation/groups.rst index b25c82236fc..7681f583a08 100644 --- a/validation/groups.rst +++ b/validation/groups.rst @@ -123,7 +123,7 @@ user registers and when a user updates their contact information later: ])); $metadata->addPropertyConstraint('city', new Assert\Length([ - "min" => 2, + 'min' => 2, ])); } } From a74de75dde9029e83192bfe156272c71f01e4891 Mon Sep 17 00:00:00 2001 From: Thijs-jan Veldhuizen Date: Wed, 17 Feb 2021 15:53:19 +0100 Subject: [PATCH 0334/1045] Update monolog_console.rst --- logging/monolog_console.rst | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/logging/monolog_console.rst b/logging/monolog_console.rst index 5c0263c5349..21c67d705d8 100644 --- a/logging/monolog_console.rst +++ b/logging/monolog_console.rst @@ -67,6 +67,16 @@ the console. If they are displayed, they are timestamped and colored appropriate Additionally, error logs are written to the error output (``php://stderr``). There is no need to conditionally handle the verbosity settings anymore. +=============== ======================================= ============ +LoggerInterface Verbosity Command line +=============== ======================================= ============ +->error() OutputInterface::VERBOSITY_QUIET stderr +->warning() OutputInterface::VERBOSITY_NORMAL stdout +->notice() OutputInterface::VERBOSITY_VERBOSE -v +->info() OutputInterface::VERBOSITY_VERY_VERBOSE -vv +->debug() OutputInterface::VERBOSITY_DEBUG -vvv +=============== ======================================= ============ + The Monolog console handler is enabled by default: .. configuration-block:: From 25c0716f376796104c3ecebeb839305c07672024 Mon Sep 17 00:00:00 2001 From: Wouter de Jong Date: Wed, 17 Feb 2021 17:21:03 +0100 Subject: [PATCH 0335/1045] Add reference to commit message conventions --- contributing/code/conventions.rst | 6 +++--- contributing/code/pull_requests.rst | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/contributing/code/conventions.rst b/contributing/code/conventions.rst index 3174ac93660..0b50de6885f 100644 --- a/contributing/code/conventions.rst +++ b/contributing/code/conventions.rst @@ -99,9 +99,9 @@ conventions: * No third level sections are allowed; -* Messages should follow the commit message conventions: should be short, - capitalize the line, do not end with a period, use an imperative verb to - start the line; +* Messages should follow the :ref:`commit message conventions `: + should be short, capitalize the line, do not end with a period, use an + imperative verb to start the line; * New entries must be added on top of the list. diff --git a/contributing/code/pull_requests.rst b/contributing/code/pull_requests.rst index e69371e9d5e..1cb0da6dddc 100644 --- a/contributing/code/pull_requests.rst +++ b/contributing/code/pull_requests.rst @@ -224,6 +224,8 @@ in mind the following: * Never fix coding standards in some existing code as it makes the code review more difficult; +.. _commit-messages: + * Write good commit messages: Start by a short subject line (the first line), followed by a blank line and a more detailed description. From 251304e424f26a2dad7cd1d594a17ec23e333f93 Mon Sep 17 00:00:00 2001 From: wkania Date: Wed, 17 Feb 2021 19:13:44 +0100 Subject: [PATCH 0336/1045] [Validator] Use null coalescing operator instead of ternary operator --- validation/severity.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/validation/severity.rst b/validation/severity.rst index 23b81145ee9..7a8c22298fd 100644 --- a/validation/severity.rst +++ b/validation/severity.rst @@ -137,7 +137,7 @@ method. Each constraint exposes the attached payload as a public property:: // Symfony\Component\Validator\ConstraintViolation $constraintViolation = ...; $constraint = $constraintViolation->getConstraint(); - $severity = isset($constraint->payload['severity']) ? $constraint->payload['severity'] : null; + $severity = $constraint->payload['severity'] ?? null; For example, you can leverage this to customize the ``form_errors`` block so that the severity is added as an additional HTML class: From 4f851e84f2a4372cdc259359bf51eded04ecde06 Mon Sep 17 00:00:00 2001 From: wkania Date: Wed, 17 Feb 2021 19:42:10 +0100 Subject: [PATCH 0337/1045] [Validator] Use import instead of FQCN --- form/dynamic_form_modification.rst | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/form/dynamic_form_modification.rst b/form/dynamic_form_modification.rst index 279b5b4118d..7c52e5f3abd 100644 --- a/form/dynamic_form_modification.rst +++ b/form/dynamic_form_modification.rst @@ -377,6 +377,8 @@ sport like this:: // src/Form/Type/SportMeetupType.php namespace App\Form\Type; + use App\Entity\Position; + use App\Entity\Sport; use Symfony\Bridge\Doctrine\Form\Type\EntityType; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\FormBuilderInterface; @@ -390,7 +392,7 @@ sport like this:: { $builder ->add('sport', EntityType::class, [ - 'class' => 'App\Entity\Sport', + 'class' => Sport::class, 'placeholder' => '', ]) ; @@ -407,7 +409,7 @@ sport like this:: $positions = null === $sport ? [] : $sport->getAvailablePositions(); $form->add('position', EntityType::class, [ - 'class' => 'App\Entity\Position', + 'class' => Position::class, 'placeholder' => '', 'choices' => $positions, ]); @@ -443,6 +445,7 @@ The type would now look like:: // src/Form/Type/SportMeetupType.php namespace App\Form\Type; + use App\Entity\Position; use App\Entity\Sport; use Symfony\Bridge\Doctrine\Form\Type\EntityType; use Symfony\Component\Form\FormInterface; @@ -454,7 +457,7 @@ The type would now look like:: { $builder ->add('sport', EntityType::class, [ - 'class' => 'App\Entity\Sport', + 'class' => Sport::class, 'placeholder' => '', ]) ; @@ -463,7 +466,7 @@ The type would now look like:: $positions = null === $sport ? [] : $sport->getAvailablePositions(); $form->add('position', EntityType::class, [ - 'class' => 'App\Entity\Position', + 'class' => Position::class, 'placeholder' => '', 'choices' => $positions, ]); From 7948311afca73fc192531e03575382fd9783ac5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20Schl=C3=A4pfer?= Date: Wed, 17 Feb 2021 16:15:05 +0100 Subject: [PATCH 0338/1045] fix specifying http_version in YAML --- http_client.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/http_client.rst b/http_client.rst index 91122c00961..6add04b711e 100644 --- a/http_client.rst +++ b/http_client.rst @@ -750,7 +750,8 @@ the ``http_version`` option: # config/packages/framework.yaml framework: http_client: - http_version: '2.0' + default_options: + http_version: '2.0' .. code-block:: xml From cb5764ad53359ca859abec4c00972f23df69d3ad Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Thu, 18 Feb 2021 15:03:54 +0100 Subject: [PATCH 0339/1045] Updated XML and PHP configs too --- http_client.rst | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/http_client.rst b/http_client.rst index 6add04b711e..be195f2008d 100644 --- a/http_client.rst +++ b/http_client.rst @@ -765,7 +765,9 @@ the ``http_version`` option: http://symfony.com/schema/dic/symfony https://symfony.com/schema/dic/symfony/symfony-1.0.xsd"> - + + + @@ -774,7 +776,9 @@ the ``http_version`` option: // config/packages/framework.php $container->loadFromExtension('framework', [ 'http_client' => [ - 'http_version' => '2.0', + 'default_options' => [ + 'http_version' => '2.0', + ], ], ]); From d44bfa826d7ea3dc438999d81cd0dd36a8f29516 Mon Sep 17 00:00:00 2001 From: Yonel Ceruto Date: Sun, 14 Feb 2021 22:57:48 -0500 Subject: [PATCH 0340/1045] Promoting new bundle directory structure as best practice --- bundles/best_practices.rst | 107 +++++++++++++++++++++++-------------- 1 file changed, 68 insertions(+), 39 deletions(-) diff --git a/bundles/best_practices.rst b/bundles/best_practices.rst index 696c9da58ff..bf32457cd81 100644 --- a/bundles/best_practices.rst +++ b/bundles/best_practices.rst @@ -68,30 +68,47 @@ The basic directory structure of an AcmeBlogBundle must read as follows: .. code-block:: text / - ├─ AcmeBlogBundle.php - ├─ Controller/ - ├─ README.md - ├─ LICENSE - ├─ Resources/ - │ ├─ config/ - │ ├─ doc/ - │ │ └─ index.rst - │ ├─ translations/ - │ ├─ views/ - │ └─ public/ - └─ Tests/ + ├── config/ + ├── docs/ + │ └─ index.md + ├── public/ + ├── src/ + │ ├── Controller/ + │ ├── DependencyInjection/ + │ └── AcmeBlogBundle.php + ├── templates/ + ├── tests/ + ├── translations/ + ├── LICENSE + └── README.md + +.. versionadded:: 4.4 + + This directory convention was introduced in Symfony 4.4 and can be used only when requiring + ``symfony/http-kernel`` 4.4 or superior. + + +and the bundle path must be adjusted to the root directory:: + + class AcmeBlogBundle extends Bundle + { + public function getPath(): string + { + return \dirname(__DIR__); + } + } **The following files are mandatory**, because they ensure a structure convention that automated tools can rely on: -* ``AcmeBlogBundle.php``: This is the class that transforms a plain directory +* ``src/AcmeBlogBundle.php``: This is the class that transforms a plain directory into a Symfony bundle (change this to your bundle's name); * ``README.md``: This file contains the basic description of the bundle and it usually shows some basic examples and links to its full documentation (it can use any of the markup formats supported by GitHub, such as ``README.rst``); * ``LICENSE``: The full contents of the license used by the code. Most third-party bundles are published under the MIT license, but you can `choose any license`_; -* ``Resources/doc/index.rst``: The root file for the Bundle documentation. +* ``docs/index.md``: The root file for the Bundle documentation. The depth of subdirectories should be kept to a minimum for the most used classes and files. Two levels is the maximum. @@ -107,19 +124,19 @@ and others are just conventions followed by most developers): =================================================== ======================================== Type Directory =================================================== ======================================== -Commands ``Command/`` -Controllers ``Controller/`` -Service Container Extensions ``DependencyInjection/`` -Doctrine ORM entities (when not using annotations) ``Entity/`` -Doctrine ODM documents (when not using annotations) ``Document/`` -Event Listeners ``EventListener/`` -Configuration (routes, services, etc.) ``Resources/config/`` -Web Assets (CSS, JS, images) ``Resources/public/`` -Translation files ``Resources/translations/`` -Validation (when not using annotations) ``Resources/config/validation/`` -Serialization (when not using annotations) ``Resources/config/serialization/`` -Templates ``Resources/views/`` -Unit and Functional Tests ``Tests/`` +Commands ``src/Command/`` +Controllers ``src/Controller/`` +Service Container Extensions ``src/DependencyInjection/`` +Doctrine ORM entities (when not using annotations) ``src/Entity/`` +Doctrine ODM documents (when not using annotations) ``src/Document/`` +Event Listeners ``src/EventListener/`` +Configuration (routes, services, etc.) ``config/`` +Web Assets (CSS, JS, images) ``public/`` +Translation files ``translations/`` +Validation (when not using annotations) ``config/validation/`` +Serialization (when not using annotations) ``config/serialization/`` +Templates ``templates/`` +Unit and Functional Tests ``tests/`` =================================================== ======================================== Classes @@ -127,7 +144,7 @@ Classes The bundle directory structure is used as the namespace hierarchy. For instance, a ``ContentController`` controller which is stored in -``Acme/BlogBundle/Controller/ContentController.php`` would have the fully +``src/Controller/ContentController.php`` would have the fully qualified class name of ``Acme\BlogBundle\Controller\ContentController``. All classes and files must follow the :doc:`Symfony coding standards `. @@ -153,7 +170,7 @@ Tests ----- A bundle should come with a test suite written with PHPUnit and stored under -the ``Tests/`` directory. Tests should follow the following principles: +the ``tests/`` directory. Tests should follow the following principles: * The test suite must be executable with a simple ``phpunit`` command run from a sample application; @@ -240,10 +257,10 @@ Documentation All classes and functions must come with full PHPDoc. -Extensive documentation should also be provided in the ``Resources/doc/`` +Extensive documentation should also be provided in the ``docs/`` directory. -The index file (for example ``Resources/doc/index.rst`` or -``Resources/doc/index.md``) is the only mandatory file and must be the entry +The index file (for example ``docs/index.rst`` or +``docs/index.md``) is the only mandatory file and must be the entry point for the documentation. The :doc:`reStructuredText (rST) ` is the format used to render the documentation on the Symfony website. @@ -480,10 +497,22 @@ The ``composer.json`` file should include at least the following metadata: This information is used by Symfony to load the classes of the bundle. It's recommended to use the `PSR-4`_ autoload standard: use the namespace as key, and the location of the bundle's main class (relative to ``composer.json``) - as value. For example, if the main class is located in the bundle root - directory: ``"autoload": { "psr-4": { "SomeVendor\\BlogBundle\\": "" } }``. - If the main class is located in the ``src/`` directory of the bundle: - ``"autoload": { "psr-4": { "SomeVendor\\BlogBundle\\": "src/" } }``. + as value. As the main class is located in the ``src/`` directory of the bundle: + + .. code-block:: json + + { + "autoload": { + "psr-4": { + "Acme\\BlogBundle\\": "src/" + } + }, + "autoload-dev": { + "psr-4": { + "Acme\\BlogBundle\\Tests\\": "tests/" + } + } + } In order to make it easier for developers to find your bundle, register it on `Packagist`_, the official repository for Composer packages. @@ -493,15 +522,15 @@ Resources If the bundle references any resources (config files, translation files, etc.), don't use physical paths (e.g. ``__DIR__/config/services.xml``) but logical -paths (e.g. ``@FooBundle/Resources/config/services.xml``). +paths (e.g. ``@AcmeBlogBundle/config/services.xml``). The logical paths are required because of the bundle overriding mechanism that lets you override any resource/file of any bundle. See :ref:`http-kernel-resource-locator` for more details about transforming physical paths into logical paths. Beware that templates use a simplified version of the logical path shown above. -For example, an ``index.html.twig`` template located in the ``Resources/views/Default/`` -directory of the FooBundle, is referenced as ``@Foo/Default/index.html.twig``. +For example, an ``index.html.twig`` template located in the ``templates/Default/`` +directory of the AcmeBlogBundle, is referenced as ``@AcmeBlog/Default/index.html.twig``. Learn more ---------- From 36421ad60206b79bf1fb5d701dac7c480ddd474e Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Thu, 18 Feb 2021 15:50:36 +0100 Subject: [PATCH 0341/1045] Tweaks --- bundles/best_practices.rst | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/bundles/best_practices.rst b/bundles/best_practices.rst index bf32457cd81..9c615c46db1 100644 --- a/bundles/best_practices.rst +++ b/bundles/best_practices.rst @@ -63,7 +63,7 @@ configuration options (see below for some usage examples). Directory Structure ------------------- -The basic directory structure of an AcmeBlogBundle must read as follows: +The following is the recommended directory structure of an AcmeBlogBundle: .. code-block:: text @@ -84,11 +84,11 @@ The basic directory structure of an AcmeBlogBundle must read as follows: .. versionadded:: 4.4 - This directory convention was introduced in Symfony 4.4 and can be used only when requiring - ``symfony/http-kernel`` 4.4 or superior. + This directory convention was introduced in Symfony 4.4 and can be used only + when requiring ``symfony/http-kernel`` 4.4 or superior. - -and the bundle path must be adjusted to the root directory:: +This directory structure requires to configure the bundle path to its root +directory as follows:: class AcmeBlogBundle extends Bundle { From f37c6bed41b3c755b31bc04c70cdc8baa6cab587 Mon Sep 17 00:00:00 2001 From: Nietono <8806554+nietonchique@users.noreply.github.com> Date: Fri, 29 Jan 2021 03:03:50 +0300 Subject: [PATCH 0342/1045] Update Type.rst Change Ramsey to symfony/uid --- reference/constraints/Type.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/reference/constraints/Type.rst b/reference/constraints/Type.rst index 8aa0edd1ba2..aa48a17ca6d 100644 --- a/reference/constraints/Type.rst +++ b/reference/constraints/Type.rst @@ -18,7 +18,7 @@ Validator :class:`Symfony\\Component\\Validator\\Constraints\\TypeValidator` Basic Usage ----------- -This will check if ``id`` is an instance of ``Ramsey\Uuid\UuidInterface``, +This will check if ``id`` is an instance of ``Symfony\Component\Uid\Uid``, ``firstName`` is of type ``string`` (using :phpfunction:`is_string` PHP function), ``age`` is an ``integer`` (using :phpfunction:`is_int` PHP function) and ``accessCode`` contains either only letters or only digits (using @@ -36,7 +36,7 @@ This will check if ``id`` is an instance of ``Ramsey\Uuid\UuidInterface``, class Author { /** - * @Assert\Type("Ramsey\Uuid\UuidInterface") + * @Assert\Type("Symfony\Component\Uid\Uid") */ protected $id; From e229b93002bab30207ccba82c36091d7c65b7367 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Fri, 19 Feb 2021 17:29:09 +0100 Subject: [PATCH 0343/1045] Reworded the example --- reference/constraints/Type.rst | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/reference/constraints/Type.rst b/reference/constraints/Type.rst index aa48a17ca6d..103ea9fd43c 100644 --- a/reference/constraints/Type.rst +++ b/reference/constraints/Type.rst @@ -18,7 +18,7 @@ Validator :class:`Symfony\\Component\\Validator\\Constraints\\TypeValidator` Basic Usage ----------- -This will check if ``id`` is an instance of ``Symfony\Component\Uid\Uid``, +This will check if ``emailAddress`` is an instance of ``Symfony\Component\Mime\Address``, ``firstName`` is of type ``string`` (using :phpfunction:`is_string` PHP function), ``age`` is an ``integer`` (using :phpfunction:`is_int` PHP function) and ``accessCode`` contains either only letters or only digits (using @@ -36,9 +36,9 @@ This will check if ``id`` is an instance of ``Symfony\Component\Uid\Uid``, class Author { /** - * @Assert\Type("Symfony\Component\Uid\Uid") + * @Assert\Type("Symfony\Component\Mime\Address") */ - protected $id; + protected $emailAddress; /** * @Assert\Type("string") @@ -64,8 +64,8 @@ This will check if ``id`` is an instance of ``Symfony\Component\Uid\Uid``, # config/validator/validation.yaml App\Entity\Author: properties: - id: - - Type: Ramsey\Uuid\UuidInterface + emailAddress: + - Type: Symfony\Component\Mime\Address firstName: - Type: string @@ -88,9 +88,9 @@ This will check if ``id`` is an instance of ``Symfony\Component\Uid\Uid``, xsi:schemaLocation="http://symfony.com/schema/dic/constraint-mapping https://symfony.com/schema/dic/constraint-mapping/constraint-mapping-1.0.xsd"> - + - + @@ -120,7 +120,7 @@ This will check if ``id`` is an instance of ``Symfony\Component\Uid\Uid``, // src/Entity/Author.php namespace App\Entity; - use Ramsey\Uuid\UuidInterface; + use Symfony\Component\Mime\Address; use Symfony\Component\Validator\Constraints as Assert; use Symfony\Component\Validator\Mapping\ClassMetadata; @@ -128,7 +128,7 @@ This will check if ``id`` is an instance of ``Symfony\Component\Uid\Uid``, { public static function loadValidatorMetadata(ClassMetadata $metadata) { - $metadata->addPropertyConstraint('id', new Assert\Type(UuidInterface::class)); + $metadata->addPropertyConstraint('emailAddress', new Assert\Type(Address::class)); $metadata->addPropertyConstraint('firstName', new Assert\Type('string')); From 9a8101f544cfc4e361f5d8bf0aa8a2ef188e3ee3 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Fri, 19 Feb 2021 17:38:28 +0100 Subject: [PATCH 0344/1045] Tweaks --- http_client.rst | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/http_client.rst b/http_client.rst index d541c5933b4..185e4a972cd 100644 --- a/http_client.rst +++ b/http_client.rst @@ -120,7 +120,7 @@ You can configure the global options using the ``default_options`` option: - + @@ -179,7 +179,7 @@ The HTTP client also has one configuration option called - + @@ -502,8 +502,7 @@ associative array via the ``query`` option, that will be merged with the URL:: Headers ~~~~~~~ -Use the ``headers`` option to define both the default headers added to all -requests and the specific headers for each request: +Use the ``headers`` option to define the default headers added to all requests: .. configuration-block:: @@ -511,8 +510,8 @@ requests and the specific headers for each request: # config/packages/framework.yaml framework: - default_options: - http_client: + http_client: + default_options: headers: 'User-Agent': 'My Fancy App' @@ -532,7 +531,7 @@ requests and the specific headers for each request: My Fancy App - + @@ -558,6 +557,8 @@ requests and the specific headers for each request: ], ]); +You can also set new headers or override the default ones for specific requests: + .. code-block:: php // this header is only included in this request and overrides the value @@ -772,7 +773,7 @@ the ``http_version`` option: - + From 5c4e78061ff2ead019005ee6b56d31b7e35f3d7f Mon Sep 17 00:00:00 2001 From: wkania Date: Fri, 19 Feb 2021 18:42:57 +0100 Subject: [PATCH 0345/1045] Fix invalid file --- http_client.rst | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/http_client.rst b/http_client.rst index 185e4a972cd..f80b2bc96ba 100644 --- a/http_client.rst +++ b/http_client.rst @@ -559,15 +559,18 @@ Use the ``headers`` option to define the default headers added to all requests: You can also set new headers or override the default ones for specific requests: -.. code-block:: php - // this header is only included in this request and overrides the value - // of the same header if defined globally by the HTTP client - $response = $client->request('POST', 'https://...', [ - 'headers' => [ - 'Content-Type' => 'text/plain', - ], - ]); +.. configuration-block:: + + .. code-block:: php + + // this header is only included in this request and overrides the value + // of the same header if defined globally by the HTTP client + $response = $client->request('POST', 'https://...', [ + 'headers' => [ + 'Content-Type' => 'text/plain', + ], + ]); Uploading Data ~~~~~~~~~~~~~~ From 4e212eedd0617acf4b16d66bb9e0189aff1bbc40 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Fri, 19 Feb 2021 19:27:06 +0100 Subject: [PATCH 0346/1045] Tweak --- http_client.rst | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/http_client.rst b/http_client.rst index f80b2bc96ba..37be3137771 100644 --- a/http_client.rst +++ b/http_client.rst @@ -557,20 +557,15 @@ Use the ``headers`` option to define the default headers added to all requests: ], ]); -You can also set new headers or override the default ones for specific requests: +You can also set new headers or override the default ones for specific requests:: - -.. configuration-block:: - - .. code-block:: php - - // this header is only included in this request and overrides the value - // of the same header if defined globally by the HTTP client - $response = $client->request('POST', 'https://...', [ - 'headers' => [ - 'Content-Type' => 'text/plain', - ], - ]); + // this header is only included in this request and overrides the value + // of the same header if defined globally by the HTTP client + $response = $client->request('POST', 'https://...', [ + 'headers' => [ + 'Content-Type' => 'text/plain', + ], + ]); Uploading Data ~~~~~~~~~~~~~~ From a757019a71115250ec82c61aee4f98eab9d134f1 Mon Sep 17 00:00:00 2001 From: Wojciech Kania Date: Sun, 21 Feb 2021 20:28:44 +0100 Subject: [PATCH 0347/1045] [Validator] Mention doctrine-bridge in the UniqueEntity constraint --- reference/constraints/UniqueEntity.rst | 5 +++++ reference/constraints/UserPassword.rst | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/reference/constraints/UniqueEntity.rst b/reference/constraints/UniqueEntity.rst index e6e449d949b..ca0a0be28c6 100644 --- a/reference/constraints/UniqueEntity.rst +++ b/reference/constraints/UniqueEntity.rst @@ -10,6 +10,11 @@ using an email address that already exists in the system. If you want to validate that all the elements of the collection are unique use the :doc:`Unique constraint `. +.. note:: + + In order to use this constraint, you should have installed the + symfony/doctrine-bridge with Composer. + ========== =================================================================== Applies to :ref:`class ` Options - `em`_ diff --git a/reference/constraints/UserPassword.rst b/reference/constraints/UserPassword.rst index 91017168a82..208281df216 100644 --- a/reference/constraints/UserPassword.rst +++ b/reference/constraints/UserPassword.rst @@ -12,7 +12,7 @@ password, but needs to enter their old password for security. .. note:: - In order to use this constraints, you should have installed the + In order to use this constraint, you should have installed the symfony/security-core component with Composer. ========== =================================================================== From f5fb27dac8fb5c3709130ca1f25c4d095553ddb6 Mon Sep 17 00:00:00 2001 From: Sebastian Paczkowski <74934099+sebpacz@users.noreply.github.com> Date: Sun, 21 Feb 2021 21:59:37 +0100 Subject: [PATCH 0348/1045] [Twig] Add missing space --- performance.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/performance.rst b/performance.rst index afd5295a9e3..80e36849cc9 100644 --- a/performance.rst +++ b/performance.rst @@ -275,7 +275,7 @@ You can also profile your template code with the :ref:`stopwatch Twig tag Date: Sun, 21 Feb 2021 11:03:54 +0100 Subject: [PATCH 0349/1045] Minor change to use DateTimeImmutable instead of DateTime Using DateTimeImmutable instead of DateTime when no mutation is needed improves performances. --- doctrine/events.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doctrine/events.rst b/doctrine/events.rst index c98be25d736..30b48856c13 100644 --- a/doctrine/events.rst +++ b/doctrine/events.rst @@ -76,7 +76,7 @@ define a callback for the ``prePersist`` Doctrine event: */ public function setCreatedAtValue(): void { - $this->createdAt = new \DateTime(); + $this->createdAt = new \DateTimeImmutable(); } } From 8ddf8ec5b8a3544cb1db3ee0356d863cf5d9f489 Mon Sep 17 00:00:00 2001 From: Pierre Boissinot Date: Mon, 22 Feb 2021 12:25:05 +0100 Subject: [PATCH 0350/1045] fix file path in comment following namespace --- security/impersonating_user.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/security/impersonating_user.rst b/security/impersonating_user.rst index 5f44a7fad23..ca4c1e3947f 100644 --- a/security/impersonating_user.rst +++ b/security/impersonating_user.rst @@ -259,7 +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 + // src/Security/Voter/SwitchToCustomerVoter.php namespace App\Security\Voter; use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; From c4a398e55598cef9f2bc4557cfa1e0a12ff98e1d Mon Sep 17 00:00:00 2001 From: wkania Date: Mon, 22 Feb 2021 21:46:34 +0100 Subject: [PATCH 0351/1045] [Validator][Translation] Mention symfony/translation --- validation/translations.rst | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/validation/translations.rst b/validation/translations.rst index 5c22f9362c3..3edc15dab5e 100644 --- a/validation/translations.rst +++ b/validation/translations.rst @@ -8,6 +8,11 @@ If you're using validation constraints with the Form component, you can translat the error messages by creating a translation resource for the ``validators`` :ref:`domain `. +.. note:: + + In order to translate the error message, you should have installed the + symfony/translation component with Composer. + To start, suppose you've created a plain-old-PHP object that you need to use somewhere in your application:: @@ -93,7 +98,7 @@ Now, create a ``validators`` catalog file in the ``translations/`` directory: .. code-block:: xml - + @@ -108,12 +113,12 @@ Now, create a ``validators`` catalog file in the ``translations/`` directory: .. code-block:: yaml - # translations/validators.en.yaml + # translations/validators/validators.en.yaml author.name.not_blank: Please enter an author name. .. code-block:: php - // translations/validators.en.php + // translations/validators/validators.en.php return [ 'author.name.not_blank' => 'Please enter an author name.', ]; From 2d2f3b7cbdbea6b805212c8dc21bdd02966aebcc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20Isaert?= Date: Mon, 21 Dec 2020 19:43:42 +0100 Subject: [PATCH 0352/1045] [Cache] Add TLS scheme for Redis connection See https://github.com/symfony/symfony/pull/39599 --- components/cache/adapters/redis_adapter.rst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/components/cache/adapters/redis_adapter.rst b/components/cache/adapters/redis_adapter.rst index 935afcd9f92..f1d00b248c2 100644 --- a/components/cache/adapters/redis_adapter.rst +++ b/components/cache/adapters/redis_adapter.rst @@ -62,7 +62,8 @@ helper method allows creating and configuring the Redis client class instance us ); The DSN can specify either an IP/host (and an optional port) or a socket path, as well as a -password and a database index. +password and a database index. To enable TLS for connections, the scheme ``redis`` must be +replaced by ``rediss``. .. note:: @@ -70,7 +71,7 @@ password and a database index. .. code-block:: text - redis://[pass@][ip|host|socket[:port]][/db-index] + redis[s]://[pass@][ip|host|socket[:port]][/db-index] Below are common examples of valid DSNs showing a combination of available values:: From efd9cd0758127350e7a67c28fc9100e936d68ae4 Mon Sep 17 00:00:00 2001 From: Wojciech Kania Date: Tue, 23 Feb 2021 19:49:10 +0100 Subject: [PATCH 0353/1045] Use null coalescing operator instead of ternary operator --- components/property_access.rst | 8 ++------ create_framework/http_foundation.rst | 4 ++-- frontend/custom_version_strategy.rst | 2 +- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/components/property_access.rst b/components/property_access.rst index 7b9053b835f..5cd5095908a 100644 --- a/components/property_access.rst +++ b/components/property_access.rst @@ -237,9 +237,7 @@ enable this feature by using :class:`Symfony\\Component\\PropertyAccess\\Propert { $property = lcfirst(substr($name, 3)); if ('get' === substr($name, 0, 3)) { - return isset($this->children[$property]) - ? $this->children[$property] - : null; + return $this->children[$property] ?? null; } elseif ('set' === substr($name, 0, 3)) { $value = 1 == count($args) ? $args[0] : null; $this->children[$property] = $value; @@ -334,9 +332,7 @@ see `Enable other Features`_:: { $property = lcfirst(substr($name, 3)); if ('get' === substr($name, 0, 3)) { - return isset($this->children[$property]) - ? $this->children[$property] - : null; + return $this->children[$property] ?? null; } elseif ('set' === substr($name, 0, 3)) { $value = 1 == count($args) ? $args[0] : null; $this->children[$property] = $value; diff --git a/create_framework/http_foundation.rst b/create_framework/http_foundation.rst index 99dff5c1faf..3c84dd25e57 100644 --- a/create_framework/http_foundation.rst +++ b/create_framework/http_foundation.rst @@ -25,7 +25,7 @@ First, if the ``name`` query parameter is not defined in the URL query string, you will get a PHP warning; so let's fix it:: // framework/index.php - $name = isset($_GET['name']) ? $_GET['name'] : 'World'; + $name = $_GET['name'] ?? 'World'; printf('Hello %s', $name); @@ -33,7 +33,7 @@ Then, this *application is not secure*. Can you believe it? Even this simple snippet of PHP code is vulnerable to one of the most widespread Internet security issue, XSS (Cross-Site Scripting). Here is a more secure version:: - $name = isset($_GET['name']) ? $_GET['name'] : 'World'; + $name = $_GET['name'] ?? 'World'; header('Content-Type: text/html; charset=utf-8'); diff --git a/frontend/custom_version_strategy.rst b/frontend/custom_version_strategy.rst index 6361ba632c0..d6280637b7f 100644 --- a/frontend/custom_version_strategy.rst +++ b/frontend/custom_version_strategy.rst @@ -83,7 +83,7 @@ version string:: $this->hashes = $this->loadManifest(); } - return isset($this->hashes[$path]) ? $this->hashes[$path] : ''; + return $this->hashes[$path] ?? ''; } public function applyVersion($path) From c335d0e232a55b90911bd2db818de05b9261a00e Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Tue, 23 Feb 2021 09:21:01 +0100 Subject: [PATCH 0354/1045] [Internal] Set the specific version of the doc-builder --- _build/composer.json | 6 +- _build/composer.lock | 267 ++++++++++++++++++------------------------- 2 files changed, 117 insertions(+), 156 deletions(-) diff --git a/_build/composer.json b/_build/composer.json index ea0ef4eee25..45f492f2f06 100644 --- a/_build/composer.json +++ b/_build/composer.json @@ -15,8 +15,8 @@ }, "require": { "php": ">=7.2.9", - "symfony/console": "^4.1", - "symfony/docs-builder": "dev-master", - "symfony/process": "9999999-dev" + "symfony/console": "^4.4", + "symfony/docs-builder": "^0.12.0", + "symfony/process": "^4.4" } } diff --git a/_build/composer.lock b/_build/composer.lock index 8a5ab63dcb7..b1815909808 100644 --- a/_build/composer.lock +++ b/_build/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "e580f6d54e3fe0b71ca6103550882138", + "content-hash": "f237cd997543c606037f2517b2ffad9f", "packages": [ { "name": "doctrine/event-manager", @@ -571,16 +571,16 @@ }, { "name": "scrivo/highlight.php", - "version": "v9.18.1.3", + "version": "v9.18.1.6", "source": { "type": "git", "url": "https://github.com/scrivo/highlight.php.git", - "reference": "6a1699707b099081f20a488ac1f92d682181018c" + "reference": "44a3d4136edb5ad8551590bf90f437db80b2d466" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/scrivo/highlight.php/zipball/6a1699707b099081f20a488ac1f92d682181018c", - "reference": "6a1699707b099081f20a488ac1f92d682181018c", + "url": "https://api.github.com/repos/scrivo/highlight.php/zipball/44a3d4136edb5ad8551590bf90f437db80b2d466", + "reference": "44a3d4136edb5ad8551590bf90f437db80b2d466", "shasum": "" }, "require": { @@ -594,9 +594,6 @@ "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": { @@ -646,20 +643,20 @@ "type": "github" } ], - "time": "2020-10-16T07:43:22+00:00" + "time": "2020-12-22T19:20:29+00:00" }, { "name": "symfony/console", - "version": "v4.4.15", + "version": "v4.4.19", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "90933b39c7b312fc3ceaa1ddeac7eb48cb953124" + "reference": "24026c44fc37099fa145707fecd43672831b837a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/90933b39c7b312fc3ceaa1ddeac7eb48cb953124", - "reference": "90933b39c7b312fc3ceaa1ddeac7eb48cb953124", + "url": "https://api.github.com/repos/symfony/console/zipball/24026c44fc37099fa145707fecd43672831b837a", + "reference": "24026c44fc37099fa145707fecd43672831b837a", "shasum": "" }, "require": { @@ -694,11 +691,6 @@ "symfony/process": "" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.4-dev" - } - }, "autoload": { "psr-4": { "Symfony\\Component\\Console\\": "" @@ -721,10 +713,10 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony Console Component", + "description": "Eases the creation of beautiful and testable command line interfaces", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/console/tree/v4.4.15" + "source": "https://github.com/symfony/console/tree/v4.4.19" }, "funding": [ { @@ -740,31 +732,26 @@ "type": "tidelift" } ], - "time": "2020-09-15T07:58:55+00:00" + "time": "2021-01-27T09:09:26+00:00" }, { "name": "symfony/css-selector", - "version": "v4.4.15", + "version": "v4.4.19", "source": { "type": "git", "url": "https://github.com/symfony/css-selector.git", - "reference": "bf17dc9f6ce144e41f786c32435feea4d8e11dcc" + "reference": "f907d3e53ecb2a5fad8609eb2f30525287a734c8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/css-selector/zipball/bf17dc9f6ce144e41f786c32435feea4d8e11dcc", - "reference": "bf17dc9f6ce144e41f786c32435feea4d8e11dcc", + "url": "https://api.github.com/repos/symfony/css-selector/zipball/f907d3e53ecb2a5fad8609eb2f30525287a734c8", + "reference": "f907d3e53ecb2a5fad8609eb2f30525287a734c8", "shasum": "" }, "require": { "php": ">=7.1.3" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.4-dev" - } - }, "autoload": { "psr-4": { "Symfony\\Component\\CssSelector\\": "" @@ -791,10 +778,10 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony CssSelector Component", + "description": "Converts CSS selectors to XPath expressions", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/css-selector/tree/v4.4.15" + "source": "https://github.com/symfony/css-selector/tree/v4.4.19" }, "funding": [ { @@ -810,11 +797,11 @@ "type": "tidelift" } ], - "time": "2020-07-05T09:39:30+00:00" + "time": "2021-01-27T09:09:26+00:00" }, { "name": "symfony/docs-builder", - "version": "dev-master", + "version": "v0.12.0", "source": { "type": "git", "url": "https://github.com/weaverryan/docs-builder", @@ -839,7 +826,6 @@ "symfony/phpunit-bridge": "^4.1", "symfony/process": "^4.2" }, - "default-branch": true, "type": "project", "autoload": { "psr-4": { @@ -854,16 +840,16 @@ }, { "name": "symfony/dom-crawler", - "version": "v4.4.15", + "version": "v4.4.19", "source": { "type": "git", "url": "https://github.com/symfony/dom-crawler.git", - "reference": "bdcb7633a501770a0daefbf81d2e6b28c3864f2b" + "reference": "21032c566558255e551d23f4a516434c9e3a9a78" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/bdcb7633a501770a0daefbf81d2e6b28c3864f2b", - "reference": "bdcb7633a501770a0daefbf81d2e6b28c3864f2b", + "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/21032c566558255e551d23f4a516434c9e3a9a78", + "reference": "21032c566558255e551d23f4a516434c9e3a9a78", "shasum": "" }, "require": { @@ -882,11 +868,6 @@ "symfony/css-selector": "" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.4-dev" - } - }, "autoload": { "psr-4": { "Symfony\\Component\\DomCrawler\\": "" @@ -909,10 +890,10 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony DomCrawler Component", + "description": "Eases DOM navigation for HTML and XML documents", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/dom-crawler/tree/v4.4.15" + "source": "https://github.com/symfony/dom-crawler/tree/v4.4.19" }, "funding": [ { @@ -928,20 +909,20 @@ "type": "tidelift" } ], - "time": "2020-10-02T07:34:48+00:00" + "time": "2021-01-27T09:09:26+00:00" }, { "name": "symfony/filesystem", - "version": "v4.4.15", + "version": "v4.4.19", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "ebc51494739d3b081ea543ed7c462fa73a4f74db" + "reference": "83a6feed14846d2d9f3916adbaf838819e4e3380" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/ebc51494739d3b081ea543ed7c462fa73a4f74db", - "reference": "ebc51494739d3b081ea543ed7c462fa73a4f74db", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/83a6feed14846d2d9f3916adbaf838819e4e3380", + "reference": "83a6feed14846d2d9f3916adbaf838819e4e3380", "shasum": "" }, "require": { @@ -949,11 +930,6 @@ "symfony/polyfill-ctype": "~1.8" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.4-dev" - } - }, "autoload": { "psr-4": { "Symfony\\Component\\Filesystem\\": "" @@ -976,10 +952,10 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony Filesystem Component", + "description": "Provides basic utilities for the filesystem", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/filesystem/tree/v4.4.15" + "source": "https://github.com/symfony/filesystem/tree/v4.4.19" }, "funding": [ { @@ -995,31 +971,26 @@ "type": "tidelift" } ], - "time": "2020-09-27T13:54:16+00:00" + "time": "2021-01-27T09:09:26+00:00" }, { "name": "symfony/finder", - "version": "v4.4.15", + "version": "v4.4.19", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "60d08560f9aa72997c44077c40d47aa28a963230" + "reference": "25d79cfccfc12e84e7a63a248c3f0720fdd92db6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/60d08560f9aa72997c44077c40d47aa28a963230", - "reference": "60d08560f9aa72997c44077c40d47aa28a963230", + "url": "https://api.github.com/repos/symfony/finder/zipball/25d79cfccfc12e84e7a63a248c3f0720fdd92db6", + "reference": "25d79cfccfc12e84e7a63a248c3f0720fdd92db6", "shasum": "" }, "require": { "php": ">=7.1.3" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.4-dev" - } - }, "autoload": { "psr-4": { "Symfony\\Component\\Finder\\": "" @@ -1042,10 +1013,10 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony Finder Component", + "description": "Finds files and directories via an intuitive fluent interface", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/finder/tree/v4.4.15" + "source": "https://github.com/symfony/finder/tree/v4.4.19" }, "funding": [ { @@ -1061,20 +1032,20 @@ "type": "tidelift" } ], - "time": "2020-10-02T07:34:48+00:00" + "time": "2021-01-27T09:09:26+00:00" }, { "name": "symfony/http-client", - "version": "v4.4.15", + "version": "v4.4.19", "source": { "type": "git", "url": "https://github.com/symfony/http-client.git", - "reference": "b1cb966898aaf8df37280fde537a27b6724b3bc4" + "reference": "d8df50fe9229576b254c6822eb5cfff36c02c967" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-client/zipball/b1cb966898aaf8df37280fde537a27b6724b3bc4", - "reference": "b1cb966898aaf8df37280fde537a27b6724b3bc4", + "url": "https://api.github.com/repos/symfony/http-client/zipball/d8df50fe9229576b254c6822eb5cfff36c02c967", + "reference": "d8df50fe9229576b254c6822eb5cfff36c02c967", "shasum": "" }, "require": { @@ -1091,7 +1062,7 @@ "symfony/http-client-implementation": "1.1" }, "require-dev": { - "guzzlehttp/promises": "^1.3.1", + "guzzlehttp/promises": "^1.4", "nyholm/psr7": "^1.0", "php-http/httplug": "^1.0|^2.0", "psr/http-client": "^1.0", @@ -1100,11 +1071,6 @@ "symfony/process": "^4.2|^5.0" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.4-dev" - } - }, "autoload": { "psr-4": { "Symfony\\Component\\HttpClient\\": "" @@ -1127,10 +1093,10 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony HttpClient component", + "description": "Provides powerful methods to fetch HTTP resources synchronously or asynchronously", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/http-client/tree/v4.4.15" + "source": "https://github.com/symfony/http-client/tree/v4.4.19" }, "funding": [ { @@ -1146,7 +1112,7 @@ "type": "tidelift" } ], - "time": "2020-10-02T13:41:48+00:00" + "time": "2021-01-27T09:09:26+00:00" }, { "name": "symfony/http-client-contracts", @@ -1229,16 +1195,16 @@ }, { "name": "symfony/polyfill-ctype", - "version": "v1.20.0", + "version": "v1.22.1", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "f4ba089a5b6366e453971d3aad5fe8e897b37f41" + "reference": "c6c942b1ac76c82448322025e084cadc56048b4e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/f4ba089a5b6366e453971d3aad5fe8e897b37f41", - "reference": "f4ba089a5b6366e453971d3aad5fe8e897b37f41", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/c6c942b1ac76c82448322025e084cadc56048b4e", + "reference": "c6c942b1ac76c82448322025e084cadc56048b4e", "shasum": "" }, "require": { @@ -1250,7 +1216,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.20-dev" + "dev-main": "1.22-dev" }, "thanks": { "name": "symfony/polyfill", @@ -1288,7 +1254,7 @@ "portable" ], "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.20.0" + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.22.1" }, "funding": [ { @@ -1304,20 +1270,20 @@ "type": "tidelift" } ], - "time": "2020-10-23T14:02:19+00:00" + "time": "2021-01-07T16:49:33+00:00" }, { "name": "symfony/polyfill-intl-idn", - "version": "v1.20.0", + "version": "v1.22.1", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-idn.git", - "reference": "3b75acd829741c768bc8b1f84eb33265e7cc5117" + "reference": "2d63434d922daf7da8dd863e7907e67ee3031483" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/3b75acd829741c768bc8b1f84eb33265e7cc5117", - "reference": "3b75acd829741c768bc8b1f84eb33265e7cc5117", + "url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/2d63434d922daf7da8dd863e7907e67ee3031483", + "reference": "2d63434d922daf7da8dd863e7907e67ee3031483", "shasum": "" }, "require": { @@ -1331,7 +1297,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.20-dev" + "dev-main": "1.22-dev" }, "thanks": { "name": "symfony/polyfill", @@ -1375,7 +1341,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-idn/tree/v1.20.0" + "source": "https://github.com/symfony/polyfill-intl-idn/tree/v1.22.1" }, "funding": [ { @@ -1391,20 +1357,20 @@ "type": "tidelift" } ], - "time": "2020-10-23T14:02:19+00:00" + "time": "2021-01-22T09:19:47+00:00" }, { "name": "symfony/polyfill-intl-normalizer", - "version": "v1.20.0", + "version": "v1.22.1", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-normalizer.git", - "reference": "727d1096295d807c309fb01a851577302394c897" + "reference": "43a0283138253ed1d48d352ab6d0bdb3f809f248" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/727d1096295d807c309fb01a851577302394c897", - "reference": "727d1096295d807c309fb01a851577302394c897", + "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/43a0283138253ed1d48d352ab6d0bdb3f809f248", + "reference": "43a0283138253ed1d48d352ab6d0bdb3f809f248", "shasum": "" }, "require": { @@ -1416,7 +1382,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.20-dev" + "dev-main": "1.22-dev" }, "thanks": { "name": "symfony/polyfill", @@ -1459,7 +1425,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.20.0" + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.22.1" }, "funding": [ { @@ -1475,20 +1441,20 @@ "type": "tidelift" } ], - "time": "2020-10-23T14:02:19+00:00" + "time": "2021-01-22T09:19:47+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.20.0", + "version": "v1.22.1", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "39d483bdf39be819deabf04ec872eb0b2410b531" + "reference": "5232de97ee3b75b0360528dae24e73db49566ab1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/39d483bdf39be819deabf04ec872eb0b2410b531", - "reference": "39d483bdf39be819deabf04ec872eb0b2410b531", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/5232de97ee3b75b0360528dae24e73db49566ab1", + "reference": "5232de97ee3b75b0360528dae24e73db49566ab1", "shasum": "" }, "require": { @@ -1500,7 +1466,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.20-dev" + "dev-main": "1.22-dev" }, "thanks": { "name": "symfony/polyfill", @@ -1539,7 +1505,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.20.0" + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.22.1" }, "funding": [ { @@ -1555,20 +1521,20 @@ "type": "tidelift" } ], - "time": "2020-10-23T14:02:19+00:00" + "time": "2021-01-22T09:19:47+00:00" }, { "name": "symfony/polyfill-php72", - "version": "v1.20.0", + "version": "v1.22.1", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php72.git", - "reference": "cede45fcdfabdd6043b3592e83678e42ec69e930" + "reference": "cc6e6f9b39fe8075b3dabfbaf5b5f645ae1340c9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/cede45fcdfabdd6043b3592e83678e42ec69e930", - "reference": "cede45fcdfabdd6043b3592e83678e42ec69e930", + "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/cc6e6f9b39fe8075b3dabfbaf5b5f645ae1340c9", + "reference": "cc6e6f9b39fe8075b3dabfbaf5b5f645ae1340c9", "shasum": "" }, "require": { @@ -1577,7 +1543,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.20-dev" + "dev-main": "1.22-dev" }, "thanks": { "name": "symfony/polyfill", @@ -1615,7 +1581,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php72/tree/v1.20.0" + "source": "https://github.com/symfony/polyfill-php72/tree/v1.22.1" }, "funding": [ { @@ -1631,20 +1597,20 @@ "type": "tidelift" } ], - "time": "2020-10-23T14:02:19+00:00" + "time": "2021-01-07T16:49:33+00:00" }, { "name": "symfony/polyfill-php73", - "version": "v1.20.0", + "version": "v1.22.1", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php73.git", - "reference": "8ff431c517be11c78c48a39a66d37431e26a6bed" + "reference": "a678b42e92f86eca04b7fa4c0f6f19d097fb69e2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/8ff431c517be11c78c48a39a66d37431e26a6bed", - "reference": "8ff431c517be11c78c48a39a66d37431e26a6bed", + "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/a678b42e92f86eca04b7fa4c0f6f19d097fb69e2", + "reference": "a678b42e92f86eca04b7fa4c0f6f19d097fb69e2", "shasum": "" }, "require": { @@ -1653,7 +1619,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.20-dev" + "dev-main": "1.22-dev" }, "thanks": { "name": "symfony/polyfill", @@ -1694,7 +1660,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php73/tree/v1.20.0" + "source": "https://github.com/symfony/polyfill-php73/tree/v1.22.1" }, "funding": [ { @@ -1710,20 +1676,20 @@ "type": "tidelift" } ], - "time": "2020-10-23T14:02:19+00:00" + "time": "2021-01-07T16:49:33+00:00" }, { "name": "symfony/polyfill-php80", - "version": "v1.20.0", + "version": "v1.22.1", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "e70aa8b064c5b72d3df2abd5ab1e90464ad009de" + "reference": "dc3063ba22c2a1fd2f45ed856374d79114998f91" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/e70aa8b064c5b72d3df2abd5ab1e90464ad009de", - "reference": "e70aa8b064c5b72d3df2abd5ab1e90464ad009de", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/dc3063ba22c2a1fd2f45ed856374d79114998f91", + "reference": "dc3063ba22c2a1fd2f45ed856374d79114998f91", "shasum": "" }, "require": { @@ -1732,7 +1698,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.20-dev" + "dev-main": "1.22-dev" }, "thanks": { "name": "symfony/polyfill", @@ -1777,7 +1743,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/v1.20.0" + "source": "https://github.com/symfony/polyfill-php80/tree/v1.22.1" }, "funding": [ { @@ -1793,27 +1759,25 @@ "type": "tidelift" } ], - "time": "2020-10-23T14:02:19+00:00" + "time": "2021-01-07T16:49:33+00:00" }, { "name": "symfony/process", - "version": "5.x-dev", + "version": "v4.4.19", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "88d47196a2fe06db8f90f0c2a986651e91ee3660" + "reference": "7e950b6366d4da90292c2e7fa820b3c1842b965a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/88d47196a2fe06db8f90f0c2a986651e91ee3660", - "reference": "88d47196a2fe06db8f90f0c2a986651e91ee3660", + "url": "https://api.github.com/repos/symfony/process/zipball/7e950b6366d4da90292c2e7fa820b3c1842b965a", + "reference": "7e950b6366d4da90292c2e7fa820b3c1842b965a", "shasum": "" }, "require": { - "php": ">=7.2.5", - "symfony/polyfill-php80": "^1.15" + "php": ">=7.1.3" }, - "default-branch": true, "type": "library", "autoload": { "psr-4": { @@ -1837,10 +1801,10 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony Process Component", + "description": "Executes commands in sub-processes", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/process/tree/5.x" + "source": "https://github.com/symfony/process/tree/v4.4.19" }, "funding": [ { @@ -1856,7 +1820,7 @@ "type": "tidelift" } ], - "time": "2020-10-24T12:08:07+00:00" + "time": "2021-01-27T09:09:26+00:00" }, { "name": "symfony/service-contracts", @@ -1939,16 +1903,16 @@ }, { "name": "twig/twig", - "version": "v2.14.0", + "version": "v2.14.3", "source": { "type": "git", "url": "https://github.com/twigphp/Twig.git", - "reference": "d495243dade48c39b6a5261c26cdbd8c5703f6a0" + "reference": "8bc568d460d88b25c00c046256ec14a787ea60d9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig/zipball/d495243dade48c39b6a5261c26cdbd8c5703f6a0", - "reference": "d495243dade48c39b6a5261c26cdbd8c5703f6a0", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/8bc568d460d88b25c00c046256ec14a787ea60d9", + "reference": "8bc568d460d88b25c00c046256ec14a787ea60d9", "shasum": "" }, "require": { @@ -2002,7 +1966,7 @@ ], "support": { "issues": "https://github.com/twigphp/Twig/issues", - "source": "https://github.com/twigphp/Twig/tree/v2.14.0" + "source": "https://github.com/twigphp/Twig/tree/v2.14.3" }, "funding": [ { @@ -2014,16 +1978,13 @@ "type": "tidelift" } ], - "time": "2020-10-21T12:35:06+00:00" + "time": "2021-01-05T15:34:33+00:00" } ], "packages-dev": [], "aliases": [], "minimum-stability": "dev", - "stability-flags": { - "symfony/docs-builder": 20, - "symfony/process": 20 - }, + "stability-flags": [], "prefer-stable": true, "prefer-lowest": false, "platform": { From f68b17f307b6c614d39917e4fc9f5a17c803ae03 Mon Sep 17 00:00:00 2001 From: Nyholm Date: Wed, 24 Feb 2021 15:23:59 +0100 Subject: [PATCH 0355/1045] Remove comment about PR draft status --- contributing/code/pull_requests.rst | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/contributing/code/pull_requests.rst b/contributing/code/pull_requests.rst index 1cb0da6dddc..58a6004ca14 100644 --- a/contributing/code/pull_requests.rst +++ b/contributing/code/pull_requests.rst @@ -370,8 +370,7 @@ because you want early feedback on your work, add an item to todo-list: - [ ] gather feedback for my changes As long as you have items in the todo-list, please prefix the pull request -title with "[WIP]". If you do not yet want to trigger the automated tests, -you can also set the PR to `draft status`_. +title with "[WIP]". In the pull request description, give as much detail as possible about your changes (don't hesitate to give code examples to illustrate your points). If @@ -436,4 +435,3 @@ before merging. .. _`searching on GitHub`: https://github.com/symfony/symfony/issues?q=+is%3Aopen+ .. _`Symfony Slack`: https://symfony.com/slack-invite .. _`Travis-CI`: https://travis-ci.org/symfony/symfony -.. _`draft status`: https://help.github.com/github/collaborating-with-issues-and-pull-requests/about-pull-requests#draft-pull-requests From 33794481aea1a41001d514c33ca1f24f9e214d81 Mon Sep 17 00:00:00 2001 From: Nyholm Date: Wed, 24 Feb 2021 17:52:43 +0100 Subject: [PATCH 0356/1045] Show example how to set xdebug.file_link_format --- reference/configuration/framework.rst | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/reference/configuration/framework.rst b/reference/configuration/framework.rst index 4515077d1d7..246726e820c 100644 --- a/reference/configuration/framework.rst +++ b/reference/configuration/framework.rst @@ -415,7 +415,13 @@ Since every developer uses a different IDE, the recommended way to enable this feature is to configure it on a system level. This can be done by setting the ``xdebug.file_link_format`` option in your ``php.ini`` configuration file. The format to use is the same as for the ``framework.ide`` option, but without the -need to escape the percent signs (``%``) by doubling them. +need to escape the percent signs (``%``) by doubling them:: + + // example for PhpStorm + xdebug.file_link_format="phpstorm://open?file=%f&line=%l" + + // example for Sublime + xdebug.file_link_format="subl://open?url=file://%f&line=%l" .. note:: From 69f9db34df0fa0c54aea8f6a3d72a1490ab4cb75 Mon Sep 17 00:00:00 2001 From: Wojciech Kania Date: Wed, 24 Feb 2021 21:39:22 +0100 Subject: [PATCH 0357/1045] [Validator] Mention IsNull in Basic Constraints --- reference/constraints/IsFalse.rst | 2 ++ reference/constraints/IsTrue.rst | 2 ++ reference/constraints/Type.rst | 2 ++ reference/constraints/_null-values-are-valid.rst.inc | 6 ++++++ 4 files changed, 12 insertions(+) create mode 100644 reference/constraints/_null-values-are-valid.rst.inc diff --git a/reference/constraints/IsFalse.rst b/reference/constraints/IsFalse.rst index 5b2597d8657..63f1364024c 100644 --- a/reference/constraints/IsFalse.rst +++ b/reference/constraints/IsFalse.rst @@ -107,6 +107,8 @@ method returns **false**: // ... } +.. include:: /reference/constraints/_null-values-are-valid.rst.inc + Options ------- diff --git a/reference/constraints/IsTrue.rst b/reference/constraints/IsTrue.rst index d9d53b04f82..aa172153e9f 100644 --- a/reference/constraints/IsTrue.rst +++ b/reference/constraints/IsTrue.rst @@ -111,6 +111,8 @@ Then you can validate this method with ``IsTrue`` as follows: If the ``isTokenValid()`` returns false, the validation will fail. +.. include:: /reference/constraints/_null-values-are-valid.rst.inc + Options ------- diff --git a/reference/constraints/Type.rst b/reference/constraints/Type.rst index 103ea9fd43c..307b7565749 100644 --- a/reference/constraints/Type.rst +++ b/reference/constraints/Type.rst @@ -148,6 +148,8 @@ This will check if ``emailAddress`` is an instance of ``Symfony\Component\Mime\A The feature to define multiple types in the ``type`` option was introduced in Symfony 4.4. +.. include:: /reference/constraints/_null-values-are-valid.rst.inc + Options ------- diff --git a/reference/constraints/_null-values-are-valid.rst.inc b/reference/constraints/_null-values-are-valid.rst.inc new file mode 100644 index 00000000000..49b6a54faad --- /dev/null +++ b/reference/constraints/_null-values-are-valid.rst.inc @@ -0,0 +1,6 @@ +.. note:: + + As with most of the other constraints, ``null`` is + considered a valid value. This is to allow the use of optional values. + If the value is mandatory, a common solution is to combine this constraint + with :doc:`NotNull `. From 795dcb7172dbc716df7029abc0651a9581dc66c9 Mon Sep 17 00:00:00 2001 From: Nyholm Date: Wed, 24 Feb 2021 15:43:10 +0100 Subject: [PATCH 0358/1045] Updated contribution guide with "Automated Feedback" --- contributing/code/pull_requests.rst | 32 +++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/contributing/code/pull_requests.rst b/contributing/code/pull_requests.rst index 58a6004ca14..d1f06f8db76 100644 --- a/contributing/code/pull_requests.rst +++ b/contributing/code/pull_requests.rst @@ -399,6 +399,36 @@ The :doc:`core team ` is responsible for deciding which PR gets merged, so their feedback is the most relevant. So do not feel pressured to refactor your code immediately when someone provides feedback. +Automated Feedback +~~~~~~~~~~~~~~~~~~ + +There are many automated scripts that will provide feedback on a pull request. + +fabbot +"""""" + +`fabbot`_ will review code style, check for common typos and make sure the git +history looks good. If there are any issues, fabbot will often suggest what changes +that should be done. Most of the time you get a command to run to automatically +fix the changes. + +It is rare, but fabbot could be wrong. One should verify if the suggested changes +make sense and that they are related to the pull request. + +Psalm +""""" + +`Psalm`_ will make a comment on a pull request if it discovers any potential +type errors. The Psalm errors are not always correct, but each should be reviewed +and discussed. A pull request should not update the Psalm baseline nor add ``@psalm-`` +annotations. + +After the `Psalm phar is installed`_, the analysis can be run locally with: + +.. code-block:: terminal + + $ psalm.phar src/Symfony/Component/Workflow + .. _rework-your-patch: Rework your Pull Request @@ -430,8 +460,10 @@ before merging. .. _Symfony repository: https://github.com/symfony/symfony .. _`documentation repository`: https://github.com/symfony/symfony-docs .. _`fabbot`: https://fabbot.io +.. _`Psalm`: https://psalm.dev/ .. _`PSR-1`: https://www.php-fig.org/psr/psr-1/ .. _`PSR-2`: https://www.php-fig.org/psr/psr-2/ .. _`searching on GitHub`: https://github.com/symfony/symfony/issues?q=+is%3Aopen+ .. _`Symfony Slack`: https://symfony.com/slack-invite .. _`Travis-CI`: https://travis-ci.org/symfony/symfony +.. _`Psalm phar is installed`: https://psalm.dev/docs/running_psalm/installation/ From 79661cca1f63b7a0092fc44cf5863fd1d4147e75 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Fri, 26 Feb 2021 10:37:34 +0100 Subject: [PATCH 0359/1045] Make the doc clearer --- setup/symfony_server.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup/symfony_server.rst b/setup/symfony_server.rst index bd3a6718664..b9e1ef9d2ef 100644 --- a/setup/symfony_server.rst +++ b/setup/symfony_server.rst @@ -64,8 +64,8 @@ Enabling PHP-FPM PHP-FPM must be installed locally for the Symfony server to utilize. -When the server starts it will check for common patterns like ``web/app.php``, -``web/app_dev.php`` or ``public/index.php``. If a file like this is found the +When the server starts, it checks for ``web/index_dev.php``, ``web/index.php``, +``public/app_dev.php``, ``public/app.php`` in that order. If one is found, the server will automatically start with PHP-FPM enabled. Otherwise the server will start without PHP-FPM and will show a ``Page not found`` page when trying to access a ``.php`` file in the browser. From 962e0875f7e8a5422580899e5952bd010e896d09 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Fri, 26 Feb 2021 11:12:46 +0100 Subject: [PATCH 0360/1045] Make the explanation about how Docker services are detected (hopefully) clearer --- setup/symfony_server.rst | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/setup/symfony_server.rst b/setup/symfony_server.rst index bd3a6718664..9784bd57e24 100644 --- a/setup/symfony_server.rst +++ b/setup/symfony_server.rst @@ -282,8 +282,11 @@ The local Symfony server provides full `Docker`_ integration for projects that use it. When the web server detects that Docker Compose is running for the project, it -automatically exposes environment variables according to the exposed port and -the name of the ``docker-compose`` services. +automatically exposes some environment variables. + +Via the ``docker-compose`` API, it looks for exposed ports used for common +services. When it detects one it knows about, it uses the service name to +expose environment variables. Consider the following configuration: From 00fbbdcbb31cbddd0e5a57ff586a6df29cd6469a Mon Sep 17 00:00:00 2001 From: "Alexander M. Turek" Date: Fri, 26 Feb 2021 21:25:49 +0100 Subject: [PATCH 0361/1045] Unique validator: Better description for the value placeholder --- reference/constraints/Unique.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reference/constraints/Unique.rst b/reference/constraints/Unique.rst index 97cb6ff8602..e6acb08ea71 100644 --- a/reference/constraints/Unique.rst +++ b/reference/constraints/Unique.rst @@ -107,7 +107,7 @@ You can use the following parameters in this message: ============================= ================================================ Parameter Description ============================= ================================================ -``{{ value }}`` The repeated value +``{{ value }}`` The current (invalid) value ============================= ================================================ .. include:: /reference/constraints/_payload-option.rst.inc From e3328a46d4f8b03f9a4a9f6fbbf9b2ba33554518 Mon Sep 17 00:00:00 2001 From: Thibault RICHARD Date: Sun, 28 Feb 2021 21:51:40 +0100 Subject: [PATCH 0362/1045] [Encore] Deploying to a CDN subdirectory --- frontend/encore/cdn.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/frontend/encore/cdn.rst b/frontend/encore/cdn.rst index a7a2884c13a..17df7ffce21 100644 --- a/frontend/encore/cdn.rst +++ b/frontend/encore/cdn.rst @@ -39,6 +39,10 @@ pages also use the CDN. Fortunately, the :ref:`entrypoints.json ` paths are updated to include the full URL to the CDN. +When deploying to a subdirectory of your CDN, you must add the path at the end of your URL - +e.g. ``Encore.setPublicPath('https://my-cool-app.com.global.prod.fastly.net/awesome-website')`` +will generate assets URLs like ``https://my-cool-app.com.global.prod.fastly.net/awesome-website/dashboard.js`` + If you are using ``Encore.enableIntegrityHashes()`` and your CDN and your domain are not the `same-origin`_, you may need to set the ``crossorigin`` option in your webpack_encore.yaml configuration to ``anonymous`` or ``use-credentials`` From 52ce42f0dd0003b993c52766ccd750c01ccc648b Mon Sep 17 00:00:00 2001 From: Alexander Schranz Date: Tue, 2 Mar 2021 11:21:11 +0100 Subject: [PATCH 0363/1045] Add part about resolving parameter values to prepend extension --- bundles/prepend_extension.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bundles/prepend_extension.rst b/bundles/prepend_extension.rst index 2b6f9dbfe3f..d0c6522e4ec 100644 --- a/bundles/prepend_extension.rst +++ b/bundles/prepend_extension.rst @@ -82,6 +82,9 @@ in case a specific other bundle is not registered:: // process the configuration of AcmeHelloExtension $configs = $container->getExtensionConfig($this->getAlias()); + // resolve config parameters e.g. %kernel.debug% to boolean value + $resolvingBag = $container->getParameterBag(); + $configs = $resolvingBag->resolveValue($configs); // use the Configuration class to generate a config array with // the settings "acme_hello" $config = $this->processConfiguration(new Configuration(), $configs); From 8132571a84ee69102c743368c2b3aa78416defee Mon Sep 17 00:00:00 2001 From: Wouter de Jong Date: Sat, 20 Feb 2021 20:22:27 +0100 Subject: [PATCH 0364/1045] [#15009] Fix inconsistent diff examples --- frontend/encore/legacy-applications.rst | 3 +++ frontend/encore/split-chunks.rst | 2 ++ frontend/encore/typescript.rst | 3 ++- frontend/encore/versioning.rst | 2 +- quick_tour/flex_recipes.rst | 6 +++--- setup/flex.rst | 6 +++--- 6 files changed, 14 insertions(+), 8 deletions(-) diff --git a/frontend/encore/legacy-applications.rst b/frontend/encore/legacy-applications.rst index 4f1193d7e06..f76bc35adcb 100644 --- a/frontend/encore/legacy-applications.rst +++ b/frontend/encore/legacy-applications.rst @@ -32,6 +32,7 @@ jQuery plugins often expect that jQuery is already available via the ``$`` or .. code-block:: diff + // webpack.config.js Encore // ... + .autoProvidejQuery() @@ -74,6 +75,8 @@ page, add: .. code-block:: diff + // webpack.config.js + // require jQuery normally const $ = require('jquery'); diff --git a/frontend/encore/split-chunks.rst b/frontend/encore/split-chunks.rst index ebaa4ee48ce..b03952a3153 100644 --- a/frontend/encore/split-chunks.rst +++ b/frontend/encore/split-chunks.rst @@ -10,6 +10,7 @@ To enable this, call ``splitEntryChunks()``: .. code-block:: diff + // webpack.config.js Encore // ... @@ -52,6 +53,7 @@ this plugin with the ``configureSplitChunks()`` function: .. code-block:: diff + // webpack.config.js Encore // ... diff --git a/frontend/encore/typescript.rst b/frontend/encore/typescript.rst index b1af45d9c04..0ca51f7a13f 100644 --- a/frontend/encore/typescript.rst +++ b/frontend/encore/typescript.rst @@ -6,8 +6,8 @@ Want to use `TypeScript`_? No problem! First, enable it: .. code-block:: diff // webpack.config.js - // ... + // ... Encore // ... + .addEntry('main', './assets/main.ts') @@ -30,6 +30,7 @@ method. .. code-block:: diff + // webpack.config.js Encore // ... .addEntry('main', './assets/main.ts') diff --git a/frontend/encore/versioning.rst b/frontend/encore/versioning.rst index 1f3d0cdd39e..27177d2d554 100644 --- a/frontend/encore/versioning.rst +++ b/frontend/encore/versioning.rst @@ -13,8 +13,8 @@ ignoring any existing cache: .. code-block:: diff // webpack.config.js - // ... + // ... Encore .setOutputPath('public/build/') // ... diff --git a/quick_tour/flex_recipes.rst b/quick_tour/flex_recipes.rst index 435b4f07351..16724e3ee90 100644 --- a/quick_tour/flex_recipes.rst +++ b/quick_tour/flex_recipes.rst @@ -83,9 +83,9 @@ Thanks to Flex, after one command, you can start using Twig immediately: - use Symfony\Component\HttpFoundation\Response; + use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; - -class DefaultController - +class DefaultController extends AbstractController - { + - class DefaultController + + class DefaultController extends AbstractController + { /** * @Route("/hello/{name}") */ diff --git a/setup/flex.rst b/setup/flex.rst index eaba102d073..31f034db862 100644 --- a/setup/flex.rst +++ b/setup/flex.rst @@ -61,9 +61,9 @@ manual steps: { "require": { "symfony/flex": "^1.0", - + }, - + "conflict": { - + "symfony/symfony": "*" + + }, + + "conflict": { + + "symfony/symfony": "*" } } From 4865b3bfa9ae03cb9a8dfda0793c4a9225c92fd7 Mon Sep 17 00:00:00 2001 From: Wouter de Jong Date: Tue, 23 Feb 2021 19:09:49 +0100 Subject: [PATCH 0365/1045] [#15009] Fix indentation of all diff code blocks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Jérémy Derussé --- configuration/dot-env-changes.rst | 8 ++-- controller.rst | 10 ++--- doctrine.rst | 14 +++---- frontend/encore/cdn.rst | 18 ++++----- frontend/encore/copy-files.rst | 8 ++-- frontend/encore/custom-loaders-plugins.rst | 8 ++-- frontend/encore/dev-server.rst | 24 ++++++------ frontend/encore/faq.rst | 10 ++--- frontend/encore/legacy-applications.rst | 14 +++---- frontend/encore/postcss.rst | 24 ++++++------ frontend/encore/reactjs.rst | 10 ++--- frontend/encore/shared-entry.rst | 10 ++--- frontend/encore/simple-example.rst | 36 +++++++++--------- frontend/encore/split-chunks.rst | 24 ++++++------ frontend/encore/typescript.rst | 28 +++++++------- frontend/encore/versioning.rst | 10 ++--- frontend/encore/virtual-machine.rst | 36 +++++++++--------- frontend/encore/vuejs.rst | 24 ++++++------ http_cache.rst | 12 +++--- page_creation.rst | 28 +++++++------- quick_tour/flex_recipes.rst | 24 ++++++------ quick_tour/the_architecture.rst | 30 +++++++-------- quick_tour/the_big_picture.rst | 44 +++++++++++----------- security.rst | 40 ++++++++++---------- security/form_login_setup.rst | 12 +++--- security/guard_authentication.rst | 32 ++++++++-------- security/securing_services.rst | 24 ++++++------ service_container.rst | 36 +++++++++--------- setup/flex.rst | 10 ++--- setup/unstable_versions.rst | 10 ++--- setup/upgrade_major.rst | 34 ++++++++--------- setup/upgrade_minor.rst | 34 ++++++++--------- 32 files changed, 343 insertions(+), 343 deletions(-) diff --git a/configuration/dot-env-changes.rst b/configuration/dot-env-changes.rst index df418e6ea75..316bfa01aba 100644 --- a/configuration/dot-env-changes.rst +++ b/configuration/dot-env-changes.rst @@ -60,16 +60,16 @@ changes can be made to any Symfony 3.4 or higher app: .. code-block:: diff - # .gitignore - # ... + # .gitignore + # ... - ###> symfony/framework-bundle ### + ###> symfony/framework-bundle ### - /.env + /.env.local + /.env.local.php + /.env.*.local - # ... + # ... #. Rename ``.env`` to ``.env.local`` and ``.env.dist`` to ``.env``: diff --git a/controller.rst b/controller.rst index 212d0a2b509..ef3c3987a96 100644 --- a/controller.rst +++ b/controller.rst @@ -98,16 +98,16 @@ Add the ``use`` statement atop your controller class and then modify .. code-block:: diff - // src/Controller/LuckyController.php - namespace App\Controller; + // src/Controller/LuckyController.php + namespace App\Controller; + use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; - class LuckyController + class LuckyController extends AbstractController - { - // ... - } + { + // ... + } That's it! You now have access to methods like :ref:`$this->render() ` and many others that you'll learn about next. diff --git a/doctrine.rst b/doctrine.rst index 8226bf22700..e1ee1785c00 100644 --- a/doctrine.rst +++ b/doctrine.rst @@ -280,20 +280,20 @@ methods: .. code-block:: diff - // src/Entity/Product.php - // ... + // src/Entity/Product.php + // ... - class Product - { - // ... + class Product + { + // ... + /** + * @ORM\Column(type="text") + */ + private $description; - // getDescription() & setDescription() were also added - } + // getDescription() & setDescription() were also added + } The new property is mapped, but it doesn't exist yet in the ``product`` table. No problem! Generate a new migration: diff --git a/frontend/encore/cdn.rst b/frontend/encore/cdn.rst index a7a2884c13a..267e3e2f88f 100644 --- a/frontend/encore/cdn.rst +++ b/frontend/encore/cdn.rst @@ -6,15 +6,15 @@ built files are uploaded to the CDN, configure it in Encore: .. code-block:: diff - // webpack.config.js - // ... - - Encore - .setOutputPath('public/build/') - // in dev mode, don't use the CDN - .setPublicPath('/build'); - // ... - ; + // webpack.config.js + // ... + + Encore + .setOutputPath('public/build/') + // in dev mode, don't use the CDN + .setPublicPath('/build'); + // ... + ; + if (Encore.isProduction()) { + Encore.setPublicPath('https://my-cool-app.com.global.prod.fastly.net'); diff --git a/frontend/encore/copy-files.rst b/frontend/encore/copy-files.rst index bc263ef056a..dc97fb0d434 100644 --- a/frontend/encore/copy-files.rst +++ b/frontend/encore/copy-files.rst @@ -32,11 +32,11 @@ files into your final output directory. .. code-block:: diff - // webpack.config.js + // webpack.config.js - Encore - // ... - .setOutputPath('public/build/') + Encore + // ... + .setOutputPath('public/build/') + .copyFiles({ + from: './assets/images', diff --git a/frontend/encore/custom-loaders-plugins.rst b/frontend/encore/custom-loaders-plugins.rst index 66ce1f7c5cc..31c688ffc75 100644 --- a/frontend/encore/custom-loaders-plugins.rst +++ b/frontend/encore/custom-loaders-plugins.rst @@ -50,14 +50,14 @@ to use the `IgnorePlugin`_ (see `moment/moment#2373`_): .. code-block:: diff - // webpack.config.js + // webpack.config.js + var webpack = require('webpack'); - Encore - // ... + Encore + // ... + .addPlugin(new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/)) - ; + ; .. _`handlebars-loader`: https://github.com/pcardune/handlebars-loader .. _`plugins`: https://webpack.js.org/plugins/ diff --git a/frontend/encore/dev-server.rst b/frontend/encore/dev-server.rst index 3a602f89b19..76047ddc2a7 100644 --- a/frontend/encore/dev-server.rst +++ b/frontend/encore/dev-server.rst @@ -65,14 +65,14 @@ the ``package.json`` file: .. code-block:: diff - { - ... - "scripts": { + { + ... + "scripts": { - "dev-server": "encore dev-server", + "dev-server": "encore dev-server --https --pfx=$HOME/.symfony/certs/default.p12 --allowed-hosts=mydomain.wip", - ... - } - } + ... + } + } If you experience issues related to CORS (Cross Origin Resource Sharing), add the ``--disable-host-check`` and ``--port`` options to the ``dev-server`` @@ -80,14 +80,14 @@ command in the ``package.json`` file: .. code-block:: diff - { - ... - "scripts": { + { + ... + "scripts": { - "dev-server": "encore dev-server", + "dev-server": "encore dev-server --port 8080 --disable-host-check", - ... - } - } + ... + } + } .. caution:: diff --git a/frontend/encore/faq.rst b/frontend/encore/faq.rst index 3c621c3b8d0..f349cf350cf 100644 --- a/frontend/encore/faq.rst +++ b/frontend/encore/faq.rst @@ -63,11 +63,11 @@ like ``/myAppSubdir``), you will need to configure that when calling ``Encore.se .. code-block:: diff - // webpack.config.js - Encore - // ... + // webpack.config.js + Encore + // ... - .setOutputPath('public/build/') + .setOutputPath('public/build/') - .setPublicPath('/build') + // this is your *true* public path @@ -76,7 +76,7 @@ like ``/myAppSubdir``), you will need to configure that when calling ``Encore.se + // this is now needed so that your manifest.json keys are still `build/foo.js` + // (which is a file that's used by Symfony's `asset()` function) + .setManifestKeyPrefix('build') - ; + ; If you're using the ``encore_entry_script_tags()`` and ``encore_entry_link_tags()`` Twig shortcuts (or are :ref:`processing your assets through entrypoints.json ` diff --git a/frontend/encore/legacy-applications.rst b/frontend/encore/legacy-applications.rst index f76bc35adcb..36087b88978 100644 --- a/frontend/encore/legacy-applications.rst +++ b/frontend/encore/legacy-applications.rst @@ -32,11 +32,11 @@ jQuery plugins often expect that jQuery is already available via the ``$`` or .. code-block:: diff - // webpack.config.js - Encore - // ... + // webpack.config.js + Encore + // ... + .autoProvidejQuery() - ; + ; After restarting Encore, Webpack will look for all uninitialized ``$`` and ``jQuery`` variables and automatically require ``jquery`` and set those variables for you. @@ -75,10 +75,10 @@ page, add: .. code-block:: diff - // webpack.config.js + // webpack.config.js - // require jQuery normally - const $ = require('jquery'); + // require jQuery normally + const $ = require('jquery'); + // create global $ and jQuery variables + global.$ = global.jQuery = $; diff --git a/frontend/encore/postcss.rst b/frontend/encore/postcss.rst index 76c6e8d67e9..e30af2ae6ca 100644 --- a/frontend/encore/postcss.rst +++ b/frontend/encore/postcss.rst @@ -28,12 +28,12 @@ Then, enable the loader in Encore! .. code-block:: diff - // webpack.config.js + // webpack.config.js - Encore - // ... + Encore + // ... + .enablePostCssLoader() - ; + ; Because you just modified ``webpack.config.js``, stop and restart Encore. @@ -42,17 +42,17 @@ You can also pass options to the `postcss-loader`_ by passing a callback: .. code-block:: diff - // webpack.config.js + // webpack.config.js - Encore - // ... + Encore + // ... + .enablePostCssLoader((options) => { + options.config = { + // the directory where the postcss.config.js file is stored + path: 'path/to/config' + }; + }) - ; + ; .. _browserslist_package_config: @@ -65,25 +65,25 @@ support. The best-practice is to configure this directly in your ``package.json` .. code-block:: diff - { + { + "browserslist": [ + "defaults" + ] - } + } The ``defaults`` option is recommended for most users and would be equivalent to the following browserslist: .. code-block:: diff - { + { + "browserslist": [ + "> 0.5%", + "last 2 versions", + "Firefox ESR", + "not dead" + ] - } + } See `browserslist`_ for more details on the syntax. diff --git a/frontend/encore/reactjs.rst b/frontend/encore/reactjs.rst index ca3b017f13b..f7e206e15e8 100644 --- a/frontend/encore/reactjs.rst +++ b/frontend/encore/reactjs.rst @@ -17,13 +17,13 @@ Enable react in your ``webpack.config.js``: .. code-block:: diff - // webpack.config.js - // ... + // webpack.config.js + // ... - Encore - // ... + Encore + // ... + .enableReactPreset() - ; + ; Then restart Encore. When you do, it will give you a command you can run to diff --git a/frontend/encore/shared-entry.rst b/frontend/encore/shared-entry.rst index 6693b649d8d..f71868eee2f 100644 --- a/frontend/encore/shared-entry.rst +++ b/frontend/encore/shared-entry.rst @@ -16,13 +16,13 @@ Update your code to use ``createSharedEntry()``: .. code-block:: diff - Encore - // ... + Encore + // ... - .addEntry('app', './assets/js/app.js') + .createSharedEntry('app', './assets/js/app.js') - .addEntry('homepage', './assets/js/homepage.js') - .addEntry('blog', './assets/js/blog.js') - .addEntry('store', './assets/js/store.js') + .addEntry('homepage', './assets/js/homepage.js') + .addEntry('blog', './assets/js/blog.js') + .addEntry('store', './assets/js/store.js') Before making this change, if both ``app.js`` and ``store.js`` require ``jquery``, then ``jquery`` would be packaged into *both* files, which is wasteful. By making diff --git a/frontend/encore/simple-example.rst b/frontend/encore/simple-example.rst index 4373f9c3b66..2e9153e26db 100644 --- a/frontend/encore/simple-example.rst +++ b/frontend/encore/simple-example.rst @@ -167,8 +167,8 @@ Great! Use ``require()`` to import ``jquery`` and ``greet.js``: .. code-block:: diff - // assets/js/app.js - // ... + // assets/js/app.js + // ... + // loads the jquery package from node_modules + var $ = require('jquery'); @@ -196,17 +196,17 @@ To export values using the alternate syntax, use ``export``: .. code-block:: diff - // assets/js/greet.js + // assets/js/greet.js - module.exports = function(name) { + export default function(name) { - return `Yo yo ${name} - welcome to Encore!`; - }; + return `Yo yo ${name} - welcome to Encore!`; + }; To import values, use ``import``: .. code-block:: diff - // assets/js/app.js + // assets/js/app.js - require('../css/app.css'); + import '../css/app.css'; @@ -240,13 +240,13 @@ Next, use ``addEntry()`` to tell Webpack to read these two new files when it bui .. code-block:: diff - // webpack.config.js - Encore - // ... - .addEntry('app', './assets/js/app.js') + // webpack.config.js + Encore + // ... + .addEntry('app', './assets/js/app.js') + .addEntry('checkout', './assets/js/checkout.js') + .addEntry('account', './assets/js/account.js') - // ... + // ... And because you just changed the ``webpack.config.js`` file, make sure to stop and restart Encore: @@ -264,8 +264,8 @@ you need them: .. code-block:: diff - {# templates/.../checkout.html.twig #} - {% extends 'base.html.twig' %} + {# templates/.../checkout.html.twig #} + {% extends 'base.html.twig' %} + {% block stylesheets %} + {{ parent() }} @@ -294,7 +294,7 @@ file to ``app.scss`` and update the ``import`` statement: .. code-block:: diff - // assets/js/app.js + // assets/js/app.js - import '../css/app.css'; + import '../css/app.scss'; @@ -302,12 +302,12 @@ Then, tell Encore to enable the Sass pre-processor: .. code-block:: diff - // webpack.config.js - Encore - // ... + // webpack.config.js + Encore + // ... + .enableSassLoader() - ; + ; Because you just changed your ``webpack.config.js`` file, you'll need to restart Encore. When you do, you'll see an error! diff --git a/frontend/encore/split-chunks.rst b/frontend/encore/split-chunks.rst index b03952a3153..f25c876704d 100644 --- a/frontend/encore/split-chunks.rst +++ b/frontend/encore/split-chunks.rst @@ -10,15 +10,15 @@ To enable this, call ``splitEntryChunks()``: .. code-block:: diff - // webpack.config.js - Encore - // ... + // webpack.config.js + Encore + // ... - // multiple entry files, which probably import the same code - .addEntry('app', './assets/js/app.js') - .addEntry('homepage', './assets/js/homepage.js') - .addEntry('blog', './assets/js/blog.js') - .addEntry('store', './assets/js/store.js') + // multiple entry files, which probably import the same code + .addEntry('app', './assets/js/app.js') + .addEntry('homepage', './assets/js/homepage.js') + .addEntry('blog', './assets/js/blog.js') + .addEntry('store', './assets/js/store.js') + .splitEntryChunks() @@ -53,11 +53,11 @@ this plugin with the ``configureSplitChunks()`` function: .. code-block:: diff - // webpack.config.js - Encore - // ... + // webpack.config.js + Encore + // ... - .splitEntryChunks() + .splitEntryChunks() + .configureSplitChunks(function(splitChunks) { + // change the configuration + splitChunks.minSize = 0; diff --git a/frontend/encore/typescript.rst b/frontend/encore/typescript.rst index 0ca51f7a13f..fbd0b616c86 100644 --- a/frontend/encore/typescript.rst +++ b/frontend/encore/typescript.rst @@ -5,20 +5,20 @@ Want to use `TypeScript`_? No problem! First, enable it: .. code-block:: diff - // webpack.config.js + // webpack.config.js - // ... - Encore - // ... + // ... + Encore + // ... + .addEntry('main', './assets/main.ts') + .enableTypeScriptLoader() - // optionally enable forked type script for faster builds - // https://www.npmjs.com/package/fork-ts-checker-webpack-plugin - // requires that you have a tsconfig.json file that is setup correctly. + // optionally enable forked type script for faster builds + // https://www.npmjs.com/package/fork-ts-checker-webpack-plugin + // requires that you have a tsconfig.json file that is setup correctly. + //.enableForkedTypeScriptTypesChecking() - ; + ; Then restart Encore. When you do, it will give you a command you can run to install any missing dependencies. After running that command and restarting @@ -30,10 +30,10 @@ method. .. code-block:: diff - // webpack.config.js - Encore - // ... - .addEntry('main', './assets/main.ts') + // webpack.config.js + Encore + // ... + .addEntry('main', './assets/main.ts') - .enableTypeScriptLoader() + .enableTypeScriptLoader(function(tsConfig) { @@ -43,8 +43,8 @@ method. + // tsConfig.silent = false + }) - // ... - ; + // ... + ; See the `Encore's index.js file`_ for detailed documentation and check out the `tsconfig.json reference`_ and the `Webpack guide about Typescript`_. diff --git a/frontend/encore/versioning.rst b/frontend/encore/versioning.rst index 27177d2d554..0911f8d8cc3 100644 --- a/frontend/encore/versioning.rst +++ b/frontend/encore/versioning.rst @@ -12,12 +12,12 @@ ignoring any existing cache: .. code-block:: diff - // webpack.config.js + // webpack.config.js - // ... - Encore - .setOutputPath('public/build/') - // ... + // ... + Encore + .setOutputPath('public/build/') + // ... + .enableVersioning() To link to these assets, Encore creates two files ``entrypoints.json`` and diff --git a/frontend/encore/virtual-machine.rst b/frontend/encore/virtual-machine.rst index 068d5c8451f..40b7ec2d386 100644 --- a/frontend/encore/virtual-machine.rst +++ b/frontend/encore/virtual-machine.rst @@ -49,14 +49,14 @@ If your Symfony application is running on a custom domain (e.g. .. code-block:: diff - { - ... - "scripts": { + { + ... + "scripts": { - "dev-server": "encore dev-server", + "dev-server": "encore dev-server --public http://app.vm:8080", - ... - } - } + ... + } + } After restarting Encore and reloading your web page, you will probably see different issues in the web console: @@ -78,14 +78,14 @@ connections: .. code-block:: diff - { - ... - "scripts": { + { + ... + "scripts": { - "dev-server": "encore dev-server --public http://app.vm:8080", + "dev-server": "encore dev-server --public http://app.vm:8080 --host 0.0.0.0", - ... - } - } + ... + } + } .. caution:: @@ -100,14 +100,14 @@ the dev-server. To fix this, add the argument ``--disable-host-check``: .. code-block:: diff - { - ... - "scripts": { + { + ... + "scripts": { - "dev-server": "encore dev-server --public http://app.vm:8080 --host 0.0.0.0", + "dev-server": "encore dev-server --public http://app.vm:8080 --host 0.0.0.0 --disable-host-check", - ... - } - } + ... + } + } .. caution:: diff --git a/frontend/encore/vuejs.rst b/frontend/encore/vuejs.rst index dd1227c9447..2af99c075fb 100644 --- a/frontend/encore/vuejs.rst +++ b/frontend/encore/vuejs.rst @@ -10,15 +10,15 @@ Want to use `Vue.js`_? No problem! First enable it in ``webpack.config.js``: .. code-block:: diff - // webpack.config.js - // ... + // webpack.config.js + // ... - Encore - // ... - .addEntry('main', './assets/main.js') + Encore + // ... + .addEntry('main', './assets/main.js') + .enableVueLoader() - ; + ; Then restart Encore. When you do, it will give you a command you can run to install any missing dependencies. After running that command and restarting @@ -53,18 +53,18 @@ You can enable `JSX with Vue.js`_ by configuring the second parameter of the .. code-block:: diff - // webpack.config.js - // ... + // webpack.config.js + // ... - Encore - // ... - .addEntry('main', './assets/main.js') + Encore + // ... + .addEntry('main', './assets/main.js') - .enableVueLoader() + .enableVueLoader(() => {}, { + useJsx: true + }) - ; + ; Next, run or restart Encore. When you do, you will see an error message helping you install any missing dependencies. After running that command and restarting diff --git a/http_cache.rst b/http_cache.rst index 0bd62b30c8e..6061ed128cc 100644 --- a/http_cache.rst +++ b/http_cache.rst @@ -93,20 +93,20 @@ caching kernel: .. code-block:: diff - // public/index.php + // public/index.php + use App\CacheKernel; - use App\Kernel; + use App\Kernel; - // ... - $kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']); + // ... + $kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']); + // Wrap the default Kernel with the CacheKernel one in 'prod' environment + if ('prod' === $kernel->getEnvironment()) { + $kernel = new CacheKernel($kernel); + } - $request = Request::createFromGlobals(); - // ... + $request = Request::createFromGlobals(); + // ... The caching kernel will immediately act as a reverse proxy: caching responses from your application and returning them to the client. diff --git a/page_creation.rst b/page_creation.rst index 90096beb4d4..817c59fc6ff 100644 --- a/page_creation.rst +++ b/page_creation.rst @@ -105,21 +105,21 @@ You can now add your route directly *above* the controller: .. code-block:: diff - // src/Controller/LuckyController.php + // src/Controller/LuckyController.php - // ... + // ... + use Symfony\Component\Routing\Annotation\Route; - class LuckyController - { + class LuckyController + { + /** + * @Route("/lucky/number") + */ - public function number() - { - // this looks exactly the same - } - } + public function number() + { + // this looks exactly the same + } + } That's it! The page - http://localhost:8000/lucky/number will work exactly like before! Annotations are the recommended way to configure routes. @@ -209,16 +209,16 @@ Make sure that ``LuckyController`` extends Symfony's base .. code-block:: diff - // src/Controller/LuckyController.php + // src/Controller/LuckyController.php - // ... + // ... + use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; - class LuckyController + class LuckyController extends AbstractController - { - // ... - } + { + // ... + } Now, use the handy ``render()`` function to render a template. Pass it a ``number`` variable so you can use it in Twig:: diff --git a/quick_tour/flex_recipes.rst b/quick_tour/flex_recipes.rst index 16724e3ee90..1b929667b92 100644 --- a/quick_tour/flex_recipes.rst +++ b/quick_tour/flex_recipes.rst @@ -75,28 +75,28 @@ Thanks to Flex, after one command, you can start using Twig immediately: .. code-block:: diff - render('default/index.html.twig', [ + 'name' => $name, + ]); - } - } + } + } By extending ``AbstractController``, you now have access to a number of shortcut methods and tools, like ``render()``. Create the new template: diff --git a/quick_tour/the_architecture.rst b/quick_tour/the_architecture.rst index d88bb5d32ed..0d640d1746d 100644 --- a/quick_tour/the_architecture.rst +++ b/quick_tour/the_architecture.rst @@ -138,12 +138,12 @@ difference is that it's done in the constructor: .. code-block:: diff - logger = $logger; + } - public function getRandomGreeting() - { - // ... + public function getRandomGreeting() + { + // ... + $this->logger->info('Using the greeting: '.$greeting); - return $greeting; - } - } + return $greeting; + } + } Yes! This works too: no configuration, no time wasted. Keep coding! @@ -279,7 +279,7 @@ from ``dev`` to ``prod``: .. code-block:: diff - # .env + # .env - APP_ENV=dev + APP_ENV=prod @@ -321,10 +321,10 @@ Thanks to a new recipe installed by Flex, look at the ``.env`` file again: .. code-block:: diff - ###> symfony/framework-bundle ### - APP_ENV=dev - APP_SECRET=cc86c7ca937636d5ddf1b754beb22a10 - ###< symfony/framework-bundle ### + ###> symfony/framework-bundle ### + APP_ENV=dev + APP_SECRET=cc86c7ca937636d5ddf1b754beb22a10 + ###< symfony/framework-bundle ### + ###> doctrine/doctrine-bundle ### + # ... diff --git a/quick_tour/the_big_picture.rst b/quick_tour/the_big_picture.rst index 4fae7ef5991..b6ad8eaafdd 100644 --- a/quick_tour/the_big_picture.rst +++ b/quick_tour/the_big_picture.rst @@ -105,32 +105,32 @@ But the routing system is *much* more powerful. So let's make the route more int .. code-block:: diff - # config/routes.yaml - index: + # config/routes.yaml + index: - path: / + path: /hello/{name} - controller: 'App\Controller\DefaultController::index' + controller: 'App\Controller\DefaultController::index' The URL to this page has changed: it is *now* ``/hello/*``: the ``{name}`` acts like a wildcard that matches anything. And it gets better! Update the controller too: .. code-block:: diff - passwordEncoder = $passwordEncoder; + } - public function load(ObjectManager $manager) - { - $user = new User(); - // ... + public function load(ObjectManager $manager) + { + $user = new User(); + // ... + $user->setPassword($this->passwordEncoder->encodePassword( + $user, + 'the_new_password' + )); - // ... - } - } + // ... + } + } You can manually encode a password by running: @@ -671,8 +671,8 @@ using annotations: .. code-block:: diff - // src/Controller/AdminController.php - // ... + // src/Controller/AdminController.php + // ... + use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted; @@ -681,18 +681,18 @@ using annotations: + * + * @IsGranted("ROLE_ADMIN") + */ - class AdminController extends AbstractController - { + class AdminController extends AbstractController + { + /** + * Require ROLE_ADMIN for only this controller method. + * + * @IsGranted("ROLE_ADMIN") + */ - public function adminDashboard() - { - // ... - } - } + public function adminDashboard() + { + // ... + } + } For more information, see the `FrameworkExtraBundle documentation`_. diff --git a/security/form_login_setup.rst b/security/form_login_setup.rst index 768ce725a72..d78a415ff34 100644 --- a/security/form_login_setup.rst +++ b/security/form_login_setup.rst @@ -377,17 +377,17 @@ be redirected after success: .. code-block:: diff - // src/Security/LoginFormAuthenticator.php + // src/Security/LoginFormAuthenticator.php - // ... - public function onAuthenticationSuccess(Request $request, TokenInterface $token, $providerKey) - { - // ... + // ... + public function onAuthenticationSuccess(Request $request, TokenInterface $token, $providerKey) + { + // ... - throw new \Exception('TODO: provide a valid redirect inside '.__FILE__); + // redirect to some "app_homepage" route - of wherever you want + return new RedirectResponse($this->urlGenerator->generate('app_homepage')); - } + } Unless you have any other TODOs in that file, that's it! If you're loading users from the database, make sure you've loaded some :ref:`dummy users `. diff --git a/security/guard_authentication.rst b/security/guard_authentication.rst index 7a6a25b9618..7f0ff8b7f0b 100644 --- a/security/guard_authentication.rst +++ b/security/guard_authentication.rst @@ -27,22 +27,22 @@ your ``User`` class (the ``make:entity`` command is a good way to do this): .. code-block:: diff - // src/Entity/User.php - namespace App\Entity; + // src/Entity/User.php + namespace App\Entity; - // ... + // ... - class User implements UserInterface - { - // ... + class User implements UserInterface + { + // ... + /** + * @ORM\Column(type="string", unique=true, nullable=true) + */ + private $apiToken; - // the getter and setter methods - } + // the getter and setter methods + } Don't forget to generate and run the migration: @@ -518,13 +518,13 @@ are two possible fixes: .. code-block:: diff - // src/Security/MyIpAuthenticator.php - // ... + // src/Security/MyIpAuthenticator.php + // ... + use Symfony\Component\Security\Core\Security; - class MyIpAuthenticator - { + class MyIpAuthenticator + { + private $security; + public function __construct(Security $security) @@ -532,8 +532,8 @@ are two possible fixes: + $this->security = $security; + } - public function supports(Request $request) - { + public function supports(Request $request) + { + // if there is already an authenticated user (likely due to the session) + // then return false and skip authentication: there is no need. + if ($this->security->getUser()) { @@ -542,8 +542,8 @@ are two possible fixes: + // the user is not logged in, so the authenticator should continue + return true; - } - } + } + } If you use autowiring, the ``Security`` service will automatically be passed to your authenticator. diff --git a/security/securing_services.rst b/security/securing_services.rst index 67b37dd792e..015d2a76400 100644 --- a/security/securing_services.rst +++ b/security/securing_services.rst @@ -14,14 +14,14 @@ want to include extra details only for users that have a ``ROLE_SALES_ADMIN`` ro .. code-block:: diff - // src/Newsletter/NewsletterManager.php + // src/Newsletter/NewsletterManager.php - // ... - use Symfony\Component\Security\Core\Exception\AccessDeniedException; + // ... + use Symfony\Component\Security\Core\Exception\AccessDeniedException; + use Symfony\Component\Security\Core\Security; - class SalesReportManager - { + class SalesReportManager + { + private $security; + public function __construct(Security $security) @@ -29,19 +29,19 @@ want to include extra details only for users that have a ``ROLE_SALES_ADMIN`` ro + $this->security = $security; + } - public function sendNewsletter() - { - $salesData = []; + public function sendNewsletter() + { + $salesData = []; + if ($this->security->isGranted('ROLE_SALES_ADMIN')) { + $salesData['top_secret_numbers'] = rand(); + } - // ... - } + // ... + } - // ... - } + // ... + } If you're using the :ref:`default services.yaml configuration `, Symfony will automatically pass the ``security.helper`` to your service diff --git a/service_container.rst b/service_container.rst index 9c4892712ea..fec082a377c 100644 --- a/service_container.rst +++ b/service_container.rst @@ -369,34 +369,34 @@ example, suppose you want to make the admin email configurable: .. code-block:: diff - // src/Service/SiteUpdateManager.php - // ... + // src/Service/SiteUpdateManager.php + // ... - class SiteUpdateManager - { - // ... + class SiteUpdateManager + { + // ... + private $adminEmail; - public function __construct(MessageGenerator $messageGenerator, MailerInterface $mailer) + public function __construct(MessageGenerator $messageGenerator, MailerInterface $mailer, string $adminEmail) - { - // ... + { + // ... + $this->adminEmail = $adminEmail; - } + } - public function notifyOfSiteUpdate(): bool - { - // ... + public function notifyOfSiteUpdate(): bool + { + // ... - $email = (new Email()) - // ... + $email = (new Email()) + // ... - ->to('manager@example.com') + ->to($this->adminEmail) - // ... - ; - // ... - } - } + // ... + ; + // ... + } + } If you make this change and refresh, you'll see an error: diff --git a/setup/flex.rst b/setup/flex.rst index 31f034db862..21c470a1073 100644 --- a/setup/flex.rst +++ b/setup/flex.rst @@ -58,14 +58,14 @@ manual steps: .. code-block:: diff - { - "require": { - "symfony/flex": "^1.0", + { + "require": { + "symfony/flex": "^1.0", + }, + "conflict": { + "symfony/symfony": "*" - } - } + } + } Now you must add in ``composer.json`` all the Symfony dependencies required by your project. A quick way to do that is to add all the components that diff --git a/setup/unstable_versions.rst b/setup/unstable_versions.rst index 5e11526b20e..5e6e138ff8d 100644 --- a/setup/unstable_versions.rst +++ b/setup/unstable_versions.rst @@ -33,14 +33,14 @@ new version and change your ``minimum-stability`` to ``beta``: .. code-block:: diff - { - "require": { + { + "require": { + "symfony/framework-bundle": "^4.0", + "symfony/finder": "^4.0", - "...": "..." - }, + "...": "..." + }, + "minimum-stability": "beta" - } + } You can also use set ``minimum-stability`` to ``dev``, or omit this line entirely, and opt into your stability on each package by using constraints diff --git a/setup/upgrade_major.rst b/setup/upgrade_major.rst index 89f80ae109f..1562be9442b 100644 --- a/setup/upgrade_major.rst +++ b/setup/upgrade_major.rst @@ -131,26 +131,26 @@ starting with ``symfony/`` to the new major version: .. code-block:: diff - { - "...": "...", + { + "...": "...", - "require": { + "require": { - "symfony/cache": "4.4.*", + "symfony/cache": "5.0.*", - "symfony/config": "4.4.*", + "symfony/config": "5.0.*", - "symfony/console": "4.4.*", + "symfony/console": "5.0.*", - "...": "...", + "...": "...", - "...": "A few libraries starting with - symfony/ follow their own versioning scheme. You - do not need to update these versions: you can - upgrade them independently whenever you want", - "symfony/monolog-bundle": "^3.5", - }, - "...": "...", - } + "...": "A few libraries starting with + symfony/ follow their own versioning scheme. You + do not need to update these versions: you can + upgrade them independently whenever you want", + "symfony/monolog-bundle": "^3.5", + }, + "...": "...", + } At the bottom of your ``composer.json`` file, in the ``extra`` block you can find a data setting for the Symfony version. Make sure to also upgrade @@ -158,13 +158,13 @@ this one. For instance, update it to ``5.0.*`` to upgrade to Symfony 5.0: .. code-block:: diff - "extra": { - "symfony": { - "allow-contrib": false, + "extra": { + "symfony": { + "allow-contrib": false, - "require": "4.4.*" + "require": "5.0.*" - } - } + } + } Next, use Composer to download new versions of the libraries: diff --git a/setup/upgrade_minor.rst b/setup/upgrade_minor.rst index 09a88124fa8..66e261a6726 100644 --- a/setup/upgrade_minor.rst +++ b/setup/upgrade_minor.rst @@ -28,39 +28,39 @@ probably need to update the version constraint next to each library starting .. code-block:: diff - { - "...": "...", + { + "...": "...", - "require": { + "require": { - "symfony/cache": "4.3.*", + "symfony/cache": "4.4.*", - "symfony/config": "4.3.*", + "symfony/config": "4.4.*", - "symfony/console": "4.3.*", + "symfony/console": "4.4.*", - "...": "...", + "...": "...", - "...": "A few libraries starting with - symfony/ follow their versioning scheme. You - do not need to update these versions: you can - upgrade them independently whenever you want", - "symfony/monolog-bundle": "^3.5", - }, - "...": "...", - } + "...": "A few libraries starting with + symfony/ follow their versioning scheme. You + do not need to update these versions: you can + upgrade them independently whenever you want", + "symfony/monolog-bundle": "^3.5", + }, + "...": "...", + } Your ``composer.json`` file should also have an ``extra`` block that you will *also* need to update: .. code-block:: diff - "extra": { - "symfony": { - "...": "...", + "extra": { + "symfony": { + "...": "...", - "require": "4.3.*" + "require": "4.4.*" - } - } + } + } Next, use Composer to download new versions of the libraries: From c55c2a2745ce464fc90f0cb8c8d3d173205904ec Mon Sep 17 00:00:00 2001 From: Nyholm Date: Tue, 2 Mar 2021 21:23:44 +0100 Subject: [PATCH 0366/1045] [Messenger] Added note about timezone --- messenger.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/messenger.rst b/messenger.rst index 0ee914216ca..1f4b116595e 100644 --- a/messenger.rst +++ b/messenger.rst @@ -1001,6 +1001,12 @@ auto_setup Whether the table should be created automatically during send / get. true ================== ===================================== ====================== +.. caution:: + + Messages are stored in the database will have a datetime property which is created + with the timezone of the current system. This may cause issues if multiple machines + with different timezone configuration is using the same storage. + Redis Transport ~~~~~~~~~~~~~~~ From e98f953d7bda83018ed723ad37f48b1656862f21 Mon Sep 17 00:00:00 2001 From: Sebastian Paczkowski <74934099+sebpacz@users.noreply.github.com> Date: Wed, 3 Mar 2021 21:12:36 +0100 Subject: [PATCH 0367/1045] [Translation] Update translation.rst The trans() in the translator service is a method, not a function. --- translation.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/translation.rst b/translation.rst index 20025b8b5cd..4a0137b94d8 100644 --- a/translation.rst +++ b/translation.rst @@ -352,7 +352,7 @@ The ``translation:update`` command looks for missing translations in: defined in the :ref:`twig.default_path ` and :ref:`twig.paths ` config options); * Any PHP file/class that injects or :doc:`autowires ` - the ``translator`` service and makes calls to the ``trans()`` function. + the ``translator`` service and makes calls to the ``trans()`` method. .. versionadded:: 4.3 From 3d5dadda9986dd58c5e9df44bb3fd6ce6c1cf438 Mon Sep 17 00:00:00 2001 From: Roland Franssen Date: Fri, 5 Mar 2021 09:10:22 +0100 Subject: [PATCH 0368/1045] Update env_var_processors.rst --- configuration/env_var_processors.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/configuration/env_var_processors.rst b/configuration/env_var_processors.rst index 7b134067bef..a1c28de0c4f 100644 --- a/configuration/env_var_processors.rst +++ b/configuration/env_var_processors.rst @@ -285,7 +285,7 @@ Symfony provides the following env var processors: # config/packages/framework.yaml parameters: - env(TRUSTED_HOSTS): "10.0.0.1, 10.0.0.2" + env(TRUSTED_HOSTS): "10.0.0.1,10.0.0.2" framework: trusted_hosts: '%env(csv:TRUSTED_HOSTS)%' @@ -302,7 +302,7 @@ Symfony provides the following env var processors: https://symfony.com/schema/dic/symfony/symfony-1.0.xsd"> - ["10.0.0.1", "10.0.0.2"] + 10.0.0.1,10.0.0.2 @@ -311,7 +311,7 @@ Symfony provides the following env var processors: .. code-block:: php // config/packages/framework.php - $container->setParameter('env(TRUSTED_HOSTS)', '["10.0.0.1", "10.0.0.2"]'); + $container->setParameter('env(TRUSTED_HOSTS)', '10.0.0.1,10.0.0.2'); $container->loadFromExtension('framework', [ 'trusted_hosts' => '%env(csv:TRUSTED_HOSTS)%', ]); From e40b5d5ddefe1e61a14736d2a5f80521c3478d72 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Fri, 5 Mar 2021 10:37:44 +0100 Subject: [PATCH 0369/1045] Reword --- messenger.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/messenger.rst b/messenger.rst index 1f4b116595e..52f125a3b61 100644 --- a/messenger.rst +++ b/messenger.rst @@ -1003,9 +1003,9 @@ auto_setup Whether the table should be created .. caution:: - Messages are stored in the database will have a datetime property which is created - with the timezone of the current system. This may cause issues if multiple machines - with different timezone configuration is using the same storage. + The datetime property of the messages stored in the database uses the + timezone of the current system. This may cause issues if multiple machines + with different timezone configuration use the same storage. Redis Transport ~~~~~~~~~~~~~~~ From b11322cc7f511054f9601e2bbaf55fe846633e2b Mon Sep 17 00:00:00 2001 From: Nyholm Date: Tue, 2 Mar 2021 15:32:52 +0100 Subject: [PATCH 0370/1045] [Cache] Remove `compression` option from Redis and Memcache --- components/cache/adapters/memcached_adapter.rst | 12 ------------ components/cache/adapters/redis_adapter.rst | 5 ----- 2 files changed, 17 deletions(-) diff --git a/components/cache/adapters/memcached_adapter.rst b/components/cache/adapters/memcached_adapter.rst index 9cd8c8cdd25..1b8103433e1 100644 --- a/components/cache/adapters/memcached_adapter.rst +++ b/components/cache/adapters/memcached_adapter.rst @@ -124,7 +124,6 @@ option names and their respective values:: // associative array of configuration options [ - 'compression' => true, 'libketama_compatible' => true, 'serializer' => 'igbinary', ] @@ -143,17 +142,6 @@ Available Options server(s). Any action that retrieves data, quits the connection, or closes down the connection will cause the buffer to be committed. -``compression`` (type: ``bool``, default: ``true``) - Enables or disables payload compression, where item values longer than 100 - bytes are compressed during storage and decompressed during retrieval. - -``compression_type`` (type: ``string``) - Specifies the compression method used on value payloads. when the - **compression** option is enabled. - - Valid option values include ``fastlz`` and ``zlib``, with a default value - that *varies based on flags used at compilation*. - ``connect_timeout`` (type: ``int``, default: ``1000``) Specifies the timeout (in milliseconds) of socket connection operations when the ``no_block`` option is enabled. diff --git a/components/cache/adapters/redis_adapter.rst b/components/cache/adapters/redis_adapter.rst index 935afcd9f92..ef40de623e9 100644 --- a/components/cache/adapters/redis_adapter.rst +++ b/components/cache/adapters/redis_adapter.rst @@ -131,7 +131,6 @@ array of ``key => value`` pairs representing option names and their respective v // associative array of configuration options [ - 'compression' => true, 'lazy' => false, 'persistent' => 0, 'persistent_id' => null, @@ -151,10 +150,6 @@ Available Options If none is specified, it will return ``\Redis`` if the ``redis`` extension is available, and ``\Predis\Client`` otherwise. -``compression`` (type: ``bool``, default: ``true``) - Enables or disables compression of items. This requires phpredis v4 or higher with - LZF support enabled. - ``lazy`` (type: ``bool``, default: ``false``) Enables or disables lazy connections to the backend. It's ``false`` by default when using this as a stand-alone component and ``true`` by default From e98cef46e8a9469049446c97e49fc8b6817de372 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Farys?= Date: Thu, 4 Mar 2021 18:00:32 +0100 Subject: [PATCH 0371/1045] Fixed typo for YamlEncoder section Minor typo fix for YamlEncoder section --- components/serializer.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/serializer.rst b/components/serializer.rst index f554ed7cf76..f2c3285a33b 100644 --- a/components/serializer.rst +++ b/components/serializer.rst @@ -994,7 +994,7 @@ The ``YamlEncoder`` Context Options The ``encode()`` method, like other encoder, uses ``context`` to set configuration options for the YamlEncoder an associative array:: - $xmlEncoder->encode($array, 'xml', $context); + $yamlEncoder->encode($array, 'yaml', $context); These are the options available: From 84ce746d39ce93e7c24a161763258794123be877 Mon Sep 17 00:00:00 2001 From: Nyholm Date: Tue, 2 Mar 2021 14:00:25 +0100 Subject: [PATCH 0372/1045] [Lock] Added paragraph about auto release --- components/lock.rst | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/components/lock.rst b/components/lock.rst index 7b2c131947d..c1d3983aa46 100644 --- a/components/lock.rst +++ b/components/lock.rst @@ -199,6 +199,38 @@ This component also provides two useful methods related to expiring locks: ``getRemainingLifetime()`` (which returns ``null`` or a ``float`` as seconds) and ``isExpired()`` (which returns a boolean). +Automatically Releasing The Lock +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +A Lock will be automatically released when the Lock object is destructed. This is +an implementation detail that will be important when Locks are shared between processes. +In the example below, the ``pcntl_fork()`` will create two processes and the Lock +will be released automatically as soon as one process finishes:: + + // ... + $lock = $factory->createLock('report-generation', 3600); + if (!$lock->acquire()) { + return; + } + + $pid = pcntl_fork(); + if ($pid == -1) { + // Could not fork + exit(1); + } elseif ($pid) { + // Parent process + sleep(30); + } else { + // Child process + echo 'The lock will be released now.' + exit(0); + } + // ... + +To disable this behavior, one needs to set the 3rd argument to the ``LockFactory::createLock()`` +to false. That will make the Lock acquired for 3600 seconds or until ``Lock::release()`` +is called. + The Owner of The Lock --------------------- From 4ed8ef05f5c2638305fa0e70f76e2f66a043ded0 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Fri, 5 Mar 2021 11:00:58 +0100 Subject: [PATCH 0373/1045] Tweaks --- components/lock.rst | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/components/lock.rst b/components/lock.rst index e92603aec5e..e0baecd9560 100644 --- a/components/lock.rst +++ b/components/lock.rst @@ -203,10 +203,10 @@ as seconds) and ``isExpired()`` (which returns a boolean). Automatically Releasing The Lock ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -A Lock will be automatically released when the Lock object is destructed. This is -an implementation detail that will be important when Locks are shared between processes. -In the example below, the ``pcntl_fork()`` will create two processes and the Lock -will be released automatically as soon as one process finishes:: +Lock are automatically released when their Lock objects are destructed. This is +an implementation detail that will be important when sharing Locks between +processes. In the example below, ``pcntl_fork()`` creates two processes and the +Lock will be released automatically as soon as one process finishes:: // ... $lock = $factory->createLock('report-generation', 3600); @@ -215,7 +215,7 @@ will be released automatically as soon as one process finishes:: } $pid = pcntl_fork(); - if ($pid == -1) { + if (-1 === $pid) { // Could not fork exit(1); } elseif ($pid) { @@ -228,9 +228,9 @@ will be released automatically as soon as one process finishes:: } // ... -To disable this behavior, one needs to set the 3rd argument to the ``LockFactory::createLock()`` -to false. That will make the Lock acquired for 3600 seconds or until ``Lock::release()`` -is called. +To disable this behavior, set to ``false`` the third argument of +``LockFactory::createLock()``. That will make the lock acquired for 3600 seconds +or until ``Lock::release()`` is called. The Owner of The Lock --------------------- From 685cb2c6a684aca654b8be4baee4d81536da0a71 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Fri, 5 Mar 2021 12:19:52 +0100 Subject: [PATCH 0374/1045] Tweak --- bundles/prepend_extension.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bundles/prepend_extension.rst b/bundles/prepend_extension.rst index d0c6522e4ec..a332d45141f 100644 --- a/bundles/prepend_extension.rst +++ b/bundles/prepend_extension.rst @@ -82,9 +82,11 @@ in case a specific other bundle is not registered:: // process the configuration of AcmeHelloExtension $configs = $container->getExtensionConfig($this->getAlias()); - // resolve config parameters e.g. %kernel.debug% to boolean value + + // resolve config parameters e.g. %kernel.debug% to its boolean value $resolvingBag = $container->getParameterBag(); $configs = $resolvingBag->resolveValue($configs); + // use the Configuration class to generate a config array with // the settings "acme_hello" $config = $this->processConfiguration(new Configuration(), $configs); From d1190fcfafecb4ee29f8a59fa77210a0b9822799 Mon Sep 17 00:00:00 2001 From: William Pinaud Date: Sat, 6 Mar 2021 15:51:38 +0100 Subject: [PATCH 0375/1045] Added doc and defaults for missing 'ttl' option in config Hi, this might need validation, but I stumbled upon a difference between what the doc says (4.4+) and what's in https://github.com/symfony/http-foundation/blob/5.x/Session/Storage/Handler/RedisSessionHandler.php. I think the 'ttl' option is unexplained and undocumented since it was added in 2019: https://github.com/symfony/http-foundation/commit/0c5217a9050712a1e66f851d04962abf8f2c6fc4 --- session/database.rst | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/session/database.rst b/session/database.rst index a0fb1b3d4a6..f7a5b002dbb 100644 --- a/session/database.rst +++ b/session/database.rst @@ -89,9 +89,10 @@ and ``RedisProxy``: Symfony\Component\HttpFoundation\Session\Storage\Handler\RedisSessionHandler: arguments: - '@Redis' - # you can optionally pass an array of options. The only option is 'prefix', - # which defines the prefix to use for the keys to avoid collision on the Redis server - # - { prefix: 'my_prefix' } + # you can optionally pass an array of options. The only options are 'prefix' and 'ttl', + # which define the prefix to use for the keys to avoid collision on the Redis server + # and the expiration time for any given entry (in seconds), defaults are 'sf_s' and null: + # - { 'prefix' => 'my_prefix', 'ttl' => 600 } .. code-block:: xml @@ -99,8 +100,9 @@ and ``RedisProxy``: - @@ -116,9 +118,10 @@ and ``RedisProxy``: ->register(RedisSessionHandler::class) ->addArgument( new Reference('Redis'), - // you can optionally pass an array of options. The only option is 'prefix', - // which defines the prefix to use for the keys to avoid collision on the Redis server: - // ['prefix' => 'my_prefix'], + // you can optionally pass an array of options. The only options are 'prefix' and 'ttl', + // which define the prefix to use for the keys to avoid collision on the Redis server + // and the expiration time for any given entry (in seconds), defaults are 'sf_s' and null: + // ['prefix' => 'my_prefix', 'ttl' => 600], ); Next, use the :ref:`handler_id ` From 070c9bb8781d956ba645442e1b71781a79e51044 Mon Sep 17 00:00:00 2001 From: Massimiliano Arione Date: Sun, 7 Mar 2021 11:20:51 +0100 Subject: [PATCH 0376/1045] add a warning about object as extra parameter in route --- routing.rst | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/routing.rst b/routing.rst index 86defd2bafc..7c852af98da 100644 --- a/routing.rst +++ b/routing.rst @@ -1880,6 +1880,14 @@ use the ``generateUrl()`` helper:: // the 'blog' route only defines the 'page' parameter; the generated URL is: // /blog/2?category=Symfony +.. caution:: + + While objects are converted to string when used as placeholders, they are not + converted when used as extra parameters. So, if you're passing an object (e.g. an Uuid) + as value of an extra parameter, you need to explictly convert it to a string:: + + $this->generateUrl('blog', ['uuid' => (string) $entity->getUuid())] + If your controller does not extend from ``AbstractController``, you'll need to :ref:`fetch services in your controller ` and follow the instructions of the next section. From db79f2a9e6f0ce0d4c485fe21df43fdc68470990 Mon Sep 17 00:00:00 2001 From: Sebastian Paczkowski <74934099+sebpacz@users.noreply.github.com> Date: Sun, 7 Mar 2021 11:23:33 +0100 Subject: [PATCH 0377/1045] [Framework] Fix reference to default_path --- reference/configuration/framework.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reference/configuration/framework.rst b/reference/configuration/framework.rst index 246726e820c..ada92f8f25e 100644 --- a/reference/configuration/framework.rst +++ b/reference/configuration/framework.rst @@ -2223,7 +2223,7 @@ paths This option allows to define an array of paths where the component will look for translation files. The later a path is added, the more priority it has (translations from later paths overwrite earlier ones). Translations from the -`default_path ` have more priority than +:ref:`default_path ` have more priority than translations from all these paths. .. _reference-translator-default_path: From a4063c413d398f48e88356c3fd7f27d338b02f9b Mon Sep 17 00:00:00 2001 From: Sebastian Paczkowski <74934099+sebpacz@users.noreply.github.com> Date: Sun, 7 Mar 2021 11:39:39 +0100 Subject: [PATCH 0378/1045] [Translation] Fix link to Translatable Extension documentation The site http://atlantic18.github.io/DoctrineExtensions/ returns 404. --- translation.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/translation.rst b/translation.rst index 4a0137b94d8..0e1601cc536 100644 --- a/translation.rst +++ b/translation.rst @@ -610,5 +610,5 @@ Learn more .. _`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 +.. _`Translatable Extension`: https://github.com/doctrine-extensions/DoctrineExtensions/blob/main/doc/translatable.md .. _`Translatable Behavior`: https://github.com/KnpLabs/DoctrineBehaviors From eba011912bd32de759dc4a6569bacdbe53701f39 Mon Sep 17 00:00:00 2001 From: Chris Maiden Date: Sun, 7 Mar 2021 13:54:03 +0000 Subject: [PATCH 0379/1045] Fix typo --- configuration/secrets.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/configuration/secrets.rst b/configuration/secrets.rst index bb89c67258f..15f4d194f5b 100644 --- a/configuration/secrets.rst +++ b/configuration/secrets.rst @@ -212,9 +212,9 @@ Listing the secrets will now also display the local variable: DATABASE_PASSWORD "dev value" "root" ------------------- ------------- ------------- -Symfony also provides the ``secrets:decrypt-to-local`` command to decrypts -all secrets and stores them in the local vault and ``secrets:encrypt-from-local`` -to encrypt all local secrets to the vault. +Symfony also provides the ``secrets:decrypt-to-local`` command which decrypts +all secrets and stores them in the local vault and the ``secrets:encrypt-from-local`` +command to encrypt all local secrets to the vault. Secrets in the test Environment ------------------------------- From 5f26782afe95e6ef9912b57899222142a5ddc658 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Tue, 9 Mar 2021 11:05:00 +0100 Subject: [PATCH 0380/1045] [PropertyAccess] fix the component name --- reference/forms/types/entity.rst | 2 +- serializer/normalizers.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/reference/forms/types/entity.rst b/reference/forms/types/entity.rst index 21183ad4e57..cf245c2c275 100644 --- a/reference/forms/types/entity.rst +++ b/reference/forms/types/entity.rst @@ -182,7 +182,7 @@ more details, see the main :ref:`choice_label ` doc When passing a string, the ``choice_label`` option is a property path. So you can use anything supported by the - :doc:`PropertyAccessor component ` + :doc:`PropertyAccess component ` For example, if the translations property is actually an associative array of objects, each with a ``name`` property, then you could do this:: diff --git a/serializer/normalizers.rst b/serializer/normalizers.rst index 5aef4568dc6..af30532e48a 100644 --- a/serializer/normalizers.rst +++ b/serializer/normalizers.rst @@ -25,7 +25,7 @@ Symfony includes the following normalizers but you can also :doc:`create your own normalizer `: * :class:`Symfony\\Component\\Serializer\\Normalizer\\ObjectNormalizer` to - normalize PHP object using the :doc:`PropertyAccessor component `; + normalize PHP object using the :doc:`PropertyAccess component `; * :class:`Symfony\\Component\\Serializer\\Normalizer\\DateTimeZoneNormalizer` for :phpclass:`DateTimeZone` objects * :class:`Symfony\\Component\\Serializer\\Normalizer\\DateTimeNormalizer` for From 97a164daa87d81ede8e5f954a32d1af52f0c2408 Mon Sep 17 00:00:00 2001 From: mostefamed Date: Tue, 9 Mar 2021 11:17:02 +0100 Subject: [PATCH 0381/1045] Fix the matched path value During the test of the example, I didn't get the expected result when calling /blog --- routing.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/routing.rst b/routing.rst index 86defd2bafc..3fc50a8f5d7 100644 --- a/routing.rst +++ b/routing.rst @@ -1264,7 +1264,7 @@ the common configuration using options when importing the routes. was introduced in Symfony 4.4. In this example, the route of the ``index()`` action will be called ``blog_index`` -and its URL will be ``/blog/``. The route of the ``show()`` action will be called +and its URL will be ``/blog/{_locale}``. The route of the ``show()`` action will be called ``blog_show`` and its URL will be ``/blog/{_locale}/posts/{slug}``. Both routes will also validate that the ``_locale`` parameter matches the regular expression defined in the class annotation. From ad8330b010dd87a6b869cb2a219f68b58a43a22c Mon Sep 17 00:00:00 2001 From: Antoine Makdessi Date: Wed, 10 Mar 2021 15:32:53 +0100 Subject: [PATCH 0382/1045] [Workflow] fix PHP config --- workflow/dumping-workflows.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/workflow/dumping-workflows.rst b/workflow/dumping-workflows.rst index d1749603155..1611082c6f4 100644 --- a/workflow/dumping-workflows.rst +++ b/workflow/dumping-workflows.rst @@ -241,8 +241,8 @@ Below is the configuration for the pull request state machine with styling added 'pull_request' => [ 'type' => 'state_machine', 'marking_store' => [ - type: 'method', - property: 'currentPlace', + 'type' => 'method', + 'property' => 'currentPlace', ], 'supports' => ['App\Entity\PullRequest'], 'initial_marking' => 'start', From d59c1c8fdcdff10bc2b2cbd99a73d04261e79d93 Mon Sep 17 00:00:00 2001 From: Antoine Makdessi Date: Fri, 12 Mar 2021 00:00:46 +0100 Subject: [PATCH 0383/1045] Update debug.rst --- reference/configuration/debug.rst | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/reference/configuration/debug.rst b/reference/configuration/debug.rst index 86aed3b7ba6..33a6c656537 100644 --- a/reference/configuration/debug.rst +++ b/reference/configuration/debug.rst @@ -67,9 +67,10 @@ dump_destination Configures the output destination of the dumps. -By default, the dumps are shown in the toolbar. Since this is not always -possible (e.g. when working on a JSON API), you can have an alternate output -destination for dumps. Typically, you would set this to ``php://stderr``: +By default, dumps are shown in the WebDebugToolbar when returning HTML. +Since this is not always possible (e.g. when working on a JSON API), +you can have an alternate output destination for dumps. +Typically, you would set this to ``php://stderr``: .. configuration-block:: From ce6cdbe33c5f01b36a2486fdfb649bc8e6bf48e2 Mon Sep 17 00:00:00 2001 From: Antoine Makdessi Date: Fri, 12 Mar 2021 00:06:40 +0100 Subject: [PATCH 0384/1045] Update kernel.rst --- reference/configuration/kernel.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reference/configuration/kernel.rst b/reference/configuration/kernel.rst index 6b0ac4279ad..5cb1f8ea781 100644 --- a/reference/configuration/kernel.rst +++ b/reference/configuration/kernel.rst @@ -5,7 +5,7 @@ Configuring in the Kernel ========================= Some configuration can be done on the kernel class itself (located by default at -``src/Kernel.php``). You can do this by overriding specific methods in +``src/Kernel.php``). You can do this by overriding specific methods of the parent :class:`Symfony\\Component\\HttpKernel\\Kernel` class. Configuration From 1ad9effde7927b35af83c1fb3b6981c65308fee9 Mon Sep 17 00:00:00 2001 From: Antoine Makdessi Date: Fri, 12 Mar 2021 00:15:50 +0100 Subject: [PATCH 0385/1045] Update events.rst --- reference/events.rst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/reference/events.rst b/reference/events.rst index 900d40eb12c..c55bfdcc824 100644 --- a/reference/events.rst +++ b/reference/events.rst @@ -1,10 +1,11 @@ Built-in Symfony Events ======================= -During the handling of an HTTP request, the Symfony framework (or any +The Symfony framework is an HTTP Request-Response one. +During the handling of an HTTP request, the framework (or any application using the :doc:`HttpKernel component `) dispatches some :doc:`events ` which you can use to modify -how the request is handled. +how the request is handled and how the response is returned. Kernel Events ------------- From ad6075bf1770d43a8dd71b38bdce5b57bdcf05bf Mon Sep 17 00:00:00 2001 From: mostefamed Date: Sat, 13 Mar 2021 20:23:19 +0100 Subject: [PATCH 0386/1045] Update definitions.rst Rename the returned variable from setArgument method and the assigned variable to addArgument method --- service_container/definitions.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/service_container/definitions.rst b/service_container/definitions.rst index f90a185e1c5..1107413cf99 100644 --- a/service_container/definitions.rst +++ b/service_container/definitions.rst @@ -92,10 +92,10 @@ fetched from the container:: // adds a new argument with the name of the argument // $argumentName = the name of the argument in the constructor - $argument = $definition->setArgument('$argumentName', $argumentValue); + $definition = $definition->setArgument('$argumentName', $argumentValue); // adds a new argument - $definition->addArgument($argument); + $definition->addArgument($argumentValue); // replaces argument on a specific index (0 = first argument) $definition->replaceArgument($index, $argument); From 2f3d95778ff70da9288ae87b4ce38309681435b2 Mon Sep 17 00:00:00 2001 From: Sebastian Paczkowski <74934099+sebpacz@users.noreply.github.com> Date: Sun, 14 Mar 2021 19:11:11 +0100 Subject: [PATCH 0387/1045] [Session] Add missing semicolon --- session/locale_sticky_session.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/session/locale_sticky_session.rst b/session/locale_sticky_session.rst index f8caef23370..265298f864b 100644 --- a/session/locale_sticky_session.rst +++ b/session/locale_sticky_session.rst @@ -109,7 +109,8 @@ via some "Change Locale" route & controller), or create a route with the :ref:`_ $container->register(LocaleSubscriber::class) ->addArgument('%kernel.default_locale%') // uncomment the next line if you are not using autoconfigure - // ->addTag('kernel.event_subscriber'); + // ->addTag('kernel.event_subscriber') + ; That's it! Now celebrate by changing the user's locale and seeing that it's sticky throughout the request. From 74d2938580c363c38df6979700103483ec0b1d69 Mon Sep 17 00:00:00 2001 From: Sebastian Paczkowski <74934099+sebpacz@users.noreply.github.com> Date: Sun, 14 Mar 2021 19:38:47 +0100 Subject: [PATCH 0388/1045] [Intl] Fix typos --- components/intl.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/intl.rst b/components/intl.rst index 6417489b14e..dafe45800d0 100644 --- a/components/intl.rst +++ b/components/intl.rst @@ -110,7 +110,7 @@ to catching the exception, you can also check if a given language code is valid: $isValidLanguage = Languages::exists($languageCode); -Or if you have a alpha3 language code you want to check:: +Or if you have an alpha3 language code you want to check:: $isValidLanguage = Languages::alpha3CodeExists($alpha3Code); @@ -209,7 +209,7 @@ to catching the exception, you can also check if a given country code is valid:: $isValidCountry = Countries::exists($alpha2Code); -Or if you have a alpha3 country code you want to check:: +Or if you have an alpha3 country code you want to check:: $isValidCountry = Countries::alpha3CodeExists($alpha3Code); From ac44f85bd9596c5eff147f1b6ce93d8e7cf31817 Mon Sep 17 00:00:00 2001 From: Peter Date: Sun, 7 Mar 2021 21:03:35 +0100 Subject: [PATCH 0389/1045] Update description for Access decision strategies Updated the description to reflect the current behavior of the builtin AccessDecisionManager. --- security/voters.rst | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/security/voters.rst b/security/voters.rst index 98ba54519af..869df508d50 100644 --- a/security/voters.rst +++ b/security/voters.rst @@ -278,12 +278,16 @@ There are three strategies available: This grants access as soon as there is *one* voter granting access; ``consensus`` - This grants access if there are more voters granting access than denying; + This grants access if there are more voters granting access than + denying. If case of a tie the decision is based on the + ``allow_if_equal_granted_denied`` config option (defaulting to ``true``); ``unanimous`` - This only grants access if there is no voter denying access. If all voters - abstained from voting, the decision is based on the ``allow_if_all_abstain`` - config option (which defaults to ``false``). + This only grants access if there is no voter denying access. + +Regardless the chosen strategy, if all voters abstained from voting, the +decision is based on the ``allow_if_all_abstain`` config option (which +defaults to ``false``). In the above scenario, both voters should grant access in order to grant access to the user to read the post. In this case, the default strategy is no longer From d24d45c3bfdc68e9b6040e939fc9d21ee7588be6 Mon Sep 17 00:00:00 2001 From: Nyholm Date: Fri, 12 Mar 2021 17:16:49 +0100 Subject: [PATCH 0390/1045] [Translation] Move the "templates" section into the main guide --- _build/redirection_map | 1 + translation.rst | 121 +++++++++++++++++++++++++++++++++++-- translation/templates.rst | 123 -------------------------------------- 3 files changed, 116 insertions(+), 129 deletions(-) delete mode 100644 translation/templates.rst diff --git a/_build/redirection_map b/_build/redirection_map index 4954ce471fa..fe432c55aa1 100644 --- a/_build/redirection_map +++ b/_build/redirection_map @@ -458,6 +458,7 @@ /templating/embedding_controllers /templates#embedding-controllers /templating/inheritance /templates#template-inheritance-and-layouts /testing/doctrine /testing/database +/translation/templates /translation#translation-in-templates /doctrine/lifecycle_callbacks /doctrine/events /doctrine/event_listeners_subscribers /doctrine/events /doctrine/common_extensions /doctrine diff --git a/translation.rst b/translation.rst index 0e1601cc536..bb822614451 100644 --- a/translation.rst +++ b/translation.rst @@ -304,14 +304,124 @@ Translations in Templates ------------------------- Most of the time, translation occurs in templates. Symfony provides native -support for both Twig and PHP templates: +support for both Twig and PHP templates. -.. code-block:: html+twig +Using Twig Tags +~~~~~~~~~~~~~~~ -

                  {% trans %}Symfony is great!{% endtrans %}

                  +Symfony provides specialized Twig tags (``trans`` and ``transchoice``) to +help with message translation of *static blocks of text*: + +.. code-block:: twig + + {% trans %}Hello %name%{% endtrans %} + + {% transchoice count %} + {0} There are no apples|{1} There is one apple|]1,Inf[ There are %count% apples + {% endtranschoice %} + +The ``transchoice`` tag automatically gets the ``%count%`` variable from +the current context and passes it to the translator. This mechanism only +works when you use a placeholder following the ``%var%`` pattern. + +.. deprecated:: 4.2 + + The ``transchoice`` tag is deprecated since Symfony 4.2 and will be + removed in 5.0. Use the :doc:`ICU MessageFormat ` with + the ``trans`` tag instead. + +.. caution:: + + The ``%var%`` notation of placeholders is required when translating in + Twig templates using the tag. + +.. tip:: + + If you need to use the percent character (``%``) in a string, escape it by + doubling it: ``{% trans %}Percent: %percent%%%{% endtrans %}`` + +You can also specify the message domain and pass some additional variables: + +.. code-block:: twig + + {% trans with {'%name%': 'Fabien'} from 'app' %}Hello %name%{% endtrans %} + + {% trans with {'%name%': 'Fabien'} from 'app' into 'fr' %}Hello %name%{% endtrans %} + + {% transchoice count with {'%name%': 'Fabien'} from 'app' %} + {0} %name%, there are no apples|{1} %name%, there is one apple|]1,Inf[ %name%, there are %count% apples + {% endtranschoice %} + +.. _translation-filters: + +Using Twig Filters +~~~~~~~~~~~~~~~~~~ + +The ``trans`` and ``transchoice`` filters can be used to translate *variable +texts* and complex expressions: + +.. code-block:: twig + + {{ message|trans }} + + {{ message|transchoice(5) }} + + {{ message|trans({'%name%': 'Fabien'}, 'app') }} + + {{ message|transchoice(5, {'%name%': 'Fabien'}, 'app') }} + +.. deprecated:: 4.2 + + The ``transchoice`` filter is deprecated since Symfony 4.2 and will be + removed in 5.0. Use the :doc:`ICU MessageFormat ` with + the ``trans`` filter instead. + +.. tip:: + + Using the translation tags or filters have the same effect, but with + one subtle difference: automatic output escaping is only applied to + translations using a filter. In other words, if you need to be sure + that your translated message is *not* output escaped, you must apply + the ``raw`` filter after the translation filter: + + .. code-block:: html+twig + + {# text translated between tags is never escaped #} + {% trans %} +

                  foo

                  + {% endtrans %} + + {% set message = '

                  foo

                  ' %} + + {# strings and variables translated via a filter are escaped by default #} + {{ message|trans|raw }} + {{ '

                  bar

                  '|trans|raw }} + +.. tip:: + + You can set the translation domain for an entire Twig template with a single tag: + + .. code-block:: twig + + {% trans_default_domain 'app' %} + + Note that this only influences the current template, not any "included" + template (in order to avoid side effects). + +PHP Templates +~~~~~~~~~~~~~ + +The translator service is accessible in PHP templates through the +``translator`` helper:: + + trans('Symfony is great') ?> + + transChoice( + '{0} There are no apples|{1} There is one apple|]1,Inf[ There are %count% apples', + 10, + ['%count%' => 10] + ) ?> -Read :doc:`/translation/templates` for more information about the Twig tags and -filters for translation. Forcing the Translator Locale ----------------------------- @@ -600,7 +710,6 @@ Learn more :maxdepth: 1 translation/message_format - translation/templates translation/locale translation/debug translation/lint diff --git a/translation/templates.rst b/translation/templates.rst deleted file mode 100644 index 903f1934d92..00000000000 --- a/translation/templates.rst +++ /dev/null @@ -1,123 +0,0 @@ -Using Translation in Templates -============================== - -Twig Templates --------------- - -.. _translation-tags: - -Using Twig Tags -~~~~~~~~~~~~~~~ - -Symfony provides specialized Twig tags (``trans`` and ``transchoice``) to -help with message translation of *static blocks of text*: - -.. code-block:: twig - - {% trans %}Hello %name%{% endtrans %} - - {% transchoice count %} - {0} There are no apples|{1} There is one apple|]1,Inf[ There are %count% apples - {% endtranschoice %} - -The ``transchoice`` tag automatically gets the ``%count%`` variable from -the current context and passes it to the translator. This mechanism only -works when you use a placeholder following the ``%var%`` pattern. - -.. deprecated:: 4.2 - - The ``transchoice`` tag is deprecated since Symfony 4.2 and will be - removed in 5.0. Use the :doc:`ICU MessageFormat ` with - the ``trans`` tag instead. - -.. caution:: - - The ``%var%`` notation of placeholders is required when translating in - Twig templates using the tag. - -.. tip:: - - If you need to use the percent character (``%``) in a string, escape it by - doubling it: ``{% trans %}Percent: %percent%%%{% endtrans %}`` - -You can also specify the message domain and pass some additional variables: - -.. code-block:: twig - - {% trans with {'%name%': 'Fabien'} from 'app' %}Hello %name%{% endtrans %} - - {% trans with {'%name%': 'Fabien'} from 'app' into 'fr' %}Hello %name%{% endtrans %} - - {% transchoice count with {'%name%': 'Fabien'} from 'app' %} - {0} %name%, there are no apples|{1} %name%, there is one apple|]1,Inf[ %name%, there are %count% apples - {% endtranschoice %} - -.. _translation-filters: - -Using Twig Filters -~~~~~~~~~~~~~~~~~~ - -The ``trans`` and ``transchoice`` filters can be used to translate *variable -texts* and complex expressions: - -.. code-block:: twig - - {{ message|trans }} - - {{ message|transchoice(5) }} - - {{ message|trans({'%name%': 'Fabien'}, 'app') }} - - {{ message|transchoice(5, {'%name%': 'Fabien'}, 'app') }} - -.. deprecated:: 4.2 - - The ``transchoice`` filter is deprecated since Symfony 4.2 and will be - removed in 5.0. Use the :doc:`ICU MessageFormat ` with - the ``trans`` filter instead. - -.. tip:: - - Using the translation tags or filters have the same effect, but with - one subtle difference: automatic output escaping is only applied to - translations using a filter. In other words, if you need to be sure - that your translated message is *not* output escaped, you must apply - the ``raw`` filter after the translation filter: - - .. code-block:: html+twig - - {# text translated between tags is never escaped #} - {% trans %} -

                  foo

                  - {% endtrans %} - - {% set message = '

                  foo

                  ' %} - - {# strings and variables translated via a filter are escaped by default #} - {{ message|trans|raw }} - {{ '

                  bar

                  '|trans|raw }} - -.. tip:: - - You can set the translation domain for an entire Twig template with a single tag: - - .. code-block:: twig - - {% trans_default_domain 'app' %} - - Note that this only influences the current template, not any "included" - template (in order to avoid side effects). - -PHP Templates -------------- - -The translator service is accessible in PHP templates through the -``translator`` helper:: - - trans('Symfony is great') ?> - - transChoice( - '{0} There are no apples|{1} There is one apple|]1,Inf[ There are %count% apples', - 10, - ['%count%' => 10] - ) ?> From 271f8f6d64d9bb25893e88ae150c2507a6d3d64a Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Mon, 15 Mar 2021 20:13:00 +0100 Subject: [PATCH 0391/1045] Readded a missing reference --- translation.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/translation.rst b/translation.rst index bb822614451..ac14dd8c318 100644 --- a/translation.rst +++ b/translation.rst @@ -306,6 +306,8 @@ Translations in Templates Most of the time, translation occurs in templates. Symfony provides native support for both Twig and PHP templates. +.. _translation-tags: + Using Twig Tags ~~~~~~~~~~~~~~~ From 518926f33835067cc67a57c887e3490fe86d6961 Mon Sep 17 00:00:00 2001 From: Massimiliano Arione Date: Tue, 16 Mar 2021 08:53:19 +0100 Subject: [PATCH 0392/1045] add a warning about Amazon SES signature --- mailer.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/mailer.rst b/mailer.rst index ff567eab3bc..0a44eace54c 100644 --- a/mailer.rst +++ b/mailer.rst @@ -160,6 +160,11 @@ party provider: For example, the DSN ``ses+smtp://ABC1234:abc+12/345@default`` should be configured as ``ses+smtp://ABC1234:abc%2B12%2F345@default`` +.. caution:: + + Symfony 4.4 only suppports Amazon SES Signature Version 3, that has been deprecated. + You need to use symfony/amazon-mailer 5.1 or newer. + .. tip:: If you want to override the default host for a provider (to debug an issue using From 5cabc722845f9f08d4636d378636f56e07a70c03 Mon Sep 17 00:00:00 2001 From: Oskar Stark Date: Tue, 16 Mar 2021 09:25:52 +0100 Subject: [PATCH 0393/1045] Typo --- mailer.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mailer.rst b/mailer.rst index 0a44eace54c..e236b27c1a5 100644 --- a/mailer.rst +++ b/mailer.rst @@ -162,7 +162,7 @@ party provider: .. caution:: - Symfony 4.4 only suppports Amazon SES Signature Version 3, that has been deprecated. + Symfony 4.4 only supports Amazon SES Signature Version 3, that has been deprecated. You need to use symfony/amazon-mailer 5.1 or newer. .. tip:: From dd280ea98bcb48529038852d7b3b653d8c72be3c Mon Sep 17 00:00:00 2001 From: Oskar Stark Date: Tue, 16 Mar 2021 09:27:04 +0100 Subject: [PATCH 0394/1045] minor --- mailer.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mailer.rst b/mailer.rst index e236b27c1a5..dd0c14956c3 100644 --- a/mailer.rst +++ b/mailer.rst @@ -162,8 +162,8 @@ party provider: .. caution:: - Symfony 4.4 only supports Amazon SES Signature Version 3, that has been deprecated. - You need to use symfony/amazon-mailer 5.1 or newer. + Symfony 4.4 only supports Amazon SES signature version 3 which has been + deprecated. You need to use ``symfony/amazon-mailer`` 5.1 or newer. .. tip:: From e37983a7cc8316fc409a0c9b6a5fc85b95309d22 Mon Sep 17 00:00:00 2001 From: Antoine Makdessi Date: Tue, 16 Mar 2021 16:34:14 +0100 Subject: [PATCH 0395/1045] Update logging.rst --- logging.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/logging.rst b/logging.rst index d4ed95189ba..ae9ddd10a73 100644 --- a/logging.rst +++ b/logging.rst @@ -23,7 +23,7 @@ To do so, :ref:`override the "logger" service definition `. Logging a Message ----------------- -To log a message, inject the default logger in your controller:: +To log a message, inject the default logger in your controller or service:: use Psr\Log\LoggerInterface; From 89a9964dea89a754283a00d966ede0636c6fcf34 Mon Sep 17 00:00:00 2001 From: Oskar Stark Date: Wed, 17 Mar 2021 11:35:22 +0100 Subject: [PATCH 0396/1045] Fix DSNs --- mailer.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mailer.rst b/mailer.rst index dd0c14956c3..dda2efc5898 100644 --- a/mailer.rst +++ b/mailer.rst @@ -150,8 +150,8 @@ party provider: Google Gmail gmail+smtp://USERNAME:PASSWORD@default n/a n/a Mailchimp Mandrill mandrill+smtp://USERNAME:PASSWORD@default mandrill+https://KEY@default mandrill+api://KEY@default Mailgun mailgun+smtp://USERNAME:PASSWORD@default mailgun+https://KEY:DOMAIN@default mailgun+api://KEY:DOMAIN@default - Postmark postmark+smtp://ID:ID@default n/a postmark+api://KEY@default - Sendgrid sendgrid+smtp://apikey:KEY@default n/a sendgrid+api://KEY@default + Postmark postmark+smtp://ID@default n/a postmark+api://KEY@default + Sendgrid sendgrid+smtp://KEY@default n/a sendgrid+api://KEY@default ==================== ========================================== =========================================== ======================================== .. caution:: From f019d537fa82e5f93929f3c1b4c9f2a469219141 Mon Sep 17 00:00:00 2001 From: Oskar Stark Date: Wed, 17 Mar 2021 11:37:17 +0100 Subject: [PATCH 0397/1045] Use correct domain --- mailer.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mailer.rst b/mailer.rst index dd0c14956c3..0f57ba46164 100644 --- a/mailer.rst +++ b/mailer.rst @@ -173,8 +173,8 @@ party provider: .. code-block:: env # .env - MAILER_DSN=mailgun+https://KEY:DOMAIN@example.com - MAILER_DSN=mailgun+https://KEY:DOMAIN@example.com:99 + MAILER_DSN=mailgun+https://KEY:DOMAIN@requestbin.com + MAILER_DSN=mailgun+https://KEY:DOMAIN@requestbin.com:99 Note that the protocol is *always* HTTPs and cannot be changed. From 97614c0f05bc84e035c0a21ed0c019d27e2e5024 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Wed, 17 Mar 2021 17:30:31 +0100 Subject: [PATCH 0398/1045] Remove Jakub from the core team --- contributing/code/core_team.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contributing/code/core_team.rst b/contributing/code/core_team.rst index 4c719ff4330..136edb28dbb 100644 --- a/contributing/code/core_team.rst +++ b/contributing/code/core_team.rst @@ -60,7 +60,6 @@ Active Core Members * **Christian Flothmann** (`xabbuh`_); * **Tobias Schultze** (`Tobion`_); * **Kévin Dunglas** (`dunglas`_); - * **Jakub Zalas** (`jakzal`_); * **Javier Eguiluz** (`javiereguiluz`_); * **Grégoire Pineau** (`lyrixx`_); * **Ryan Weaver** (`weaverryan`_); @@ -106,7 +105,8 @@ Symfony contributions: * **Romain Neutron** (`romainneutron`_); * **Jordi Boggiano** (`Seldaek`_); * **Lukas Kahwe Smith** (`lsmith77`_); -* **Jules Pietri** (`HeahDude`_). +* **Jules Pietri** (`HeahDude`_); +* **Jakub Zalas** (`jakzal`_). Core Membership Application ~~~~~~~~~~~~~~~~~~~~~~~~~~~ From 3a10fff91326c84f1c3956d19a60d89f513501ab Mon Sep 17 00:00:00 2001 From: Nicolas Hart Date: Wed, 17 Mar 2021 22:23:20 +0100 Subject: [PATCH 0399/1045] [Testing] Fix typo in assertEmailAttachmentCount --- testing/functional_tests_assertions.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/functional_tests_assertions.rst b/testing/functional_tests_assertions.rst index edf1a6bb679..29e4b1e5e3a 100644 --- a/testing/functional_tests_assertions.rst +++ b/testing/functional_tests_assertions.rst @@ -84,7 +84,7 @@ Mailer - ``assertQueuedEmailCount()`` - ``assertEmailIsQueued()`` - ``assertEmailIsNotQueued()`` -- ``assertEmailAttachementCount()`` +- ``assertEmailAttachmentCount()`` - ``assertEmailTextBodyContains()`` - ``assertEmailTextBodyNotContains()`` - ``assertEmailHtmlBodyContains()`` From 07dea78ee4fe513abd4d6abf0622d1a8315a7aab Mon Sep 17 00:00:00 2001 From: Antoine Makdessi Date: Fri, 19 Mar 2021 09:04:52 +0100 Subject: [PATCH 0400/1045] Update workflow.rst --- workflow.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/workflow.rst b/workflow.rst index 7f7acffaa3a..fa489c63cf7 100644 --- a/workflow.rst +++ b/workflow.rst @@ -238,7 +238,8 @@ Accessing the Workflow in a Class You can use the workflow inside a class by using :doc:`service autowiring ` and using -``camelCased workflow name + Workflow`` as parameter name:: +``camelCased workflow name + Workflow`` as parameter name. If it is a state machine type +you can use ``camelCased workflow name + StateMachine``:: use App\Entity\BlogPost; use Symfony\Component\Workflow\WorkflowInterface; From 455edf4f2a7a764ae16ab06b5878600f38149dfd Mon Sep 17 00:00:00 2001 From: Hossein Vakili Date: Thu, 18 Mar 2021 13:01:45 +0100 Subject: [PATCH 0401/1045] Add Oracle DATABASE_URL instruction --- doctrine.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doctrine.rst b/doctrine.rst index e1ee1785c00..9d98f26b7ca 100644 --- a/doctrine.rst +++ b/doctrine.rst @@ -54,6 +54,9 @@ The database connection information is stored as an environment variable called # to use postgresql: # DATABASE_URL="postgresql://db_user:db_password@127.0.0.1:5432/db_name?serverVersion=11&charset=utf8" + + # to use oracle: + # DATABASE_URL="oci8://db_user:db_password@127.0.0.1:1521/db_name" .. caution:: From b3f014dff10f9331102fa1cb6fe56c000fff32b9 Mon Sep 17 00:00:00 2001 From: rodmar35 Date: Thu, 18 Mar 2021 09:56:35 +0100 Subject: [PATCH 0402/1045] Update reverse_engineering.rst --- doctrine/reverse_engineering.rst | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/doctrine/reverse_engineering.rst b/doctrine/reverse_engineering.rst index 087e41db955..320e424ea0a 100644 --- a/doctrine/reverse_engineering.rst +++ b/doctrine/reverse_engineering.rst @@ -99,9 +99,12 @@ run: .. code-block:: terminal - // generates getter/setter methods + // generates getter/setter methods for all Entities $ php bin/console make:entity --regenerate App + // generates getter/setter methods for one specific Entity + $ php bin/console make:entity --regenerate App\\Entity\\Country + .. note:: If you want to have a OneToMany relationship, you will need to add From 6e3a415ad1d256e630aa34c5a2507f9f46f793b2 Mon Sep 17 00:00:00 2001 From: Antoine Makdessi Date: Sat, 20 Mar 2021 19:07:46 +0100 Subject: [PATCH 0403/1045] Update bc.rst --- contributing/code/bc.rst | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/contributing/code/bc.rst b/contributing/code/bc.rst index 15f1f03674d..371c1a35b95 100644 --- a/contributing/code/bc.rst +++ b/contributing/code/bc.rst @@ -4,10 +4,13 @@ Our Backward Compatibility Promise Ensuring smooth upgrades of your projects is our first priority. That's why we promise you backward compatibility (BC) for all minor Symfony releases. You probably recognize this strategy as `Semantic Versioning`_. In short, -Semantic Versioning means that only major releases (such as 2.0, 3.0 etc.) are -allowed to break backward compatibility. Minor releases (such as 2.5, 2.6 etc.) +Semantic Versioning means that only major releases (such as 5.0, 6.0 etc.) are +allowed to break backward compatibility. Minor releases (such as 5.1, 5.2 etc.) may introduce new features, but must do so without breaking the existing API of -that release branch (2.x in the previous example). +that release branch (5.x in the previous example). + +We also provide deprecation message triggered in the code base to help you with +the migration process across major release. .. caution:: From 0e04632a01caee166f8dff10d5de2101e851627b Mon Sep 17 00:00:00 2001 From: Yonel Ceruto Date: Sat, 20 Mar 2021 16:51:09 -0400 Subject: [PATCH 0404/1045] Remove extra slash in template path --- configuration/override_dir_structure.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configuration/override_dir_structure.rst b/configuration/override_dir_structure.rst index e0bd417886d..ece722f6f27 100644 --- a/configuration/override_dir_structure.rst +++ b/configuration/override_dir_structure.rst @@ -109,7 +109,7 @@ for multiple directories): # config/packages/twig.yaml twig: # ... - default_path: "%kernel.project_dir%//resources/views" + default_path: "%kernel.project_dir%/resources/views" .. code-block:: xml From 7803935f38f770401db5a477d8accdac20f83809 Mon Sep 17 00:00:00 2001 From: Sebastian Paczkowski <74934099+sebpacz@users.noreply.github.com> Date: Sun, 21 Mar 2021 22:57:06 +0100 Subject: [PATCH 0405/1045] [Intl] Remove duplicated parentheses --- components/intl.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/intl.rst b/components/intl.rst index dafe45800d0..dae70440cf5 100644 --- a/components/intl.rst +++ b/components/intl.rst @@ -381,8 +381,8 @@ arguments to get the offset at any given point in time:: The string representation of the GMT offset can vary depending on the locale, so you can pass the locale as the third optional argument:: - $offset = Timezones::getGmtOffset('Europe/Madrid', strtotime('October 28, 2019'), 'ar')); // $offset = 'غرينتش+01:00' - $offset = Timezones::getGmtOffset('Europe/Madrid', strtotime('October 28, 2019'), 'dz')); // $offset = 'ཇི་ཨེམ་ཏི་+01:00' + $offset = Timezones::getGmtOffset('Europe/Madrid', strtotime('October 28, 2019'), 'ar'); // $offset = 'غرينتش+01:00' + $offset = Timezones::getGmtOffset('Europe/Madrid', strtotime('October 28, 2019'), 'dz'); // $offset = 'ཇི་ཨེམ་ཏི་+01:00' If the given timezone ID doesn't exist, the methods trigger a :class:`Symfony\\Component\\Intl\\Exception\\MissingResourceException`. In addition From e28f5a1172ed0f520b9d218b81a956b6f6a2a790 Mon Sep 17 00:00:00 2001 From: Sebastian Paczkowski <74934099+sebpacz@users.noreply.github.com> Date: Sun, 21 Mar 2021 23:01:14 +0100 Subject: [PATCH 0406/1045] [Filesystem] Fix typo --- components/filesystem.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/filesystem.rst b/components/filesystem.rst index c0cad3dc9b9..4b09bc4cd7e 100644 --- a/components/filesystem.rst +++ b/components/filesystem.rst @@ -162,7 +162,7 @@ permissions of a file. The fourth argument is a boolean recursive option:: // sets the mode of the video to 0600 $filesystem->chmod('video.ogg', 0600); - // changes the mod of the src directory recursively + // changes the mode of the src directory recursively $filesystem->chmod('src', 0700, 0000, true); .. note:: From bc8997112a103b12493c4869c5f6592c85ca8367 Mon Sep 17 00:00:00 2001 From: Farhad Safarov Date: Tue, 23 Mar 2021 10:07:30 +0300 Subject: [PATCH 0407/1045] [Mailer] fix ses+smtp credentials format --- mailer.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mailer.rst b/mailer.rst index e7ca76dbb7f..42ec190574a 100644 --- a/mailer.rst +++ b/mailer.rst @@ -146,7 +146,7 @@ party provider: ==================== ========================================== =========================================== ======================================== Provider SMTP HTTP API ==================== ========================================== =========================================== ======================================== - Amazon SES ses+smtp://ACCESS_KEY:SECRET_KEY@default ses+https://ACCESS_KEY:SECRET_KEY@default ses+api://ACCESS_KEY:SECRET_KEY@default + Amazon SES ses+smtp://USERNAME:PASSWORD@default ses+https://ACCESS_KEY:SECRET_KEY@default ses+api://ACCESS_KEY:SECRET_KEY@default Google Gmail gmail+smtp://USERNAME:PASSWORD@default n/a n/a Mailchimp Mandrill mandrill+smtp://USERNAME:PASSWORD@default mandrill+https://KEY@default mandrill+api://KEY@default Mailgun mailgun+smtp://USERNAME:PASSWORD@default mailgun+https://KEY:DOMAIN@default mailgun+api://KEY:DOMAIN@default From e1ca15247611f9dfa2b88c4f00ab2a2cb41c8b80 Mon Sep 17 00:00:00 2001 From: Al-Saleh KEITA <28827545+askeita@users.noreply.github.com> Date: Mon, 22 Mar 2021 13:57:04 +0100 Subject: [PATCH 0408/1045] Typo with backticks. Removed extra backticks. --- http_cache/validation.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/http_cache/validation.rst b/http_cache/validation.rst index 3a1dabf902e..599d0883b52 100644 --- a/http_cache/validation.rst +++ b/http_cache/validation.rst @@ -106,7 +106,7 @@ doing so much work. .. tip:: - Symfony also supports weak ``ETag``s by passing ``true`` as the second + Symfony also supports weak ``ETag`` s by passing ``true`` as the second argument to the :method:`Symfony\\Component\\HttpFoundation\\Response::setEtag` method. From 40bdc02b644f722430b6178ab1c0315cf4edf9fb Mon Sep 17 00:00:00 2001 From: Ilya Antipenko Date: Tue, 23 Mar 2021 18:19:11 +0100 Subject: [PATCH 0409/1045] Fix markdown in multiple_entity_managers.rst --- doctrine/multiple_entity_managers.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doctrine/multiple_entity_managers.rst b/doctrine/multiple_entity_managers.rst index ba3475dbfbc..57b2879f868 100644 --- a/doctrine/multiple_entity_managers.rst +++ b/doctrine/multiple_entity_managers.rst @@ -313,6 +313,6 @@ The same applies to repository calls:: // ... } - You should now always fetch this repository using ``ManagerRegistry::getRepository()``. +You should now always fetch this repository using ``ManagerRegistry::getRepository()``. .. _`several alternatives`: https://stackoverflow.com/a/11494543 From 85c9813c7adb18bba646492b792e54bb9fc94427 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Wed, 24 Mar 2021 11:34:54 +0100 Subject: [PATCH 0410/1045] Minor tweak --- doctrine/multiple_entity_managers.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doctrine/multiple_entity_managers.rst b/doctrine/multiple_entity_managers.rst index 57b2879f868..32e5a979cdb 100644 --- a/doctrine/multiple_entity_managers.rst +++ b/doctrine/multiple_entity_managers.rst @@ -313,6 +313,6 @@ The same applies to repository calls:: // ... } -You should now always fetch this repository using ``ManagerRegistry::getRepository()``. + You should now always fetch this repository using ``ManagerRegistry::getRepository()``. .. _`several alternatives`: https://stackoverflow.com/a/11494543 From 3938dbdc9b63f80d9900396f903e1f8d8b446fc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20W=C3=B3js?= Date: Mon, 22 Mar 2021 10:22:09 +0100 Subject: [PATCH 0411/1045] Fixed invalid alias definition in "Deprecating Service Aliases" YAML example Fixed invalid alias definition in "Deprecating Service Aliases" YAML example. Current version is ```yaml app.mailer: alias: '@App\Mail\PhpMailer' # .... ``` Correct version is ```yaml app.mailer: alias: 'App\Mail\PhpMailer' # .... ``` (without `@` prefix in service id) --- service_container/alias_private.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/service_container/alias_private.rst b/service_container/alias_private.rst index bac0b8fdc5f..f202ce8d277 100644 --- a/service_container/alias_private.rst +++ b/service_container/alias_private.rst @@ -166,7 +166,7 @@ or you decided not to maintain it anymore), you can deprecate its definition: .. code-block:: yaml app.mailer: - alias: '@App\Mail\PhpMailer' + alias: 'App\Mail\PhpMailer' # this will display a generic deprecation message... deprecated: true From 53fab68e61f0eccc1a0d51b74d4ee97ddbbf6cfb Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Wed, 24 Mar 2021 12:27:28 +0100 Subject: [PATCH 0412/1045] Tweak --- workflow.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/workflow.rst b/workflow.rst index fa489c63cf7..74d986ed868 100644 --- a/workflow.rst +++ b/workflow.rst @@ -238,8 +238,8 @@ Accessing the Workflow in a Class You can use the workflow inside a class by using :doc:`service autowiring ` and using -``camelCased workflow name + Workflow`` as parameter name. If it is a state machine type -you can use ``camelCased workflow name + StateMachine``:: +``camelCased workflow name + Workflow`` as parameter name. If it is a state +machine type, use ``camelCased workflow name + StateMachine``:: use App\Entity\BlogPost; use Symfony\Component\Workflow\WorkflowInterface; From c4dd584759b514f9158c115e8da988285d910406 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Fri, 26 Mar 2021 09:10:21 +0100 Subject: [PATCH 0413/1045] [#15074] fix typo --- security/voters.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/security/voters.rst b/security/voters.rst index 869df508d50..c8daae7ba38 100644 --- a/security/voters.rst +++ b/security/voters.rst @@ -279,7 +279,7 @@ There are three strategies available: ``consensus`` This grants access if there are more voters granting access than - denying. If case of a tie the decision is based on the + denying. In case of a tie the decision is based on the ``allow_if_equal_granted_denied`` config option (defaulting to ``true``); ``unanimous`` From cf8f937743d5f9afaaae7911796d90e68adb3e66 Mon Sep 17 00:00:00 2001 From: Jules Pietri Date: Sun, 5 Apr 2020 04:19:52 +0200 Subject: [PATCH 0414/1045] [Validator] Added grouped constraints in `Collection` reference --- reference/constraints/Collection.rst | 34 ++++++++++++++++++++++++++++ validation/raw_values.rst | 7 ++++++ 2 files changed, 41 insertions(+) diff --git a/reference/constraints/Collection.rst b/reference/constraints/Collection.rst index 2f3dfd52035..c60679aa90b 100644 --- a/reference/constraints/Collection.rst +++ b/reference/constraints/Collection.rst @@ -289,6 +289,40 @@ However, if the ``personal_email`` field does not exist in the array, the ``NotBlank`` constraint will still be applied (since it is wrapped in ``Required``) and you will receive a constraint violation. +When you define groups in nested constraints they are automatically added to +the ``Collection`` constraint itself so it can be traversed for all nested +groups. Take the following example:: + + use Symfony\Component\Validator\Constraints as Assert; + + $constraint = new Assert\Collection([ + 'fields' => [ + 'name' => new Assert\NotBlank(['groups' => 'basic']), + 'email' => new Assert\NotBlank(['groups' => 'contact']), + ], + ]); + +This will result in the following configuration:: + + $constraint = new Assert\Collection([ + 'fields' => [ + 'name' => new Assert\Required([ + 'constraints' => new Assert\NotBlank(['groups' => 'basic']), + 'groups' => ['basic', 'strict'], + ]), + 'email' => new Assert\Required([ + "constraints" => new Assert\NotBlank(['groups' => 'contact']), + 'groups' => ['basic', 'strict'], + ]), + ], + 'groups' => ['basic', 'strict'], + ]); + +The default ``allowMissingFields`` option requires the fields in all groups. +So when validating in ``contact`` group, ``$name`` can be empty but the key is +still required. If this is not the intended behavior, use the ``Optional`` +constraint explicitly instead of ``Required``. + Options ------- diff --git a/validation/raw_values.rst b/validation/raw_values.rst index 8cee65108b8..2014d37644b 100644 --- a/validation/raw_values.rst +++ b/validation/raw_values.rst @@ -105,3 +105,10 @@ The ``validate()`` method returns a :class:`Symfony\\Component\\Validator\\Const object, which acts like an array of errors. Each error in the collection is a :class:`Symfony\\Component\\Validator\\ConstraintViolation` object, which holds the error message on its ``getMessage()`` method. + +.. note:: + + When using groups with the + :doc:`Collection` constraint, be sure to + use the ``Optional`` constraint when appropriate as explained in its + reference documentation. From 64eb995d1df235b7d048bea89e4d522f0f9a7e57 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Fri, 26 Mar 2021 13:23:18 +0100 Subject: [PATCH 0415/1045] [#13492] satisfy the linter --- validation/raw_values.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/validation/raw_values.rst b/validation/raw_values.rst index 2014d37644b..9699e5353cc 100644 --- a/validation/raw_values.rst +++ b/validation/raw_values.rst @@ -109,6 +109,6 @@ which holds the error message on its ``getMessage()`` method. .. note:: When using groups with the - :doc:`Collection` constraint, be sure to + :doc:`Collection ` constraint, be sure to use the ``Optional`` constraint when appropriate as explained in its reference documentation. From 1e6d1304681e4942adf30faf9987dc1051236948 Mon Sep 17 00:00:00 2001 From: Andrii Popov Date: Sat, 27 Mar 2021 09:27:39 +0200 Subject: [PATCH 0416/1045] [Validator] Add missing backticks for constraint option names --- reference/constraints/Bic.rst | 16 +-- reference/constraints/CardScheme.rst | 8 +- reference/constraints/Choice.rst | 36 +++--- reference/constraints/Count.rst | 20 ++-- reference/constraints/DateTime.rst | 4 +- reference/constraints/DivisibleBy.rst | 4 +- reference/constraints/Email.rst | 16 +-- reference/constraints/Expression.rst | 4 +- reference/constraints/File.rst | 64 +++++------ reference/constraints/Image.rst | 108 +++++++++--------- reference/constraints/Ip.rst | 8 +- reference/constraints/Isbn.rst | 20 ++-- reference/constraints/Issn.rst | 12 +- reference/constraints/Json.rst | 4 +- reference/constraints/Length.rst | 28 ++--- reference/constraints/Locale.rst | 4 +- reference/constraints/Negative.rst | 4 +- reference/constraints/NegativeOrZero.rst | 4 +- reference/constraints/NotBlank.rst | 4 +- .../constraints/NotCompromisedPassword.rst | 12 +- reference/constraints/Positive.rst | 4 +- reference/constraints/PositiveOrZero.rst | 4 +- reference/constraints/Range.rst | 32 +++--- reference/constraints/Regex.rst | 16 +-- reference/constraints/Timezone.rst | 16 +-- reference/constraints/Type.rst | 8 +- reference/constraints/Unique.rst | 4 +- reference/constraints/UniqueEntity.rst | 24 ++-- reference/constraints/Url.rst | 20 ++-- reference/constraints/Valid.rst | 4 +- .../constraints/_normalizer-option.rst.inc | 4 +- 31 files changed, 258 insertions(+), 258 deletions(-) diff --git a/reference/constraints/Bic.rst b/reference/constraints/Bic.rst index 6496ae63d54..0d00fca6297 100644 --- a/reference/constraints/Bic.rst +++ b/reference/constraints/Bic.rst @@ -87,8 +87,8 @@ Available Options .. include:: /reference/constraints/_groups-option.rst.inc -iban -~~~~ +``iban`` +~~~~~~~~ **type**: ``string`` **default**: ``null`` @@ -98,8 +98,8 @@ iban An IBAN value to validate that its country code is the same as the BIC's one. -ibanMessage -~~~~~~~~~~~ +``ibanMessage`` +~~~~~~~~~~~~~~~ **type**: ``string`` **default**: ``This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}.`` @@ -109,8 +109,8 @@ ibanMessage The default message supplied when the value does not pass the combined BIC/IBAN check. -ibanPropertyPath -~~~~~~~~~~~~~~~~ +``ibanPropertyPath`` +~~~~~~~~~~~~~~~~~~~~ **type**: ``string`` **default**: ``null`` @@ -124,8 +124,8 @@ For example, if you want to compare the ``$bic`` property of some object with regard to the ``$iban`` property of the same object, use ``ibanPropertyPath="iban"`` in the comparison constraint of ``$bic``. -message -~~~~~~~ +``message`` +~~~~~~~~~~~ **type**: ``string`` **default**: ``This is not a valid Business Identifier Code (BIC).`` diff --git a/reference/constraints/CardScheme.rst b/reference/constraints/CardScheme.rst index 6362d9932ee..e8e2b744987 100644 --- a/reference/constraints/CardScheme.rst +++ b/reference/constraints/CardScheme.rst @@ -99,8 +99,8 @@ Available Options .. include:: /reference/constraints/_groups-option.rst.inc -message -~~~~~~~ +``message`` +~~~~~~~~~~~ **type**: ``string`` **default**: ``Unsupported card type or invalid card number.`` @@ -116,8 +116,8 @@ Parameter Description .. include:: /reference/constraints/_payload-option.rst.inc -schemes -~~~~~~~ +``schemes`` +~~~~~~~~~~~ **type**: ``mixed`` [:ref:`default option `] diff --git a/reference/constraints/Choice.rst b/reference/constraints/Choice.rst index b1407c8add0..0e099053775 100644 --- a/reference/constraints/Choice.rst +++ b/reference/constraints/Choice.rst @@ -275,8 +275,8 @@ you can pass the class name and the method as an array. Available Options ----------------- -callback -~~~~~~~~ +``callback`` +~~~~~~~~~~~~ **type**: ``string|array|Closure`` @@ -284,8 +284,8 @@ This is a callback method that can be used instead of the `choices`_ option to return the choices array. See `Supplying the Choices with a Callback Function`_ for details on its usage. -choices -~~~~~~~ +``choices`` +~~~~~~~~~~~ **type**: ``array`` [:ref:`default option `] @@ -295,8 +295,8 @@ will be matched against this array. .. include:: /reference/constraints/_groups-option.rst.inc -max -~~~ +``max`` +~~~~~~~ **type**: ``integer`` @@ -305,8 +305,8 @@ to force no more than XX number of values to be selected. For example, if ``max`` is 3, but the input array contains 4 valid items, the validation will fail. -maxMessage -~~~~~~~~~~ +``maxMessage`` +~~~~~~~~~~~~~~ **type**: ``string`` **default**: ``You must select at most {{ limit }} choices.`` @@ -326,8 +326,8 @@ Parameter Description The ``{{ choices }}`` parameter was introduced in Symfony 4.3. -message -~~~~~~~ +``message`` +~~~~~~~~~~~ **type**: ``string`` **default**: ``The value you selected is not a valid choice.`` @@ -344,8 +344,8 @@ Parameter Description ``{{ value }}`` The current (invalid) value ================= ============================================================ -min -~~~ +``min`` +~~~~~~~ **type**: ``integer`` @@ -354,8 +354,8 @@ to force at least XX number of values to be selected. For example, if ``min`` is 3, but the input array only contains 2 valid items, the validation will fail. -minMessage -~~~~~~~~~~ +``minMessage`` +~~~~~~~~~~~~~~ **type**: ``string`` **default**: ``You must select at least {{ limit }} choices.`` @@ -375,8 +375,8 @@ Parameter Description The ``{{ choices }}`` parameter was introduced in Symfony 4.3. -multiple -~~~~~~~~ +``multiple`` +~~~~~~~~~~~~ **type**: ``boolean`` **default**: ``false`` @@ -385,8 +385,8 @@ of a single, scalar value. The constraint will check that each value of the input array can be found in the array of valid choices. If even one of the input values cannot be found, the validation will fail. -multipleMessage -~~~~~~~~~~~~~~~ +``multipleMessage`` +~~~~~~~~~~~~~~~~~~~ **type**: ``string`` **default**: ``One or more of the given values is invalid.`` diff --git a/reference/constraints/Count.rst b/reference/constraints/Count.rst index 2ff99b5adbb..dbbe94b480a 100644 --- a/reference/constraints/Count.rst +++ b/reference/constraints/Count.rst @@ -101,8 +101,8 @@ you might add the following: Options ------- -exactMessage -~~~~~~~~~~~~ +``exactMessage`` +~~~~~~~~~~~~~~~~ **type**: ``string`` **default**: ``This collection should contain exactly {{ limit }} elements.`` @@ -120,8 +120,8 @@ Parameter Description .. include:: /reference/constraints/_groups-option.rst.inc -max -~~~ +``max`` +~~~~~~~ **type**: ``integer`` @@ -130,8 +130,8 @@ collection elements count is **greater** than this max value. This option is required when the ``min`` option is not defined. -maxMessage -~~~~~~~~~~ +``maxMessage`` +~~~~~~~~~~~~~~ **type**: ``string`` **default**: ``This collection should contain {{ limit }} elements or less.`` @@ -147,8 +147,8 @@ Parameter Description ``{{ limit }}`` The upper limit =============== ============================================================== -min -~~~ +``min`` +~~~~~~~ **type**: ``integer`` @@ -157,8 +157,8 @@ collection elements count is **less** than this min value. This option is required when the ``max`` option is not defined. -minMessage -~~~~~~~~~~ +``minMessage`` +~~~~~~~~~~~~~~ **type**: ``string`` **default**: ``This collection should contain {{ limit }} elements or more.`` diff --git a/reference/constraints/DateTime.rst b/reference/constraints/DateTime.rst index 41b4db2acc0..c3a9c328932 100644 --- a/reference/constraints/DateTime.rst +++ b/reference/constraints/DateTime.rst @@ -84,8 +84,8 @@ Basic Usage Options ------- -format -~~~~~~ +``format`` +~~~~~~~~~~ **type**: ``string`` **default**: ``Y-m-d H:i:s`` diff --git a/reference/constraints/DivisibleBy.rst b/reference/constraints/DivisibleBy.rst index f4ae78ab0f8..73b0a9c88b6 100644 --- a/reference/constraints/DivisibleBy.rst +++ b/reference/constraints/DivisibleBy.rst @@ -104,8 +104,8 @@ Options .. include:: /reference/constraints/_groups-option.rst.inc -message -~~~~~~~ +``message`` +~~~~~~~~~~~ **type**: ``string`` **default**: ``This value should be a multiple of {{ compared_value }}.`` diff --git a/reference/constraints/Email.rst b/reference/constraints/Email.rst index 5b149f0bf5f..5cbeaeb4523 100644 --- a/reference/constraints/Email.rst +++ b/reference/constraints/Email.rst @@ -92,8 +92,8 @@ Basic Usage Options ------- -checkHost -~~~~~~~~~ +``checkHost`` +~~~~~~~~~~~~~ **type**: ``boolean`` **default**: ``false`` @@ -105,8 +105,8 @@ If true, then the :phpfunction:`checkdnsrr` PHP function will be used to check the validity of the MX *or* the A *or* the AAAA record of the host of the given email. -checkMX -~~~~~~~ +``checkMX`` +~~~~~~~~~~~ **type**: ``boolean`` **default**: ``false`` @@ -124,8 +124,8 @@ check the validity of the MX record of the host of the given email. .. include:: /reference/constraints/_groups-option.rst.inc -message -~~~~~~~ +``message`` +~~~~~~~~~~~ **type**: ``string`` **default**: ``This value is not a valid email address.`` @@ -139,8 +139,8 @@ Parameter Description ``{{ value }}`` The current (invalid) value =============== ============================================================== -mode -~~~~ +``mode`` +~~~~~~~~ **type**: ``string`` **default**: ``loose`` diff --git a/reference/constraints/Expression.rst b/reference/constraints/Expression.rst index f3af00f1d3a..fbcbfc9c2b2 100644 --- a/reference/constraints/Expression.rst +++ b/reference/constraints/Expression.rst @@ -264,8 +264,8 @@ Parameter Description .. include:: /reference/constraints/_payload-option.rst.inc -values -~~~~~~ +``values`` +~~~~~~~~~~ **type**: ``array`` **default**: ``[]`` diff --git a/reference/constraints/File.rst b/reference/constraints/File.rst index a865349f913..bc93caf83d1 100644 --- a/reference/constraints/File.rst +++ b/reference/constraints/File.rst @@ -158,8 +158,8 @@ have been specified. Options ------- -binaryFormat -~~~~~~~~~~~~ +``binaryFormat`` +~~~~~~~~~~~~~~~~ **type**: ``boolean`` **default**: ``null`` @@ -171,8 +171,8 @@ the value defined in the ``maxSize`` option. For more information about the difference between binary and SI prefixes, see `Wikipedia: Binary prefix`_. -disallowEmptyMessage -~~~~~~~~~~~~~~~~~~~~ +``disallowEmptyMessage`` +~~~~~~~~~~~~~~~~~~~~~~~~ **type**: ``string`` **default**: ``An empty file is not allowed.`` @@ -190,8 +190,8 @@ Parameter Description .. include:: /reference/constraints/_groups-option.rst.inc -maxSize -~~~~~~~ +``maxSize`` +~~~~~~~~~~~ **type**: ``mixed`` @@ -212,8 +212,8 @@ Suffix Unit Name Value Example For more information about the difference between binary and SI prefixes, see `Wikipedia: Binary prefix`_. -maxSizeMessage -~~~~~~~~~~~~~~ +``maxSizeMessage`` +~~~~~~~~~~~~~~~~~~ **type**: ``string`` **default**: ``The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}.`` @@ -231,8 +231,8 @@ Parameter Description ``{{ suffix }}`` Suffix for the used file size unit (see above) ================ ============================================================= -mimeTypes -~~~~~~~~~ +``mimeTypes`` +~~~~~~~~~~~~~ **type**: ``array`` or ``string`` @@ -256,8 +256,8 @@ You can find a list of existing mime types on the `IANA website`_. This feature was introduced in Symfony 4.4. -mimeTypesMessage -~~~~~~~~~~~~~~~~ +``mimeTypesMessage`` +~~~~~~~~~~~~~~~~~~~~ **type**: ``string`` **default**: ``The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}.`` @@ -275,8 +275,8 @@ Parameter Description ``{{ types }}`` The list of allowed MIME types =============== ============================================================== -notFoundMessage -~~~~~~~~~~~~~~~ +``notFoundMessage`` +~~~~~~~~~~~~~~~~~~~ **type**: ``string`` **default**: ``The file could not be found.`` @@ -292,8 +292,8 @@ Parameter Description ``{{ file }}`` Absolute file path =============== ============================================================== -notReadableMessage -~~~~~~~~~~~~~~~~~~ +``notReadableMessage`` +~~~~~~~~~~~~~~~~~~~~~~ **type**: ``string`` **default**: ``The file is not readable.`` @@ -310,8 +310,8 @@ Parameter Description .. include:: /reference/constraints/_payload-option.rst.inc -uploadCantWriteErrorMessage -~~~~~~~~~~~~~~~~~~~~~~~~~~~ +``uploadCantWriteErrorMessage`` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ **type**: ``string`` **default**: ``Cannot write temporary file to disk.`` @@ -320,8 +320,8 @@ temporary folder. This message has no parameters. -uploadErrorMessage -~~~~~~~~~~~~~~~~~~ +``uploadErrorMessage`` +~~~~~~~~~~~~~~~~~~~~~~ **type**: ``string`` **default**: ``The file could not be uploaded.`` @@ -330,8 +330,8 @@ for some unknown reason. This message has no parameters. -uploadExtensionErrorMessage -~~~~~~~~~~~~~~~~~~~~~~~~~~~ +``uploadExtensionErrorMessage`` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ **type**: ``string`` **default**: ``A PHP extension caused the upload to fail.`` @@ -340,8 +340,8 @@ fail. This message has no parameters. -uploadFormSizeErrorMessage -~~~~~~~~~~~~~~~~~~~~~~~~~~ +``uploadFormSizeErrorMessage`` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ **type**: ``string`` **default**: ``The file is too large.`` @@ -350,8 +350,8 @@ by the HTML file input field. This message has no parameters. -uploadIniSizeErrorMessage -~~~~~~~~~~~~~~~~~~~~~~~~~ +``uploadIniSizeErrorMessage`` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ **type**: ``string`` **default**: ``The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}.`` @@ -367,8 +367,8 @@ Parameter Description ``{{ suffix }}`` Suffix for the used file size unit (see above) ================ ============================================================= -uploadNoFileErrorMessage -~~~~~~~~~~~~~~~~~~~~~~~~ +``uploadNoFileErrorMessage`` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ **type**: ``string`` **default**: ``No file was uploaded.`` @@ -376,8 +376,8 @@ The message that is displayed if no file was uploaded. This message has no parameters. -uploadNoTmpDirErrorMessage -~~~~~~~~~~~~~~~~~~~~~~~~~~ +``uploadNoTmpDirErrorMessage`` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ **type**: ``string`` **default**: ``No temporary folder was configured in php.ini.`` @@ -386,8 +386,8 @@ missing. This message has no parameters. -uploadPartialErrorMessage -~~~~~~~~~~~~~~~~~~~~~~~~~ +``uploadPartialErrorMessage`` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ **type**: ``string`` **default**: ``The file was only partially uploaded.`` diff --git a/reference/constraints/Image.rst b/reference/constraints/Image.rst index e8b492bf4ae..8ab714db79b 100644 --- a/reference/constraints/Image.rst +++ b/reference/constraints/Image.rst @@ -230,15 +230,15 @@ This constraint shares all of its options with the :doc:`File `] diff --git a/reference/constraints/Timezone.rst b/reference/constraints/Timezone.rst index c5f27e1cbfb..3725038f0d8 100644 --- a/reference/constraints/Timezone.rst +++ b/reference/constraints/Timezone.rst @@ -86,8 +86,8 @@ string which contains any of the `PHP timezone identifiers`_ (e.g. ``America/New Options ------- -countryCode -~~~~~~~~~~~ +``countryCode`` +~~~~~~~~~~~~~~~ **type**: ``string`` **default**: ``null`` @@ -100,8 +100,8 @@ The value of this option must be a valid `ISO 3166-1 alpha-2`_ country code .. include:: /reference/constraints/_groups-option.rst.inc -intlCompatible -~~~~~~~~~~~~~~ +``intlCompatible`` +~~~~~~~~~~~~~~~~~~ **type**: ``boolean`` **default**: ``false`` @@ -114,8 +114,8 @@ timezones provided by PHP's Intl extension (because they use different ICU versions). If this option is set to ``true``, this constraint only considers valid the values compatible with the PHP ``\IntlTimeZone::createTimeZone()`` method. -message -~~~~~~~ +``message`` +~~~~~~~~~~~ **type**: ``string`` **default**: ``This value is not a valid timezone.`` @@ -131,8 +131,8 @@ Parameter Description .. include:: /reference/constraints/_payload-option.rst.inc -zone -~~~~ +``zone`` +~~~~~~~~ **type**: ``string`` **default**: ``\DateTimeZone::ALL`` diff --git a/reference/constraints/Type.rst b/reference/constraints/Type.rst index 307b7565749..17ee98fec78 100644 --- a/reference/constraints/Type.rst +++ b/reference/constraints/Type.rst @@ -155,8 +155,8 @@ Options .. include:: /reference/constraints/_groups-option.rst.inc -message -~~~~~~~ +``message`` +~~~~~~~~~~~ **type**: ``string`` **default**: ``This value should be of type {{ type }}.`` @@ -175,8 +175,8 @@ Parameter Description .. _reference-constraint-type-type: -type -~~~~ +``type`` +~~~~~~~~ **type**: ``string`` or ``array`` [:ref:`default option `] diff --git a/reference/constraints/Unique.rst b/reference/constraints/Unique.rst index e6acb08ea71..9d9cc0ffed2 100644 --- a/reference/constraints/Unique.rst +++ b/reference/constraints/Unique.rst @@ -94,8 +94,8 @@ Options .. include:: /reference/constraints/_groups-option.rst.inc -message -~~~~~~~ +``message`` +~~~~~~~~~~~ **type**: ``string`` **default**: ``This collection should contain only unique elements.`` diff --git a/reference/constraints/UniqueEntity.rst b/reference/constraints/UniqueEntity.rst index ca0a0be28c6..f96d6d91b47 100644 --- a/reference/constraints/UniqueEntity.rst +++ b/reference/constraints/UniqueEntity.rst @@ -140,8 +140,8 @@ the uniqueness. If it's left blank, the correct entity manager will be determined for this class. For that reason, this option should probably not need to be used. -entityClass -~~~~~~~~~~~ +``entityClass`` +~~~~~~~~~~~~~~~ **type**: ``string`` @@ -151,8 +151,8 @@ inheritance mapping, you need to execute the query in a different repository. Use this option to define the fully-qualified class name (FQCN) of the Doctrine entity associated with the repository you want to use. -errorPath -~~~~~~~~~ +``errorPath`` +~~~~~~~~~~~~~ **type**: ``string`` **default**: The name of the first field in `fields`_ @@ -249,8 +249,8 @@ Consider this example: Now, the message would be bound to the ``port`` field with this configuration. -fields -~~~~~~ +``fields`` +~~~~~~~~~~ **type**: ``array`` | ``string`` [:ref:`default option `] @@ -266,8 +266,8 @@ each with a single field. .. include:: /reference/constraints/_groups-option.rst.inc -ignoreNull -~~~~~~~~~~ +``ignoreNull`` +~~~~~~~~~~~~~~ **type**: ``boolean`` **default**: ``true`` @@ -276,8 +276,8 @@ entities to have a ``null`` value for a field without failing validation. If set to ``false``, only one ``null`` value is allowed - if a second entity also has a ``null`` value, validation would fail. -message -~~~~~~~ +``message`` +~~~~~~~~~~~ **type**: ``string`` **default**: ``This value is already used.`` @@ -300,8 +300,8 @@ Parameter Description .. include:: /reference/constraints/_payload-option.rst.inc -repositoryMethod -~~~~~~~~~~~~~~~~ +``repositoryMethod`` +~~~~~~~~~~~~~~~~~~~~ **type**: ``string`` **default**: ``findBy`` diff --git a/reference/constraints/Url.rst b/reference/constraints/Url.rst index 4c9885d0147..ac230890a9a 100644 --- a/reference/constraints/Url.rst +++ b/reference/constraints/Url.rst @@ -81,8 +81,8 @@ Basic Usage Options ------- -checkDNS -~~~~~~~~ +``checkDNS`` +~~~~~~~~~~~~ **type**: ``boolean`` **default**: ``false`` @@ -163,8 +163,8 @@ option to the value of any of the ``CHECK_DNS_TYPE_*`` constants in the This option uses the :phpfunction:`checkdnsrr` PHP function to check the validity of the DNS record corresponding to the host associated with the given URL. -dnsMessage -~~~~~~~~~~ +``dnsMessage`` +~~~~~~~~~~~~~~ **type**: ``string`` **default**: ``The host could not be resolved.`` @@ -242,8 +242,8 @@ DNS check failed. .. include:: /reference/constraints/_groups-option.rst.inc -message -~~~~~~~ +``message`` +~~~~~~~~~~~ **type**: ``string`` **default**: ``This value is not a valid URL.`` @@ -324,8 +324,8 @@ Parameter Description .. include:: /reference/constraints/_payload-option.rst.inc -protocols -~~~~~~~~~ +``protocols`` +~~~~~~~~~~~~~ **type**: ``array`` **default**: ``['http', 'https']`` @@ -399,8 +399,8 @@ the ``ftp://`` type URLs to be valid, redefine the ``protocols`` array, listing } } -relativeProtocol -~~~~~~~~~~~~~~~~ +``relativeProtocol`` +~~~~~~~~~~~~~~~~~~~~ **type**: ``boolean`` **default**: ``false`` diff --git a/reference/constraints/Valid.rst b/reference/constraints/Valid.rst index 1cb992128ac..edd282fa53b 100644 --- a/reference/constraints/Valid.rst +++ b/reference/constraints/Valid.rst @@ -250,8 +250,8 @@ Options .. include:: /reference/constraints/_payload-option.rst.inc -traverse -~~~~~~~~ +``traverse`` +~~~~~~~~~~~~ **type**: ``boolean`` **default**: ``true`` diff --git a/reference/constraints/_normalizer-option.rst.inc b/reference/constraints/_normalizer-option.rst.inc index 784f915ff95..dcbba1c2da8 100644 --- a/reference/constraints/_normalizer-option.rst.inc +++ b/reference/constraints/_normalizer-option.rst.inc @@ -1,5 +1,5 @@ -normalizer -~~~~~~~~~~ +``normalizer`` +~~~~~~~~~~~~~~ **type**: a `PHP callable`_ **default**: ``null`` From c610653de3785f1e7578bf06c5b32cd234742147 Mon Sep 17 00:00:00 2001 From: Chris Maiden Date: Thu, 25 Mar 2021 11:14:31 +0000 Subject: [PATCH 0417/1045] Fix typo --- frontend/encore/versioning.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/encore/versioning.rst b/frontend/encore/versioning.rst index 0911f8d8cc3..ecea440ec75 100644 --- a/frontend/encore/versioning.rst +++ b/frontend/encore/versioning.rst @@ -7,7 +7,7 @@ Tired of deploying and having browser's cache the old version of your assets? By calling ``enableVersioning()``, each filename will now include a hash that changes whenever the *contents* of that file change (e.g. ``app.123abc.js`` instead of ``app.js``). This allows you to use aggressive caching strategies -(e.g. a far future ``Expires``) because, whenever a file change, its hash will change, +(e.g. a far future ``Expires``) because, whenever a file changes, its hash will change, ignoring any existing cache: .. code-block:: diff From 04b203118081c7714687031f3f5e9f70142a0b69 Mon Sep 17 00:00:00 2001 From: Chris Maiden Date: Thu, 25 Mar 2021 14:11:06 +0000 Subject: [PATCH 0418/1045] [CssSelector] Grammatical fix --- components/css_selector.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/css_selector.rst b/components/css_selector.rst index c8100793ab4..be68d1801ed 100644 --- a/components/css_selector.rst +++ b/components/css_selector.rst @@ -25,8 +25,8 @@ Usage component in any PHP application. Read the :ref:`Symfony Functional Tests ` article to learn about how to use it when creating Symfony tests. -Why to Use CSS selectors? -~~~~~~~~~~~~~~~~~~~~~~~~~ +Why Use CSS selectors? +~~~~~~~~~~~~~~~~~~~~~~ When you're parsing an HTML or an XML document, by far the most powerful method is `XPath`_. From a6874e68d8710a01239b99e3499d3c127fed290a Mon Sep 17 00:00:00 2001 From: Sebastian Paczkowski <74934099+sebpacz@users.noreply.github.com> Date: Sun, 28 Mar 2021 11:37:53 +0200 Subject: [PATCH 0419/1045] [Finder] Fix typo --- components/finder.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/finder.rst b/components/finder.rst index f799208558e..6952685b64f 100644 --- a/components/finder.rst +++ b/components/finder.rst @@ -214,7 +214,7 @@ Use the forward slash (i.e. ``/``) as the directory separator on all platforms, including Windows. The component makes the necessary conversion internally. The ``path()`` method accepts a string, a regular expression or an array of -strings or regulars expressions:: +strings or regular expressions:: $finder->path('foo/bar'); $finder->path('/^foo\/bar/'); From 687199ee2bb22b4decbec8e8c1f7f4b4730d9de3 Mon Sep 17 00:00:00 2001 From: Guillaume Sarramegna <13528732+sarramegnag@users.noreply.github.com> Date: Tue, 30 Mar 2021 19:06:41 +0200 Subject: [PATCH 0420/1045] Standardize built-in normalizers lists --- components/serializer.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/components/serializer.rst b/components/serializer.rst index f2c3285a33b..84c8ecb8a36 100644 --- a/components/serializer.rst +++ b/components/serializer.rst @@ -782,6 +782,9 @@ The Serializer component provides several built-in normalizers: :class:`Symfony\\Component\\Serializer\\Normalizer\\ProblemNormalizer` Normalizes errors according to the API Problem spec `RFC 7807`_. +:class:`Symfony\\Component\\Serializer\\Normalizer\\CustomNormalizer` + Normalizes a PHP object using an object that implements :class:`Symfony\\Component\\Serializer\\Normalizer\\NormalizableInterface`. + .. note:: You can also create your own Normalizer to use another structure. Read more at From 3f33c81da2b1d3330d353c86af52aba5789bb205 Mon Sep 17 00:00:00 2001 From: Guilliam Xavier Date: Wed, 31 Mar 2021 11:36:34 +0200 Subject: [PATCH 0421/1045] [Validator] Fix Regex htmlPattern examples --- reference/constraints/Regex.rst | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/reference/constraints/Regex.rst b/reference/constraints/Regex.rst index 02a5ea8f407..c3b9a9bd5c6 100644 --- a/reference/constraints/Regex.rst +++ b/reference/constraints/Regex.rst @@ -175,12 +175,12 @@ Options This option specifies the pattern to use in the HTML5 ``pattern`` attribute. You usually don't need to specify this option because by default, the constraint will convert the pattern given in the `pattern`_ option into an HTML5 compatible -pattern. This means that the delimiters are removed (e.g. ``/[a-z]+/`` becomes -``[a-z]+``). +pattern. Notably, the delimiters are removed and the anchors are implicit (e.g. +``/^[a-z]+$/`` becomes ``[a-z]+``, and ``/[a-z]+/`` becomes ``.*[a-z]+.*``). However, there are some other incompatibilities between both patterns which cannot be fixed by the constraint. For instance, the HTML5 ``pattern`` attribute -does not support flags. If you have a pattern like ``/[a-z]+/i``, you +does not support flags. If you have a pattern like ``/^[a-z]+$/i``, you need to specify the HTML5 compatible pattern in the ``htmlPattern`` option: .. configuration-block:: @@ -197,7 +197,7 @@ need to specify the HTML5 compatible pattern in the ``htmlPattern`` option: /** * @Assert\Regex( * pattern = "/^[a-z]+$/i", - * htmlPattern = "^[a-zA-Z]+$" + * htmlPattern = "[a-zA-Z]+" * ) */ protected $name; @@ -211,7 +211,7 @@ need to specify the HTML5 compatible pattern in the ``htmlPattern`` option: name: - Regex: pattern: '/^[a-z]+$/i' - htmlPattern: '^[a-zA-Z]+$' + htmlPattern: '[a-zA-Z]+' .. code-block:: xml @@ -225,7 +225,7 @@ need to specify the HTML5 compatible pattern in the ``htmlPattern`` option: - +
                  @@ -245,7 +245,7 @@ need to specify the HTML5 compatible pattern in the ``htmlPattern`` option: { $metadata->addPropertyConstraint('name', new Assert\Regex([ 'pattern' => '/^[a-z]+$/i', - 'htmlPattern' => '^[a-zA-Z]+$', + 'htmlPattern' => '[a-zA-Z]+', ])); } } From ebddb78293a7901799d6aeba24d80f42301c13fa Mon Sep 17 00:00:00 2001 From: Nyholm Date: Wed, 31 Mar 2021 09:24:36 +0200 Subject: [PATCH 0422/1045] [Validator] Add warning about closure not being cachable --- reference/constraints/Callback.rst | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/reference/constraints/Callback.rst b/reference/constraints/Callback.rst index 6985f3953e1..65a63235a73 100644 --- a/reference/constraints/Callback.rst +++ b/reference/constraints/Callback.rst @@ -251,6 +251,13 @@ constructor of the Callback constraint:: } } +.. warning:: + + Using a ``Closure`` together with annotation configuration will disable the + annotation cache for that class/property/methods because ``Closure``s cannot + be cached. For best performance, it is recommended to use a static callback + method. + Options ------- From f57055d5e95f79ee49c604ed3bd273070f773e91 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Wed, 31 Mar 2021 13:17:07 +0200 Subject: [PATCH 0423/1045] Minor tweak --- reference/constraints/Callback.rst | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/reference/constraints/Callback.rst b/reference/constraints/Callback.rst index 65a63235a73..c917bf93412 100644 --- a/reference/constraints/Callback.rst +++ b/reference/constraints/Callback.rst @@ -254,9 +254,8 @@ constructor of the Callback constraint:: .. warning:: Using a ``Closure`` together with annotation configuration will disable the - annotation cache for that class/property/methods because ``Closure``s cannot - be cached. For best performance, it is recommended to use a static callback - method. + annotation cache for that class/property/method because ``Closure`` cannot + be cached. For best performance, it's recommended to use a static callback method. Options ------- From 8e5d9bcaaee6bf5bb55b927331f470a66352f04e Mon Sep 17 00:00:00 2001 From: ferror Date: Mon, 5 Apr 2021 16:46:16 +0200 Subject: [PATCH 0424/1045] Every custom header in testing client must have HTTP prefix --- testing.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/testing.rst b/testing.rst index 130ed0ab2ae..d6fa9774a1b 100644 --- a/testing.rst +++ b/testing.rst @@ -1029,6 +1029,10 @@ You can also override HTTP headers on a per request basis:: 'HTTP_USER_AGENT' => 'MySuperBrowser/1.0', ]); +.. caution:: + + Every custom header must have `HTTP_` prefix. + .. tip:: The test client is available as a service in the container in the ``test`` From cc0337ca95bcdf1ecec0c3db32cfedb81e2911cd Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Tue, 6 Apr 2021 13:36:11 +0200 Subject: [PATCH 0425/1045] Added more details to the explanation --- testing.rst | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/testing.rst b/testing.rst index d6fa9774a1b..12bd6c74524 100644 --- a/testing.rst +++ b/testing.rst @@ -1031,7 +1031,10 @@ You can also override HTTP headers on a per request basis:: .. caution:: - Every custom header must have `HTTP_` prefix. + The name of your custom headers must follow the syntax defined in the + `section 4.1.18 of RFC 3875`_: replace ``-`` by ``_``, transform it into + uppercase and prefix the result with ``HTTP_``. For example, if your + header name is ``X-Session-Token``, pass ``HTTP_X_SESSION_TOKEN``. .. tip:: @@ -1128,3 +1131,4 @@ Learn more .. _`$_SERVER`: https://www.php.net/manual/en/reserved.variables.server.php .. _`data providers`: https://phpunit.de/manual/current/en/writing-tests-for-phpunit.html#writing-tests-for-phpunit.data-providers .. _`code coverage analysis`: https://phpunit.readthedocs.io/en/9.1/code-coverage-analysis.html +.. _`section 4.1.18 of RFC 3875`: https://tools.ietf.org/html/rfc3875#section-4.1.18 From 0e53eb0a675ccd1f64948fd0b000016bc409be26 Mon Sep 17 00:00:00 2001 From: azjezz Date: Wed, 24 Mar 2021 12:19:38 +0100 Subject: [PATCH 0426/1045] update mercure documentation --- mercure.rst | 169 +++++++++++++++++++++++++++++++++++----------------- 1 file changed, 114 insertions(+), 55 deletions(-) diff --git a/mercure.rst b/mercure.rst index f32e8eee6a8..d67609f659a 100644 --- a/mercure.rst +++ b/mercure.rst @@ -159,20 +159,19 @@ service, including controllers:: namespace App\Controller; use Symfony\Component\HttpFoundation\Response; - use Symfony\Component\Mercure\PublisherInterface; + use Symfony\Component\Mercure\HubInterface; use Symfony\Component\Mercure\Update; class PublishController { - public function __invoke(PublisherInterface $publisher): Response + public function __invoke(HubInterface $hub): Response { $update = new Update( 'http://example.com/books/1', json_encode(['status' => 'OutOfStock']) ); - // The Publisher service is an invokable object - $publisher($update); + $hub->publish($update); return new Response('published!'); } @@ -297,17 +296,14 @@ by using the ``AbstractController::addLink`` helper method:: use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\Request; - use Symfony\Component\WebLink\Link; + use Symfony\Component\Mercure\Discovery; class DiscoverController extends AbstractController { - public function __invoke(Request $request): JsonResponse + public function __invoke(Request $request, Discovery $discovery): JsonResponse { - // This parameter is automatically created by the MercureBundle - $hubUrl = $this->getParameter('mercure.default_hub'); - // Link: ; rel="mercure" - $this->addLink($request, new Link('mercure', $hubUrl)); + $discovery->addLink($request); return $this->json([ '@id' => '/books/1', @@ -346,13 +342,13 @@ of the ``Update`` constructor to ``true``:: // src/Controller/Publish.php namespace App\Controller; + use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\Response; - use Symfony\Component\Mercure\PublisherInterface; use Symfony\Component\Mercure\Update; - class PublishController + class PublishController extends AbstractController { - public function __invoke(PublisherInterface $publisher): Response + public function __invoke(HubInterface $hub): Response { $update = new Update( 'http://example.com/books/1', @@ -362,7 +358,7 @@ of the ``Update`` constructor to ``true``:: // Publisher's JWT must contain this topic, a URI template it matches or * in mercure.publish or you'll get a 401 // Subscriber's JWT must contain this topic, a URI template it matches or * in mercure.subscribe to receive the update - $publisher($update); + $hub->publish($update); return new Response('private update published!'); } @@ -406,44 +402,71 @@ This cookie will be automatically sent by the web browser when connecting to the Then, the Hub will verify the validity of the provided JWT, and extract the topic selectors from it. -To generate the JWT, we'll use the ``lcobucci/jwt`` library. Install it: +add your JWT secret to the configuration as follow :: -.. code-block:: terminal +.. configuration-block:: + + .. code-block:: yaml + + # config/packages/mercure.yaml + mercure: + hubs: + default: + url: https://mercure-hub.example.com/.well-known/mercure + jwt: + secret: '!ChangeMe!' + + .. code-block:: xml + + + + + + + + + + .. code-block:: php - $ composer require lcobucci/jwt + // config/packages/mercure.php + $container->loadFromExtension('mercure', [ + 'hubs' => [ + 'default' => [ + 'url' => 'https://mercure-hub.example.com/.well-known/mercure', + 'jwt' => [ + 'secret' => '!ChangeMe!', + ] + ], + ], + ]); And here is the controller:: // src/Controller/DiscoverController.php namespace App\Controller; - use Lcobucci\JWT\Configuration; - use Lcobucci\JWT\Signer\Hmac\Sha256; - use Lcobucci\JWT\Signer\Key; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; - use Symfony\Component\WebLink\Link; + use Symfony\Component\Mercure\Authorization; + use Symfony\Component\Mercure\Discovery; class DiscoverController extends AbstractController { - public function __invoke(Request $request): Response + public function __invoke(Request $request, Discovery $discovery, Authorization $authorization): Response { - $hubUrl = $this->getParameter('mercure.default_hub'); - $this->addLink($request, new Link('mercure', $hubUrl)); - - $key = Key\InMemory::plainText('mercure_secret_key'); // don't forget to set this parameter! Test value: !ChangeMe! - $configuration = Configuration::forSymmetricSigner(new Sha256(), $key); + $discovery->addLink($request); - $token = $configuration->builder() - ->withClaim('mercure', ['subscribe' => ["http://example.com/books/1"]]) // can also be a URI template, or * - ->getToken($configuration->signer(), $configuration->signingKey()) - ->toString(); + $response = new JsonResponse([ + '@id' => '/demo/books/1', + 'availability' => 'https://schema.org/InStock' + ]); - $response = $this->json(['@id' => '/demo/books/1', 'availability' => 'https://schema.org/InStock']); - $response->headers->set( - 'set-cookie', - sprintf('mercureAuthorization=%s; path=/.well-known/mercure; secure; httponly; SameSite=strict', $token) + $response->headers->setCookie( + $authorization->createCookie($request, ["http://example.com/books/1"]) ); return $response; @@ -459,15 +482,17 @@ Programmatically Generating The JWT Used to Publish --------------------------------------------------- Instead of directly storing a JWT in the configuration, -you can create a service that will return the token used by -the ``Publisher`` object:: +you can create a token provider that will return the token used by +the ``HubInterface`` object:: - // src/Mercure/MyJwtProvider.php + // src/Mercure/MyTokenProvider.php namespace App\Mercure; - final class MyJwtProvider + use Symfony\Component\Mercure\JWT\TokenProviderInterface; + + final class MyTokenProvider implements TokenProviderInterface { - public function __invoke(): string + public function getToken(): string { return 'the-JWT'; } @@ -484,7 +509,8 @@ Then, reference this service in the bundle configuration: hubs: default: url: https://mercure-hub.example.com/.well-known/mercure - jwt_provider: App\Mercure\MyJwtProvider + jwt: + provider: App\Mercure\MyTokenProvider .. code-block:: xml @@ -494,8 +520,9 @@ Then, reference this service in the bundle configuration: + > + + .. code-block:: php @@ -507,7 +534,9 @@ Then, reference this service in the bundle configuration: 'hubs' => [ 'default' => [ 'url' => 'https://mercure-hub.example.com/.well-known/mercure', - 'jwt_provider' => MyJwtProvider::class, + 'jwt' => [ + 'provider' => MyJwtProvider::class, + ] ], ], ]); @@ -568,29 +597,59 @@ its Mercure support. Testing -------- -During functional testing there is no need to send updates to Mercure. They will -be handled by a stub publisher:: +During unit testing there is not need to send updates to Mercure. + +You can instead make use of the `MockHub`:: + + // tests/Functional/.php + namespace App\Tests\Unit\Controller; - // tests/Functional/Fixtures/PublisherStub.php + use App\Controller\MessageController; + use Symfony\Component\Mercure\HubInterface; + use Symfony\Component\Mercure\JWT\StaticTokenProvider; + use Symfony\Component\Mercure\MockHub; + use Symfony\Component\Mercure\Update; + + class MessageControllerTest extends TestCase + { + public function testPublishing() + { + $hub = new MockHub('default', 'https://internal/.well-known/mercure', new StaticTokenProvider('foo'), function(Update $update): string { + // $this->assertTrue($update->isPrivate()); + + return 'id'; + }); + + $controller = new MessageController($hub); + + ... + } + } + +During functional testing you can instead decorate the Hub:: + + // tests/Functional/Fixtures/HubStub.php namespace App\Tests\Functional\Fixtures; - use Symfony\Component\Mercure\PublisherInterface; + use Symfony\Component\Mercure\HubInterface; use Symfony\Component\Mercure\Update; - class PublisherStub implements PublisherInterface + class HubStub implements HubInterface { - public function __invoke(Update $update): string + public function publish(Update $update): string { - return ''; + return 'id'; } + + // implement rest of HubInterface methods here } -PublisherStub decorates the default publisher service so no updates are actually -sent. Here is the PublisherStub implementation:: +HubStub decorates the default hub service so no updates are actually +sent. Here is the HubStub implementation:: # config/services_test.yaml - App\Tests\Functional\Fixtures\PublisherStub: - decorates: mercure.hub.default.publisher + App\Tests\Functional\Fixtures\HubStub: + decorates: mercure.hub.default Debugging From 6c728236ebf666002fb73fe9b5c53e6b65d3aeb9 Mon Sep 17 00:00:00 2001 From: Sebastian Paczkowski <74934099+sebpacz@users.noreply.github.com> Date: Tue, 6 Apr 2021 22:15:12 +0200 Subject: [PATCH 0427/1045] [HttpFoundation] Remove extra space --- components/http_foundation.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/http_foundation.rst b/components/http_foundation.rst index 980eb597c3b..0fa78dc6439 100644 --- a/components/http_foundation.rst +++ b/components/http_foundation.rst @@ -633,7 +633,7 @@ handling, switching to chunked encoding instead:: use Symfony\Component\HttpFoundation\BinaryFileResponse; use Symfony\Component\HttpFoundation\File\Stream; - $stream = new Stream('path/to/stream'); + $stream = new Stream('path/to/stream'); $response = new BinaryFileResponse($stream); .. note:: From f5ee47256a00b3f1544215bbd3b2633d2454baf1 Mon Sep 17 00:00:00 2001 From: Sylvain Fabre Date: Fri, 16 Oct 2020 13:17:42 +0200 Subject: [PATCH 0428/1045] [Messenger] Routing & Inheritance --- messenger.rst | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/messenger.rst b/messenger.rst index 52f125a3b61..8b977fcd283 100644 --- a/messenger.rst +++ b/messenger.rst @@ -314,6 +314,13 @@ to multiple transports: ], ]); +.. note:: + + If you configure routing for both a child and parent class, but rules + are used. E.g. if you have an ``SmsNotification`` object that extends + from ``Notification``, both the routing for ``Notification`` and + ``SmsNotification`` will be used. + Doctrine Entities in Messages ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ From 5c20fe3a94072394baec216a5d48947f010b66e1 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Wed, 7 Apr 2021 16:14:13 +0200 Subject: [PATCH 0429/1045] [Messenger] fix typo --- messenger.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/messenger.rst b/messenger.rst index 8b977fcd283..70944b9a2d0 100644 --- a/messenger.rst +++ b/messenger.rst @@ -316,7 +316,7 @@ to multiple transports: .. note:: - If you configure routing for both a child and parent class, but rules + If you configure routing for both a child and parent class, both rules are used. E.g. if you have an ``SmsNotification`` object that extends from ``Notification``, both the routing for ``Notification`` and ``SmsNotification`` will be used. From e16bc4ea4180381e515095f898163faeeba04397 Mon Sep 17 00:00:00 2001 From: Wouter de Jong Date: Wed, 7 Apr 2021 17:02:08 +0200 Subject: [PATCH 0430/1045] [#14728] Be explicit about the double 's' --- components/cache/adapters/redis_adapter.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/cache/adapters/redis_adapter.rst b/components/cache/adapters/redis_adapter.rst index bed064679e4..0845b3bcb96 100644 --- a/components/cache/adapters/redis_adapter.rst +++ b/components/cache/adapters/redis_adapter.rst @@ -63,7 +63,7 @@ helper method allows creating and configuring the Redis client class instance us The DSN can specify either an IP/host (and an optional port) or a socket path, as well as a password and a database index. To enable TLS for connections, the scheme ``redis`` must be -replaced by ``rediss``. +replaced by ``rediss`` (the second ``s`` means "secure"). .. note:: From 367efdb0ea5ef8648d857660623a7d59701ce36c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mehmet=20G=C3=B6kalp?= Date: Sat, 30 Jan 2021 18:31:32 +0300 Subject: [PATCH 0431/1045] JsonResponse content updated --- components/http_foundation.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/components/http_foundation.rst b/components/http_foundation.rst index 0fa78dc6439..449d29ea0f0 100644 --- a/components/http_foundation.rst +++ b/components/http_foundation.rst @@ -668,9 +668,11 @@ class, which can make this even easier:: // if you know the data to send when creating the response $response = new JsonResponse(['data' => 123]); - // if you don't know the data to send when creating the response + // if you don't know the data to send or if you want to customize the encoding options $response = new JsonResponse(); // ... + // configure any custom encoding options (if needed, it must be called before "setData()") + //$response->setEncodingOptions(JsonResponse::DEFAULT_ENCODING_OPTIONS | \JSON_PRESERVE_ZERO_FRACTION); $response->setData(['data' => 123]); // if the data to send is already encoded in JSON From 90e6580276ba5e07a002b453c069f093daac6731 Mon Sep 17 00:00:00 2001 From: AntoineRoue <64271860+AntoineRoue@users.noreply.github.com> Date: Tue, 6 Apr 2021 20:57:34 +0200 Subject: [PATCH 0432/1045] Update framework.rst This value was not changed with https://github.com/symfony/symfony/pull/30390 --- reference/configuration/framework.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reference/configuration/framework.rst b/reference/configuration/framework.rst index ada92f8f25e..63e0ca7ad20 100644 --- a/reference/configuration/framework.rst +++ b/reference/configuration/framework.rst @@ -1221,7 +1221,7 @@ The value can be one of: ``true`` Throw an exception when the requirements are not met; ``false`` - Disable exceptions when the requirements are not met and return ``null`` + Disable exceptions when the requirements are not met and return ``''`` instead; ``null`` Disable checking the requirements (thus, match the route even when the From 0c57c73506ccc7663f618cfe69766cdd3f724fa4 Mon Sep 17 00:00:00 2001 From: Wouter de Jong Date: Thu, 8 Apr 2021 13:16:41 +0200 Subject: [PATCH 0433/1045] Add troubleshooting for parallel merges to maintainer guide --- _build/maintainer_guide.rst | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/_build/maintainer_guide.rst b/_build/maintainer_guide.rst index f5913a8e811..8485bc3191d 100644 --- a/_build/maintainer_guide.rst +++ b/_build/maintainer_guide.rst @@ -352,6 +352,26 @@ forgot to merge as ``gh merge NNNNN -s 5.1`` to change the merge branch. Solutio $ git merge 5.1 $ ... +Merging while the target branch changed +....................................... + +Sometimes, someone else merges a PR in ``5.x`` at the same time as you are +doing it. In these cases, ``gh merge ...`` failes to push. Solve this by +resetting your local branch and restarting the merge: + +.. code-block:: terminal + + $ gh merge ... + # this failed + + # fetch the updated 5.x branch from GitHub + $ git fetch upstream + $ git checkout 5.x + $ git reset --hard upstream/5.x + + # restart the merge + $ gh merge ... + .. _`symfony/symfony-docs`: https://github.com/symfony/symfony-docs .. _`Symfony Docs team`: https://github.com/orgs/symfony/teams/team-symfony-docs .. _`Symfony's respectful review comments`: https://symfony.com/doc/current/contributing/community/review-comments.html From 60d3a1b335040c55dbaa7e2db485e15515ef8766 Mon Sep 17 00:00:00 2001 From: Sebastian Paczkowski <74934099+sebpacz@users.noreply.github.com> Date: Sun, 11 Apr 2021 13:12:35 +0200 Subject: [PATCH 0434/1045] [HttpFoundation] Fix IpUtils example This PR fixes a small bug in the IpUtils class name. --- components/http_foundation.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/http_foundation.rst b/components/http_foundation.rst index 449d29ea0f0..cbb1742dad1 100644 --- a/components/http_foundation.rst +++ b/components/http_foundation.rst @@ -331,11 +331,11 @@ analysis purposes. Use the ``anonymize()`` method from the use Symfony\Component\HttpFoundation\IpUtils; $ipv4 = '123.234.235.236'; - $anonymousIpv4 = IPUtils::anonymize($ipv4); + $anonymousIpv4 = IpUtils::anonymize($ipv4); // $anonymousIpv4 = '123.234.235.0' $ipv6 = '2a01:198:603:10:396e:4789:8e99:890f'; - $anonymousIpv6 = IPUtils::anonymize($ipv6); + $anonymousIpv6 = IpUtils::anonymize($ipv6); // $anonymousIpv6 = '2a01:198:603:10::' Accessing other Data From cc800ddfb486ff60d8ea2a8cf603f9657821f5ea Mon Sep 17 00:00:00 2001 From: Martin Bens Date: Mon, 12 Apr 2021 01:18:39 +0200 Subject: [PATCH 0435/1045] Tip added to explain how to use HttpClient options in BrowserKit requests. --- components/browser_kit.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/components/browser_kit.rst b/components/browser_kit.rst index 76c0e33d5e1..764e42e0e2b 100644 --- a/components/browser_kit.rst +++ b/components/browser_kit.rst @@ -317,6 +317,12 @@ dedicated web crawler or scraper such as `Goutte`_:: '.table-list-header-toggle a:nth-child(1)' )->text()); +.. tip:: + + You can also use HTTP client options like 'ciphers', 'auth_basic' and 'query'. + They have to be passed as the default options argument to the client, + which is used by the HTTP browser. + .. versionadded:: 4.3 The feature to make external HTTP requests was introduced in Symfony 4.3. From 12b0cfc4d6f9e3d47fa4a7046f4b8941107954ff Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Fri, 9 Apr 2021 11:13:06 +0200 Subject: [PATCH 0436/1045] [DomCrawler] Clarify the ways to add contents --- components/dom_crawler.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/components/dom_crawler.rst b/components/dom_crawler.rst index 1363d977a3a..b1dda3d42f7 100644 --- a/components/dom_crawler.rst +++ b/components/dom_crawler.rst @@ -292,7 +292,9 @@ context of the crawler:: Adding the Content ~~~~~~~~~~~~~~~~~~ -The crawler supports multiple ways of adding the content:: +The crawler supports multiple ways of adding the content, but they are mutually +exclusive, so you can only use one of them to add content (e.g. if you pass the +content to the ``Crawler`` constructor, you can't call ``addContent()`` later):: $crawler = new Crawler(''); From 6b105893cfe25b8b34cddd504a230d3c38e5220a Mon Sep 17 00:00:00 2001 From: Hugo Alliaume Date: Mon, 12 Apr 2021 23:21:43 +0200 Subject: [PATCH 0437/1045] [Symfony CLI] Document about `APP_ENV=test` behavior Running the Symfony CLI with `APP_ENV=test` has an interesting but undocumented behaviour, it updates `DATABASE_*` environment variables for a test environment. --- setup/symfony_server.rst | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/setup/symfony_server.rst b/setup/symfony_server.rst index f0723c20ea1..580af42bfba 100644 --- a/setup/symfony_server.rst +++ b/setup/symfony_server.rst @@ -322,6 +322,22 @@ prefixed with ``DB_``, but as the ``com.symfony.server.service-prefix`` is set to ``DATABASE``, the web server creates environment variables starting with ``DATABASE_`` instead as expected by the default Symfony configuration. +You don't need to create two containers for a main database and a test database. +Using `APP_ENV=test symfony` will automatically adjust `DATABASE_*` environment variables +for a test environment. + +.. code-block:: terminal + + $ symfony var:export --multiline + export DATABASE_DATABASE=app + export DATABASE_NAME=app + export DATABASE_URL=postgres://app:app@127.0.0.1:49160/app?sslmode=disable&charset=utf8 + + $ APP_ENV=test symfony var:export --multiline + export DATABASE_DATABASE=app_test + export DATABASE_NAME=app_test + export DATABASE_URL=postgres://app:app@127.0.0.1:49160/app_test?sslmode=disable&charset=utf8 + Here is the list of supported services with their ports and default Symfony prefixes: From 2e77005d76dff81a99055f7eca8286bec44f850e Mon Sep 17 00:00:00 2001 From: Jason Aller Date: Thu, 8 Apr 2021 13:29:05 -0700 Subject: [PATCH 0438/1045] [Ldap] Update ldap.rst --- components/ldap.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/components/ldap.rst b/components/ldap.rst index d7cb6ed17cd..60c4629fec9 100644 --- a/components/ldap.rst +++ b/components/ldap.rst @@ -115,6 +115,11 @@ to the ``LDAP_SCOPE_BASE`` scope of :phpfunction:`ldap_read`) and ``SCOPE_ONE`` $query = $ldap->query('dc=symfony,dc=com', '...', ['scope' => QueryInterface::SCOPE_ONE]); +To retrieve only specific attributes you can specify which attributes you want returned using +the ``filter`` option:: + + $query = $ldap->query('dc=symfony,dc=com', '...', ['filter' => ['cn, mail']); + Creating or Updating Entries ---------------------------- From 4586d288f27709970e2c60f6c51ccd66d5e4667e Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Tue, 13 Apr 2021 08:57:23 +0200 Subject: [PATCH 0439/1045] Minor reword --- components/ldap.rst | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/components/ldap.rst b/components/ldap.rst index 60c4629fec9..5b16a3ffb97 100644 --- a/components/ldap.rst +++ b/components/ldap.rst @@ -115,8 +115,7 @@ to the ``LDAP_SCOPE_BASE`` scope of :phpfunction:`ldap_read`) and ``SCOPE_ONE`` $query = $ldap->query('dc=symfony,dc=com', '...', ['scope' => QueryInterface::SCOPE_ONE]); -To retrieve only specific attributes you can specify which attributes you want returned using -the ``filter`` option:: +Use the ``filter`` option to only retrieve some specific attributes: $query = $ldap->query('dc=symfony,dc=com', '...', ['filter' => ['cn, mail']); From 5529b12eb11e8557c6f94fc663bee2beb42c0490 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Tue, 13 Apr 2021 12:00:38 +0200 Subject: [PATCH 0440/1045] Minor tweak --- 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 580af42bfba..7420a822ab6 100644 --- a/setup/symfony_server.rst +++ b/setup/symfony_server.rst @@ -322,9 +322,9 @@ prefixed with ``DB_``, but as the ``com.symfony.server.service-prefix`` is set to ``DATABASE``, the web server creates environment variables starting with ``DATABASE_`` instead as expected by the default Symfony configuration. -You don't need to create two containers for a main database and a test database. -Using `APP_ENV=test symfony` will automatically adjust `DATABASE_*` environment variables -for a test environment. +You don't need to create two containers for the main database and the test +database. Using ``APP_ENV=test symfony`` will automatically adjust +``DATABASE_*`` environment variables for the ``test`` environment: .. code-block:: terminal From 369e959d0edc411a1d006781e25da4c732f7245d Mon Sep 17 00:00:00 2001 From: Thomas Landauer Date: Tue, 13 Apr 2021 21:09:00 +0200 Subject: [PATCH 0441/1045] Fixing typo "by" was misssing. --- forms.rst | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/forms.rst b/forms.rst index 17cd593d416..6f244fd7d1c 100644 --- a/forms.rst +++ b/forms.rst @@ -695,8 +695,7 @@ Set the ``label`` option on fields to define their labels explicitly:: .. tip:: By default, ``