Skip to content

Commit bdc6c3f

Browse files
committed
Merge branch '2.4'
Conflicts: components/options_resolver.rst
2 parents 7e75b64 + c483ac6 commit bdc6c3f

30 files changed

+266
-110
lines changed

book/forms.rst

+1
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ going to need to build a form. But before you begin, first focus on the generic
4848
{
4949
return $this->dueDate;
5050
}
51+
5152
public function setDueDate(\DateTime $dueDate = null)
5253
{
5354
$this->dueDate = $dueDate;

book/http_cache.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -795,13 +795,13 @@ Gateway caches are a great way to make your website perform better. But they
795795
have one limitation: they can only cache whole pages. If you can't cache
796796
whole pages or if parts of a page has "more" dynamic parts, you are out of
797797
luck. Fortunately, Symfony2 provides a solution for these cases, based on a
798-
technology called `ESI`_, or Edge Side Includes. Akamaï wrote this specification
798+
technology called `ESI`_, or Edge Side Includes. Akamai wrote this specification
799799
almost 10 years ago, and it allows specific parts of a page to have a different
800800
caching strategy than the main page.
801801

802802
The ESI specification describes tags you can embed in your pages to communicate
803803
with the gateway cache. Only one tag is implemented in Symfony2, ``include``,
804-
as this is the only useful one outside of Akamaï context:
804+
as this is the only useful one outside of Akamai context:
805805

806806
.. code-block:: html
807807

@@ -936,7 +936,7 @@ used ``render``.
936936

937937
.. note::
938938

939-
Symfony2 detects if a gateway cache supports ESI via another Akamaï
939+
Symfony2 detects if a gateway cache supports ESI via another Akamai
940940
specification that is supported out of the box by the Symfony2 reverse
941941
proxy.
942942

book/includes/_service_container_my_mailer.rst.inc

+2-3
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@
1616
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1717
xsi:schemaLocation="http://symfony.com/schema/dic/services
1818
http://symfony.com/schema/dic/services/services-1.0.xsd"
19-
>
20-
19+
>
2120
<services>
2221
<service id="my_mailer" class="Acme\HelloBundle\Mailer">
2322
<argument>sendmail</argument>
@@ -33,4 +32,4 @@
3332
$container->setDefinition('my_mailer', new Definition(
3433
'Acme\HelloBundle\Mailer',
3534
array('sendmail')
36-
));
35+
));

book/security.rst

+6-6
Original file line numberDiff line numberDiff line change
@@ -764,13 +764,13 @@ is used to enforce access.
764764
Each ``access_control`` has several options that configure two different
765765
things:
766766

767-
* (a) :ref:`should the incoming request match this access control entry <security-book-access-control-matching-options>`
768-
* (b) :ref:`once it matches, should some sort of access restriction be enforced <security-book-access-control-enforcement-options>`:
767+
#. :ref:`should the incoming request match this access control entry <security-book-access-control-matching-options>`
768+
#. :ref:`once it matches, should some sort of access restriction be enforced <security-book-access-control-enforcement-options>`:
769769

770770
.. _security-book-access-control-matching-options:
771771

772-
(a) Matching Options
773-
....................
772+
1. Matching Options
773+
...................
774774

775775
Symfony2 creates an instance of :class:`Symfony\\Component\\HttpFoundation\\RequestMatcher`
776776
for each ``access_control`` entry, which determines whether or not a given
@@ -865,8 +865,8 @@ will match any ``ip``, ``host`` or ``method``:
865865

866866
.. _security-book-access-control-enforcement-options:
867867

868-
(b) Access Enforcement
869-
......................
868+
2. Access Enforcement
869+
.....................
870870

871871
Once Symfony2 has decided which ``access_control`` entry matches (if any),
872872
it then *enforces* access restrictions based on the ``roles`` and ``requires_channel``

book/service_container.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ for you. In order for this to work, you must *teach* the container how to
103103
create the ``Mailer`` service. This is done via configuration, which can
104104
be specified in YAML, XML or PHP:
105105

106-
.. include includes/_service_container_my_mailer.rst.inc
106+
.. include:: includes/_service_container_my_mailer.rst.inc
107107

108108
.. note::
109109

@@ -643,7 +643,7 @@ which has a ``getMailerMethod()`` method on it, which will return a string
643643
like ``sendmail`` based on some configuration. Remember that the first argument
644644
to the ``my_mailer`` service is the simple string ``sendmail``:
645645

646-
.. include includes/_service_container_my_mailer.rst.inc
646+
.. include:: includes/_service_container_my_mailer.rst.inc
647647

