Skip to content

Commit 769b183

Browse files
[DependencyInjection] Undeprecate RealServiceInstantiator, it's useful to disable lazy proxies in tests
1 parent bd5abf2 commit 769b183

File tree

6 files changed

+2
-12
lines changed

6 files changed

+2
-12
lines changed

CHANGELOG.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ CHANGELOG
88
* Add argument `&$asGhostObject` to LazyProxy's `DumperInterface` to allow using ghost objects for lazy loading services
99
* Add `enum` env var processor
1010
* Add `shuffle` env var processor
11-
* Deprecate `RealServiceInstantiator`
1211

1312
6.1
1413
---

ContainerBuilder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1002,7 +1002,7 @@ private function createService(Definition $definition, array &$inlineServices, b
10021002
$this,
10031003
(clone $definition)
10041004
->setClass($parameterBag->resolveValue($definition->getClass()))
1005-
->setTags($parameterBag->resolveValue($definition->getTags())),
1005+
->setTags(($definition->hasTag('proxy') ? ['proxy' => $parameterBag->resolveValue($definition->getTag('proxy'))] : []) + $definition->getTags()),
10061006
$id, function ($proxy = false) use ($definition, &$inlineServices, $id) {
10071007
return $this->createService($definition, $inlineServices, true, $id, $proxy);
10081008
}

Dumper/PhpDumper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2299,7 +2299,7 @@ private function isProxyCandidate(Definition $definition, bool &$asGhostObject =
22992299
$bag = $this->container->getParameterBag();
23002300
$definition = (clone $definition)
23012301
->setClass($bag->resolveValue($definition->getClass()))
2302-
->setTags($bag->resolveValue($definition->getTags()));
2302+
->setTags(($definition->hasTag('proxy') ? ['proxy' => $bag->resolveValue($definition->getTag('proxy'))] : []) + $definition->getTags());
23032303

23042304
return $proxyDumper->isProxyCandidate($definition, $asGhostObject) ? $definition : null;
23052305
}

LazyProxy/Instantiator/RealServiceInstantiator.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,12 @@
1414
use Symfony\Component\DependencyInjection\ContainerInterface;
1515
use Symfony\Component\DependencyInjection\Definition;
1616

17-
trigger_deprecation('symfony/dependency-injection', '6.2', 'The "%s" class is deprecated, use "%s" instead.', RealServiceInstantiator::class, LazyServiceInstantiator::class);
18-
1917
/**
2018
* {@inheritdoc}
2119
*
2220
* Noop proxy instantiator - produces the real service instead of a proxy instance.
2321
*
2422
* @author Marco Pivetta <[email protected]>
25-
*
26-
* @deprecated since Symfony 6.2, use LazyServiceInstantiator instead.
2723
*/
2824
class RealServiceInstantiator implements InstantiatorInterface
2925
{

Tests/ContainerBuilderTest.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -370,9 +370,6 @@ public function testCreateService()
370370
$this->assertInstanceOf(\Bar\FooClass::class, $builder->get('foo2'), '->createService() replaces parameters in the file provided by the service definition');
371371
}
372372

373-
/**
374-
* @group legacy
375-
*/
376373
public function testCreateProxyWithRealServiceInstantiator()
377374
{
378375
$builder = new ContainerBuilder();

Tests/LazyProxy/Instantiator/RealServiceInstantiatorTest.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@
2020
* Tests for {@see \Symfony\Component\DependencyInjection\LazyProxy\Instantiator\RealServiceInstantiator}.
2121
*
2222
* @author Marco Pivetta <[email protected]>
23-
*
24-
* @group legacy
2523
*/
2624
class RealServiceInstantiatorTest extends TestCase
2725
{

0 commit comments

Comments
 (0)