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

Skip to content

Commit c709de5

Browse files
committed
Added deprecating aliases to the various container files
1 parent ec52a09 commit c709de5

File tree

8 files changed

+61
-3
lines changed

8 files changed

+61
-3
lines changed

src/Symfony/Component/DependencyInjection/Tests/Fixtures/config/services9.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@
8787
$s->set('deprecated_service', 'stdClass')
8888
->deprecate();
8989

90+
$s->set('deprecated_service_alias', 'stdClass')
91+
->deprecate('The "%service_id%" service alias is deprecated.');
92+
9093
$s->set('new_factory', 'FactoryClass')
9194
->property('foo', 'bar')
9295
->private();

src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container9.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,11 @@
118118
->setDeprecated(true)
119119
->setPublic(true)
120120
;
121+
$container
122+
->register('deprecated_service_alias', 'stdClass')
123+
->setDeprecated(true, 'The "%service_id%" service alias is deprecated.')
124+
->setPublic(true)
125+
;
121126
$container
122127
->register('new_factory', 'FactoryClass')
123128
->setProperty('foo', 'bar')

src/Symfony/Component/DependencyInjection/Tests/Fixtures/graphviz/services9.dot

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ digraph sc {
2121
node_decorator_service [label="decorator_service\nstdClass\n", shape=record, fillcolor="#eeeeee", style="filled"];
2222
node_decorator_service_with_name [label="decorator_service_with_name\nstdClass\n", shape=record, fillcolor="#eeeeee", style="filled"];
2323
node_deprecated_service [label="deprecated_service\nstdClass\n", shape=record, fillcolor="#eeeeee", style="filled"];
24+
node_deprecated_service_alias [label="deprecated_service_alias\nstdClass\n", shape=record, fillcolor="#eeeeee", style="filled"];
2425
node_new_factory [label="new_factory\nFactoryClass\n", shape=record, fillcolor="#eeeeee", style="filled"];
2526
node_factory_service [label="factory_service\nBar\n", shape=record, fillcolor="#eeeeee", style="filled"];
2627
node_new_factory_service [label="new_factory_service\nFooBarBaz\n", shape=record, fillcolor="#eeeeee", style="filled"];

src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9.php

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ public function __construct()
4040
'decorator_service' => 'getDecoratorServiceService',
4141
'decorator_service_with_name' => 'getDecoratorServiceWithNameService',
4242
'deprecated_service' => 'getDeprecatedServiceService',
43+
'deprecated_service_alias' => 'getDeprecatedServiceAliasService',
4344
'factory_service' => 'getFactoryServiceService',
4445
'factory_service_simple' => 'getFactoryServiceSimpleService',
4546
'factory_simple' => 'getFactorySimpleService',
@@ -175,6 +176,20 @@ protected function getDeprecatedServiceService()
175176
return $this->services['deprecated_service'] = new \stdClass();
176177
}
177178

