Skip to content

Commit 0716710

Browse files
committed
Merge branch '6.0' into 6.1
* 6.0: [Form] Add doc link Fix type in alert comment about accessing session in constructor docs: fix links to phpunit docs Adding that you cannot access a session inside a constructor add missing attributes code block Shortening code block for PHP Clarify which branch should be chosen for a patch
2 parents d026fe4 + ce4e4ec commit 0716710

File tree

8 files changed

+47
-34
lines changed

8 files changed

+47
-34
lines changed

best_practices.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -463,4 +463,4 @@ you must set up a redirection.
463463
.. _`feature toggles`: https://en.wikipedia.org/wiki/Feature_toggle
464464
.. _`smoke testing`: https://en.wikipedia.org/wiki/Smoke_testing_(software)
465465
.. _`Webpack`: https://webpack.js.org/
466-
.. _`PHPUnit data providers`: https://phpunit.readthedocs.io/en/stable/writing-tests-for-phpunit.html#data-providers
466+
.. _`PHPUnit data providers`: https://phpunit.readthedocs.io/en/9.5/writing-tests-for-phpunit.html#data-providers

contributing/code/pull_requests.rst

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,10 +124,11 @@ Choose the right Branch
124124
Before working on a PR, you must determine on which branch you need to
125125
work:
126126

127-
* ``4.4``, if you are fixing a bug for an existing feature or want to make a
128-
change that falls into the :doc:`list of acceptable changes in patch versions
129-
</contributing/code/maintenance>` (you may have to choose a higher branch if
130-
the feature you are fixing was introduced in a later version);
127+
* If you are fixing a bug for an existing feature or want to make a change
128+
that falls into the :doc:`list of acceptable changes in patch versions
129+
</contributing/code/maintenance>`, pick the oldest concerned maintained
130+
branch (you can find them on the `Symfony releases page`_). E.g. if you
131+
found a bug introduced in ``v5.1.10``, you need to work on ``5.4``.
131132

132133
* ``6.2``, if you are adding a new feature.
133134

@@ -520,6 +521,7 @@ before merging.
520521
.. _GitHub: https://github.com/join
521522
.. _`GitHub's documentation`: https://help.github.com/github/using-git/ignoring-files
522523
.. _Symfony repository: https://github.com/symfony/symfony
524+
.. _Symfony releases page: https://symfony.com/releases#maintained-symfony-branches
523525
.. _`documentation repository`: https://github.com/symfony/symfony-docs
524526
.. _`fabbot`: https://fabbot.io
525527
.. _`Psalm`: https://psalm.dev/

create_framework/unit_testing.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,6 @@ Symfony code.
220220
Now that we are confident (again) about the code we have written, we can
221221
safely think about the next batch of features we want to add to our framework.
222222

223-
.. _`PHPUnit`: https://phpunit.readthedocs.io/en/stable/
224-
.. _`test doubles`: https://phpunit.readthedocs.io/en/stable/test-doubles.html
223+
.. _`PHPUnit`: https://phpunit.readthedocs.io/en/9.5/
224+
.. _`test doubles`: https://phpunit.readthedocs.io/en/9.5/test-doubles.html
225225
.. _`XDebug`: https://xdebug.org/

