Skip to content

Commit 3b4a014

Browse files
committed
Merge branch '5.4' into 6.0
* 5.4: Update page_creation.rst Corrected typo in notifier.rst [ExpressionLanguage] Remove array element Document PHP attribute naming convention Rewording when an exception is thrown
2 parents c3234ce + 006a29d commit 3b4a014

File tree

5 files changed

+19
-19
lines changed

5 files changed

+19
-19
lines changed

components/expression_language/syntax.rst

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,6 @@ Examples::
200200
'life == everything',
201201
[
202202
'life' => 10,
203-
'universe' => 10,
204203
'everything' => 22,
205204
]
206205
);
@@ -209,7 +208,6 @@ Examples::
209208
'life > everything',
210209
[
211210
'life' => 10,
212-
'universe' => 10,
213211
'everything' => 22,
214212
]
215213
);

contributing/code/standards.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,9 @@ Naming Conventions
220220

221221
* Suffix exceptions with ``Exception``;
222222

223+
* Prefix PHP attributes with ``As`` where applicable (e.g. ``#[AsCommand]``
224+
instead of ``#[Command]``, but ``#[When]`` is kept as-is);
225+
223226
* Use UpperCamelCase for naming PHP files (e.g. ``EnvVarProcessor.php``) and
224227
snake case for naming Twig templates and web assets (``section_layout.html.twig``,
225228
``index.scss``);

http_client.rst

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1037,20 +1037,19 @@ There are three types of exceptions, all of which implement the
10371037
are thrown when a content-type cannot be decoded to the expected representation.
10381038

10391039
When the HTTP status code of the response is in the 300-599 range (i.e. 3xx,
1040-
4xx or 5xx) your code is expected to handle it. If you don't do that, the
1041-
``getHeaders()``, ``getContent()`` and ``toArray()`` methods throw an appropriate exception, which will
1042-
implement the :class:`Symfony\\Contracts\\HttpClient\\Exception\\HttpExceptionInterface`::
1040+
4xx or 5xx), the ``getHeaders()``, ``getContent()`` and ``toArray()`` methods
1041+
throw an appropriate exception, all of which implement the
1042+
:class:`Symfony\\Contracts\\HttpClient\\Exception\\HttpExceptionInterface`.
10431043

1044-
// the response of this request will be a 403 HTTP error
1045-
$response = $client->request('GET', 'https://httpbin.org/status/403');
1044+
To opt-out from this exception and deal with 300-599 status codes on your own,
1045+
pass ``false`` as the optional argument to every call of those methods,
1046+
e.g. ``$response->getHeaders(false);``.
10461047

1047-
// this code results in a Symfony\Component\HttpClient\Exception\ClientException
1048-
// because it doesn't check the status code of the response
1049-
$content = $response->getContent();
1048+
If you do not call any of these 3 methods at all, the exception will still be thrown
1049+
when the ``$response`` object is destructed.
10501050

1051-
// pass FALSE as the optional argument to not throw an exception and return
1052-
// instead the original response content (even if it's an error message)
1053-
$content = $response->getContent(false);
1051+
Calling ``$response->getStatusCode()`` is enough to disable this behavior
1052+
(but then don't miss checking the status code yourself).
10541053

10551054
While responses are lazy, their destructor will always wait for headers to come
10561055
back. This means that the following request *will* complete; and if e.g. a 404

notifier.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -655,7 +655,7 @@ The
655655
:class:`Symfony\\Component\\Notifier\\Notification\\SmsNotificationInterface`
656656
and
657657
:class:`Symfony\\Component\\Notifier\\Notification\\EmailNotificationInterface`
658-
also exists to modify messages send to those channels.
658+
also exists to modify messages sent to those channels.
659659

660660
Disabling Delivery
661661
------------------

page_creation.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,13 +81,13 @@ If you see a lucky number being printed back to you, congratulations! But before
8181
you run off to play the lottery, check out how this works. Remember the two steps
8282
to creating a page?
8383

84+
#. *Create a controller and a method*: This is a function where *you* build the page and ultimately
85+
return a ``Response`` object. You'll learn more about :doc:`controllers </controller>`
86+
in their own section, including how to return JSON responses;
87+
8488
#. *Create a route*: In ``config/routes.yaml``, the route defines the URL to your
8589
page (``path``) and what ``controller`` to call. You'll learn more about :doc:`routing </routing>`
86-
in its own section, including how to make *variable* URLs;
87-
88-
#. *Create a controller*: This is a function where *you* build the page and ultimately
89-
return a ``Response`` object. You'll learn more about :doc:`controllers </controller>`
90-
in their own section, including how to return JSON responses.
90+
in its own section, including how to make *variable* URLs.
9191

9292
.. _annotation-routes:
9393

0 commit comments

Comments
 (0)