Skip to content

Commit dfae4f9

Browse files
committed
Merge branch '6.1' into 6.2
* 6.1: [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 Remove annotations from constraint examples added in 6.1 add missing attributes code block Shortening code block for PHP Clarify which branch should be chosen for a patch
2 parents c2120b2 + 0716710 commit dfae4f9

File tree

10 files changed

+47
-71
lines changed

10 files changed

+47
-71
lines changed

best_practices.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -455,4 +455,4 @@ you must set up a redirection.
455455
.. _`feature toggles`: https://en.wikipedia.org/wiki/Feature_toggle
456456
.. _`smoke testing`: https://en.wikipedia.org/wiki/Smoke_testing_(software)
457457
.. _`Webpack`: https://webpack.js.org/
458-
.. _`PHPUnit data providers`: https://phpunit.readthedocs.io/en/stable/writing-tests-for-phpunit.html#data-providers
458+
.. _`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/constraints/ExpressionSyntax.rst

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -28,28 +28,6 @@ The following constraints ensure that:
2828

2929
.. configuration-block::
3030

31-
.. code-block:: php-annotations
32-
33-
// src/Entity/Order.php
34-
namespace App\Entity;
35-
36-
use Symfony\Component\Validator\Constraints as Assert;
37-
38-
class Order
39-
{
40-
/**
41-
* @Assert\ExpressionSyntax
42-
*/
43-
protected $promotion;
44-
45-
/**
46-
* @Assert\ExpressionSyntax(
47-
* allowedVariables={"user", "shipping_centers"}
48-
* )
49-
*/
50-
protected $shippingOptions;
51-
}
52-
5331
.. code-block:: php-attributes
5432
5533
// src/Entity/Order.php

reference/constraints/Unique.rst

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -109,21 +109,6 @@ collection::
109109

110110
.. configuration-block::
111111

112-
.. code-block:: php-annotations
113-
114-
// src/Entity/Poi.php
115-
namespace App\Entity;
116-
117-
use Symfony\Component\Validator\Constraints as Assert;
118-
119-
class Poi
120-
{
121-
/**
122-
* @Assert\Unique(fields={"latitude", "longitude"})
123-
*/
124-
protected $coordinates;
125-
}
126-
127112
.. code-block:: php-attributes
128113
129114
// src/Entity/Poi.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
@@ -1393,14 +1393,10 @@ You must enable this using the ``login_throttling`` setting:
13931393
# by default, the feature allows 5 login attempts per minute
13941394
login_throttling: null
13951395
1396-
# configure the maximum login attempts (per minute)
1396+
# configure the maximum login attempts
13971397
login_throttling:
1398-
max_attempts: 3
1399-
1400-
# configure the maximum login attempts in a custom period of time
1401-
login_throttling:
1402-
max_attempts: 3
1403-
interval: '15 minutes'
1398+
max_attempts: 3 # per minute ...
1399+
# interval: '15 minutes' # ... or in a custom period
14041400
14051401
# use a custom rate limiter via its service ID
14061402
login_throttling:
@@ -1423,13 +1419,9 @@ You must enable this using the ``login_throttling`` setting:
14231419
<!-- ... -->
14241420
14251421
<firewall name="main">
1426-
<!-- by default, the feature allows 5 login attempts per minute -->
1427-
<login-throttling/>
1428-
1429-
<!-- configure the maximum login attempts (per minute) -->
1430-
<login-throttling max-attempts="3"/>
1431-
1432-
<!-- configure the maximum login attempts in a custom period of time -->
1422+
<!-- by default, the feature allows 5 login attempts per minute
1423+
max-attempts: (optional) You can configure the maximum attempts ...
1424+
interval: (optional) ... and the period of time. -->
14331425
<login-throttling max-attempts="3" interval="15 minutes"/>
14341426
14351427
<!-- use a custom rate limiter via its service ID -->
@@ -1449,17 +1441,9 @@ You must enable this using the ``login_throttling`` setting:
14491441
$mainFirewall = $security->firewall('main');
14501442
14511443
// by default, the feature allows 5 login attempts per minute
1452-
$mainFirewall->loginThrottling();
1453-
1454-
// configure the maximum login attempts (per minute)
1455-
$mainFirewall->loginThrottling()
1456-
->maxAttempts(3)
1457-
;
1458-
1459-
// configure the maximum login attempts in a custom period of time
14601444
$mainFirewall->loginThrottling()
1461-
->maxAttempts(3)
1462-
->interval('15 minutes')
1445+
// ->maxAttempts(3) // Optional: You can configure the maximum attempts ...
1446+
// ->interval('15 minutes') // ... and the period of time.
14631447
;
14641448
};
14651449

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)