Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0c8840b

Browse files
committed
Merge branch '2.0' into 2.1
2 parents d47a3c7 + 56bdd04 commit 0c8840b

24 files changed

+710
-71
lines changed

components/console/helpers/dialoghelper.rst

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@
44
Dialog Helper
55
=============
66

7-
The Dialog Helper provides functions to ask the user for more information.
8-
It is included in the default helper set, which you can get
9-
by calling :method:`Symfony\\Component\\Console\\Command\\Command::getHelperSet`::
7+
The :class:`Symfony\\Component\\Console\\Helper\\DialogHelper` provides
8+
functions to ask the user for more information. It is included in the default
9+
helper set, which you can get by calling
10+
:method:`Symfony\\Component\\Console\\Command\\Command::getHelperSet`::
1011

1112
$dialog = $this->getHelperSet()->get('dialog');
1213

@@ -19,7 +20,7 @@ Asking the User for confirmation
1920
--------------------------------
2021

2122
Suppose you want to confirm an action before actually executing it. Add
22-
the following to you command::
23+
the following to your command::
2324

2425
// ...
2526
if (!$dialog->askConfirmation(

components/console/helpers/formatterhelper.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ The Formatter helpers provides functions to format the output with colors.
88
You can do more advanced things with this helper than you can in
99
:ref:`components-console-coloring`.
1010

11-
The ``formatter`` helper is included in the default helper set, which you can
12-
get by calling
11+
The :class:`Symfony\\Component\\Console\\Helper\\FormatterHelper` is included
12+
in the default helper set, which you can get by calling
1313
:method:`Symfony\\Component\\Console\\Command\\Command::getHelperSet`::
1414

1515
$formatter = $this->getHelperSet()->get('formatter');

components/console/introduction.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,15 @@ You can install the component in many different ways:
2020
* Use the official Git repository (https://github.com/symfony/Console);
2121
* :doc:`Install it via Composer</components/using_components>` (``symfony/console`` on `Packagist`_).
2222

23+
.. note::
24+
25+
Windows does not support ANSI colors by default so the Console Component detects and
26+
disables colors where Windows does not have support. However, if Windows is not
27+
configured with an ANSI driver and your console commands invoke other scripts which
28+
emit ANSI color sequences, they will be shown as raw escape characters.
29+
30+
To enable ANSI colour support for Windows, please install `ANSICON_`.
31+
2332
Creating a basic Command
2433
------------------------
2534

@@ -399,3 +408,4 @@ Learn More!
399408
* :doc:`/components/console/single_command_tool`
400409

401410
.. _Packagist: https://packagist.org/packages/symfony/console
411+
.. _ANSICON: http://adoxa.3eeweb.com/ansicon/

components/dependency_injection/introduction.rst

Lines changed: 35 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,7 @@ Basic Usage
2323
-----------
2424

2525
You might have a simple class like the following ``Mailer`` that
26-
you want to make available as a service:
27-
28-
.. code-block:: php
26+
you want to make available as a service::
2927

3028
class Mailer
3129
{
@@ -39,9 +37,7 @@ you want to make available as a service:
3937
// ...
4038
}
4139

42-
You can register this in the container as a service:
43-
44-
.. code-block:: php
40+
You can register this in the container as a service::
4541

4642
use Symfony\Component\DependencyInjection\ContainerBuilder;
4743

@@ -50,9 +46,7 @@ You can register this in the container as a service:
5046

5147
An improvement to the class to make it more flexible would be to allow
5248
the container to set the ``transport`` used. If you change the class
53-
so this is passed into the constructor:
54-
55-
.. code-block:: php
49+
so this is passed into the constructor::
5650

5751
class Mailer
5852
{
@@ -66,14 +60,13 @@ so this is passed into the constructor:
6660
// ...
6761
}
6862

69-
Then you can set the choice of transport in the container:
70-
71-
.. code-block:: php
63+
Then you can set the choice of transport in the container::
7264

7365
use Symfony\Component\DependencyInjection\ContainerBuilder;
7466

7567
$container = new ContainerBuilder();
76-
$container->register('mailer', 'Mailer')
68+
$container
69+
->register('mailer', 'Mailer')
7770
->addArgument('sendmail');
7871

7972
This class is now much more flexible as you have separated the choice of
@@ -82,66 +75,56 @@ transport out of the implementation and into the container.
8275
Which mail transport you have chosen may be something other services need to
8376
know about. You can avoid having to change it in multiple places by making
8477
it a parameter in the container and then referring to this parameter for the
85-
``Mailer`` service's constructor argument:
86-
87-
88-
.. code-block:: php
78+
``Mailer`` service's constructor argument::
8979

9080
use Symfony\Component\DependencyInjection\ContainerBuilder;
9181

9282
$container = new ContainerBuilder();
9383
$container->setParameter('mailer.transport', 'sendmail');
94-
$container->register('mailer', 'Mailer')
84+
$container
85+
->register('mailer', 'Mailer')
9586
->addArgument('%mailer.transport%');
9687

9788
Now that the ``mailer`` service is in the container you can inject it as
9889
a dependency of other classes. If you have a ``NewsletterManager`` class
99-
like this:
100-
101-
.. code-block:: php
102-
103-
use Mailer;
90+
like this::
10491

10592
class NewsletterManager
10693
{
10794
private $mailer;
10895

109-
public function __construct(Mailer $mailer)
96+
public function __construct(\Mailer $mailer)
11097
{
11198
$this->mailer = $mailer;
11299
}
113100

114101
// ...
115102
}
116103

117-
Then you can register this as a service as well and pass the ``mailer`` service into it:
118-
119-
.. code-block:: php
104+
Then you can register this as a service as well and pass the ``mailer`` service into it::
120105

121106
use Symfony\Component\DependencyInjection\ContainerBuilder;
122107
use Symfony\Component\DependencyInjection\Reference;
123108

124109
$container = new ContainerBuilder();
125110

126111
$container->setParameter('mailer.transport', 'sendmail');
127-
$container->register('mailer', 'Mailer')
112+
$container
113+
->register('mailer', 'Mailer')
128114
->addArgument('%mailer.transport%');
129115

130-
$container->register('newsletter_manager', 'NewsletterManager')
131-
->addArgument(new Reference('mailer');
116+
$container
117+
->register('newsletter_manager', 'NewsletterManager')
118+
->addArgument(new Reference('mailer'));
132119

133120
If the ``NewsletterManager`` did not require the ``Mailer`` and injecting
134-
it was only optional then you could use setter injection instead:
135-
136-
.. code-block:: php
137-
138-
use Mailer;
121+
it was only optional then you could use setter injection instead::
139122

140123
class NewsletterManager
141124
{
142125
private $mailer;
143126

144-
public function setMailer(Mailer $mailer)
127+
public function setMailer(\Mailer $mailer)
145128
{
146129
$this->mailer = $mailer;
147130
}
@@ -150,26 +133,24 @@ it was only optional then you could use setter injection instead:
150133
}
151134

152135
You can now choose not to inject a ``Mailer`` into the ``NewsletterManager``.
153-
If you do want to though then the container can call the setter method:
154-
155-
.. code-block:: php
136+
If you do want to though then the container can call the setter method::
156137

157138
use Symfony\Component\DependencyInjection\ContainerBuilder;
158139
use Symfony\Component\DependencyInjection\Reference;
159140

160141
$container = new ContainerBuilder();
161142

162143
$container->setParameter('mailer.transport', 'sendmail');
163-
$container->register('mailer', 'Mailer')
144+
$container
145+
->register('mailer', 'Mailer')
164146
->addArgument('%mailer.transport%');
165147

166-
$container->register('newsletter_manager', 'NewsletterManager')
167-
->addMethodCall('setMailer', new Reference('mailer');
148+
$container
149+
->register('newsletter_manager', 'NewsletterManager')
150+
->addMethodCall('setMailer', new Reference('mailer'));
168151

169152
You could then get your ``newsletter_manager`` service from the container
170-
like this:
171-
172-
.. code-block:: php
153+
like this::
173154

174155
use Symfony\Component\DependencyInjection\ContainerBuilder;
175156
use Symfony\Component\DependencyInjection\Reference;
@@ -201,9 +182,7 @@ Setting Up the Container with Configuration Files
201182
As well as setting up the services using PHP as above you can also use configuration
202183
files. To do this you also need to install :doc:`the Config Component</components/config/introduction>`.
203184

204-
Loading an XML config file:
205-
206-
.. code-block:: php
185+
Loading an XML config file::
207186

208187
use Symfony\Component\DependencyInjection\ContainerBuilder;
209188
use Symfony\Component\Config\FileLocator;
@@ -213,9 +192,7 @@ Loading an XML config file:
213192
$loader = new XmlFileLoader($container, new FileLocator(__DIR__));
214193
$loader->load('services.xml');
215194

216-
Loading a YAML config file:
217-
218-
.. code-block:: php
195+
Loading a YAML config file::
219196

220197
use Symfony\Component\DependencyInjection\ContainerBuilder;
221198
use Symfony\Component\Config\FileLocator;
@@ -276,10 +253,12 @@ The ``newsletter_manager`` and ``mailer`` services can be set up using config fi
276253
277254
// ...
278255
$container->setParameter('mailer.transport', 'sendmail');
279-
$container->register('mailer', 'Mailer')
280-
->addArgument('%mailer.transport%');
256+
$container
257+
->register('mailer', 'Mailer')
258+
->addArgument('%mailer.transport%');
281259
282-
$container->register('newsletter_manager', 'NewsletterManager')
283-
->addMethodCall('setMailer', new Reference('mailer');
260+
$container
261+
->register('newsletter_manager', 'NewsletterManager')
262+
->addMethodCall('setMailer', new Reference('mailer'));
284263
285-
.. _Packagist: https://packagist.org/packages/symfony/dependency-injection
264+
.. _Packagist: https://packagist.org/packages/symfony/dependency-injection

components/dependency_injection/types.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ the dependency::
2323
{
2424
protected $mailer;
2525

26-
public function __construct(Mailer $mailer)
26+
public function __construct(\Mailer $mailer)
2727
{
2828
$this->mailer = $mailer;
2929
}
@@ -101,7 +101,7 @@ accepts the dependency::
101101
{
102102
protected $mailer;
103103

104-
public function setMailer(Mailer $mailer)
104+
public function setMailer(\Mailer $mailer)
105105
{
106106
$this->mailer = $mailer;
107107
}

components/event_dispatcher/introduction.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ The Symfony2 Event Dispatcher component implements the `Observer`_ pattern in
2424
a simple and effective way to make all these things possible and to make your
2525
projects truly extensible.
2626

27-
Take a simple example from the `Symfony2 HttpKernel component`_. Once a
27+
Take a simple example from the :doc:`/components/http_kernel/introduction`. Once a
2828
``Response`` object has been created, it may be useful to allow other elements
2929
in the system to modify it (e.g. add some cache headers) before it's actually
3030
used. To make this possible, the Symfony2 kernel throws an event -
@@ -592,7 +592,6 @@ part of the listener's processing logic::
592592
}
593593

594594
.. _Observer: http://en.wikipedia.org/wiki/Observer_pattern
595-
.. _`Symfony2 HttpKernel component`: https://github.com/symfony/HttpKernel
596595
.. _Closures: http://php.net/manual/en/functions.anonymous.php
597596
.. _PHP callable: http://www.php.net/manual/en/language.pseudo-types.php#language.types.callback
598597
.. _Packagist: https://packagist.org/packages/symfony/event-dispatcher

components/http_kernel/index.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
HTTP Kernel
2+
===========
3+
4+
.. toctree::
5+
:maxdepth: 2
6+
7+
introduction

0 commit comments

Comments
 (0)