Skip to content

Commit 006a29d

Browse files
committed
Merge branch '5.3' into 5.4
* 5.3: 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 f801108 + c661fb2 commit 006a29d

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
@@ -1063,20 +1063,19 @@ There are three types of exceptions, all of which implement the
10631063
are thrown when a content-type cannot be decoded to the expected representation.
10641064

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

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

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

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

10811080
While responses are lazy, their destructor will always wait for headers to come
10821081
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
@@ -705,7 +705,7 @@ The
705705
:class:`Symfony\\Component\\Notifier\\Notification\\SmsNotificationInterface`
706706
and
707707
:class:`Symfony\\Component\\Notifier\\Notification\\EmailNotificationInterface`
708-
also exists to modify messages send to those channels.
708+
also exists to modify messages sent to those channels.
709709

710710
Disabling Delivery
711711
------------------

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)