[DI] Improve some deprecation messages
This commit is contained in:
parent
b7f1daabed
commit
3e8076023d
@ -199,16 +199,16 @@ class Container implements ResettableContainerInterface
|
|||||||
|
|
||||||
if (isset($this->privates[$id])) {
|
if (isset($this->privates[$id])) {
|
||||||
if (null === $service) {
|
if (null === $service) {
|
||||||
@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);
|
@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);
|
||||||
unset($this->privates[$id]);
|
unset($this->privates[$id]);
|
||||||
} else {
|
} else {
|
||||||
@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);
|
@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);
|
||||||
}
|
}
|
||||||
} elseif ($wasSet && isset($this->methodMap[$id])) {
|
} elseif ($wasSet && isset($this->methodMap[$id])) {
|
||||||
if (null === $service) {
|
if (null === $service) {
|
||||||
@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);
|
@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);
|
||||||
} else {
|
} else {
|
||||||
@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);
|
@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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -224,7 +224,7 @@ class Container implements ResettableContainerInterface
|
|||||||
{
|
{
|
||||||
for ($i = 2;;) {
|
for ($i = 2;;) {
|
||||||
if (isset($this->privates[$id])) {
|
if (isset($this->privates[$id])) {
|
||||||
@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);
|
@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);
|
||||||
}
|
}
|
||||||
if (isset($this->aliases[$id])) {
|
if (isset($this->aliases[$id])) {
|
||||||
$id = $this->aliases[$id];
|
$id = $this->aliases[$id];
|
||||||
@ -282,7 +282,7 @@ class Container implements ResettableContainerInterface
|
|||||||
// calling $this->normalizeId($id) unless necessary.
|
// calling $this->normalizeId($id) unless necessary.
|
||||||
for ($i = 2;;) {
|
for ($i = 2;;) {
|
||||||
if (isset($this->privates[$id])) {
|
if (isset($this->privates[$id])) {
|
||||||
@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);
|
@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 dependency injection instead.', $id), E_USER_DEPRECATED);
|
||||||
}
|
}
|
||||||
if (isset($this->aliases[$id])) {
|
if (isset($this->aliases[$id])) {
|
||||||
$id = $this->aliases[$id];
|
$id = $this->aliases[$id];
|
||||||
|
@ -186,7 +186,7 @@ class ContainerTest extends TestCase
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @group legacy
|
* @group legacy
|
||||||
* @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.
|
* @expectedDeprecation The "bar" service is already initialized, unsetting it is deprecated since Symfony 3.3 and will fail in 4.0.
|
||||||
*/
|
*/
|
||||||
public function testSetWithNullOnInitializedPredefinedService()
|
public function testSetWithNullOnInitializedPredefinedService()
|
||||||
{
|
{
|
||||||
@ -452,7 +452,7 @@ class ContainerTest extends TestCase
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @group legacy
|
* @group legacy
|
||||||
* @expectedDeprecation Unsetting the "internal" private service is deprecated since Symfony 3.2 and won't be supported anymore in Symfony 4.0.
|
* @expectedDeprecation The "internal" service is private, unsetting it is deprecated since Symfony 3.2 and will fail in 4.0.
|
||||||
*/
|
*/
|
||||||
public function testUnsetInternalPrivateServiceIsDeprecated()
|
public function testUnsetInternalPrivateServiceIsDeprecated()
|
||||||
{
|
{
|
||||||
@ -462,7 +462,7 @@ class ContainerTest extends TestCase
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @group legacy
|
* @group legacy
|
||||||
* @expectedDeprecation Setting the "internal" private service is deprecated since Symfony 3.2 and won't be supported anymore in Symfony 4.0.
|
* @expectedDeprecation The "internal" service is private, replacing it is deprecated since Symfony 3.2 and will fail in 4.0.
|
||||||
*/
|
*/
|
||||||
public function testChangeInternalPrivateServiceIsDeprecated()
|
public function testChangeInternalPrivateServiceIsDeprecated()
|
||||||
{
|
{
|
||||||
@ -473,7 +473,7 @@ class ContainerTest extends TestCase
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @group legacy
|
* @group legacy
|
||||||
* @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.
|
* @expectedDeprecation The "internal" service is private, checking for its existence is deprecated since Symfony 3.2 and will fail in 4.0.
|
||||||
*/
|
*/
|
||||||
public function testCheckExistenceOfAnInternalPrivateServiceIsDeprecated()
|
public function testCheckExistenceOfAnInternalPrivateServiceIsDeprecated()
|
||||||
{
|
{
|
||||||
@ -484,7 +484,7 @@ class ContainerTest extends TestCase
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @group legacy
|
* @group legacy
|
||||||
* @expectedDeprecation Requesting the "internal" private service is deprecated since Symfony 3.2 and won't be supported anymore in Symfony 4.0.
|
* @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 stop getting services directly from the container and use dependency injection instead.
|
||||||
*/
|
*/
|
||||||
public function testRequestAnInternalSharedPrivateServiceIsDeprecated()
|
public function testRequestAnInternalSharedPrivateServiceIsDeprecated()
|
||||||
{
|
{
|
||||||
@ -495,7 +495,7 @@ class ContainerTest extends TestCase
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @group legacy
|
* @group legacy
|
||||||
* @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.
|
* @expectedDeprecation The "bar" service is already initialized, replacing it is deprecated since Symfony 3.3 and will fail in 4.0.
|
||||||
*/
|
*/
|
||||||
public function testReplacingAPreDefinedServiceIsDeprecated()
|
public function testReplacingAPreDefinedServiceIsDeprecated()
|
||||||
{
|
{
|
||||||
|
@ -269,7 +269,7 @@ class PhpDumperTest extends TestCase
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @group legacy
|
* @group legacy
|
||||||
* @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.
|
* @expectedDeprecation The "bar" service is already initialized, replacing it is deprecated since Symfony 3.3 and will fail in 4.0.
|
||||||
*/
|
*/
|
||||||
public function testOverrideServiceWhenUsingADumpedContainer()
|
public function testOverrideServiceWhenUsingADumpedContainer()
|
||||||
{
|
{
|
||||||
@ -286,7 +286,7 @@ class PhpDumperTest extends TestCase
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @group legacy
|
* @group legacy
|
||||||
* @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.
|
* @expectedDeprecation The "bar" service is already initialized, replacing it is deprecated since Symfony 3.3 and will fail in 4.0.
|
||||||
*/
|
*/
|
||||||
public function testOverrideServiceWhenUsingADumpedContainerAndServiceIsUsedFromAnotherOne()
|
public function testOverrideServiceWhenUsingADumpedContainerAndServiceIsUsedFromAnotherOne()
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user