From 76ff5a96da48a99c1b6b29bafba463320ea2daaa Mon Sep 17 00:00:00 2001 From: Diego Saint Esteben Date: Tue, 31 Mar 2015 23:23:52 -0300 Subject: [PATCH] Removed deprecations in DependencyInjection component --- .../LazyProxy/Fixtures/php/lazy_service.php | 3 - .../Console/Descriptor/JsonDescriptor.php | 16 -- .../Console/Descriptor/MarkdownDescriptor.php | 18 +-- .../Console/Descriptor/TextDescriptor.php | 23 +-- .../Console/Descriptor/XmlDescriptor.php | 17 -- .../Descriptor/AbstractDescriptorTest.php | 18 --- .../Console/Descriptor/ObjectsProvider.php | 33 ---- .../Fixtures/Descriptor/builder_1_public.json | 1 - .../Fixtures/Descriptor/builder_1_public.md | 1 - .../Fixtures/Descriptor/builder_1_public.xml | 2 +- .../Descriptor/builder_1_services.json | 2 - .../Fixtures/Descriptor/builder_1_services.md | 2 - .../Descriptor/builder_1_services.xml | 4 +- .../Fixtures/Descriptor/builder_1_tag1.json | 1 - .../Fixtures/Descriptor/builder_1_tag1.md | 1 - .../Fixtures/Descriptor/builder_1_tag1.xml | 2 +- .../Fixtures/Descriptor/builder_1_tags.json | 2 - .../Fixtures/Descriptor/builder_1_tags.md | 2 - .../Fixtures/Descriptor/builder_1_tags.xml | 4 +- .../Fixtures/Descriptor/definition_1.json | 1 - .../Tests/Fixtures/Descriptor/definition_1.md | 1 - .../Fixtures/Descriptor/definition_1.txt | 1 - .../Fixtures/Descriptor/definition_1.xml | 2 +- .../Fixtures/Descriptor/definition_2.json | 1 - .../Tests/Fixtures/Descriptor/definition_2.md | 1 - .../Fixtures/Descriptor/definition_2.txt | 1 - .../Fixtures/Descriptor/definition_2.xml | 2 +- ...acy_synchronized_service_definition_1.json | 15 -- ...egacy_synchronized_service_definition_1.md | 9 -- ...gacy_synchronized_service_definition_1.txt | 11 -- ...gacy_synchronized_service_definition_1.xml | 2 - ...acy_synchronized_service_definition_2.json | 33 ---- ...egacy_synchronized_service_definition_2.md | 16 -- ...gacy_synchronized_service_definition_2.txt | 15 -- ...gacy_synchronized_service_definition_2.xml | 13 -- .../Compiler/AnalyzeServiceReferencesPass.php | 6 - .../Compiler/CheckDefinitionValidityPass.php | 6 +- .../Compiler/InlineServiceDefinitionsPass.php | 4 - .../ResolveDefinitionTemplatesPass.php | 18 --- .../ResolveParameterPlaceHoldersPass.php | 3 - .../DependencyInjection/Container.php | 16 +- .../DependencyInjection/ContainerBuilder.php | 46 ------ .../DependencyInjection/Definition.php | 153 ------------------ .../DefinitionDecorator.php | 36 ----- .../DependencyInjection/Dumper/PhpDumper.php | 121 +------------- .../DependencyInjection/Dumper/XmlDumper.php | 12 -- .../DependencyInjection/Dumper/YamlDumper.php | 16 -- .../Loader/XmlFileLoader.php | 6 +- .../Loader/YamlFileLoader.php | 16 -- .../schema/dic/services/services-1.0.xsd | 4 - .../DependencyInjection/SimpleXMLElement.php | 116 ------------- .../CheckDefinitionValidityPassTest.php | 14 -- ...cyResolveParameterPlaceHoldersPassTest.php | 37 ----- .../Tests/ContainerBuilderTest.php | 92 ----------- .../Tests/ContainerTest.php | 27 +--- .../Tests/DefinitionDecoratorTest.php | 28 ---- .../Tests/DefinitionTest.php | 15 -- .../Tests/Dumper/GraphvizDumperTest.php | 12 -- .../Tests/Dumper/PhpDumperTest.php | 12 -- .../Tests/Dumper/XmlDumperTest.php | 23 --- .../Tests/Dumper/YamlDumperTest.php | 23 --- .../Tests/Fixtures/containers/container20.php | 19 --- .../Fixtures/containers/legacy-container9.php | 39 ----- .../Fixtures/graphviz/legacy-services9.dot | 15 -- .../Tests/Fixtures/php/services10.php | 3 - .../Tests/Fixtures/php/services12.php | 3 - .../Tests/Fixtures/php/services20.php | 73 --------- .../Tests/Fixtures/php/services9_compiled.php | 3 - .../Tests/Fixtures/xml/legacy-services6.xml | 10 -- .../Tests/Fixtures/xml/legacy-services9.xml | 36 ----- .../Tests/Fixtures/xml/services20.xml | 11 -- .../Tests/Fixtures/xml/services6.xml | 2 +- .../Tests/Fixtures/yaml/legacy-services6.yml | 3 - .../Tests/Fixtures/yaml/legacy-services9.yml | 28 ---- .../Tests/Fixtures/yaml/services20.yml | 9 -- .../Tests/Fixtures/yaml/services6.yml | 1 - .../Tests/LegacyContainerBuilderTest.php | 51 ------ .../Tests/LegacyDefinitionTest.php | 49 ------ .../Tests/Loader/XmlFileLoaderTest.php | 19 --- .../Tests/Loader/YamlFileLoaderTest.php | 19 --- 80 files changed, 23 insertions(+), 1508 deletions(-) delete mode 100644 src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/legacy_synchronized_service_definition_1.json delete mode 100644 src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/legacy_synchronized_service_definition_1.md delete mode 100644 src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/legacy_synchronized_service_definition_1.txt delete mode 100644 src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/legacy_synchronized_service_definition_1.xml delete mode 100644 src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/legacy_synchronized_service_definition_2.json delete mode 100644 src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/legacy_synchronized_service_definition_2.md delete mode 100644 src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/legacy_synchronized_service_definition_2.txt delete mode 100644 src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/legacy_synchronized_service_definition_2.xml delete mode 100644 src/Symfony/Component/DependencyInjection/SimpleXMLElement.php delete mode 100644 src/Symfony/Component/DependencyInjection/Tests/Compiler/LegacyResolveParameterPlaceHoldersPassTest.php delete mode 100644 src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container20.php delete mode 100644 src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/legacy-container9.php delete mode 100644 src/Symfony/Component/DependencyInjection/Tests/Fixtures/graphviz/legacy-services9.dot delete mode 100644 src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services20.php delete mode 100644 src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/legacy-services6.xml delete mode 100644 src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/legacy-services9.xml delete mode 100644 src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services20.xml delete mode 100644 src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/legacy-services6.yml delete mode 100644 src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/legacy-services9.yml delete mode 100644 src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services20.yml delete mode 100644 src/Symfony/Component/DependencyInjection/Tests/LegacyContainerBuilderTest.php delete mode 100644 src/Symfony/Component/DependencyInjection/Tests/LegacyDefinitionTest.php diff --git a/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/Fixtures/php/lazy_service.php b/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/Fixtures/php/lazy_service.php index 65e544dd62a8..da3be4997c3f 100644 --- a/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/Fixtures/php/lazy_service.php +++ b/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/Fixtures/php/lazy_service.php @@ -26,9 +26,6 @@ public function __construct() $this->services = $this->scopedServices = $this->scopeStacks = array(); - - $this->set('service_container', $this); - $this->scopes = array(); $this->scopeChildren = array(); } diff --git a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/JsonDescriptor.php b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/JsonDescriptor.php index fbaecbc8af94..c210d3b508b2 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/JsonDescriptor.php +++ b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/JsonDescriptor.php @@ -210,25 +210,9 @@ private function getContainerDefinitionData(Definition $definition, $omitTags = 'lazy' => $definition->isLazy(), ); - if (method_exists($definition, 'isSynchronized')) { - $data['synchronized'] = $definition->isSynchronized(false); - } - $data['abstract'] = $definition->isAbstract(); $data['file'] = $definition->getFile(); - if ($definition->getFactoryClass(false)) { - $data['factory_class'] = $definition->getFactoryClass(false); - } - - if ($definition->getFactoryService(false)) { - $data['factory_service'] = $definition->getFactoryService(false); - } - - if ($definition->getFactoryMethod(false)) { - $data['factory_method'] = $definition->getFactoryMethod(false); - } - if ($factory = $definition->getFactory()) { if (is_array($factory)) { if ($factory[0] instanceof Reference) { diff --git a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/MarkdownDescriptor.php b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/MarkdownDescriptor.php index cb89101adb48..1208ac2d118f 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/MarkdownDescriptor.php +++ b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/MarkdownDescriptor.php @@ -110,7 +110,7 @@ protected function describeContainerService($service, array $options = array()) } elseif ($service instanceof Definition) { $this->describeContainerDefinition($service, $childOptions); } else { - $this->write(sprintf("**`%s`:** `%s`", $options['id'], get_class($service))); + $this->write(sprintf('**`%s`:** `%s`', $options['id'], get_class($service))); } } @@ -182,28 +182,12 @@ protected function describeContainerDefinition(Definition $definition, array $op ."\n".'- Lazy: '.($definition->isLazy() ? 'yes' : 'no') ; - if (method_exists($definition, 'isSynchronized')) { - $output .= "\n".'- Synchronized: '.($definition->isSynchronized(false) ? 'yes' : 'no'); - } - $output .= "\n".'- Abstract: '.($definition->isAbstract() ? 'yes' : 'no'); if ($definition->getFile()) { $output .= "\n".'- File: `'.$definition->getFile().'`'; } - if ($definition->getFactoryClass(false)) { - $output .= "\n".'- Factory Class: `'.$definition->getFactoryClass(false).'`'; - } - - if ($definition->getFactoryService(false)) { - $output .= "\n".'- Factory Service: `'.$definition->getFactoryService(false).'`'; - } - - if ($definition->getFactoryMethod(false)) { - $output .= "\n".'- Factory Method: `'.$definition->getFactoryMethod(false).'`'; - } - if ($factory = $definition->getFactory()) { if (is_array($factory)) { if ($factory[0] instanceof Reference) { diff --git a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php index 8f8171f609d6..d1d8f8c6d2de 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php +++ b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php @@ -207,7 +207,7 @@ protected function describeContainerServices(ContainerBuilder $builder, array $o foreach ($definition->getTag($showTag) as $key => $tag) { $tagValues = array(); foreach ($tagsNames as $tagName) { - $tagValues[] = isset($tag[$tagName]) ? $tag[$tagName] : ""; + $tagValues[] = isset($tag[$tagName]) ? $tag[$tagName] : ''; } if (0 === $key) { $table->addRow(array_merge(array($serviceId), $tagValues, array($definition->getClass()))); @@ -220,10 +220,10 @@ protected function describeContainerServices(ContainerBuilder $builder, array $o } } elseif ($definition instanceof Alias) { $alias = $definition; - $table->addRow(array_merge(array($serviceId, sprintf('alias for "%s"', $alias)), $tagsCount ? array_fill(0, $tagsCount, "") : array())); + $table->addRow(array_merge(array($serviceId, sprintf('alias for "%s"', $alias)), $tagsCount ? array_fill(0, $tagsCount, '') : array())); } else { // we have no information (happens with "service_container") - $table->addRow(array_merge(array($serviceId, get_class($definition)), $tagsCount ? array_fill(0, $tagsCount, "") : array())); + $table->addRow(array_merge(array($serviceId, get_class($definition)), $tagsCount ? array_fill(0, $tagsCount, '') : array())); } } @@ -240,7 +240,7 @@ protected function describeContainerDefinition(Definition $definition, array $op : array(); $description[] = sprintf('Service Id %s', isset($options['id']) ? $options['id'] : '-'); - $description[] = sprintf('Class %s', $definition->getClass() ?: "-"); + $description[] = sprintf('Class %s', $definition->getClass() ?: '-'); $tags = $definition->getTags(); if (count($tags)) { @@ -260,27 +260,12 @@ protected function describeContainerDefinition(Definition $definition, array $op $description[] = sprintf('Public %s', $definition->isPublic() ? 'yes' : 'no'); $description[] = sprintf('Synthetic %s', $definition->isSynthetic() ? 'yes' : 'no'); $description[] = sprintf('Lazy %s', $definition->isLazy() ? 'yes' : 'no'); - if (method_exists($definition, 'isSynchronized')) { - $description[] = sprintf('Synchronized %s', $definition->isSynchronized(false) ? 'yes' : 'no'); - } $description[] = sprintf('Abstract %s', $definition->isAbstract() ? 'yes' : 'no'); if ($definition->getFile()) { $description[] = sprintf('Required File %s', $definition->getFile() ? $definition->getFile() : '-'); } - if ($definition->getFactoryClass(false)) { - $description[] = sprintf('Factory Class %s', $definition->getFactoryClass(false)); - } - - if ($definition->getFactoryService(false)) { - $description[] = sprintf('Factory Service %s', $definition->getFactoryService(false)); - } - - if ($definition->getFactoryMethod(false)) { - $description[] = sprintf('Factory Method %s', $definition->getFactoryMethod(false)); - } - if ($factory = $definition->getFactory()) { if (is_array($factory)) { if ($factory[0] instanceof Reference) { diff --git a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/XmlDescriptor.php b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/XmlDescriptor.php index fe0c357e1197..2279a9d05353 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/XmlDescriptor.php +++ b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/XmlDescriptor.php @@ -329,20 +329,6 @@ private function getContainerDefinitionDocument(Definition $definition, $id = nu $serviceXML->setAttribute('class', $definition->getClass()); - if (method_exists($definition, 'getFactoryMethod')) { - if ($definition->getFactoryClass(false)) { - $serviceXML->setAttribute('factory-class', $definition->getFactoryClass(false)); - } - - if ($definition->getFactoryService(false)) { - $serviceXML->setAttribute('factory-service', $definition->getFactoryService(false)); - } - - if ($definition->getFactoryMethod(false)) { - $serviceXML->setAttribute('factory-method', $definition->getFactoryMethod(false)); - } - } - if ($factory = $definition->getFactory()) { $serviceXML->appendChild($factoryXML = $dom->createElement('factory')); @@ -364,9 +350,6 @@ private function getContainerDefinitionDocument(Definition $definition, $id = nu $serviceXML->setAttribute('public', $definition->isPublic() ? 'true' : 'false'); $serviceXML->setAttribute('synthetic', $definition->isSynthetic() ? 'true' : 'false'); $serviceXML->setAttribute('lazy', $definition->isLazy() ? 'true' : 'false'); - if (method_exists($definition, 'isSynchronized')) { - $serviceXML->setAttribute('synchronized', $definition->isSynchronized(false) ? 'true' : 'false'); - } $serviceXML->setAttribute('abstract', $definition->isAbstract() ? 'true' : 'false'); $serviceXML->setAttribute('file', $definition->getFile()); diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Console/Descriptor/AbstractDescriptorTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Console/Descriptor/AbstractDescriptorTest.php index 87f564d12a41..b0edee046b72 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Console/Descriptor/AbstractDescriptorTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Console/Descriptor/AbstractDescriptorTest.php @@ -66,24 +66,6 @@ public function getDescribeContainerBuilderTestData() return $this->getContainerBuilderDescriptionTestData(ObjectsProvider::getContainerBuilders()); } - /** - * @dataProvider provideLegacySynchronizedServiceDefinitionTestData - * @group legacy - */ - public function testLegacyDescribeSynchronizedServiceDefinition(Definition $definition, $expectedDescription) - { - $this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED); - - $this->assertDescription($expectedDescription, $definition); - } - - public function provideLegacySynchronizedServiceDefinitionTestData() - { - $this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED); - - return $this->getDescriptionTestData(ObjectsProvider::getLegacyContainerDefinitions()); - } - /** @dataProvider getDescribeContainerDefinitionTestData */ public function testDescribeContainerDefinition(Definition $definition, $expectedDescription) { diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Console/Descriptor/ObjectsProvider.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Console/Descriptor/ObjectsProvider.php index 94db08b5bdc9..bc39865d2ead 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Console/Descriptor/ObjectsProvider.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Console/Descriptor/ObjectsProvider.php @@ -112,39 +112,6 @@ public static function getContainerDefinitions() ); } - /** - * @deprecated since version 2.7, to be removed in 3.0 - * @internal - */ - public static function getLegacyContainerDefinitions() - { - $definition1 = new Definition('Full\\Qualified\\Class1'); - $definition2 = new Definition('Full\\Qualified\\Class2'); - - return array( - 'legacy_synchronized_service_definition_1' => $definition1 - ->setPublic(true) - ->setSynthetic(false) - ->setLazy(true) - ->setSynchronized(true) - ->setAbstract(true) - ->setFactoryClass('Full\\Qualified\\FactoryClass', 'get') - ->setFactoryMethod('get'), - 'legacy_synchronized_service_definition_2' => $definition2 - ->setPublic(false) - ->setSynthetic(true) - ->setFile('/path/to/file') - ->setLazy(false) - ->setSynchronized(false) - ->setAbstract(false) - ->addTag('tag1', array('attr1' => 'val1', 'attr2' => 'val2')) - ->addTag('tag1', array('attr3' => 'val3')) - ->addTag('tag2') - ->setFactoryService('factory.service') - ->setFactoryMethod('get'), - ); - } - public static function getContainerAliases() { return array( diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_public.json b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_public.json index 047f4e8c16a4..df41732b4047 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_public.json +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_public.json @@ -6,7 +6,6 @@ "public": true, "synthetic": false, "lazy": true, - "synchronized": false, "abstract": true, "file": null, "factory_class": "Full\\Qualified\\FactoryClass", diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_public.md b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_public.md index 506f3487c57e..b3bf6c04d618 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_public.md +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_public.md @@ -12,7 +12,6 @@ definition_1 - Public: yes - Synthetic: no - Lazy: yes -- Synchronized: no - Abstract: yes - Factory Class: `Full\Qualified\FactoryClass` - Factory Method: `get` diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_public.xml b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_public.xml index b21190dc7983..9ee25ce04546 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_public.xml +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_public.xml @@ -2,7 +2,7 @@ - + diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_services.json b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_services.json index 3397fd67acd6..c17bae3d6b89 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_services.json +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_services.json @@ -6,7 +6,6 @@ "public": true, "synthetic": false, "lazy": true, - "synchronized": false, "abstract": true, "file": null, "factory_class": "Full\\Qualified\\FactoryClass", @@ -21,7 +20,6 @@ "public": false, "synthetic": true, "lazy": false, - "synchronized": false, "abstract": false, "file": "\/path\/to\/file", "factory_service": "factory.service", diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_services.md b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_services.md index d0a32aeb3fdc..c8c3c0443d4f 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_services.md +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_services.md @@ -12,7 +12,6 @@ definition_1 - Public: yes - Synthetic: no - Lazy: yes -- Synchronized: no - Abstract: yes - Factory Class: `Full\Qualified\FactoryClass` - Factory Method: `get` @@ -25,7 +24,6 @@ definition_2 - Public: no - Synthetic: yes - Lazy: no -- Synchronized: no - Abstract: no - File: `/path/to/file` - Factory Service: `factory.service` diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_services.xml b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_services.xml index 7aecc4f629e7..c7990d30f58a 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_services.xml +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_services.xml @@ -2,10 +2,10 @@ - + - + diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_tag1.json b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_tag1.json index 53bf114e81e0..541033454845 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_tag1.json +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_tag1.json @@ -6,7 +6,6 @@ "public": false, "synthetic": true, "lazy": false, - "synchronized": false, "abstract": false, "file": "\/path\/to\/file", "factory_service": "factory.service", diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_tag1.md b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_tag1.md index 56a2c390779a..7101a0b33385 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_tag1.md +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_tag1.md @@ -12,7 +12,6 @@ definition_2 - Public: no - Synthetic: yes - Lazy: no -- Synchronized: no - Abstract: no - File: `/path/to/file` - Factory Service: `factory.service` diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_tag1.xml b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_tag1.xml index d6ac0b750b16..e07d9375b7d1 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_tag1.xml +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_tag1.xml @@ -1,6 +1,6 @@ - + diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_tags.json b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_tags.json index 3837b95cb89e..5b6b36224319 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_tags.json +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_tags.json @@ -6,7 +6,6 @@ "public": false, "synthetic": true, "lazy": false, - "synchronized": false, "abstract": false, "file": "\/path\/to\/file", "factory_service": "factory.service", @@ -20,7 +19,6 @@ "public": false, "synthetic": true, "lazy": false, - "synchronized": false, "abstract": false, "file": "\/path\/to\/file", "factory_service": "factory.service", diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_tags.md b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_tags.md index 6577037f9c00..6d55a6de5c99 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_tags.md +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_tags.md @@ -12,7 +12,6 @@ definition_2 - Public: no - Synthetic: yes - Lazy: no -- Synchronized: no - Abstract: no - File: `/path/to/file` - Factory Service: `factory.service` @@ -30,7 +29,6 @@ definition_2 - Public: no - Synthetic: yes - Lazy: no -- Synchronized: no - Abstract: no - File: `/path/to/file` - Factory Service: `factory.service` diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_tags.xml b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_tags.xml index be9d2f015bd2..c8de17e5f115 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_tags.xml +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_tags.xml @@ -1,12 +1,12 @@ - + - + diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_1.json b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_1.json index 8de781dfc45a..143f7d07d15d 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_1.json +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_1.json @@ -4,7 +4,6 @@ "public": true, "synthetic": false, "lazy": true, - "synchronized": false, "abstract": true, "file": null, "factory_class": "Full\\Qualified\\FactoryClass", diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_1.md b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_1.md index 64e065866ec0..c940dfaa905d 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_1.md +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_1.md @@ -3,7 +3,6 @@ - Public: yes - Synthetic: no - Lazy: yes -- Synchronized: no - Abstract: yes - Factory Class: `Full\Qualified\FactoryClass` - Factory Method: `get` \ No newline at end of file diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_1.txt b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_1.txt index af495497dd35..8510b34e8347 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_1.txt +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_1.txt @@ -5,7 +5,6 @@ Public yes Synthetic no Lazy yes -Synchronized no Abstract yes Factory Class Full\Qualified\FactoryClass Factory Method get diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_1.xml b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_1.xml index 92a9bbd70bd3..30ec7f908b0f 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_1.xml +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_1.xml @@ -1,4 +1,4 @@ - + diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_2.json b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_2.json index 9d58434c17e1..a7b92bca4754 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_2.json +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_2.json @@ -4,7 +4,6 @@ "public": false, "synthetic": true, "lazy": false, - "synchronized": false, "abstract": false, "file": "\/path\/to\/file", "factory_service": "factory.service", diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_2.md b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_2.md index 6b2f14651d30..c603d024d748 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_2.md +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_2.md @@ -3,7 +3,6 @@ - Public: no - Synthetic: yes - Lazy: no -- Synchronized: no - Abstract: no - File: `/path/to/file` - Factory Service: `factory.service` diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_2.txt b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_2.txt index 28a00d583b09..56bbdbef8f0d 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_2.txt +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_2.txt @@ -8,7 +8,6 @@ Public no Synthetic yes Lazy no -Synchronized no Abstract no Required File /path/to/file Factory Service factory.service diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_2.xml b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_2.xml index f128e522e599..88a12bd12866 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_2.xml +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_2.xml @@ -1,5 +1,5 @@ - + diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/legacy_synchronized_service_definition_1.json b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/legacy_synchronized_service_definition_1.json deleted file mode 100644 index 6372d9e5b56d..000000000000 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/legacy_synchronized_service_definition_1.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "class": "Full\\Qualified\\Class1", - "scope": "container", - "public": true, - "synthetic": false, - "lazy": true, - "synchronized": true, - "abstract": true, - "file": null, - "factory_class": "Full\\Qualified\\FactoryClass", - "factory_method": "get", - "tags": [ - - ] -} diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/legacy_synchronized_service_definition_1.md b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/legacy_synchronized_service_definition_1.md deleted file mode 100644 index 8d9456e6fdd1..000000000000 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/legacy_synchronized_service_definition_1.md +++ /dev/null @@ -1,9 +0,0 @@ -- Class: `Full\Qualified\Class1` -- Scope: `container` -- Public: yes -- Synthetic: no -- Lazy: yes -- Synchronized: yes -- Abstract: yes -- Factory Class: `Full\Qualified\FactoryClass` -- Factory Method: `get` \ No newline at end of file diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/legacy_synchronized_service_definition_1.txt b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/legacy_synchronized_service_definition_1.txt deleted file mode 100644 index 3d9cbb2077c3..000000000000 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/legacy_synchronized_service_definition_1.txt +++ /dev/null @@ -1,11 +0,0 @@ -Service Id - -Class Full\Qualified\Class1 -Tags - -Scope container -Public yes -Synthetic no -Lazy yes -Synchronized yes -Abstract yes -Factory Class Full\Qualified\FactoryClass -Factory Method get diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/legacy_synchronized_service_definition_1.xml b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/legacy_synchronized_service_definition_1.xml deleted file mode 100644 index 75d082024457..000000000000 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/legacy_synchronized_service_definition_1.xml +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/legacy_synchronized_service_definition_2.json b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/legacy_synchronized_service_definition_2.json deleted file mode 100644 index 278a5bfed413..000000000000 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/legacy_synchronized_service_definition_2.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "class": "Full\\Qualified\\Class2", - "scope": "container", - "public": false, - "synthetic": true, - "lazy": false, - "synchronized": false, - "abstract": false, - "file": "\/path\/to\/file", - "factory_service": "factory.service", - "factory_method": "get", - "tags": [ - { - "name": "tag1", - "parameters": { - "attr1": "val1", - "attr2": "val2" - } - }, - { - "name": "tag1", - "parameters": { - "attr3": "val3" - } - }, - { - "name": "tag2", - "parameters": [ - - ] - } - ] -} diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/legacy_synchronized_service_definition_2.md b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/legacy_synchronized_service_definition_2.md deleted file mode 100644 index 6b2f14651d30..000000000000 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/legacy_synchronized_service_definition_2.md +++ /dev/null @@ -1,16 +0,0 @@ -- Class: `Full\Qualified\Class2` -- Scope: `container` -- Public: no -- Synthetic: yes -- Lazy: no -- Synchronized: no -- Abstract: no -- File: `/path/to/file` -- Factory Service: `factory.service` -- Factory Method: `get` -- Tag: `tag1` - - Attr1: val1 - - Attr2: val2 -- Tag: `tag1` - - Attr3: val3 -- Tag: `tag2` \ No newline at end of file diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/legacy_synchronized_service_definition_2.txt b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/legacy_synchronized_service_definition_2.txt deleted file mode 100644 index 28a00d583b09..000000000000 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/legacy_synchronized_service_definition_2.txt +++ /dev/null @@ -1,15 +0,0 @@ -Service Id - -Class Full\Qualified\Class2 -Tags - - tag1 (attr1: val1, attr2: val2) - - tag1 (attr3: val3) - - tag2 () -Scope container -Public no -Synthetic yes -Lazy no -Synchronized no -Abstract no -Required File /path/to/file -Factory Service factory.service -Factory Method get diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/legacy_synchronized_service_definition_2.xml b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/legacy_synchronized_service_definition_2.xml deleted file mode 100644 index dd3e2e06d717..000000000000 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/legacy_synchronized_service_definition_2.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - val1 - val2 - - - val3 - - - - diff --git a/src/Symfony/Component/DependencyInjection/Compiler/AnalyzeServiceReferencesPass.php b/src/Symfony/Component/DependencyInjection/Compiler/AnalyzeServiceReferencesPass.php index 5120eb6215c1..9fd3523706ac 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/AnalyzeServiceReferencesPass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/AnalyzeServiceReferencesPass.php @@ -71,9 +71,6 @@ public function process(ContainerBuilder $container) $this->currentDefinition = $definition; $this->processArguments($definition->getArguments()); - if ($definition->getFactoryService(false)) { - $this->processArguments(array(new Reference($definition->getFactoryService(false)))); - } if (is_array($definition->getFactory())) { $this->processArguments($definition->getFactory()); } @@ -118,9 +115,6 @@ private function processArguments(array $arguments) if (is_array($argument->getFactory())) { $this->processArguments($argument->getFactory()); } - if ($argument->getFactoryService(false)) { - $this->processArguments(array(new Reference($argument->getFactoryService(false)))); - } } } } diff --git a/src/Symfony/Component/DependencyInjection/Compiler/CheckDefinitionValidityPass.php b/src/Symfony/Component/DependencyInjection/Compiler/CheckDefinitionValidityPass.php index 219e66313d13..938bbe897062 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/CheckDefinitionValidityPass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/CheckDefinitionValidityPass.php @@ -50,13 +50,9 @@ public function process(ContainerBuilder $container) throw new RuntimeException(sprintf('A synthetic service ("%s") cannot be of scope "prototype".', $id)); } - if ($definition->getFactory() && ($definition->getFactoryClass(false) || $definition->getFactoryService(false) || $definition->getFactoryMethod(false))) { - throw new RuntimeException(sprintf('A service ("%s") can use either the old or the new factory syntax, not both.', $id)); - } - // non-synthetic, non-abstract service has class if (!$definition->isAbstract() && !$definition->isSynthetic() && !$definition->getClass()) { - if ($definition->getFactory() || $definition->getFactoryClass(false) || $definition->getFactoryService(false)) { + if ($definition->getFactory()) { throw new RuntimeException(sprintf('Please add the class to service "%s" even if it is constructed by a factory since we might need to add method calls based on compile-time checks.', $id)); } diff --git a/src/Symfony/Component/DependencyInjection/Compiler/InlineServiceDefinitionsPass.php b/src/Symfony/Component/DependencyInjection/Compiler/InlineServiceDefinitionsPass.php index 026700d2263d..d96807ca020f 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/InlineServiceDefinitionsPass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/InlineServiceDefinitionsPass.php @@ -148,10 +148,6 @@ private function isInlineableDefinition(ContainerBuilder $container, $id, Defini return false; } - if (count($ids) > 1 && $definition->getFactoryService(false)) { - return false; - } - return $container->getDefinition(reset($ids))->getScope() === $definition->getScope(); } } diff --git a/src/Symfony/Component/DependencyInjection/Compiler/ResolveDefinitionTemplatesPass.php b/src/Symfony/Component/DependencyInjection/Compiler/ResolveDefinitionTemplatesPass.php index b0f970cb8b69..58af4b69ce7f 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/ResolveDefinitionTemplatesPass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/ResolveDefinitionTemplatesPass.php @@ -81,15 +81,6 @@ private function resolveDefinition($id, DefinitionDecorator $definition) $def->setArguments($parentDef->getArguments()); $def->setMethodCalls($parentDef->getMethodCalls()); $def->setProperties($parentDef->getProperties()); - if ($parentDef->getFactoryClass(false)) { - $def->setFactoryClass($parentDef->getFactoryClass(false)); - } - if ($parentDef->getFactoryMethod(false)) { - $def->setFactoryMethod($parentDef->getFactoryMethod(false)); - } - if ($parentDef->getFactoryService(false)) { - $def->setFactoryService($parentDef->getFactoryService(false)); - } $def->setFactory($parentDef->getFactory()); $def->setConfigurator($parentDef->getConfigurator()); $def->setFile($parentDef->getFile()); @@ -101,15 +92,6 @@ private function resolveDefinition($id, DefinitionDecorator $definition) if (isset($changes['class'])) { $def->setClass($definition->getClass()); } - if (isset($changes['factory_class'])) { - $def->setFactoryClass($definition->getFactoryClass(false)); - } - if (isset($changes['factory_method'])) { - $def->setFactoryMethod($definition->getFactoryMethod(false)); - } - if (isset($changes['factory_service'])) { - $def->setFactoryService($definition->getFactoryService(false)); - } if (isset($changes['factory'])) { $def->setFactory($definition->getFactory()); } diff --git a/src/Symfony/Component/DependencyInjection/Compiler/ResolveParameterPlaceHoldersPass.php b/src/Symfony/Component/DependencyInjection/Compiler/ResolveParameterPlaceHoldersPass.php index 0a789676c96f..0c5963cc1180 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/ResolveParameterPlaceHoldersPass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/ResolveParameterPlaceHoldersPass.php @@ -37,9 +37,6 @@ public function process(ContainerBuilder $container) $definition->setClass($parameterBag->resolveValue($definition->getClass())); $definition->setFile($parameterBag->resolveValue($definition->getFile())); $definition->setArguments($parameterBag->resolveValue($definition->getArguments())); - if ($definition->getFactoryClass(false)) { - $definition->setFactoryClass($parameterBag->resolveValue($definition->getFactoryClass())); - } $factory = $definition->getFactory(); diff --git a/src/Symfony/Component/DependencyInjection/Container.php b/src/Symfony/Component/DependencyInjection/Container.php index a969db3036c6..cf8f1654ee50 100644 --- a/src/Symfony/Component/DependencyInjection/Container.php +++ b/src/Symfony/Component/DependencyInjection/Container.php @@ -86,8 +86,6 @@ class Container implements IntrospectableContainerInterface public function __construct(ParameterBagInterface $parameterBag = null) { $this->parameterBag = $parameterBag ?: new ParameterBag(); - - $this->set('service_container', $this); } /** @@ -198,11 +196,9 @@ public function set($id, $service, $scope = self::SCOPE_CONTAINER) $id = strtolower($id); if ('service_container' === $id) { - // BC: 'service_container' is no longer a self-reference but always - // $this, so ignore this call. - // @todo Throw InvalidArgumentException in next major release. - return; + throw new InvalidArgumentException('You cannot set service "service_container".'); } + if (self::SCOPE_CONTAINER !== $scope) { if (!isset($this->scopedServices[$scope])) { throw new RuntimeException(sprintf('You cannot set service "%s" of inactive scope.', $id)); @@ -213,10 +209,6 @@ public function set($id, $service, $scope = self::SCOPE_CONTAINER) $this->services[$id] = $service; - if (method_exists($this, $method = 'synchronize'.strtr($id, array('_' => '', '.' => '_', '\\' => '_')).'Service')) { - $this->$method(); - } - if (null === $service) { if (self::SCOPE_CONTAINER !== $scope) { unset($this->scopedServices[$scope][$id]); @@ -355,9 +347,7 @@ public function initialized($id) $id = strtolower($id); if ('service_container' === $id) { - // BC: 'service_container' was a synthetic service previously. - // @todo Change to false in next major release. - return true; + return false; } if (isset($this->aliases[$id])) { diff --git a/src/Symfony/Component/DependencyInjection/ContainerBuilder.php b/src/Symfony/Component/DependencyInjection/ContainerBuilder.php index 6991fa276c43..faa1595a11a1 100644 --- a/src/Symfony/Component/DependencyInjection/ContainerBuilder.php +++ b/src/Symfony/Component/DependencyInjection/ContainerBuilder.php @@ -411,10 +411,6 @@ public function set($id, $service, $scope = self::SCOPE_CONTAINER) unset($this->definitions[$id], $this->aliasDefinitions[$id]); parent::set($id, $service, $scope); - - if (isset($this->obsoleteDefinitions[$id]) && $this->obsoleteDefinitions[$id]->isSynchronized(false)) { - $this->synchronize($id); - } } /** @@ -944,16 +940,6 @@ private function createService(Definition $definition, $id, $tryProxy = true) } $service = call_user_func_array($factory, $arguments); - } elseif (null !== $definition->getFactoryMethod(false)) { - if (null !== $definition->getFactoryClass(false)) { - $factory = $parameterBag->resolveValue($definition->getFactoryClass(false)); - } elseif (null !== $definition->getFactoryService(false)) { - $factory = $this->get($parameterBag->resolveValue($definition->getFactoryService(false))); - } else { - throw new RuntimeException(sprintf('Cannot create service "%s" from factory method without a factory service or factory class.', $id)); - } - - $service = call_user_func_array(array($factory, $definition->getFactoryMethod(false)), $arguments); } else { $r = new \ReflectionClass($parameterBag->resolveValue($definition->getClass())); @@ -1108,38 +1094,6 @@ private function getProxyInstantiator() return $this->proxyInstantiator; } - /** - * Synchronizes a service change. - * - * This method updates all services that depend on the given - * service by calling all methods referencing it. - * - * @param string $id A service id - * - * @deprecated since version 2.7, will be removed in 3.0. - */ - private function synchronize($id) - { - if ('request' !== $id) { - trigger_error('The '.__METHOD__.' method is deprecated in version 2.7 and will be removed in version 3.0.', E_USER_DEPRECATED); - } - - foreach ($this->definitions as $definitionId => $definition) { - // only check initialized services - if (!$this->initialized($definitionId)) { - continue; - } - - foreach ($definition->getMethodCalls() as $call) { - foreach ($call[1] as $argument) { - if ($argument instanceof Reference && $id == (string) $argument) { - $this->callMethod($this->get($definitionId), $call); - } - } - } - } - } - private function callMethod($service, $call) { $services = self::getServiceConditionals($call[1]); diff --git a/src/Symfony/Component/DependencyInjection/Definition.php b/src/Symfony/Component/DependencyInjection/Definition.php index c18389992f0b..fc289e467c9c 100644 --- a/src/Symfony/Component/DependencyInjection/Definition.php +++ b/src/Symfony/Component/DependencyInjection/Definition.php @@ -26,9 +26,6 @@ class Definition private $class; private $file; private $factory; - private $factoryClass; - private $factoryMethod; - private $factoryService; private $scope = ContainerInterface::SCOPE_CONTAINER; private $properties = array(); private $calls = array(); @@ -37,7 +34,6 @@ class Definition private $public = true; private $synthetic = false; private $abstract = false; - private $synchronized = false; private $lazy = false; private $decoratedService; @@ -85,62 +81,6 @@ public function getFactory() return $this->factory; } - /** - * Sets the name of the class that acts as a factory using the factory method, - * which will be invoked statically. - * - * @param string $factoryClass The factory class name - * - * @return Definition The current instance - * - * @api - * @deprecated since version 2.6, to be removed in 3.0. - */ - public function setFactoryClass($factoryClass) - { - trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0. Use Definition::setFactory() instead.', E_USER_DEPRECATED); - - $this->factoryClass = $factoryClass; - - return $this; - } - - /** - * Gets the factory class. - * - * @return string|null The factory class name - * - * @api - * @deprecated since version 2.6, to be removed in 3.0. - */ - public function getFactoryClass($triggerDeprecationError = true) - { - if ($triggerDeprecationError) { - trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0.', E_USER_DEPRECATED); - } - - return $this->factoryClass; - } - - /** - * Sets the factory method able to create an instance of this class. - * - * @param string $factoryMethod The factory method name - * - * @return Definition The current instance - * - * @api - * @deprecated since version 2.6, to be removed in 3.0. - */ - public function setFactoryMethod($factoryMethod) - { - trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0. Use Definition::setFactory() instead.', E_USER_DEPRECATED); - - $this->factoryMethod = $factoryMethod; - - return $this; - } - /** * Sets the service that this service is decorating. * @@ -176,59 +116,6 @@ public function getDecoratedService() return $this->decoratedService; } - /** - * Gets the factory method. - * - * @return string|null The factory method name - * - * @api - * @deprecated since version 2.6, to be removed in 3.0. - */ - public function getFactoryMethod($triggerDeprecationError = true) - { - if ($triggerDeprecationError) { - trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0.', E_USER_DEPRECATED); - } - - return $this->factoryMethod; - } - - /** - * Sets the name of the service that acts as a factory using the factory method. - * - * @param string $factoryService The factory service id - * - * @return Definition The current instance - * - * @api - * @deprecated since version 2.6, to be removed in 3.0. - */ - public function setFactoryService($factoryService) - { - trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0. Use Definition::setFactory() instead.', E_USER_DEPRECATED); - - $this->factoryService = $factoryService; - - return $this; - } - - /** - * Gets the factory service id. - * - * @return string|null The factory service id - * - * @api - * @deprecated since version 2.6, to be removed in 3.0. - */ - public function getFactoryService($triggerDeprecationError = true) - { - if ($triggerDeprecationError) { - trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0.', E_USER_DEPRECATED); - } - - return $this->factoryService; - } - /** * Sets the service class. * @@ -653,46 +540,6 @@ public function isPublic() return $this->public; } - /** - * Sets the synchronized flag of this service. - * - * @param bool $boolean - * - * @return Definition The current instance - * - * @api - * - * @deprecated since version 2.7, will be removed in 3.0. - */ - public function setSynchronized($boolean, $triggerDeprecationError = true) - { - if ($triggerDeprecationError) { - trigger_error('The '.__METHOD__.' method is deprecated since version 2.7 and will be removed in 3.0.', E_USER_DEPRECATED); - } - - $this->synchronized = (bool) $boolean; - - return $this; - } - - /** - * Whether this service is synchronized. - * - * @return bool - * - * @api - * - * @deprecated since version 2.7, will be removed in 3.0. - */ - public function isSynchronized($triggerDeprecationError = true) - { - if ($triggerDeprecationError) { - trigger_error('The '.__METHOD__.' method is deprecated since version 2.7 and will be removed in 3.0.', E_USER_DEPRECATED); - } - - return $this->synchronized; - } - /** * Sets the lazy flag of this service. * diff --git a/src/Symfony/Component/DependencyInjection/DefinitionDecorator.php b/src/Symfony/Component/DependencyInjection/DefinitionDecorator.php index d4b45d34ad31..939190d231c6 100644 --- a/src/Symfony/Component/DependencyInjection/DefinitionDecorator.php +++ b/src/Symfony/Component/DependencyInjection/DefinitionDecorator.php @@ -86,42 +86,6 @@ public function setFactory($callable) return parent::setFactory($callable); } - /** - * {@inheritdoc} - * - * @api - */ - public function setFactoryClass($class) - { - $this->changes['factory_class'] = true; - - return parent::setFactoryClass($class); - } - - /** - * {@inheritdoc} - * - * @api - */ - public function setFactoryMethod($method) - { - $this->changes['factory_method'] = true; - - return parent::setFactoryMethod($method); - } - - /** - * {@inheritdoc} - * - * @api - */ - public function setFactoryService($service) - { - $this->changes['factory_service'] = true; - - return parent::setFactoryService($service); - } - /** * {@inheritdoc} * diff --git a/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php b/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php index e57c59e51218..1ee94819757f 100644 --- a/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php +++ b/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php @@ -60,11 +60,6 @@ class PhpDumper extends Dumper private $targetDirRegex; private $targetDirMaxMatches; - /** - * @var ExpressionFunctionProviderInterface[] - */ - private $expressionLanguageProviders = array(); - /** * @var \Symfony\Component\DependencyInjection\LazyProxy\PhpDumper\DumperInterface */ @@ -572,10 +567,6 @@ private function addService($id, $definition) $return[] = sprintf('@return object An instance returned by %s::%s().', $factory[0]->getClass(), $factory[1]); } } - } elseif ($definition->getFactoryClass(false)) { - $return[] = sprintf('@return object An instance returned by %s::%s().', $definition->getFactoryClass(false), $definition->getFactoryMethod(false)); - } elseif ($definition->getFactoryService(false)) { - $return[] = sprintf('@return object An instance returned by %s::%s().', $definition->getFactoryService(false), $definition->getFactoryMethod(false)); } $scope = $definition->getScope(); @@ -672,7 +663,7 @@ private function addService($id, $definition) */ private function addServices() { - $publicServices = $privateServices = $synchronizers = ''; + $publicServices = $privateServices = ''; $definitions = $this->container->getDefinitions(); ksort($definitions); foreach ($definitions as $id => $definition) { @@ -681,70 +672,9 @@ private function addServices() } else { $privateServices .= $this->addService($id, $definition); } - - $synchronizers .= $this->addServiceSynchronizer($id, $definition); } - return $publicServices.$synchronizers.$privateServices; - } - - /** - * Adds synchronizer methods. - * - * @param string $id A service identifier - * @param Definition $definition A Definition instance - * - * @return string|null - * - * @deprecated since version 2.7, will be removed in 3.0. - */ - private function addServiceSynchronizer($id, Definition $definition) - { - if (!$definition->isSynchronized(false)) { - return; - } - - if ('request' !== $id) { - trigger_error('Synchronized services were deprecated in version 2.7 and won\'t work anymore in 3.0.', E_USER_DEPRECATED); - } - - $code = ''; - foreach ($this->container->getDefinitions() as $definitionId => $definition) { - foreach ($definition->getMethodCalls() as $call) { - foreach ($call[1] as $argument) { - if ($argument instanceof Reference && $id == (string) $argument) { - $arguments = array(); - foreach ($call[1] as $value) { - $arguments[] = $this->dumpValue($value); - } - - $call = $this->wrapServiceConditionals($call[1], sprintf("\$this->get('%s')->%s(%s);", $definitionId, $call[0], implode(', ', $arguments))); - - $code .= <<initialized('$definitionId')) { - $call - } - -EOF; - } - } - } - } - - if (!$code) { - return; - } - - return <<camelize($id)}Service() - { -$code } - -EOF; + return $publicServices.$privateServices; } private function addNewInstance($id, Definition $definition, $return, $instantiation) @@ -774,23 +704,6 @@ private function addNewInstance($id, Definition $definition, $return, $instantia } return sprintf(" $return{$instantiation}\\%s(%s);\n", $callable, $arguments ? implode(', ', $arguments) : ''); - } elseif (null !== $definition->getFactoryMethod(false)) { - if (null !== $definition->getFactoryClass(false)) { - $class = $this->dumpValue($definition->getFactoryClass(false)); - - // If the class is a string we can optimize call_user_func away - if (strpos($class, "'") === 0) { - return sprintf(" $return{$instantiation}%s::%s(%s);\n", $this->dumpLiteralClass($class), $definition->getFactoryMethod(false), $arguments ? implode(', ', $arguments) : ''); - } - - return sprintf(" $return{$instantiation}call_user_func(array(%s, '%s')%s);\n", $this->dumpValue($definition->getFactoryClass(false)), $definition->getFactoryMethod(false), $arguments ? ', '.implode(', ', $arguments) : ''); - } - - if (null !== $definition->getFactoryService(false)) { - return sprintf(" $return{$instantiation}%s->%s(%s);\n", $this->getServiceCall($definition->getFactoryService(false)), $definition->getFactoryMethod(false), implode(', ', $arguments)); - } - - throw new RuntimeException(sprintf('Factory method requires a factory service or factory class in service definition for %s', $id)); } if (false !== strpos($class, '$')) { @@ -904,9 +817,6 @@ public function __construct() \$this->services = \$this->scopedServices = \$this->scopeStacks = array(); - - \$this->set('service_container', \$this); - EOF; $code .= "\n"; @@ -1334,18 +1244,6 @@ private function dumpValue($value, $interpolate = true) throw new RuntimeException('Cannot dump definition because of invalid factory'); } - if (null !== $value->getFactoryMethod(false)) { - if (null !== $value->getFactoryClass(false)) { - return sprintf("call_user_func(array(%s, '%s')%s)", $this->dumpValue($value->getFactoryClass(false)), $value->getFactoryMethod(false), count($arguments) > 0 ? ', '.implode(', ', $arguments) : ''); - } elseif (null !== $value->getFactoryService(false)) { - $service = $this->dumpValue($value->getFactoryService(false)); - - return sprintf('%s->%s(%s)', 0 === strpos($service, '$') ? sprintf('$this->get(%s)', $service) : $this->getServiceCall($value->getFactoryService(false)), $value->getFactoryMethod(false), implode(', ', $arguments)); - } else { - throw new RuntimeException('Cannot dump definitions which have factory method without factory service or factory class.'); - } - } - return sprintf("new \\%s(%s)", substr(str_replace('\\\\', '\\', $class), 1, -1), implode(', ', $arguments)); } elseif ($value instanceof Variable) { return '$'.$value; @@ -1408,19 +1306,6 @@ private function dumpParameter($name) return sprintf("\$this->getParameter('%s')", strtolower($name)); } - /** - * @deprecated since version 2.6.2, to be removed in 3.0. - * Use \Symfony\Component\DependencyInjection\ContainerBuilder::addExpressionLanguageProvider instead. - * - * @param ExpressionFunctionProviderInterface $provider - */ - public function addExpressionLanguageProvider(ExpressionFunctionProviderInterface $provider) - { - trigger_error('The '.__METHOD__.' method is deprecated since version 2.6.2 and will be removed in 3.0. Use the Symfony\Component\DependencyInjection\ContainerBuilder::addExpressionLanguageProvider method instead.', E_USER_DEPRECATED); - - $this->expressionLanguageProviders[] = $provider; - } - /** * Gets a service call. * @@ -1510,7 +1395,7 @@ private function getExpressionLanguage() if (!class_exists('Symfony\Component\ExpressionLanguage\ExpressionLanguage')) { throw new RuntimeException('Unable to use expressions as the Symfony ExpressionLanguage component is not installed.'); } - $providers = array_merge($this->container->getExpressionLanguageProviders(), $this->expressionLanguageProviders); + $providers = $this->container->getExpressionLanguageProviders(); $this->expressionLanguage = new ExpressionLanguage(null, $providers); if ($this->container->isTrackingResources()) { diff --git a/src/Symfony/Component/DependencyInjection/Dumper/XmlDumper.php b/src/Symfony/Component/DependencyInjection/Dumper/XmlDumper.php index 40486c459554..2911e069e3e0 100644 --- a/src/Symfony/Component/DependencyInjection/Dumper/XmlDumper.php +++ b/src/Symfony/Component/DependencyInjection/Dumper/XmlDumper.php @@ -117,15 +117,6 @@ private function addService($definition, $id, \DOMElement $parent) if ($definition->getClass()) { $service->setAttribute('class', $definition->getClass()); } - if ($definition->getFactoryMethod(false)) { - $service->setAttribute('factory-method', $definition->getFactoryMethod(false)); - } - if ($definition->getFactoryClass(false)) { - $service->setAttribute('factory-class', $definition->getFactoryClass(false)); - } - if ($definition->getFactoryService(false)) { - $service->setAttribute('factory-service', $definition->getFactoryService(false)); - } if (ContainerInterface::SCOPE_CONTAINER !== $scope = $definition->getScope()) { $service->setAttribute('scope', $scope); } @@ -135,9 +126,6 @@ private function addService($definition, $id, \DOMElement $parent) if ($definition->isSynthetic()) { $service->setAttribute('synthetic', 'true'); } - if ($definition->isSynchronized(false)) { - $service->setAttribute('synchronized', 'true'); - } if ($definition->isLazy()) { $service->setAttribute('lazy', 'true'); } diff --git a/src/Symfony/Component/DependencyInjection/Dumper/YamlDumper.php b/src/Symfony/Component/DependencyInjection/Dumper/YamlDumper.php index f291a0f5cf51..55b4377ea535 100644 --- a/src/Symfony/Component/DependencyInjection/Dumper/YamlDumper.php +++ b/src/Symfony/Component/DependencyInjection/Dumper/YamlDumper.php @@ -103,26 +103,10 @@ private function addService($id, $definition) $code .= sprintf(" synthetic: true\n"); } - if ($definition->isSynchronized(false)) { - $code .= sprintf(" synchronized: true\n"); - } - - if ($definition->getFactoryClass(false)) { - $code .= sprintf(" factory_class: %s\n", $definition->getFactoryClass(false)); - } - if ($definition->isLazy()) { $code .= sprintf(" lazy: true\n"); } - if ($definition->getFactoryMethod(false)) { - $code .= sprintf(" factory_method: %s\n", $definition->getFactoryMethod(false)); - } - - if ($definition->getFactoryService(false)) { - $code .= sprintf(" factory_service: %s\n", $definition->getFactoryService(false)); - } - if ($definition->getArguments()) { $code .= sprintf(" arguments: %s\n", $this->dumper->dump($this->dumpValue($definition->getArguments()), 0)); } diff --git a/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php b/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php index f81d8d693197..60a9b9296e60 100644 --- a/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php +++ b/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php @@ -147,17 +147,13 @@ private function parseDefinition(\DOMElement $service) $definition = new Definition(); } - foreach (array('class', 'scope', 'public', 'factory-class', 'factory-method', 'factory-service', 'synthetic', 'lazy', 'abstract') as $key) { + foreach (array('class', 'scope', 'public', 'synthetic', 'lazy', 'abstract') as $key) { if ($value = $service->getAttribute($key)) { $method = 'set'.str_replace('-', '', $key); $definition->$method(XmlUtils::phpize($value)); } } - if ($value = $service->getAttribute('synchronized')) { - $definition->setSynchronized(XmlUtils::phpize($value), 'request' !== (string) $service->getAttribute('id')); - } - if ($files = $this->getChildren($service, 'file')) { $definition->setFile($files[0]->nodeValue); } diff --git a/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php b/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php index e903a4263474..5bbe81cacb6c 100644 --- a/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php +++ b/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php @@ -170,10 +170,6 @@ private function parseDefinition($id, $service, $file) $definition->setSynthetic($service['synthetic']); } - if (isset($service['synchronized'])) { - $definition->setSynchronized($service['synchronized'], 'request' !== $id); - } - if (isset($service['lazy'])) { $definition->setLazy($service['lazy']); } @@ -199,18 +195,6 @@ private function parseDefinition($id, $service, $file) } } - if (isset($service['factory_class'])) { - $definition->setFactoryClass($service['factory_class']); - } - - if (isset($service['factory_method'])) { - $definition->setFactoryMethod($service['factory_method']); - } - - if (isset($service['factory_service'])) { - $definition->setFactoryService($service['factory_service']); - } - if (isset($service['file'])) { $definition->setFile($service['file']); } diff --git a/src/Symfony/Component/DependencyInjection/Loader/schema/dic/services/services-1.0.xsd b/src/Symfony/Component/DependencyInjection/Loader/schema/dic/services/services-1.0.xsd index ac2cba7a80ce..97b38af463c0 100644 --- a/src/Symfony/Component/DependencyInjection/Loader/schema/dic/services/services-1.0.xsd +++ b/src/Symfony/Component/DependencyInjection/Loader/schema/dic/services/services-1.0.xsd @@ -90,12 +90,8 @@ - - - - diff --git a/src/Symfony/Component/DependencyInjection/SimpleXMLElement.php b/src/Symfony/Component/DependencyInjection/SimpleXMLElement.php deleted file mode 100644 index 1b318fd9e423..000000000000 --- a/src/Symfony/Component/DependencyInjection/SimpleXMLElement.php +++ /dev/null @@ -1,116 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\DependencyInjection; - -trigger_error('The '.__NAMESPACE__.'\SimpleXMLElement method is deprecated since version 2.5 and will be removed in 3.0.', E_USER_DEPRECATED); - -use Symfony\Component\Config\Util\XmlUtils; -use Symfony\Component\ExpressionLanguage\Expression; - -/** - * SimpleXMLElement class. - * - * @author Fabien Potencier - * - * @deprecated since version 2.5, to be removed in 3.0. - */ -class SimpleXMLElement extends \SimpleXMLElement -{ - /** - * Converts an attribute as a PHP type. - * - * @param string $name - * - * @return mixed - */ - public function getAttributeAsPhp($name) - { - return self::phpize($this[$name]); - } - - /** - * Returns arguments as valid PHP types. - * - * @param string $name - * @param bool $lowercase - * - * @return mixed - */ - public function getArgumentsAsPhp($name, $lowercase = true) - { - $arguments = array(); - foreach ($this->$name as $arg) { - if (isset($arg['name'])) { - $arg['key'] = (string) $arg['name']; - } - $key = isset($arg['key']) ? (string) $arg['key'] : (!$arguments ? 0 : max(array_keys($arguments)) + 1); - - // parameter keys are case insensitive - if ('parameter' == $name && $lowercase) { - $key = strtolower($key); - } - - // this is used by DefinitionDecorator to overwrite a specific - // argument of the parent definition - if (isset($arg['index'])) { - $key = 'index_'.$arg['index']; - } - - switch ($arg['type']) { - case 'service': - $invalidBehavior = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE; - if (isset($arg['on-invalid']) && 'ignore' == $arg['on-invalid']) { - $invalidBehavior = ContainerInterface::IGNORE_ON_INVALID_REFERENCE; - } elseif (isset($arg['on-invalid']) && 'null' == $arg['on-invalid']) { - $invalidBehavior = ContainerInterface::NULL_ON_INVALID_REFERENCE; - } - - if (isset($arg['strict'])) { - $strict = self::phpize($arg['strict']); - } else { - $strict = true; - } - - $arguments[$key] = new Reference((string) $arg['id'], $invalidBehavior, $strict); - break; - case 'expression': - $arguments[$key] = new Expression((string) $arg); - break; - case 'collection': - $arguments[$key] = $arg->getArgumentsAsPhp($name, false); - break; - case 'string': - $arguments[$key] = (string) $arg; - break; - case 'constant': - $arguments[$key] = constant((string) $arg); - break; - default: - $arguments[$key] = self::phpize($arg); - } - } - - return $arguments; - } - - /** - * Converts an xml value to a PHP type. - * - * @param mixed $value - * - * @return mixed - */ - public static function phpize($value) - { - return XmlUtils::phpize($value); - } -} diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/CheckDefinitionValidityPassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/CheckDefinitionValidityPassTest.php index 09ae3c413a75..b5e49842e7af 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/CheckDefinitionValidityPassTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/CheckDefinitionValidityPassTest.php @@ -50,20 +50,6 @@ public function testProcessDetectsNonSyntheticNonAbstractDefinitionWithoutClass( $this->process($container); } - /** - * @expectedException \Symfony\Component\DependencyInjection\Exception\RuntimeException - * @group legacy - */ - public function testLegacyProcessDetectsBothFactorySyntaxesUsed() - { - $this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED); - - $container = new ContainerBuilder(); - $container->register('a')->setFactory(array('a', 'b'))->setFactoryClass('a'); - - $this->process($container); - } - public function testProcess() { $container = new ContainerBuilder(); diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/LegacyResolveParameterPlaceHoldersPassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/LegacyResolveParameterPlaceHoldersPassTest.php deleted file mode 100644 index 148a30b6c275..000000000000 --- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/LegacyResolveParameterPlaceHoldersPassTest.php +++ /dev/null @@ -1,37 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\DependencyInjection\Tests\Compiler; - -use Symfony\Component\DependencyInjection\Compiler\ResolveParameterPlaceHoldersPass; -use Symfony\Component\DependencyInjection\ContainerBuilder; - -/** - * @group legacy - */ -class LegacyResolveParameterPlaceHoldersPassTest extends \PHPUnit_Framework_TestCase -{ - public function testFactoryClassParametersShouldBeResolved() - { - $this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED); - - $compilerPass = new ResolveParameterPlaceHoldersPass(); - - $container = new ContainerBuilder(); - $container->setParameter('foo.factory.class', 'FooFactory'); - $fooDefinition = $container->register('foo', '%foo.factory.class%'); - $fooDefinition->setFactoryClass('%foo.factory.class%'); - $compilerPass->process($container); - $fooDefinition = $container->getDefinition('foo'); - - $this->assertSame('FooFactory', $fooDefinition->getFactoryClass()); - } -} diff --git a/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php b/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php index 4988d8a560e3..34cd8dfb7ad9 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php @@ -333,42 +333,6 @@ public function testCreateServiceFactory() $this->assertTrue($builder->get('baz')->called, '->createService() uses another service as factory'); } - public function testLegacyCreateServiceFactory() - { - $this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED); - - $builder = new ContainerBuilder(); - $builder->register('bar', 'Bar\FooClass'); - $builder - ->register('foo1', 'Bar\FooClass') - ->setFactoryClass('%foo_class%') - ->setFactoryMethod('getInstance') - ->addArgument(array('foo' => '%value%', '%value%' => 'foo', new Reference('bar'))) - ; - $builder->setParameter('value', 'bar'); - $builder->setParameter('foo_class', 'Bar\FooClass'); - $this->assertTrue($builder->get('foo1')->called, '->createService() calls the factory method to create the service instance'); - $this->assertEquals(array('foo' => 'bar', 'bar' => 'foo', $builder->get('bar')), $builder->get('foo1')->arguments, '->createService() passes the arguments to the factory method'); - } - - /** - * @covers Symfony\Component\DependencyInjection\ContainerBuilder::createService - */ - public function testLegacyCreateServiceFactoryService() - { - $this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED); - - $builder = new ContainerBuilder(); - $builder->register('foo_service', 'Bar\FooClass'); - $builder - ->register('foo', 'Bar\FooClass') - ->setFactoryService('%foo_service%') - ->setFactoryMethod('getInstance') - ; - $builder->setParameter('foo_service', 'foo_service'); - $this->assertTrue($builder->get('foo')->called, '->createService() calls the factory method to create the service instance'); - } - /** * @covers Symfony\Component\DependencyInjection\ContainerBuilder::createService */ @@ -720,62 +684,6 @@ public function testNoExceptionWhenSetSyntheticServiceOnAFrozenContainer() $this->assertEquals($a, $container->get('a')); } - /** - * @group legacy - */ - public function testLegacySetOnSynchronizedService() - { - $this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED); - - $container = new ContainerBuilder(); - $container->register('baz', 'BazClass') - ->setSynchronized(true) - ; - $container->register('bar', 'BarClass') - ->addMethodCall('setBaz', array(new Reference('baz'))) - ; - - $container->set('baz', $baz = new \BazClass()); - $this->assertSame($baz, $container->get('bar')->getBaz()); - - $container->set('baz', $baz = new \BazClass()); - $this->assertSame($baz, $container->get('bar')->getBaz()); - } - - /** - * @group legacy - */ - public function testLegacySynchronizedServiceWithScopes() - { - $this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED); - - $container = new ContainerBuilder(); - $container->addScope(new Scope('foo')); - $container->register('baz', 'BazClass') - ->setSynthetic(true) - ->setSynchronized(true) - ->setScope('foo') - ; - $container->register('bar', 'BarClass') - ->addMethodCall('setBaz', array(new Reference('baz', ContainerInterface::NULL_ON_INVALID_REFERENCE, false))) - ; - $container->compile(); - - $container->enterScope('foo'); - $container->set('baz', $outerBaz = new \BazClass(), 'foo'); - $this->assertSame($outerBaz, $container->get('bar')->getBaz()); - - $container->enterScope('foo'); - $container->set('baz', $innerBaz = new \BazClass(), 'foo'); - $this->assertSame($innerBaz, $container->get('bar')->getBaz()); - $container->leaveScope('foo'); - - $this->assertNotSame($innerBaz, $container->get('bar')->getBaz()); - $this->assertSame($outerBaz, $container->get('bar')->getBaz()); - - $container->leaveScope('foo'); - } - /** * @expectedException \BadMethodCallException */ diff --git a/src/Symfony/Component/DependencyInjection/Tests/ContainerTest.php b/src/Symfony/Component/DependencyInjection/Tests/ContainerTest.php index 2ce50ee5f982..f28990c17c95 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/ContainerTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/ContainerTest.php @@ -146,7 +146,7 @@ public function testGetServiceIds() $sc = new ProjectServiceContainer(); $sc->set('foo', $obj = new \stdClass()); - $this->assertEquals(array('scoped', 'scoped_foo', 'scoped_synchronized_foo', 'inactive', 'bar', 'foo_bar', 'foo.baz', 'circular', 'throw_exception', 'throws_exception_on_service_configuration', 'service_container', 'foo'), $sc->getServiceIds(), '->getServiceIds() returns defined service ids by getXXXService() methods, followed by service ids defined by set()'); + $this->assertEquals(array('scoped', 'scoped_foo', 'inactive', 'bar', 'foo_bar', 'foo.baz', 'circular', 'throw_exception', 'throws_exception_on_service_configuration', 'service_container', 'foo'), $sc->getServiceIds(), '->getServiceIds() returns defined service ids by getXXXService() methods, followed by service ids defined by set()'); } /** @@ -200,15 +200,6 @@ public function testSetAlsoSetsScopedService() $this->assertSame($foo, $scoped['foo']['foo'], '->set() sets a scoped service'); } - public function testSetAlsoCallsSynchronizeService() - { - $c = new ProjectServiceContainer(); - $c->addScope(new Scope('foo')); - $c->enterScope('foo'); - $c->set('scoped_synchronized_foo', $bar = new \stdClass(), 'foo'); - $this->assertTrue($c->synchronized, '->set() calls synchronize*Service() if it is defined for the service'); - } - /** * @covers Symfony\Component\DependencyInjection\Container::get */ @@ -629,7 +620,6 @@ public function testAlias() class ProjectServiceContainer extends Container { public $__bar, $__foo_bar, $__foo_baz; - public $synchronized; public function __construct() { @@ -638,7 +628,6 @@ public function __construct() $this->__bar = new \stdClass(); $this->__foo_bar = new \stdClass(); $this->__foo_baz = new \stdClass(); - $this->synchronized = false; $this->aliases = array('alias' => 'bar'); } @@ -660,20 +649,6 @@ protected function getScopedFooService() return $this->services['scoped_foo'] = $this->scopedServices['foo']['scoped_foo'] = new \stdClass(); } - protected function getScopedSynchronizedFooService() - { - if (!$this->isScopeActive('foo')) { - throw new \RuntimeException('invalid call'); - } - - return $this->services['scoped_bar'] = $this->scopedServices['foo']['scoped_bar'] = new \stdClass(); - } - - protected function synchronizeScopedSynchronizedFooService() - { - $this->synchronized = true; - } - protected function getInactiveService() { throw new InactiveScopeException('request', 'request'); diff --git a/src/Symfony/Component/DependencyInjection/Tests/DefinitionDecoratorTest.php b/src/Symfony/Component/DependencyInjection/Tests/DefinitionDecoratorTest.php index f9006540a561..12122ff968d5 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/DefinitionDecoratorTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/DefinitionDecoratorTest.php @@ -49,34 +49,6 @@ public function getPropertyTests() ); } - /** - * @dataProvider provideLegacyPropertyTests - * @group legacy - */ - public function testLegacySetProperty($property, $changeKey) - { - $this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED); - - $def = new DefinitionDecorator('foo'); - - $getter = 'get'.ucfirst($property); - $setter = 'set'.ucfirst($property); - - $this->assertNull($def->$getter()); - $this->assertSame($def, $def->$setter('foo')); - $this->assertEquals('foo', $def->$getter()); - $this->assertEquals(array($changeKey => true), $def->getChanges()); - } - - public function provideLegacyPropertyTests() - { - return array( - array('factoryClass', 'factory_class'), - array('factoryMethod', 'factory_method'), - array('factoryService', 'factory_service'), - ); - } - public function testSetPublic() { $def = new DefinitionDecorator('foo'); diff --git a/src/Symfony/Component/DependencyInjection/Tests/DefinitionTest.php b/src/Symfony/Component/DependencyInjection/Tests/DefinitionTest.php index b6539f3b7400..625d56d97c29 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/DefinitionTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/DefinitionTest.php @@ -163,21 +163,6 @@ public function testSetIsSynthetic() $this->assertTrue($def->isSynthetic(), '->isSynthetic() returns true if the service is synthetic.'); } - /** - * @covers Symfony\Component\DependencyInjection\Definition::setSynchronized - * @covers Symfony\Component\DependencyInjection\Definition::isSynchronized - * @group legacy - */ - public function testLegacySetIsSynchronized() - { - $this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED); - - $def = new Definition('stdClass'); - $this->assertFalse($def->isSynchronized(), '->isSynchronized() returns false by default'); - $this->assertSame($def, $def->setSynchronized(true), '->setSynchronized() implements a fluent interface'); - $this->assertTrue($def->isSynchronized(), '->isSynchronized() returns true if the service is synchronized.'); - } - /** * @covers Symfony\Component\DependencyInjection\Definition::setLazy * @covers Symfony\Component\DependencyInjection\Definition::isLazy diff --git a/src/Symfony/Component/DependencyInjection/Tests/Dumper/GraphvizDumperTest.php b/src/Symfony/Component/DependencyInjection/Tests/Dumper/GraphvizDumperTest.php index ba5e12cd5076..79689d78dc4f 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Dumper/GraphvizDumperTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Dumper/GraphvizDumperTest.php @@ -23,18 +23,6 @@ public static function setUpBeforeClass() self::$fixturesPath = __DIR__.'/../Fixtures/'; } - /** - * @group legacy - */ - public function testLegacyDump() - { - $this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED); - - $container = include self::$fixturesPath.'/containers/legacy-container9.php'; - $dumper = new GraphvizDumper($container); - $this->assertEquals(str_replace('%path%', __DIR__, file_get_contents(self::$fixturesPath.'/graphviz/legacy-services9.dot')), $dumper->dump(), '->dump() dumps services'); - } - public function testDump() { $dumper = new GraphvizDumper($container = new ContainerBuilder()); diff --git a/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php b/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php index 7fa0c17a13b7..f6b5dadaf9d3 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php @@ -124,18 +124,6 @@ public function testAddService() } } - /** - * @group legacy - */ - public function testLegacySynchronizedServices() - { - $this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED); - - $container = include self::$fixturesPath.'/containers/container20.php'; - $dumper = new PhpDumper($container); - $this->assertEquals(str_replace('%path%', str_replace('\\', '\\\\', self::$fixturesPath.DIRECTORY_SEPARATOR.'includes'.DIRECTORY_SEPARATOR), file_get_contents(self::$fixturesPath.'/php/services20.php')), $dumper->dump(), '->dump() dumps services'); - } - public function testServicesWithAnonymousFactories() { $container = include self::$fixturesPath.'/containers/container19.php'; diff --git a/src/Symfony/Component/DependencyInjection/Tests/Dumper/XmlDumperTest.php b/src/Symfony/Component/DependencyInjection/Tests/Dumper/XmlDumperTest.php index fe253f918cbc..e54c5aefc2b8 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Dumper/XmlDumperTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Dumper/XmlDumperTest.php @@ -44,29 +44,6 @@ public function testAddParameters() $this->assertXmlStringEqualsXmlFile(self::$fixturesPath.'/xml/services8.xml', $dumper->dump(), '->dump() dumps parameters'); } - /** - * @group legacy - */ - public function testLegacyAddService() - { - $this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED); - - $container = include self::$fixturesPath.'/containers/legacy-container9.php'; - $dumper = new XmlDumper($container); - - $this->assertEquals(str_replace('%path%', self::$fixturesPath.DIRECTORY_SEPARATOR.'includes'.DIRECTORY_SEPARATOR, file_get_contents(self::$fixturesPath.'/xml/legacy-services9.xml')), $dumper->dump(), '->dump() dumps services'); - - $dumper = new XmlDumper($container = new ContainerBuilder()); - $container->register('foo', 'FooClass')->addArgument(new \stdClass()); - try { - $dumper->dump(); - $this->fail('->dump() throws a RuntimeException if the container to be dumped has reference to objects or resources'); - } catch (\Exception $e) { - $this->assertInstanceOf('\RuntimeException', $e, '->dump() throws a RuntimeException if the container to be dumped has reference to objects or resources'); - $this->assertEquals('Unable to dump a service container if a parameter is an object or a resource.', $e->getMessage(), '->dump() throws a RuntimeException if the container to be dumped has reference to objects or resources'); - } - } - public function testAddService() { $container = include self::$fixturesPath.'/containers/container9.php'; diff --git a/src/Symfony/Component/DependencyInjection/Tests/Dumper/YamlDumperTest.php b/src/Symfony/Component/DependencyInjection/Tests/Dumper/YamlDumperTest.php index c22c7eb40e24..f9747a7c2fae 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Dumper/YamlDumperTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Dumper/YamlDumperTest.php @@ -40,29 +40,6 @@ public function testAddParameters() $this->assertStringEqualsFile(self::$fixturesPath.'/yaml/services8.yml', $dumper->dump(), '->dump() dumps parameters'); } - /** - * @group legacy - */ - public function testLegacyAddService() - { - $this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED); - - $container = include self::$fixturesPath.'/containers/legacy-container9.php'; - $dumper = new YamlDumper($container); - - $this->assertEquals(str_replace('%path%', self::$fixturesPath.DIRECTORY_SEPARATOR.'includes'.DIRECTORY_SEPARATOR, file_get_contents(self::$fixturesPath.'/yaml/legacy-services9.yml')), $dumper->dump(), '->dump() dumps services'); - - $dumper = new YamlDumper($container = new ContainerBuilder()); - $container->register('foo', 'FooClass')->addArgument(new \stdClass()); - try { - $dumper->dump(); - $this->fail('->dump() throws a RuntimeException if the container to be dumped has reference to objects or resources'); - } catch (\Exception $e) { - $this->assertInstanceOf('\RuntimeException', $e, '->dump() throws a RuntimeException if the container to be dumped has reference to objects or resources'); - $this->assertEquals('Unable to dump a service container if a parameter is an object or a resource.', $e->getMessage(), '->dump() throws a RuntimeException if the container to be dumped has reference to objects or resources'); - } - } - public function testAddService() { $container = include self::$fixturesPath.'/containers/container9.php'; diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container20.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container20.php deleted file mode 100644 index a40a0e8a6c10..000000000000 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container20.php +++ /dev/null @@ -1,19 +0,0 @@ -register('request', 'Request') - ->setSynchronized(true) -; -$container - ->register('depends_on_request', 'stdClass') - ->addMethodCall('setRequest', array(new Reference('request', ContainerInterface::NULL_ON_INVALID_REFERENCE, false))) -; - -return $container; diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/legacy-container9.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/legacy-container9.php deleted file mode 100644 index 9f4210c9d5b7..000000000000 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/legacy-container9.php +++ /dev/null @@ -1,39 +0,0 @@ - - register('foo', 'Bar\FooClass')-> - addTag('foo', array('foo' => 'foo'))-> - addTag('foo', array('bar' => 'bar'))-> - setFactoryClass('Bar\\FooClass')-> - setFactoryMethod('getInstance')-> - setArguments(array('foo', new Reference('foo.baz'), array('%foo%' => 'foo is %foo%', 'foobar' => '%foo%'), true, new Reference('service_container')))-> - setProperties(array('foo' => 'bar', 'moo' => new Reference('foo.baz'), 'qux' => array('%foo%' => 'foo is %foo%', 'foobar' => '%foo%')))-> - addMethodCall('setBar', array(new Reference('bar')))-> - addMethodCall('initialize')-> - setConfigurator('sc_configure') -; -$container-> - register('foo.baz', '%baz_class%')-> - setFactoryClass('%baz_class%')-> - setFactoryMethod('getInstance')-> - setConfigurator(array('%baz_class%', 'configureStatic1')) -; -$container-> - register('factory_service', 'Bar')-> - setFactoryService('foo.baz')-> - setFactoryMethod('getInstance') -; -$container->getParameterBag()->clear(); -$container->getParameterBag()->add(array( - 'baz_class' => 'BazClass', - 'foo' => 'bar', -)); - -return $container; diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/graphviz/legacy-services9.dot b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/graphviz/legacy-services9.dot deleted file mode 100644 index 4e8dfb977495..000000000000 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/graphviz/legacy-services9.dot +++ /dev/null @@ -1,15 +0,0 @@ -digraph sc { - ratio="compress" - node [fontsize="11" fontname="Arial" shape="record"]; - edge [fontsize="9" fontname="Arial" color="grey" arrowhead="open" arrowsize="0.5"]; - - node_foo [label="foo\nBar\\FooClass\n", shape=record, fillcolor="#eeeeee", style="filled"]; - node_foo_baz [label="foo.baz\nBazClass\n", shape=record, fillcolor="#eeeeee", style="filled"]; - node_factory_service [label="factory_service\nBar\n", shape=record, fillcolor="#eeeeee", style="filled"]; - node_service_container [label="service_container\nSymfony\\Component\\DependencyInjection\\ContainerBuilder\n", shape=record, fillcolor="#9999ff", style="filled"]; - node_bar [label="bar\n\n", shape=record, fillcolor="#ff9999", style="filled"]; - node_foo -> node_foo_baz [label="" style="filled"]; - node_foo -> node_service_container [label="" style="filled"]; - node_foo -> node_foo_baz [label="" style="dashed"]; - node_foo -> node_bar [label="setBar()" style="dashed"]; -} diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services10.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services10.php index a9a1fffff7b8..b9b8d5b38620 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services10.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services10.php @@ -29,9 +29,6 @@ public function __construct() $this->services = $this->scopedServices = $this->scopeStacks = array(); - - $this->set('service_container', $this); - $this->scopes = array(); $this->scopeChildren = array(); $this->methodMap = array( diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services12.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services12.php index 6e7823e0901f..a53f3a3e8176 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services12.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services12.php @@ -33,9 +33,6 @@ public function __construct() $this->services = $this->scopedServices = $this->scopeStacks = array(); - - $this->set('service_container', $this); - $this->scopes = array(); $this->scopeChildren = array(); $this->methodMap = array( diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services20.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services20.php deleted file mode 100644 index 83f6dc7ed3c2..000000000000 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services20.php +++ /dev/null @@ -1,73 +0,0 @@ -methodMap = array( - 'depends_on_request' => 'getDependsOnRequestService', - 'request' => 'getRequestService', - ); - } - - /** - * Gets the 'depends_on_request' service. - * - * This service is shared. - * This method always returns the same instance of the service. - * - * @return \stdClass A stdClass instance. - */ - protected function getDependsOnRequestService() - { - $this->services['depends_on_request'] = $instance = new \stdClass(); - - $instance->setRequest($this->get('request', ContainerInterface::NULL_ON_INVALID_REFERENCE)); - - return $instance; - } - - /** - * Gets the 'request' service. - * - * This service is shared. - * This method always returns the same instance of the service. - * - * @return \Request A Request instance. - */ - protected function getRequestService() - { - return $this->services['request'] = new \Request(); - } - - /** - * Updates the 'request' service. - */ - protected function synchronizeRequestService() - { - if ($this->initialized('depends_on_request')) { - $this->get('depends_on_request')->setRequest($this->get('request', ContainerInterface::NULL_ON_INVALID_REFERENCE)); - } - } -} 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 0f715c31ca04..8c1e71f437a8 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_compiled.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_compiled.php @@ -29,9 +29,6 @@ public function __construct() $this->services = $this->scopedServices = $this->scopeStacks = array(); - - $this->set('service_container', $this); - $this->scopes = array(); $this->scopeChildren = array(); $this->methodMap = array( diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/legacy-services6.xml b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/legacy-services6.xml deleted file mode 100644 index 17fe00f8fe93..000000000000 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/legacy-services6.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/legacy-services9.xml b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/legacy-services9.xml deleted file mode 100644 index 5692ba13ea20..000000000000 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/legacy-services9.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - - BazClass - bar - - - - - - foo - - - foo is %foo% - %foo% - - true - - bar - - - foo is %foo% - %foo% - - - - - - - - - - - - - diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services20.xml b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services20.xml deleted file mode 100644 index 5d799fc944c8..000000000000 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services20.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services6.xml b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services6.xml index 3a68c6e39a33..80e3dd60b2c1 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services6.xml +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services6.xml @@ -47,7 +47,7 @@ - + diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/legacy-services6.yml b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/legacy-services6.yml deleted file mode 100644 index d6ca937a5ede..000000000000 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/legacy-services6.yml +++ /dev/null @@ -1,3 +0,0 @@ -services: - constructor: { class: FooClass, factory_method: getInstance } - factory_service: { class: BazClass, factory_method: getInstance, factory_service: baz_factory } diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/legacy-services9.yml b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/legacy-services9.yml deleted file mode 100644 index 64d17262aa30..000000000000 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/legacy-services9.yml +++ /dev/null @@ -1,28 +0,0 @@ -parameters: - baz_class: BazClass - foo: bar - -services: - foo: - class: Bar\FooClass - tags: - - { name: foo, foo: foo } - - { name: foo, bar: bar } - factory_class: Bar\FooClass - factory_method: getInstance - arguments: [foo, '@foo.baz', { '%foo%': 'foo is %foo%', foobar: '%foo%' }, true, '@service_container'] - properties: { foo: bar, moo: '@foo.baz', qux: { '%foo%': 'foo is %foo%', foobar: '%foo%' } } - calls: - - [setBar, ['@bar']] - - [initialize, { }] - - configurator: sc_configure - foo.baz: - class: %baz_class% - factory_class: %baz_class% - factory_method: getInstance - configurator: ['%baz_class%', configureStatic1] - factory_service: - class: Bar - factory_method: getInstance - factory_service: foo.baz diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services20.yml b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services20.yml deleted file mode 100644 index 847f656886d5..000000000000 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services20.yml +++ /dev/null @@ -1,9 +0,0 @@ -services: - request: - class: Request - synthetic: true - synchronized: true - depends_on_request: - class: stdClass - calls: - - [setRequest, ['@?request']] diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services6.yml b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services6.yml index 8820b274ee20..f4c5e32c6f60 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services6.yml +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services6.yml @@ -26,7 +26,6 @@ services: request: class: Request synthetic: true - synchronized: true lazy: true decorator_service: decorates: decorated diff --git a/src/Symfony/Component/DependencyInjection/Tests/LegacyContainerBuilderTest.php b/src/Symfony/Component/DependencyInjection/Tests/LegacyContainerBuilderTest.php deleted file mode 100644 index b8512a2610ea..000000000000 --- a/src/Symfony/Component/DependencyInjection/Tests/LegacyContainerBuilderTest.php +++ /dev/null @@ -1,51 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\DependencyInjection\Tests; - -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Reference; - -/** - * @group legacy - */ -class LegacyContainerBuilderTest extends \PHPUnit_Framework_TestCase -{ - protected function setUp() - { - $this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED); - } - - /** - * @covers Symfony\Component\DependencyInjection\ContainerBuilder::createService - */ - public function testCreateServiceFactoryMethod() - { - $builder = new ContainerBuilder(); - $builder->register('bar', 'stdClass'); - $builder->register('foo1', 'Bar\FooClass')->setFactoryClass('Bar\FooClass')->setFactoryMethod('getInstance')->addArgument(array('foo' => '%value%', '%value%' => 'foo', new Reference('bar'))); - $builder->setParameter('value', 'bar'); - $this->assertTrue($builder->get('foo1')->called, '->createService() calls the factory method to create the service instance'); - $this->assertEquals(array('foo' => 'bar', 'bar' => 'foo', $builder->get('bar')), $builder->get('foo1')->arguments, '->createService() passes the arguments to the factory method'); - } - - /** - * @covers Symfony\Component\DependencyInjection\ContainerBuilder::createService - */ - public function testCreateServiceFactoryService() - { - $builder = new ContainerBuilder(); - $builder->register('baz_service')->setFactoryService('baz_factory')->setFactoryMethod('getInstance'); - $builder->register('baz_factory', 'BazClass'); - - $this->assertInstanceOf('BazClass', $builder->get('baz_service')); - } -} diff --git a/src/Symfony/Component/DependencyInjection/Tests/LegacyDefinitionTest.php b/src/Symfony/Component/DependencyInjection/Tests/LegacyDefinitionTest.php deleted file mode 100644 index 437b77b31b05..000000000000 --- a/src/Symfony/Component/DependencyInjection/Tests/LegacyDefinitionTest.php +++ /dev/null @@ -1,49 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\DependencyInjection\Tests; - -use Symfony\Component\DependencyInjection\Definition; - -/** - * @group legacy - */ -class LegacyDefinitionTest extends \PHPUnit_Framework_TestCase -{ - protected function setUp() - { - $this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED); - } - - public function testSetGetFactoryClass() - { - $def = new Definition('stdClass'); - $this->assertNull($def->getFactoryClass()); - $this->assertSame($def, $def->setFactoryClass('stdClass2'), "->setFactoryClass() implements a fluent interface."); - $this->assertEquals('stdClass2', $def->getFactoryClass(), "->getFactoryClass() returns current class to construct this service."); - } - - public function testSetGetFactoryMethod() - { - $def = new Definition('stdClass'); - $this->assertNull($def->getFactoryMethod()); - $this->assertSame($def, $def->setFactoryMethod('foo'), '->setFactoryMethod() implements a fluent interface'); - $this->assertEquals('foo', $def->getFactoryMethod(), '->getFactoryMethod() returns the factory method name'); - } - - public function testSetGetFactoryService() - { - $def = new Definition('stdClass'); - $this->assertNull($def->getFactoryService()); - $this->assertSame($def, $def->setFactoryService('foo.bar'), "->setFactoryService() implements a fluent interface."); - $this->assertEquals('foo.bar', $def->getFactoryService(), "->getFactoryService() returns current service to construct this service."); - } -} diff --git a/src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php b/src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php index c9b454c4e084..12d67f926bae 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php @@ -191,24 +191,6 @@ public function testLoadAnonymousServices() $this->assertEquals('BazClass', $inner->getClass(), '->load() uses the same configuration as for the anonymous ones'); } - /** - * @group legacy - */ - public function testLegacyLoadServices() - { - $this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED); - - $container = new ContainerBuilder(); - $loader = new XmlFileLoader($container, new FileLocator(self::$fixturesPath.'/xml')); - $loader->load('legacy-services6.xml'); - $services = $container->getDefinitions(); - $this->assertEquals('FooClass', $services['constructor']->getClass()); - $this->assertEquals('getInstance', $services['constructor']->getFactoryMethod()); - $this->assertNull($services['factory_service']->getClass()); - $this->assertEquals('baz_factory', $services['factory_service']->getFactoryService()); - $this->assertEquals('getInstance', $services['factory_service']->getFactoryMethod()); - } - public function testLoadServices() { $container = new ContainerBuilder(); @@ -233,7 +215,6 @@ public function testLoadServices() $this->assertEquals(array('BazClass', 'getInstance'), $services['new_factory3']->getFactory(), '->load() parses the factory tag'); $this->assertTrue($services['request']->isSynthetic(), '->load() parses the synthetic flag'); - $this->assertTrue($services['request']->isSynchronized(false), '->load() parses the synchronized flag'); $this->assertTrue($services['request']->isLazy(), '->load() parses the lazy flag'); $aliases = $container->getAliases(); diff --git a/src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php b/src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php index 6bcb19c74678..1da365db922f 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php @@ -120,24 +120,6 @@ public function testLoadImports() $loader->load('services4_bad_import.yml'); } - /** - * @group legacy - */ - public function testLegacyLoadServices() - { - $this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED); - - $container = new ContainerBuilder(); - $loader = new YamlFileLoader($container, new FileLocator(self::$fixturesPath.'/yaml')); - $loader->load('legacy-services6.yml'); - $services = $container->getDefinitions(); - $this->assertEquals('FooClass', $services['constructor']->getClass()); - $this->assertEquals('getInstance', $services['constructor']->getFactoryMethod()); - $this->assertEquals('BazClass', $services['factory_service']->getClass()); - $this->assertEquals('baz_factory', $services['factory_service']->getFactoryService()); - $this->assertEquals('getInstance', $services['factory_service']->getFactoryMethod()); - } - public function testLoadServices() { $container = new ContainerBuilder(); @@ -162,7 +144,6 @@ public function testLoadServices() $this->assertEquals(array('BazClass', 'getInstance'), $services['new_factory3']->getFactory(), '->load() parses the factory tag'); $this->assertTrue($services['request']->isSynthetic(), '->load() parses the synthetic flag'); - $this->assertTrue($services['request']->isSynchronized(false), '->load() parses the synchronized flag'); $this->assertTrue($services['request']->isLazy(), '->load() parses the lazy flag'); $aliases = $container->getAliases();