Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 9f18291

Browse filesBrowse files
[DI] Improve some deprecation messages
1 parent b7f1daa commit 9f18291
Copy full SHA for 9f18291

File tree

3 files changed

+14
-14
lines changed
Filter options

3 files changed

+14
-14
lines changed

‎src/Symfony/Component/DependencyInjection/Container.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/DependencyInjection/Container.php
+6-6Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -199,16 +199,16 @@ public function set($id, $service)
199199

200200
if (isset($this->privates[$id])) {
201201
if (null === $service) {
202-
@trigger_error(sprintf('Unsetting the "%s" private service is deprecated since Symfony 3.2 and won\'t be supported anymore in Symfony 4.0.', $id), E_USER_DEPRECATED);
202+
@trigger_error(sprintf('The "%s" service is private, unsetting it is deprecated since Symfony 3.2 and will fail in 4.0.', $id), E_USER_DEPRECATED);
203203
unset($this->privates[$id]);
204204
} else {
205-
@trigger_error(sprintf('Setting 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+
@trigger_error(sprintf('The "%s" service is private, replacing it is deprecated since Symfony 3.2 and will fail in 4.0.', $id), E_USER_DEPRECATED);
206206
}
207207
} elseif ($wasSet && isset($this->methodMap[$id])) {
208208
if (null === $service) {
209-
@trigger_error(sprintf('Unsetting the "%s" service after it\'s been initialized is deprecated since Symfony 3.3 and won\'t be supported anymore in Symfony 4.0.', $id), E_USER_DEPRECATED);
209+
@trigger_error(sprintf('The "%s" service is already initialized, unsetting it is deprecated since Symfony 3.3 and will fail in 4.0.', $id), E_USER_DEPRECATED);
210210
} else {
211-
@trigger_error(sprintf('Setting the "%s" service after it\'s been initialized is deprecated since Symfony 3.3 and won\'t be supported anymore in Symfony 4.0.', $id), E_USER_DEPRECATED);
211+
@trigger_error(sprintf('The "%s" service is already initialized, replacing it is deprecated since Symfony 3.3 and will fail in 4.0.', $id), E_USER_DEPRECATED);
212212
}
213213
}
214214
}
@@ -224,7 +224,7 @@ public function has($id)
224224
{
225225
for ($i = 2;;) {
226226
if (isset($this->privates[$id])) {
227-
@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);
227+
@trigger_error(sprintf('The "%s" service is private, checking for its existence is deprecated since Symfony 3.2 and will fail in 4.0.', $id), E_USER_DEPRECATED);
228228
}
229229
if (isset($this->aliases[$id])) {
230230
$id = $this->aliases[$id];
@@ -282,7 +282,7 @@ public function get($id, $invalidBehavior = self::EXCEPTION_ON_INVALID_REFERENCE
282282
// calling $this->normalizeId($id) unless necessary.
283283
for ($i = 2;;) {
284284
if (isset($this->privates[$id])) {
285-
@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);
285+
@trigger_error(sprintf('The "%s" service is private, getting it from the container is deprecated since Symfony 3.2 and will fail in 4.0. You should either make the service public or stop getting services directly from the container and use any dependency injection methods instead.');
286286
}
287287
if (isset($this->aliases[$id])) {
288288
$id = $this->aliases[$id];

‎src/Symfony/Component/DependencyInjection/Tests/ContainerTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/DependencyInjection/Tests/ContainerTest.php
+6-6Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ public function testSetReplacesAlias()
186186

187187
/**
188188
* @group legacy
189-
* @expectedDeprecation Unsetting the "bar" service after it's been initialized is deprecated since Symfony 3.3 and won't be supported anymore in Symfony 4.0.
189+
* @expectedDeprecation The "bar" service is already initialized, unsetting it is deprecated since Symfony 3.3 and will fail in 4.0.
190190
*/
191191
public function testSetWithNullOnInitializedPredefinedService()
192192
{
@@ -452,7 +452,7 @@ public function testThatCloningIsNotSupported()
452452

453453
/**
454454
* @group legacy
455-
* @expectedDeprecation Unsetting the "internal" private service is deprecated since Symfony 3.2 and won't be supported anymore in Symfony 4.0.
455+
* @expectedDeprecation The "internal" service is private, unsetting it is deprecated since Symfony 3.2 and will fail in 4.0.
456456
*/
457457
public function testUnsetInternalPrivateServiceIsDeprecated()
458458
{
@@ -462,7 +462,7 @@ public function testUnsetInternalPrivateServiceIsDeprecated()
462462

463463
/**
464464
* @group legacy
465-
* @expectedDeprecation Setting the "internal" private service is deprecated since Symfony 3.2 and won't be supported anymore in Symfony 4.0.
465+
* @expectedDeprecation The "internal" service is private, getting it from the container is deprecated since Symfony 3.2 and will fail in 4.0. You should either make the service public, or preferably eg implement ServiceSubscriberInterface or use any other dependency injection method instead of using the container at all.
466466
*/
467467
public function testChangeInternalPrivateServiceIsDeprecated()
468468
{
@@ -473,7 +473,7 @@ public function testChangeInternalPrivateServiceIsDeprecated()
473473

474474
/**
475475
* @group legacy
476-
* @expectedDeprecation Checking for the existence of the "internal" private service is deprecated since Symfony 3.2 and won't be supported anymore in Symfony 4.0.
476+
* @expectedDeprecation The "internal" service is private, checking for its existence is deprecated since Symfony 3.2 and will fail in 4.0.
477477
*/
478478
public function testCheckExistenceOfAnInternalPrivateServiceIsDeprecated()
479479
{
@@ -484,7 +484,7 @@ public function testCheckExistenceOfAnInternalPrivateServiceIsDeprecated()
484484

485485
/**
486486
* @group legacy
487-
* @expectedDeprecation Requesting the "internal" private service is deprecated since Symfony 3.2 and won't be supported anymore in Symfony 4.0.
487+
* @expectedDeprecation The "internal" service is private, getting it from the container is deprecated since Symfony 3.2 and will fail in 4.0. You should either make the service public, or preferably eg implement ServiceSubscriberInterface or use any other dependency injection method instead of using the container at all.
488488
*/
489489
public function testRequestAnInternalSharedPrivateServiceIsDeprecated()
490490
{
@@ -495,7 +495,7 @@ public function testRequestAnInternalSharedPrivateServiceIsDeprecated()
495495

496496
/**
497497
* @group legacy
498-
* @expectedDeprecation Setting the "bar" service after it's been initialized is deprecated since Symfony 3.3 and won't be supported anymore in Symfony 4.0.
498+
* @expectedDeprecation The "bar" service is already initialized, replacing it is deprecated since Symfony 3.3 and will fail in 4.0.
499499
*/
500500
public function testReplacingAPreDefinedServiceIsDeprecated()
501501
{

‎src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ public function testFrozenContainerWithoutAliases()
269269

270270
/**
271271
* @group legacy
272-
* @expectedDeprecation Setting the "bar" service after it's been initialized is deprecated since Symfony 3.3 and won't be supported anymore in Symfony 4.0.
272+
* @expectedDeprecation The "bar" service is already initialized, replacing it is deprecated since Symfony 3.3 and will fail in 4.0.
273273
*/
274274
public function testOverrideServiceWhenUsingADumpedContainer()
275275
{
@@ -286,7 +286,7 @@ public function testOverrideServiceWhenUsingADumpedContainer()
286286

287287
/**
288288
* @group legacy
289-
* @expectedDeprecation Setting the "bar" service after it's been initialized is deprecated since Symfony 3.3 and won't be supported anymore in Symfony 4.0.
289+
* @expectedDeprecation The "bar" service is already initialized, replacing it is deprecated since Symfony 3.3 and will fail in 4.0.
290290
*/
291291
public function testOverrideServiceWhenUsingADumpedContainerAndServiceIsUsedFromAnotherOne()
292292
{

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.