disable inlining deprecated services
This commit is contained in:
parent
0c6096fc32
commit
6ab8ca0d36
@ -113,7 +113,7 @@ class InlineServiceDefinitionsPass implements RepeatablePassInterface
|
||||
return true;
|
||||
}
|
||||
|
||||
if ($definition->isPublic() || $definition->isLazy()) {
|
||||
if ($definition->isDeprecated() || $definition->isPublic() || $definition->isLazy()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -891,6 +891,27 @@ class ContainerBuilderTest extends TestCase
|
||||
|
||||
$this->assertEquals('a', (string) $container->getDefinition('b')->getArgument(0));
|
||||
}
|
||||
|
||||
/**
|
||||
* This test checks the trigger of a deprecation note and should not be removed in major releases.
|
||||
*
|
||||
* @group legacy
|
||||
* @expectedDeprecation The "foo" service is deprecated. You should stop using it, as it will soon be removed.
|
||||
*/
|
||||
public function testPrivateServiceTriggersDeprecation()
|
||||
{
|
||||
$container = new ContainerBuilder();
|
||||
$container->register('foo', 'stdClass')
|
||||
->setPublic(false)
|
||||
->setDeprecated(true);
|
||||
$container->register('bar', 'stdClass')
|
||||
->setPublic(true)
|
||||
->setProperty('foo', new Reference('foo'));
|
||||
|
||||
$container->compile();
|
||||
|
||||
$container->get('bar');
|
||||
}
|
||||
}
|
||||
|
||||
class FooClass
|
||||
|
@ -360,4 +360,30 @@ class PhpDumperTest extends TestCase
|
||||
|
||||
$this->assertInstanceOf('stdClass', $container->get('foo'));
|
||||
}
|
||||
|
||||
/**
|
||||
* This test checks the trigger of a deprecation note and should not be removed in major releases.
|
||||
*
|
||||
* @group legacy
|
||||
* @expectedDeprecation The "foo" service is deprecated. You should stop using it, as it will soon be removed.
|
||||
*/
|
||||
public function testPrivateServiceTriggersDeprecation()
|
||||
{
|
||||
$container = new ContainerBuilder();
|
||||
$container->register('foo', 'stdClass')
|
||||
->setPublic(false)
|
||||
->setDeprecated(true);
|
||||
$container->register('bar', 'stdClass')
|
||||
->setPublic(true)
|
||||
->setProperty('foo', new Reference('foo'));
|
||||
|
||||
$container->compile();
|
||||
|
||||
$dumper = new PhpDumper($container);
|
||||
eval('?>'.$dumper->dump(array('class' => 'Symfony_DI_PhpDumper_Test_Private_Service_Triggers_Deprecation')));
|
||||
|
||||
$container = new \Symfony_DI_PhpDumper_Test_Private_Service_Triggers_Deprecation();
|
||||
|
||||
$container->get('bar');
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user