diff --git a/src/Symfony/Component/DependencyInjection/Container.php b/src/Symfony/Component/DependencyInjection/Container.php index 376c4b5aa5c2b..7570b4d9d7733 100644 --- a/src/Symfony/Component/DependencyInjection/Container.php +++ b/src/Symfony/Component/DependencyInjection/Container.php @@ -77,6 +77,7 @@ class Container implements ResettableContainerInterface private $underscoreMap = array('_' => '', '.' => '_', '\\' => '_'); private $envCache = array(); + private $compiled = false; /** * @param ParameterBagInterface $parameterBag A ParameterBagInterface instance @@ -99,15 +100,31 @@ public function compile() $this->parameterBag->resolve(); $this->parameterBag = new FrozenParameterBag($this->parameterBag->all()); + + $this->compiled = true; + } + + /** + * Returns true if the container is compiled. + * + * @return bool + */ + public function isCompiled() + { + return $this->compiled; } /** * Returns true if the container parameter bag are frozen. * + * Deprecated since 3.3, to be removed in 4.0. + * * @return bool true if the container parameter bag are frozen, false otherwise */ public function isFrozen() { + @trigger_error(sprintf('The %s() method is deprecated since version 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), E_USER_DEPRECATED); + return $this->parameterBag instanceof FrozenParameterBag; } diff --git a/src/Symfony/Component/DependencyInjection/ContainerBuilder.php b/src/Symfony/Component/DependencyInjection/ContainerBuilder.php index ad789367b0be3..eeba128951061 100644 --- a/src/Symfony/Component/DependencyInjection/ContainerBuilder.php +++ b/src/Symfony/Component/DependencyInjection/ContainerBuilder.php @@ -416,13 +416,13 @@ public function fileExists($path, $trackContents = true) * * @return $this * - * @throws BadMethodCallException When this ContainerBuilder is frozen - * @throws \LogicException if the container is frozen + * @throws BadMethodCallException When this ContainerBuilder is compiled + * @throws \LogicException if the extension is not registered */ public function loadFromExtension($extension, array $values = array()) { - if ($this->isFrozen()) { - throw new BadMethodCallException('Cannot load from an extension on a frozen container.'); + if ($this->isCompiled()) { + throw new BadMethodCallException('Cannot load from an extension on a compiled container.'); } $namespace = $this->getExtension($extension)->getAlias(); @@ -493,13 +493,13 @@ public function getCompiler() * @param string $id The service identifier * @param object $service The service instance * - * @throws BadMethodCallException When this ContainerBuilder is frozen + * @throws BadMethodCallException When this ContainerBuilder is compiled */ public function set($id, $service) { $id = $this->normalizeId($id); - if ($this->isFrozen() && (isset($this->definitions[$id]) && !$this->definitions[$id]->isSynthetic())) { + if ($this->isCompiled() && (isset($this->definitions[$id]) && !$this->definitions[$id]->isSynthetic())) { // setting a synthetic service on a frozen container is alright throw new BadMethodCallException(sprintf('Setting service "%s" for an unknown or non-synthetic service definition on a frozen container is not allowed.', $id)); } @@ -601,12 +601,12 @@ public function get($id, $invalidBehavior = ContainerInterface::EXCEPTION_ON_INV * * @param ContainerBuilder $container The ContainerBuilder instance to merge * - * @throws BadMethodCallException When this ContainerBuilder is frozen + * @throws BadMethodCallException When this ContainerBuilder is compiled */ public function merge(ContainerBuilder $container) { - if ($this->isFrozen()) { - throw new BadMethodCallException('Cannot merge on a frozen container.'); + if ($this->isCompiled()) { + throw new BadMethodCallException('Cannot merge on a compiled container.'); } $this->addDefinitions($container->getDefinitions()); @@ -922,12 +922,12 @@ public function getDefinitions() * * @return Definition the service definition * - * @throws BadMethodCallException When this ContainerBuilder is frozen + * @throws BadMethodCallException When this ContainerBuilder is compiled */ public function setDefinition($id, Definition $definition) { - if ($this->isFrozen()) { - throw new BadMethodCallException('Adding definition to a frozen container is not allowed'); + if ($this->isCompiled()) { + throw new BadMethodCallException('Adding definition to a compiled container is not allowed'); } $id = $this->normalizeId($id); diff --git a/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php b/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php index d2da48b028026..d4721ccaaef2b 100644 --- a/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php +++ b/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php @@ -83,7 +83,7 @@ class PhpDumper extends Dumper */ public function __construct(ContainerBuilder $container) { - if (!$container->isFrozen()) { + if (!$container->isCompiled()) { @trigger_error('Dumping an uncompiled ContainerBuilder is deprecated since version 3.3 and will not be supported anymore in 4.0. Compile the container beforehand.', E_USER_DEPRECATED); } @@ -162,10 +162,10 @@ public function dump(array $options = array()) $code = $this->startClass($options['class'], $options['base_class'], $options['namespace']); - if ($this->container->isFrozen()) { + if ($this->container->isCompiled()) { $code .= $this->addFrozenConstructor(); $code .= $this->addFrozenCompile(); - $code .= $this->addIsFrozenMethod(); + $code .= $this->addFrozenIsCompiled(); } else { $code .= $this->addConstructor(); } @@ -893,7 +893,7 @@ private function addNewInstance(Definition $definition, $return, $instantiation, */ private function startClass($class, $baseClass, $namespace) { - $bagClass = $this->container->isFrozen() ? 'use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag;' : 'use Symfony\Component\DependencyInjection\ParameterBag\\ParameterBag;'; + $bagClass = $this->container->isCompiled() ? 'use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag;' : 'use Symfony\Component\DependencyInjection\ParameterBag\\ParameterBag;'; $namespaceLine = $namespace ? "namespace $namespace;\n" : ''; return <<docStar} + * {@inheritdoc} + */ + public function isCompiled() + { + return true; + } + /*{$this->docStar} * {@inheritdoc} */ public function isFrozen() { + @trigger_error(sprintf('The %s() method is deprecated since version 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), E_USER_DEPRECATED); + return true; } @@ -1112,7 +1122,7 @@ private function addPrivateServices() private function addAliases() { if (!$aliases = $this->container->getAliases()) { - return $this->container->isFrozen() ? "\n \$this->aliases = array();\n" : ''; + return $this->container->isCompiled() ? "\n \$this->aliases = array();\n" : ''; } $code = " \$this->aliases = array(\n"; @@ -1158,7 +1168,7 @@ private function addDefaultParametersMethod() $parameters = sprintf("array(\n%s\n%s)", implode("\n", $php), str_repeat(' ', 8)); $code = ''; - if ($this->container->isFrozen()) { + if ($this->container->isCompiled()) { $code .= <<<'EOF' /** @@ -1721,7 +1731,7 @@ private function dumpLiteralClass($class) */ private function dumpParameter($name) { - if ($this->container->isFrozen() && $this->container->hasParameter($name)) { + if ($this->container->isCompiled() && $this->container->hasParameter($name)) { return $this->dumpValue($this->container->getParameter($name), false); } diff --git a/src/Symfony/Component/DependencyInjection/Dumper/XmlDumper.php b/src/Symfony/Component/DependencyInjection/Dumper/XmlDumper.php index 1cb7b5b0b6f51..cca5444ece51e 100644 --- a/src/Symfony/Component/DependencyInjection/Dumper/XmlDumper.php +++ b/src/Symfony/Component/DependencyInjection/Dumper/XmlDumper.php @@ -73,7 +73,7 @@ private function addParameters(\DOMElement $parent) return; } - if ($this->container->isFrozen()) { + if ($this->container->isCompiled()) { $data = $this->escape($data); } diff --git a/src/Symfony/Component/DependencyInjection/Dumper/YamlDumper.php b/src/Symfony/Component/DependencyInjection/Dumper/YamlDumper.php index 7301511567de2..ee0bd3d619218 100644 --- a/src/Symfony/Component/DependencyInjection/Dumper/YamlDumper.php +++ b/src/Symfony/Component/DependencyInjection/Dumper/YamlDumper.php @@ -218,7 +218,7 @@ private function addParameters() return ''; } - $parameters = $this->prepareParameters($this->container->getParameterBag()->all(), $this->container->isFrozen()); + $parameters = $this->prepareParameters($this->container->getParameterBag()->all(), $this->container->isCompiled()); return $this->dumper->dump(array('parameters' => $parameters), 2); } diff --git a/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php b/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php index 756934a982017..098d620f690ed 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php @@ -848,7 +848,7 @@ public function testPrivateServiceUser() /** * @expectedException \BadMethodCallException */ - public function testThrowsExceptionWhenSetServiceOnAFrozenContainer() + public function testThrowsExceptionWhenSetServiceOnACompiledContainer() { $container = new ContainerBuilder(); $container->setResourceTracking(false); @@ -857,7 +857,7 @@ public function testThrowsExceptionWhenSetServiceOnAFrozenContainer() $container->set('a', new \stdClass()); } - public function testThrowsExceptionWhenAddServiceOnAFrozenContainer() + public function testThrowsExceptionWhenAddServiceOnACompiledContainer() { $container = new ContainerBuilder(); $container->compile(); @@ -865,7 +865,7 @@ public function testThrowsExceptionWhenAddServiceOnAFrozenContainer() $this->assertSame($foo, $container->get('a')); } - public function testNoExceptionWhenSetSyntheticServiceOnAFrozenContainer() + public function testNoExceptionWhenSetSyntheticServiceOnACompiledContainer() { $container = new ContainerBuilder(); $def = new Definition('stdClass'); @@ -879,7 +879,7 @@ public function testNoExceptionWhenSetSyntheticServiceOnAFrozenContainer() /** * @expectedException \BadMethodCallException */ - public function testThrowsExceptionWhenSetDefinitionOnAFrozenContainer() + public function testThrowsExceptionWhenSetDefinitionOnACompiledContainer() { $container = new ContainerBuilder(); $container->setResourceTracking(false); diff --git a/src/Symfony/Component/DependencyInjection/Tests/ContainerTest.php b/src/Symfony/Component/DependencyInjection/Tests/ContainerTest.php index ba32c35712687..d6cdcec9d2312 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/ContainerTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/ContainerTest.php @@ -16,6 +16,7 @@ use Symfony\Component\DependencyInjection\Container; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag; +use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag; class ContainerTest extends TestCase { @@ -82,6 +83,11 @@ public function testCompile() $this->assertEquals(array('foo' => 'bar'), $sc->getParameterBag()->all(), '->compile() copies the current parameters to the new parameter bag'); } + /** + * @group legacy + * @expectedDeprecation The Symfony\Component\DependencyInjection\Container::isFrozen() method is deprecated since version 3.3 and will be removed in 4.0. Use the isCompiled() method instead. + * @expectedDeprecation The Symfony\Component\DependencyInjection\Container::isFrozen() method is deprecated since version 3.3 and will be removed in 4.0. Use the isCompiled() method instead. + */ public function testIsFrozen() { $sc = new Container(new ParameterBag(array('foo' => 'bar'))); @@ -90,6 +96,20 @@ public function testIsFrozen() $this->assertTrue($sc->isFrozen(), '->isFrozen() returns true if the parameters are frozen'); } + public function testIsCompiled() + { + $sc = new Container(new ParameterBag(array('foo' => 'bar'))); + $this->assertFalse($sc->isCompiled(), '->isCompiled() returns false if the container is not compiled'); + $sc->compile(); + $this->assertTrue($sc->isCompiled(), '->isCompiled() returns true if the container is compiled'); + } + + public function testIsCompiledWithFrozenParameters() + { + $sc = new Container(new FrozenParameterBag(array('foo' => 'bar'))); + $this->assertFalse($sc->isCompiled(), '->isCompiled() returns false if the container is not compiled but the parameter bag is already frozen'); + } + public function testGetParameterBag() { $sc = new Container(); diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services1-1.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services1-1.php index 0af447b775d23..cdd91761b3b50 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services1-1.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services1-1.php @@ -41,7 +41,15 @@ public function __construct() */ public function compile() { - throw new LogicException('You cannot compile a dumped frozen container.'); + throw new LogicException('You cannot compile a dumped container that was already compiled.'); + } + + /** + * {@inheritdoc} + */ + public function isCompiled() + { + return true; } /** @@ -49,6 +57,8 @@ public function compile() */ public function isFrozen() { + @trigger_error(sprintf('The %s() method is deprecated since version 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), E_USER_DEPRECATED); + return true; } } diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services1.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services1.php index 377dbe93028a0..629448deb1562 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services1.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services1.php @@ -40,7 +40,15 @@ public function __construct() */ public function compile() { - throw new LogicException('You cannot compile a dumped frozen container.'); + throw new LogicException('You cannot compile a dumped container that was already compiled.'); + } + + /** + * {@inheritdoc} + */ + public function isCompiled() + { + return true; } /** @@ -48,6 +56,8 @@ public function compile() */ public function isFrozen() { + @trigger_error(sprintf('The %s() method is deprecated since version 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), E_USER_DEPRECATED); + return true; } } diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services10.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services10.php index ef9e2fad5e999..d06dd5194bbe1 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services10.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services10.php @@ -45,7 +45,15 @@ public function __construct() */ public function compile() { - throw new LogicException('You cannot compile a dumped frozen container.'); + throw new LogicException('You cannot compile a dumped container that was already compiled.'); + } + + /** + * {@inheritdoc} + */ + public function isCompiled() + { + return true; } /** @@ -53,6 +61,8 @@ public function compile() */ public function isFrozen() { + @trigger_error(sprintf('The %s() method is deprecated since version 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), E_USER_DEPRECATED); + return true; } diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services12.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services12.php index 278233be4537e..119c0589cd1de 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services12.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services12.php @@ -49,7 +49,15 @@ public function __construct() */ public function compile() { - throw new LogicException('You cannot compile a dumped frozen container.'); + throw new LogicException('You cannot compile a dumped container that was already compiled.'); + } + + /** + * {@inheritdoc} + */ + public function isCompiled() + { + return true; } /** @@ -57,6 +65,8 @@ public function compile() */ public function isFrozen() { + @trigger_error(sprintf('The %s() method is deprecated since version 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), E_USER_DEPRECATED); + return true; } diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services13.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services13.php index 4d5093d847700..274651ce7d9b6 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services13.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services13.php @@ -43,7 +43,15 @@ public function __construct() */ public function compile() { - throw new LogicException('You cannot compile a dumped frozen container.'); + throw new LogicException('You cannot compile a dumped container that was already compiled.'); + } + + /** + * {@inheritdoc} + */ + public function isCompiled() + { + return true; } /** @@ -51,6 +59,8 @@ public function compile() */ public function isFrozen() { + @trigger_error(sprintf('The %s() method is deprecated since version 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), E_USER_DEPRECATED); + return true; } diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services19.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services19.php index 1c029eda808fe..3d48492db49a1 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services19.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services19.php @@ -44,7 +44,15 @@ public function __construct() */ public function compile() { - throw new LogicException('You cannot compile a dumped frozen container.'); + throw new LogicException('You cannot compile a dumped container that was already compiled.'); + } + + /** + * {@inheritdoc} + */ + public function isCompiled() + { + return true; } /** @@ -52,6 +60,8 @@ public function compile() */ public function isFrozen() { + @trigger_error(sprintf('The %s() method is deprecated since version 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), E_USER_DEPRECATED); + return true; } diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services24.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services24.php index 3b75ff16d67ce..be8cb0678c19a 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services24.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services24.php @@ -43,7 +43,15 @@ public function __construct() */ public function compile() { - throw new LogicException('You cannot compile a dumped frozen container.'); + throw new LogicException('You cannot compile a dumped container that was already compiled.'); + } + + /** + * {@inheritdoc} + */ + public function isCompiled() + { + return true; } /** @@ -51,6 +59,8 @@ public function compile() */ public function isFrozen() { + @trigger_error(sprintf('The %s() method is deprecated since version 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), E_USER_DEPRECATED); + return true; } diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services26.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services26.php index e25c4ef795186..9613de5775fb0 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services26.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services26.php @@ -45,7 +45,15 @@ public function __construct() */ public function compile() { - throw new LogicException('You cannot compile a dumped frozen container.'); + throw new LogicException('You cannot compile a dumped container that was already compiled.'); + } + + /** + * {@inheritdoc} + */ + public function isCompiled() + { + return true; } /** @@ -53,6 +61,8 @@ public function compile() */ public function isFrozen() { + @trigger_error(sprintf('The %s() method is deprecated since version 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), E_USER_DEPRECATED); + return true; } diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services29.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services29.php index 0c64f779fe852..ee1e44f4a102a 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services29.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services29.php @@ -44,7 +44,15 @@ public function __construct() */ public function compile() { - throw new LogicException('You cannot compile a dumped frozen container.'); + throw new LogicException('You cannot compile a dumped container that was already compiled.'); + } + + /** + * {@inheritdoc} + */ + public function isCompiled() + { + return true; } /** @@ -52,6 +60,8 @@ public function compile() */ public function isFrozen() { + @trigger_error(sprintf('The %s() method is deprecated since version 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), E_USER_DEPRECATED); + return true; } diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services31.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services31.php index 06654f6d9d7cb..e6353d6e49b06 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services31.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services31.php @@ -44,7 +44,15 @@ public function __construct() */ public function compile() { - throw new LogicException('You cannot compile a dumped frozen container.'); + throw new LogicException('You cannot compile a dumped container that was already compiled.'); + } + + /** + * {@inheritdoc} + */ + public function isCompiled() + { + return true; } /** @@ -52,6 +60,8 @@ public function compile() */ public function isFrozen() { + @trigger_error(sprintf('The %s() method is deprecated since version 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), E_USER_DEPRECATED); + return true; } diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services32.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services32.php index 9ead7348a9e79..b86de7acaf032 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services32.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services32.php @@ -44,7 +44,15 @@ public function __construct() */ public function compile() { - throw new LogicException('You cannot compile a dumped frozen container.'); + throw new LogicException('You cannot compile a dumped container that was already compiled.'); + } + + /** + * {@inheritdoc} + */ + public function isCompiled() + { + return true; } /** @@ -52,6 +60,8 @@ public function compile() */ public function isFrozen() { + @trigger_error(sprintf('The %s() method is deprecated since version 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), E_USER_DEPRECATED); + return true; } diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services33.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services33.php index 92da7a5132811..cde76531bb0c4 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services33.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services33.php @@ -44,7 +44,15 @@ public function __construct() */ public function compile() { - throw new LogicException('You cannot compile a dumped frozen container.'); + throw new LogicException('You cannot compile a dumped container that was already compiled.'); + } + + /** + * {@inheritdoc} + */ + public function isCompiled() + { + return true; } /** @@ -52,6 +60,8 @@ public function compile() */ public function isFrozen() { + @trigger_error(sprintf('The %s() method is deprecated since version 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), E_USER_DEPRECATED); + return true; } diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services8.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services8.php index f57292889cd39..edd62bedf5192 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services8.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services8.php @@ -42,7 +42,15 @@ public function __construct() */ public function compile() { - throw new LogicException('You cannot compile a dumped frozen container.'); + throw new LogicException('You cannot compile a dumped container that was already compiled.'); + } + + /** + * {@inheritdoc} + */ + public function isCompiled() + { + return true; } /** @@ -50,6 +58,8 @@ public function compile() */ public function isFrozen() { + @trigger_error(sprintf('The %s() method is deprecated since version 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), E_USER_DEPRECATED); + return true; } diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_compiled.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_compiled.php index 4949f85aab5af..eecae7fe79482 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_compiled.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_compiled.php @@ -66,7 +66,15 @@ public function __construct() */ public function compile() { - throw new LogicException('You cannot compile a dumped frozen container.'); + throw new LogicException('You cannot compile a dumped container that was already compiled.'); + } + + /** + * {@inheritdoc} + */ + public function isCompiled() + { + return true; } /** @@ -74,6 +82,8 @@ public function compile() */ public function isFrozen() { + @trigger_error(sprintf('The %s() method is deprecated since version 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), E_USER_DEPRECATED); + return true; } diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_dump_overriden_getters_with_constructor.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_dump_overriden_getters_with_constructor.php index 67004e5585c5a..3c96c5dc89bd1 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_dump_overriden_getters_with_constructor.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_dump_overriden_getters_with_constructor.php @@ -44,7 +44,15 @@ public function __construct() */ public function compile() { - throw new LogicException('You cannot compile a dumped frozen container.'); + throw new LogicException('You cannot compile a dumped container that was already compiled.'); + } + + /** + * {@inheritdoc} + */ + public function isCompiled() + { + return true; } /** @@ -52,6 +60,8 @@ public function compile() */ public function isFrozen() { + @trigger_error(sprintf('The %s() method is deprecated since version 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), E_USER_DEPRECATED); + return true; } diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_dump_proxy_with_void_return_type.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_dump_proxy_with_void_return_type.php index bf0d3cb4b5e82..afb09b61c9d91 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_dump_proxy_with_void_return_type.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_dump_proxy_with_void_return_type.php @@ -44,7 +44,15 @@ public function __construct() */ public function compile() { - throw new LogicException('You cannot compile a dumped frozen container.'); + throw new LogicException('You cannot compile a dumped container that was already compiled.'); + } + + /** + * {@inheritdoc} + */ + public function isCompiled() + { + return true; } /** @@ -52,6 +60,8 @@ public function compile() */ public function isFrozen() { + @trigger_error(sprintf('The %s() method is deprecated since version 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), E_USER_DEPRECATED); + return true; } diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_locator.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_locator.php index 0cab09bbbc96e..6ca318c5f5d90 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_locator.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_locator.php @@ -48,7 +48,15 @@ public function __construct() */ public function compile() { - throw new LogicException('You cannot compile a dumped frozen container.'); + throw new LogicException('You cannot compile a dumped container that was already compiled.'); + } + + /** + * {@inheritdoc} + */ + public function isCompiled() + { + return true; } /** @@ -56,6 +64,8 @@ public function compile() */ public function isFrozen() { + @trigger_error(sprintf('The %s() method is deprecated since version 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), E_USER_DEPRECATED); + return true; } diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_private_frozen.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_private_frozen.php index 5734e7aa61d72..db80c72b16881 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_private_frozen.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_private_frozen.php @@ -48,7 +48,15 @@ public function __construct() */ public function compile() { - throw new LogicException('You cannot compile a dumped frozen container.'); + throw new LogicException('You cannot compile a dumped container that was already compiled.'); + } + + /** + * {@inheritdoc} + */ + public function isCompiled() + { + return true; } /** @@ -56,6 +64,8 @@ public function compile() */ public function isFrozen() { + @trigger_error(sprintf('The %s() method is deprecated since version 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), E_USER_DEPRECATED); + return true; }