Skip to content

Commit 4216289

Browse files
GuilhemNxabbuh
authored andcommitted
Use the short Yaml syntax for service definition
1 parent f9dafd6 commit 4216289

19 files changed

+42
-76
lines changed

best_practices/security.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -339,8 +339,7 @@ To enable the security voter in the application, define a new service:
339339
class: AppBundle\Security\PostVoter
340340
arguments: ['@security.access.decision_manager']
341341
public: false
342-
tags:
343-
- { name: security.voter }
342+
tags: [security.voter]
344343
345344
Now, you can use the voter with the ``@Security`` annotation:
346345

best_practices/templates.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,7 @@ name is irrelevant because you never use it in your own code):
158158
class: AppBundle\Twig\AppExtension
159159
arguments: ['@app.markdown']
160160
public: false
161-
tags:
162-
- { name: twig.extension }
161+
tags: [twig.extension]
163162
164163
.. _`Twig`: http://twig.sensiolabs.org/
165164
.. _`Parsedown`: http://parsedown.org/

console/commands_as_services.rst

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@ with ``console.command``:
2929
services:
3030
app.command.my_command:
3131
class: AppBundle\Command\MyCommand
32-
tags:
33-
- { name: console.command }
32+
tags: [console.command]
3433
3534
.. code-block:: xml
3635
@@ -89,7 +88,7 @@ store the default value in some ``%command.default_name%`` parameter::
8988
public function __construct($defaultName)
9089
{
9190
$this->defaultName = $defaultName;
92-
91+
9392
parent::__construct();
9493
}
9594

@@ -135,8 +134,7 @@ inject the ``command.default_name`` parameter:
135134
app.command.my_command:
136135
class: AppBundle\Command\MyCommand
137136
arguments: ["%command.default_name%"]
138-
tags:
139-
- { name: console.command }
137+
tags: [console.command]
140138
141139
.. code-block:: xml
142140

form/create_custom_field_type.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -309,8 +309,7 @@ the ``genders`` parameter value as the first argument to its to-be-created
309309
class: AppBundle\Form\Type\GenderType
310310
arguments:
311311
- '%genders%'
312-
tags:
313-
- { name: form.type }
312+
tags: [form.type]
314313
315314
.. code-block:: xml
316315

form/data_transformers.rst

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -300,8 +300,7 @@ Define the form type as a service in your configuration files.
300300
app.form.type.task:
301301
class: AppBundle\Form\Type\TaskType
302302
arguments: ["@doctrine.orm.entity_manager"]
303-
tags:
304-
- { name: form.type }
303+
tags: [form.type]
305304
306305
.. code-block:: xml
307306
@@ -434,8 +433,7 @@ it's recognized as a custom field type:
434433
app.type.issue_selector:
435434
class: AppBundle\Form\IssueSelectorType
436435
arguments: ['@doctrine.orm.entity_manager']
437-
tags:
438-
- { name: form.type }
436+
tags: [form.type]
439437
440438
441439
.. code-block:: xml

form/dynamic_form_modification.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -344,8 +344,7 @@ you need to register it as a service and tag it with :ref:`form.type <dic-tags-f
344344
app.form.friend_message:
345345
class: AppBundle\Form\Type\FriendMessageFormType
346346
arguments: ['@security.token_storage']
347-
tags:
348-
- { name: form.type }
347+
tags: [form.type]
349348
350349
.. code-block:: xml
351350

form/form_dependencies.rst

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ Suppose you need to access the ``doctrine.orm.entity_manager`` service so that y
7575
can make a query. First, add this as an argument to your form class::
7676

7777
// src/AppBundle/Form/TaskType.php
78-
78+
7979
use Doctrine\ORM\EntityManager;
8080
// ...
8181

@@ -102,8 +102,7 @@ Next, register this as a service and tag it with ``form.type``:
102102
app.form.type.task:
103103
class: AppBundle\Form\TaskType
104104
arguments: ['@doctrine.orm.entity_manager']
105-
tags:
106-
- { name: form.type }
105+
tags: [form.type]
107106
108107
.. code-block:: xml
109108

form/type_guesser.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,7 @@ creating a service and tagging it as ``form.type_guesser``:
188188
189189
app.phpdoc_type_guesser:
190190
class: AppBundle\Form\TypeGuesser\PHPDocTypeGuesser
191-
tags:
192-
- { name: form.type_guesser }
191+
tags: [form.type_guesser]
193192
194193
.. code-block:: xml
195194

profiler/data_collector.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,7 @@ To enable a data collector, define it as a regular service and tag it as
9494
app.request_collector:
9595
class: AppBundle\DataCollector\RequestCollector
9696
public: false
97-
tags:
98-
- { name: data_collector }
97+
tags: [data_collector]
9998
10099
.. code-block:: xml
101100

reference/dic_tags.rst

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,7 @@ And then register it as a tagged service:
9393
services:
9494
app.custom_assetic_worker:
9595
class: AppBundle\Assetic\CustomWorker
96-
tags:
97-
- { name: assetic.factory_worker }
96+
tags: [assetic.factory_worker]
9897
9998
.. code-block:: xml
10099
@@ -469,8 +468,7 @@ Then register this class and tag it with ``kernel.cache_clearer``:
469468
services:
470469
my_cache_clearer:
471470
class: AppBundle\Cache\MyClearer
472-
tags:
473-
- { name: kernel.cache_clearer }
471+
tags: [kernel.cache_clearer]
474472
475473
.. code-block:: xml
476474
@@ -640,8 +638,7 @@ configuration and tag it with ``kernel.event_subscriber``:
640638
services:
641639
app.custom_subscriber:
642640
class: AppBundle\EventListener\CustomSubscriber
643-
tags:
644-
- { name: kernel.event_subscriber }
641+
tags: [kernel.event_subscriber]
645642
646643
.. code-block:: xml
647644
@@ -771,8 +768,7 @@ You can add a processor globally:
771768
services:
772769
my_service:
773770
class: Monolog\Processor\IntrospectionProcessor
774-
tags:
775-
- { name: monolog.processor }
771+
tags: [monolog.processor]
776772
777773
.. code-block:: xml
778774
@@ -895,8 +891,7 @@ of your configuration and tag it with ``routing.loader``:
895891
services:
896892
app.custom_routing_loader:
897893
class: AppBundle\Routing\CustomLoader
898-
tags:
899-
- { name: routing.loader }
894+
tags: [routing.loader]
900895
901896
.. code-block:: xml
902897
@@ -1297,8 +1292,7 @@ configuration and tag it with ``twig.extension``:
12971292
services:
12981293
app.twig_extension:
12991294
class: AppBundle\Twig\AppExtension
1300-
tags:
1301-
- { name: twig.extension }
1295+
tags: [twig.extension]
13021296
13031297
.. code-block:: xml
13041298
@@ -1343,8 +1337,7 @@ also have to be added as regular services:
13431337
services:
13441338
twig.extension.intl:
13451339
class: Twig_Extensions_Extension_Intl
1346-
tags:
1347-
- { name: twig.extension }
1340+
tags: [twig.extension]
13481341
13491342
.. code-block:: xml
13501343

0 commit comments

Comments
 (0)