Skip to content

Commit 217aa5d

Browse files
[DI] Check privates before aliases consistently
1 parent fb2a0f2 commit 217aa5d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Container.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -256,15 +256,15 @@ public function get($id, $invalidBehavior = self::EXCEPTION_ON_INVALID_REFERENCE
256256
// this method can be called thousands of times during a request, avoid
257257
// calling strtolower() unless necessary.
258258
for ($i = 2;;) {
259+
if (isset($this->privates[$id])) {
260+
@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);
261+
}
259262
if ('service_container' === $id) {
260263
return $this;
261264
}
262265
if (isset($this->aliases[$id])) {
263266
$id = $this->aliases[$id];
264267
}
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-
}
268268

269269
// Re-use shared service instance if it exists.
270270
if (isset($this->services[$id])) {

0 commit comments

Comments
 (0)