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: Container.php
+8-7Lines changed: 8 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -200,17 +200,17 @@ public function set($id, $service)
200
200
publicfunctionhas($id)
201
201
{
202
202
for ($i = 2;;) {
203
+
if (isset($this->privates[$id])) {
204
+
@trigger_error(sprintf('Checking for the existence of the "%s" private service is deprecated since Symfony 3.2 and won\'t be supported anymore in Symfony 4.0.', $id), E_USER_DEPRECATED);
205
+
}
206
+
203
207
if ('service_container' === $id
204
208
|| isset($this->aliases[$id])
205
209
|| isset($this->services[$id])
206
210
) {
207
211
returntrue;
208
212
}
209
213
210
-
if (isset($this->privates[$id])) {
211
-
@trigger_error(sprintf('Checking for the existence of the "%s" private service is deprecated since Symfony 3.2 and won\'t be supported anymore in Symfony 4.0.', $id), E_USER_DEPRECATED);
212
-
}
213
-
214
214
if (isset($this->methodMap[$id])) {
215
215
returntrue;
216
216
}
@@ -262,6 +262,10 @@ public function get($id, $invalidBehavior = self::EXCEPTION_ON_INVALID_REFERENCE
262
262
if (isset($this->aliases[$id])) {
263
263
$id = $this->aliases[$id];
264
264
}
265
+
if (isset($this->privates[$id])) {
266
+
@trigger_error(sprintf('Requesting the "%s" private service is deprecated since Symfony 3.2 and won\'t be supported anymore in Symfony 4.0.', $id), E_USER_DEPRECATED);
267
+
}
268
+
265
269
// Re-use shared service instance if it exists.
266
270
if (isset($this->services[$id])) {
267
271
return$this->services[$id];
@@ -300,9 +304,6 @@ public function get($id, $invalidBehavior = self::EXCEPTION_ON_INVALID_REFERENCE
300
304
301
305
return;
302
306
}
303
-
if (isset($this->privates[$id])) {
304
-
@trigger_error(sprintf('Requesting the "%s" private service is deprecated since Symfony 3.2 and won\'t be supported anymore in Symfony 4.0.', $id), E_USER_DEPRECATED);
Copy file name to clipboardExpand all lines: Tests/ContainerTest.php
+17-4Lines changed: 17 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -126,7 +126,7 @@ public function testGetServiceIds()
126
126
127
127
$sc = newProjectServiceContainer();
128
128
$sc->set('foo', $obj = new \stdClass());
129
-
$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()');
129
+
$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()');
130
130
}
131
131
132
132
/**
@@ -397,7 +397,8 @@ public function testUnsetInternalPrivateServiceIsDeprecated()
0 commit comments