Skip to content

Commit 951f1fa

Browse files
Fixing line length to avoid horizontal scrolling in DI component
1 parent 2c3d526 commit 951f1fa

File tree

2 files changed

+49
-14
lines changed

2 files changed

+49
-14
lines changed

components/dependency_injection/compilation.rst

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,10 @@ A very simple extension may just load configuration files into the container::
5959
{
6060
public function load(array $configs, ContainerBuilder $container)
6161
{
62-
$loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
62+
$loader = new XmlFileLoader(
63+
$container,
64+
new FileLocator(__DIR__.'/../Resources/config')
65+
);
6366
$loader->load('services.xml');
6467
}
6568

@@ -223,7 +226,10 @@ but also load a secondary one only if a certain parameter is set::
223226
$processor = new Processor();
224227
$config = $processor->processConfiguration($configuration, $configs);
225228

226-
$loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
229+
$loader = new XmlFileLoader(
230+
$container,
231+
new FileLocator(__DIR__.'/../Resources/config')
232+
);
227233
$loader->load('services.xml');
228234

229235
if ($config['advanced']) {
@@ -305,7 +311,10 @@ For example, to run your custom pass after the default removal passes have been
305311
use Symfony\Component\DependencyInjection\Compiler\PassConfig;
306312

307313
$container = new ContainerBuilder();
308-
$container->addCompilerPass(new CustomCompilerPass, PassConfig::TYPE_AFTER_REMOVING);
314+
$container->addCompilerPass(
315+
new CustomCompilerPass,
316+
PassConfig::TYPE_AFTER_REMOVING
317+
);
309318

310319
Dumping the Configuration for Performance
311320
-----------------------------------------
@@ -351,7 +360,10 @@ it::
351360
$container->compile();
352361

353362
$dumper = new PhpDumper($container);
354-
file_put_contents($file, $dumper->dump(array('class' => 'MyCachedContainer')));
363+
file_put_contents(
364+
$file,
365+
$dumper->dump(array('class' => 'MyCachedContainer'))
366+
);
355367
}
356368

357369
You will now get the speed of the PHP configured container with the ease of using
@@ -380,7 +392,10 @@ but getting an up to date configuration whilst developing your application::
380392

381393
if (!$isDebug) {
382394
$dumper = new PhpDumper($container);
383-
file_put_contents($file, $dumper->dump(array('class' => 'MyCachedContainer')));
395+
file_put_contents(
396+
$file,
397+
$dumper->dump(array('class' => 'MyCachedContainer'))
398+
);
384399
}
385400
}
386401

components/dependency_injection/tags.rst

Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -128,14 +128,24 @@ custom tag::
128128
{
129129
public function process(ContainerBuilder $container)
130130
{
131-
if (false === $container->hasDefinition('acme_mailer.transport_chain')) {
131+
if (false === $container->hasDefinition(
132+
'acme_mailer.transport_chain'
133+
)) {
132134
return;
133135
}
134136

135-
$definition = $container->getDefinition('acme_mailer.transport_chain');
136-
137-
foreach ($container->findTaggedServiceIds('acme_mailer.transport') as $id => $attributes) {
138-
$definition->addMethodCall('addTransport', array(new Reference($id)));
137+
$definition = $container->getDefinition(
138+
'acme_mailer.transport_chain'
139+
);
140+
141+
$taggedServices = $container->findTaggedServiceIds(
142+
'acme_mailer.transport'
143+
);
144+
foreach ($taggedServices as $id => $attributes) {
145+
$definition->addMethodCall(
146+
'addTransport',
147+
array(new Reference($id))
148+
);
139149
}
140150
}
141151
}
@@ -242,15 +252,25 @@ use this, update the compiler::
242252
{
243253
public function process(ContainerBuilder $container)
244254
{
245-
if (false === $container->hasDefinition('acme_mailer.transport_chain')) {
255+
if (false === $container->hasDefinition(
256+
'acme_mailer.transport_chain')
257+
) {
246258
return;
247259
}
248260

249-
$definition = $container->getDefinition('acme_mailer.transport_chain');
261+
$definition = $container->getDefinition(
262+
'acme_mailer.transport_chain'
263+
);
250264

251-
foreach ($container->findTaggedServiceIds('acme_mailer.transport') as $id => $tagAttributes) {
265+
$taggedServices = $container->findTaggedServiceIds(
266+
'acme_mailer.transport'
267+
);
268+
foreach ($taggedServices as $id => $tagAttributes) {
252269
foreach ($tagAttributes as $attributes) {
253-
$definition->addMethodCall('addTransport', array(new Reference($id), $attributes["alias"]));
270+
$definition->addMethodCall(
271+
'addTransport',
272+
array(new Reference($id), $attributes["alias"])
273+
);
254274
}
255275
}
256276
}

0 commit comments

Comments
 (0)