179+
/**
180+
* Gets the public 'deprecated_service_alias' shared service.
181+
*
182+
* @return \stdClass
183+
*
184+
* @deprecated the "deprecated_service_alias" service alias is deprecated
185+
*/
186+
protected function getDeprecatedServiceAliasService()
187+
{
188+
@trigger_error('The "deprecated_service_alias" service alias is deprecated.', E_USER_DEPRECATED);
189+
190+
return $this->services['deprecated_service_alias'] = new \stdClass();
191+
}
192+
178193
/**
179194
* Gets the public 'factory_service' shared service.
180195
*
@@ -309,7 +324,7 @@ protected function getMethodCall1Service()
309324
if ($this->has('foobaz')) {
310325
$instance->setBar(${($_ = isset($this->services['foobaz']) ? $this->services['foobaz'] : $this->get('foobaz', ContainerInterface::NULL_ON_INVALID_REFERENCE)) && false ?: '_'});
311326
}
312-
$instance->setBar((${($_ = isset($this->services['foo']) ? $this->services['foo'] : $this->getFooService()) && false ?: '_'}->foo() . (($this->hasParameter("foo")) ? ($this->getParameter("foo")) : ("default"))));
327+
$instance->setBar((${($_ = isset($this->services['foo']) ? $this->services['foo'] : $this->getFooService()) && false ?: '_'}->foo().(($this->hasParameter('foo')) ? ($this->getParameter('foo')) : ('default'))));
313328

314329
return $instance;
315330
}

src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_as_files.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,17 @@ use Symfony\Component\DependencyInjection\Argument\RewindableGenerator;
9999

100100
return $this->services['deprecated_service'] = new \stdClass();
101101

102+
[Container%s/getDeprecatedServiceAliasService.php] => <?php
103+
104+
use Symfony\Component\DependencyInjection\Argument\RewindableGenerator;
105+
106+
// This file has been auto-generated by the Symfony Dependency Injection Component for internal use.
107+
// Returns the public 'deprecated_service_alias' shared service.
108+
109+
@trigger_error('The "deprecated_service_alias" service alias is deprecated.', E_USER_DEPRECATED);
110+
111+
return $this->services['deprecated_service_alias'] = new \stdClass();
112+
102113
[Container%s/getFactoryServiceService.php] => <?php
103114

104115
use Symfony\Component\DependencyInjection\Argument\RewindableGenerator;
@@ -313,6 +324,7 @@ class Container%s extends Container
313324
'decorator_service' => __DIR__.'/getDecoratorServiceService.php',
314325
'decorator_service_with_name' => __DIR__.'/getDecoratorServiceWithNameService.php',
315326
'deprecated_service' => __DIR__.'/getDeprecatedServiceService.php',
327+
'deprecated_service_alias' => __DIR__.'/getDeprecatedServiceAliasService.php',
316328
'factory_service' => __DIR__.'/getFactoryServiceService.php',
317329
'factory_service_simple' => __DIR__.'/getFactoryServiceSimpleService.php',
318330
'factory_simple' => __DIR__.'/getFactorySimpleService.php',

src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_compiled.php

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ public function __construct()
3535
'decorator_service' => 'getDecoratorServiceService',
3636
'decorator_service_with_name' => 'getDecoratorServiceWithNameService',
3737
'deprecated_service' => 'getDeprecatedServiceService',
38+
'deprecated_service_alias' => 'getDeprecatedServiceAliasService',
3839
'factory_service' => 'getFactoryServiceService',
3940
'factory_service_simple' => 'getFactoryServiceSimpleService',
4041
'factory_simple' => 'getFactorySimpleService',
@@ -187,6 +188,20 @@ protected function getDeprecatedServiceService()
187188
return $this->services['deprecated_service'] = new \stdClass();
188189
}
189190

191+
/**
192+
* Gets the public 'deprecated_service_alias' shared service.
193+
*
194+
* @return \stdClass
195+
*
196+
* @deprecated the "deprecated_service_alias" service alias is deprecated
197+
*/
198+
protected function getDeprecatedServiceAliasService()
199+
{
200+
@trigger_error('The "deprecated_service_alias" service alias is deprecated.', E_USER_DEPRECATED);
201+
202+
return $this->services['deprecated_service_alias'] = new \stdClass();
203+
}
204+
190205
/**
191206
* Gets the public 'factory_service' shared service.
192207
*
@@ -312,8 +327,8 @@ protected function getMethodCall1Service()
312327
$this->services['method_call1'] = $instance = new \Bar\FooClass();
313328

314329
$instance->setBar(${($_ = isset($this->services['foo']) ? $this->services['foo'] : $this->getFooService()) && false ?: '_'});
315-
$instance->setBar(NULL);
316-
$instance->setBar((${($_ = isset($this->services['foo']) ? $this->services['foo'] : $this->getFooService()) && false ?: '_'}->foo() . (($this->hasParameter("foo")) ? ($this->getParameter("foo")) : ("default"))));
330+
$instance->setBar(null);
331+
$instance->setBar((${($_ = isset($this->services['foo']) ? $this->services['foo'] : $this->getFooService()) && false ?: '_'}->foo().(($this->hasParameter('foo')) ? ($this->getParameter('foo')) : ('default'))));
317332

318333
return $instance;
319334
}

src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services9.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,9 @@
9999
<service id="deprecated_service" class="stdClass" public="true">
100100
<deprecated>The "%service_id%" service is deprecated. You should stop using it, as it will soon be removed.</deprecated>
101101
</service>
102+
<service id="deprecated_service_alias" class="stdClass" public="true">
103+
<deprecated>The "%service_id%" service alias is deprecated.</deprecated>
104+
</service>
102105
<service id="new_factory" class="FactoryClass" public="false">
103106
<property name="foo">bar</property>
104107
</service>

src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services9.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,10 @@ services:
105105
class: stdClass
106106
deprecated: The "%service_id%" service is deprecated. You should stop using it, as it will soon be removed.
107107
public: true
108+
deprecated_service_alias:
109+
class: stdClass
110+
deprecated: The "%service_id%" service alias is deprecated.
111+
public: true
108112
new_factory:
109113
class: FactoryClass
110114
public: false

0 commit comments

Comments
 (0)