648648
But instead of hardcoding this, how could we get this value from the ``getMailerMethod()``
649649
of the new ``mailer_configuration`` service? One way is to use an expression:
@@ -874,7 +874,7 @@ Now, just inject the ``request_stack``, which behaves like any normal service:
874874
# src/Acme/HelloBundle/Resources/config/services.yml
875875
services:
876876
newsletter_manager:
877-
class: "Acme\HelloBundle\Newsletter\NewsletterManager"
877+
class: Acme\HelloBundle\Newsletter\NewsletterManager
878878
arguments: ["@request_stack"]
879879
880880
.. code-block:: xml

book/translation.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ key ``Symfony2 is great``. To find the French translation, Symfony actually
392392
checks translation resources for several different locales:
393393

394394
1. First, Symfony looks for the translation in a ``fr_FR`` translation resource
395-
(e.g. ``messages.fr_FR.xfliff``);
395+
(e.g. ``messages.fr_FR.xliff``);
396396

397397
2. If it wasn't found, Symfony looks for the translation in a ``fr`` translation
398398
resource (e.g. ``messages.fr.xliff``);

components/config/definition.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -390,8 +390,8 @@ process is used to remove some of the differences that result from different
390390
configuration formats, mainly the differences between YAML and XML.
391391

392392
The separator used in keys is typically ``_`` in YAML and ``-`` in XML. For
393-
example, ``auto_connect`` in YAML and ``auto-connect``. The normalization would
394-
make both of these ``auto_connect``.
393+
example, ``auto_connect`` in YAML and ``auto-connect`` in XML.
394+
The normalization would make both of these ``auto_connect``.
395395

396396
.. caution::
397397

components/console/helpers/dialoghelper.rst

+10-6
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ helper set, which you can get by calling
1212
$dialog = $this->getHelperSet()->get('dialog');
1313

1414
All the methods inside the Dialog Helper have an
15-
:class:`Symfony\\Component\\Console\\Output\\OutputInterface` as first the
16-
argument, the question as the second argument and the default value as last
15+
:class:`Symfony\\Component\\Console\\Output\\OutputInterface` as the first
16+
argument, the question as the second argument and the default value as the last
1717
argument.
1818

1919
Asking the User for confirmation
@@ -52,8 +52,9 @@ if you want to know a bundle name, you can add this to your command::
5252
);
5353

5454
The user will be asked "Please enter the name of the bundle". They can type
55-
some name which will be returned by the ``ask`` method. If they leave it empty,
56-
the default value (``AcmeDemoBundle`` here) is returned.
55+
some name which will be returned by the
56+
:method:`Symfony\\Component\\Console\\Helper\\DialogHelper::ask` method.
57+
If they leave it empty, the default value (``AcmeDemoBundle`` here) is returned.
5758

5859
Autocompletion
5960
~~~~~~~~~~~~~~
@@ -222,9 +223,12 @@ this set the seventh argument to ``true``::
222223
return $colors[$c];
223224
}, $selected);
224225

225-
$output->writeln('You have just selected: ' . implode(', ', $selectedColors));
226+
$output->writeln(
227+
'You have just selected: ' . implode(', ', $selectedColors)
228+
);
226229

227-
Now, when the user enters ``1,2``, the result will be: ``You have just selected: blue, yellow``.
230+
Now, when the user enters ``1,2``, the result will be:
231+
``You have just selected: blue, yellow``.
228232

229233
Testing a Command which expects input
230234
-------------------------------------

components/console/introduction.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ method returns without actually printing.
233233
The MonologBridge provides a :class:`Symfony\\Bridge\\Monolog\\Handler\\ConsoleHandler`
234234
class that allows you to display messages on the console. This is cleaner
235235
than wrapping your output calls in conditions. For an example use in
236-
the Symfony Framework, see :doc:/cookbook/logging/monolog_console.
236+
the Symfony Framework, see :doc:`/cookbook/logging/monolog_console`.
237237

238238
Using Command Arguments
239239
-----------------------

components/dependency_injection/parameters.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ keywords (respectively ``true``, ``false`` and ``null``):
295295
.. code-block:: xml
296296
297297
<parameters>
298-
<parameter key="mailer.send_all_in_once">false</parameters>
298+
<parameter key="mailer.send_all_in_once">false</parameter>
299299
</parameters>
300300
301301
<!-- after parsing

components/dependency_injection/tags.rst

-3
Original file line numberDiff line numberDiff line change
@@ -199,9 +199,6 @@ To begin with, change the ``TransportChain`` class::
199199
if (array_key_exists($alias, $this->transports)) {
200200
return $this->transports[$alias];
201201
}
202-
else {
203-
return;
204-
}
205202
}
206203
}
207204

