You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/Symfony/Component/DependencyInjection/Container.php
+4
Original file line number
Diff line number
Diff line change
@@ -370,6 +370,10 @@ public function initialized($id)
370
370
$id = $this->aliases[$id];
371
371
}
372
372
373
+
if (isset($this->privates[$id])) {
374
+
@trigger_error(sprintf('Checking for the initialization of the "%s" private service is deprecated since Symfony 3.4 and won\'t be supported anymore in Symfony 4.0.', $id), E_USER_DEPRECATED);
Copy file name to clipboardExpand all lines: src/Symfony/Component/DependencyInjection/Tests/ContainerTest.php
+23-2
Original file line number
Diff line number
Diff line change
@@ -147,7 +147,7 @@ public function testGetServiceIds()
147
147
148
148
$sc = newProjectServiceContainer();
149
149
$sc->set('foo', $obj = new \stdClass());
150
-
$this->assertEquals(array('service_container', 'internal', 'bar', 'foo_bar', 'foo.baz', 'circular', 'throw_exception', 'throws_exception_on_service_configuration', 'foo'), $sc->getServiceIds(), '->getServiceIds() returns defined service ids by factory methods in the method map, followed by service ids defined by set()');
150
+
$this->assertEquals(array('service_container', 'internal', 'bar', 'foo_bar', 'foo.baz', 'circular', 'throw_exception', 'throws_exception_on_service_configuration', 'internal_dependency', 'foo'), $sc->getServiceIds(), '->getServiceIds() returns defined service ids by factory methods in the method map, followed by service ids defined by set()');
151
151
}
152
152
153
153
/**
@@ -363,6 +363,17 @@ public function testInitialized()
363
363
$this->assertTrue($sc->initialized('alias'), '->initialized() returns true for alias if aliased service is initialized');
364
364
}
365
365
366
+
/**
367
+
* @group legacy
368
+
* @expectedDeprecation Checking for the initialization of the "internal" private service is deprecated since Symfony 3.4 and won't be supported anymore in Symfony 4.0.
369
+
*/
370
+
publicfunctiontestInitializedWithPrivateService()
371
+
{
372
+
$sc = newProjectServiceContainer();
373
+
$sc->get('internal_dependency');
374
+
$this->assertTrue($sc->initialized('internal'));
375
+
}
376
+
366
377
publicfunctiontestReset()
367
378
{
368
379
$c = newContainer();
@@ -504,6 +515,7 @@ class ProjectServiceContainer extends Container
0 commit comments