Skip to content

Commit b9768c7

Browse files
committed
Merge branch '3.4' into 4.1
* 3.4: [symfony#10545] minor tweaks for the example Update form.rst Update service_decoration.rst Rename content_type header to content-type Reduce potential confusion in priority explanation [standards] Document "phpdoc_types_order"
2 parents 26b5648 + d07a5b9 commit b9768c7

File tree

7 files changed

+27
-17
lines changed

7 files changed

+27
-17
lines changed

components/event_dispatcher.rst

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -146,11 +146,10 @@ The ``addListener()`` method takes up to three arguments:
146146

147147
#. The event name (string) that this listener wants to listen to;
148148
#. A PHP callable that will be executed when the specified event is dispatched;
149-
#. An optional priority integer (higher equals more important and therefore
150-
that the listener will be triggered earlier) that determines when a listener
151-
is triggered versus other listeners (defaults to ``0``). If two listeners
152-
have the same priority, they are executed in the order that they were
153-
added to the dispatcher.
149+
#. An optional priority, defined as a positive or negative integer (defaults to
150+
``0``). The higher the priority, the earlier the listener is called. If two
151+
listeners have the same priority, they are executed in the order that they
152+
were added to the dispatcher.
154153

155154
.. note::
156155

components/form.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,13 @@ the CSRF generator and validated when binding the form.
155155
$csrfStorage = new NativeSessionTokenStorage();
156156
// ...
157157

158+
You can disable CSRF protection per form using the ``csrf_protection`` option::
159+
160+
use Symfony\\Component\\Form\\Extension\\Core\\Type\\FormType
161+
162+
$form = $formFactory->createBuilder(FormType::class, null, ['csrf_protection' => false])
163+
->getForm();
164+
158165
Twig Templating
159166
~~~~~~~~~~~~~~~
160167

contributing/code/standards.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,10 @@ Structure
194194

195195
* Do not use spaces around ``[`` offset accessor and before ``]`` offset accessor;
196196

197-
* Add a ``use`` statement for every class that is not part of the global namespace.
197+
* Add a ``use`` statement for every class that is not part of the global namespace;
198+
199+
* When PHPDoc tags like ``@param`` or ``@return`` include ``null`` and other
200+
types, always place ``null`` at the end of the list of types.
198201

199202
Naming Conventions
200203
~~~~~~~~~~~~~~~~~~

controller.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,7 @@ the ``Request`` class::
522522

523523
// retrieves an HTTP request header, with normalized, lowercase keys
524524
$request->headers->get('host');
525-
$request->headers->get('content_type');
525+
$request->headers->get('content-type');
526526
}
527527

528528
The ``Request`` class has several public properties and methods that return any

create_framework/http_foundation.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ fingertips thanks to a nice and simple API::
192192

193193
// retrieve an HTTP request header, with normalized, lowercase keys
194194
$request->headers->get('host');
195-
$request->headers->get('content_type');
195+
$request->headers->get('content-type');
196196

197197
$request->getMethod(); // GET, POST, PUT, DELETE, HEAD
198198
$request->getLanguages(); // an array of languages the client accepts

introduction/http_fundamentals.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ have all the request information at your fingertips::
231231

232232
// retrieves an HTTP request header, with normalized, lowercase keys
233233
$request->headers->get('host');
234-
$request->headers->get('content_type');
234+
$request->headers->get('content-type');
235235

236236
$request->getMethod(); // e.g. GET, POST, PUT, DELETE or HEAD
237237
$request->getLanguages(); // an array of languages the client accepts

service_container/service_decoration.rst

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
How to Decorate Services
55
========================
66

7-
When overriding an existing definition (e.g. when applying the `Decorator pattern`_),
8-
the original service is lost:
7+
When overriding an existing definition, the original service is lost:
98

109
.. configuration-block::
1110

@@ -18,7 +17,7 @@ the original service is lost:
1817
# this replaces the old App\Mailer definition with the new one, the
1918
# old definition is lost
2019
App\Mailer:
21-
class: App\DecoratingMailer
20+
class: App\NewMailer
2221
2322
.. code-block:: xml
2423
@@ -33,25 +32,27 @@ the original service is lost:
3332
3433
<!-- this replaces the old App\Mailer definition with the new
3534
one, the old definition is lost -->
36-
<service id="App\Mailer" class="App\DecoratingMailer" />
35+
<service id="App\Mailer" class="App\NewMailer" />
3736
</services>
3837
</container>
3938
4039
.. code-block:: php
4140
4241
// config/services.php
4342
use App\Mailer;
44-
use App\DecoratingMailer;
43+
use App\NewMailer;
4544
4645
$container->register(Mailer::class);
4746
4847
// this replaces the old App\Mailer definition with the new one, the
4948
// old definition is lost
50-
$container->register(Mailer::class, DecoratingMailer::class);
49+
$container->register(Mailer::class, NewMailer::class);
5150
5251
Most of the time, that's exactly what you want to do. But sometimes,
53-
you might want to decorate the old service instead and keep the old service so
54-
that you can reference it:
52+
you might want to decorate the old one instead (i.e. apply the `Decorator pattern`_).
53+
In this case, the old service should be kept around to be able to reference
54+
it in the new one. This configuration replaces ``App\Mailer`` with a new one,
55+
but keeps a reference of the old one as ``App\DecoratingMailer.inner``:
5556

5657
.. configuration-block::
5758

0 commit comments

Comments
 (0)