components/dom_crawler.rst

+9-7
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,11 @@ interacting with html links and forms as you traverse through the HTML tree.
5555
.. note::
5656

5757
The DomCrawler will attempt to automatically fix your HTML to match the
58-
official specification. For example, if you nest a `` <p>`` tag inside
59-
another `` <p>`` tag, it will be moved to be a sibling of the parent tag.
58+
official specification. For example, if you nest a ``<p>`` tag inside
59+
another ``<p>`` tag, it will be moved to be a sibling of the parent tag.
6060
This is expected and is part of the HTML5 spec. But if you're getting
6161
unexpected behavior, this could be a cause. And while the DomCrawler
62-
isn't meant to dump content, you can see the "fixed" version if your HTML
62+
isn't meant to dump content, you can see the "fixed" version of your HTML
6363
by :ref:`dumping it <component-dom-crawler-dumping>`.
6464

6565
Node Filtering
@@ -83,10 +83,12 @@ Anonymous function can be used to filter with more complex criteria::
8383
use Symfony\Component\DomCrawler\Crawler;
8484
// ...
8585

86-
$crawler = $crawler->filter('body > p')->reduce(function (Crawler $node, $i) {
87-
// filter even nodes
88-
return ($i % 2) == 0;
89-
});
86+
$crawler = $crawler
87+
->filter('body > p')
88+
->reduce(function (Crawler $node, $i) {
89+
// filter even nodes
90+
return ($i % 2) == 0;
91+
});
9092

9193
To remove a node the anonymous function must return false.
9294

components/event_dispatcher/introduction.rst

+14-12
Original file line numberDiff line numberDiff line change
@@ -441,30 +441,31 @@ which returns a boolean value::
441441
EventDispatcher aware Events and Listeners
442442
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
443443

444-
The ``EventDispatcher`` always injects a reference to itself in the passed event
445-
object. This means that all listeners have direct access to the
446-
``EventDispatcher`` object that notified the listener via the passed ``Event``
447-
object's :method:`Symfony\\Component\\EventDispatcher\\Event::getDispatcher`
448-
method.
444+
.. versionadded:: 2.4
445+
Since Symfony 2.4 the current event name and the ``EventDispatcher``
446+
itself are passed to the listeners as additional arguments.
449447

450-
This can lead to some advanced applications of the ``EventDispatcher`` including
451-
letting listeners dispatch other events, event chaining or even lazy loading of
452-
more listeners into the dispatcher object. Examples follow:
448+
The ``EventDispatcher`` always passes the dispatched event, the event's name
449+
and a reference to itself to the listeners. This can be used in some advanced
450+
usages of the ``EventDispatcher`` like dispatching other events in listeners,
451+
event chaining or even lazy loading of more listeners into the dispatcher
452+
object as shown in the following examples.
453453

454454
Lazy loading listeners::
455455

456456
use Symfony\Component\EventDispatcher\Event;
457+
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
457458
use Acme\StoreBundle\Event\StoreSubscriber;
458459

459460
class Foo
460461
{
461462
private $started = false;
462463

463-
public function myLazyListener(Event $event)
464+
public function myLazyListener(Event $event, $eventName, EventDispatcherInterface $dispatcher)
464465
{
465466
if (false === $this->started) {
466467
$subscriber = new StoreSubscriber();
467-
$event->getDispatcher()->addSubscriber($subscriber);
468+
$dispatcher->addSubscriber($subscriber);
468469
}
469470

470471
$this->started = true;
@@ -476,12 +477,13 @@ Lazy loading listeners::
476477
Dispatching another event from within a listener::
477478

478479
use Symfony\Component\EventDispatcher\Event;
480+
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
479481

480482
class Foo
481483
{
482-
public function myFooListener(Event $event)
484+
public function myFooListener(Event $event, $eventName, EventDispatcherInterface $dispatcher)
483485
{
484-
$event->getDispatcher()->dispatch('log', $event);
486+
$dispatcher->dispatch('log', $event);
485487

486488
// ... more code
487489
}

components/expression_language/caching.rst

+3-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,9 @@ Both ``evaluate()`` and ``compile()`` can handle ``ParsedExpression`` and
6363
use Symfony\Component\ExpressionLanguage\SerializedParsedExpression;
6464
// ...
6565
66-
$expression = new SerializedParsedExpression(serialize($language->parse('1 + 4')));
66+
$expression = new SerializedParsedExpression(
67+
serialize($language->parse('1 + 4'))
68+
);
6769
6870
echo $language->evaluate($expression); // prints 5
6971

0 commit comments

Comments
 (0)