form/unit_testing.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,4 +244,4 @@ guessers using the :method:`Symfony\\Component\\Form\\Test\\FormIntegrationTestC
244244
and :method:`Symfony\\Component\\Form\\Test\\FormIntegrationTestCase::getTypeGuessers`
245245
methods.
246246

247-
.. _`PHPUnit data providers`: https://phpunit.readthedocs.io/en/stable/writing-tests-for-phpunit.html#data-providers
247+
.. _`PHPUnit data providers`: https://phpunit.readthedocs.io/en/9.5/writing-tests-for-phpunit.html#data-providers

reference/constraints/Collection.rst

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,29 @@ you can do the following:
184184

185185
.. configuration-block::
186186

187+
.. code-block:: php-attributes
188+
189+
// src/Entity/Author.php
190+
namespace App\Entity;
191+
192+
use Symfony\Component\Validator\Constraints as Assert;
193+
194+
class Author
195+
{
196+
#[Assert\Collection(
197+
fields: [
198+
'personal_email' => new Assert\Required([
199+
new Assert\NotBlank,
200+
new Assert\Email,
201+
]),
202+
'alternate_email' => new Assert\Optional(
203+
new Assert\Email
204+
),
205+
],
206+
)]
207+
protected $profileData = ['personal_email' => 'email@example.com'];
208+
}
209+
187210
.. code-block:: php-attributes
188211
189212
// src/Entity/Author.php

reference/forms/types/map.rst.inc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ These types are part of the :doc:`Symfony UX initiative </frontend/ux>`:
5555
UID Fields
5656
~~~~~~~~~~
5757

58-
* UuidType
59-
* UlidType
58+
* :doc:`UuidType </reference/forms/types/uuid>`
59+
* :doc:`UlidType </reference/forms/types/ulid>`
6060

6161
Field Groups
6262
~~~~~~~~~~~~

security.rst

Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1353,14 +1353,10 @@ You must enable this using the ``login_throttling`` setting:
13531353
# by default, the feature allows 5 login attempts per minute
13541354
login_throttling: null
13551355
1356-
# configure the maximum login attempts (per minute)
1356+
# configure the maximum login attempts
13571357
login_throttling:
1358-
max_attempts: 3
1359-
1360-
# configure the maximum login attempts in a custom period of time
1361-
login_throttling:
1362-
max_attempts: 3
1363-
interval: '15 minutes'
1358+
max_attempts: 3 # per minute ...
1359+
# interval: '15 minutes' # ... or in a custom period
13641360
13651361
# use a custom rate limiter via its service ID
13661362
login_throttling:
@@ -1383,13 +1379,9 @@ You must enable this using the ``login_throttling`` setting:
13831379
<!-- ... -->
13841380
13851381
<firewall name="main">
1386-
<!-- by default, the feature allows 5 login attempts per minute -->
1387-
<login-throttling/>
1388-
1389-
<!-- configure the maximum login attempts (per minute) -->
1390-
<login-throttling max-attempts="3"/>
1391-
1392-
<!-- configure the maximum login attempts in a custom period of time -->
1382+
<!-- by default, the feature allows 5 login attempts per minute
1383+
max-attempts: (optional) You can configure the maximum attempts ...
1384+
interval: (optional) ... and the period of time. -->
13931385
<login-throttling max-attempts="3" interval="15 minutes"/>
13941386
13951387
<!-- use a custom rate limiter via its service ID -->
@@ -1409,17 +1401,9 @@ You must enable this using the ``login_throttling`` setting:
14091401
$mainFirewall = $security->firewall('main');
14101402
14111403
// by default, the feature allows 5 login attempts per minute
1412-
$mainFirewall->loginThrottling();
1413-
1414-
// configure the maximum login attempts (per minute)
1415-
$mainFirewall->loginThrottling()
1416-
->maxAttempts(3)
1417-
;
1418-
1419-
// configure the maximum login attempts in a custom period of time
14201404
$mainFirewall->loginThrottling()
1421-
->maxAttempts(3)
1422-
->interval('15 minutes')
1405+
// ->maxAttempts(3) // Optional: You can configure the maximum attempts ...
1406+
// ->interval('15 minutes') // ... and the period of time.
14231407
;
14241408
};
14251409

session.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,10 @@ if you type-hint an argument with :class:`Symfony\\Component\\HttpFoundation\\Re
149149
public function __construct(RequestStack $requestStack)
150150
{
151151
$this->requestStack = $requestStack;
152+
153+
// Accessing the session in the constructor is *NOT* recommended, since
154+
// it might not be accessible yet or lead to unwanted side-effects
155+
// $this->session = $requestStack->getSession();
152156
}
153157

154158
public function someMethod()

0 commit comments

Comments
 (0)