Skip to content

Commit b484a33

Browse files
Merge branch '3.2' into 3.3
* 3.2: [DI] Check privates before aliases consistently
2 parents 60bda50 + 217aa5d commit b484a33

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

Container.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -228,12 +228,12 @@ public function set($id, $service)
228228
public function has($id)
229229
{
230230
for ($i = 2;;) {
231-
if ('service_container' === $id) {
232-
return true;
233-
}
234231
if (isset($this->privates[$id])) {
235232
@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);
236233
}
234+
if ('service_container' === $id) {
235+
return true;
236+
}
237237
if (isset($this->aliases[$id])) {
238238
$id = $this->aliases[$id];
239239
}
@@ -286,15 +286,15 @@ public function get($id, $invalidBehavior = self::EXCEPTION_ON_INVALID_REFERENCE
286286
// this method can be called thousands of times during a request, avoid
287287
// calling $this->normalizeId($id) unless necessary.
288288
for ($i = 2;;) {
289+
if (isset($this->privates[$id])) {
290+
@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);
291+
}
289292
if ('service_container' === $id) {
290293
return $this;
291294
}
292295
if (isset($this->aliases[$id])) {
293296
$id = $this->aliases[$id];
294297
}
295-
if (isset($this->privates[$id])) {
296-
@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);
297-
}
298298

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

0 commit comments

Comments
 (0)