diff --git a/src/Symfony/Bridge/ProxyManager/LazyProxy/PhpDumper/ProxyDumper.php b/src/Symfony/Bridge/ProxyManager/LazyProxy/PhpDumper/ProxyDumper.php
index 8cca8eec09..550786d5d7 100644
--- a/src/Symfony/Bridge/ProxyManager/LazyProxy/PhpDumper/ProxyDumper.php
+++ b/src/Symfony/Bridge/ProxyManager/LazyProxy/PhpDumper/ProxyDumper.php
@@ -15,7 +15,6 @@ use ProxyManager\Generator\ClassGenerator;
use ProxyManager\GeneratorStrategy\BaseGeneratorStrategy;
use ProxyManager\ProxyGenerator\LazyLoadingValueHolderGenerator;
use Symfony\Component\DependencyInjection\Container;
-use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\LazyProxy\PhpDumper\DumperInterface;
@@ -68,10 +67,8 @@ class ProxyDumper implements DumperInterface
{
$instantiation = 'return';
- if ($definition->isShared() && ContainerInterface::SCOPE_CONTAINER === $definition->getScope(false)) {
+ if ($definition->isShared()) {
$instantiation .= " \$this->services['$id'] =";
- } elseif ($definition->isShared() && ContainerInterface::SCOPE_PROTOTYPE !== $scope = $definition->getScope(false)) {
- $instantiation .= " \$this->services['$id'] = \$this->scopedServices['$scope']['$id'] =";
}
$methodName = 'get'.Container::camelize($id).'Service';
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 da3be4997c..6c30a41344 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
@@ -2,7 +2,6 @@
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\DependencyInjection\Container;
-use Symfony\Component\DependencyInjection\Exception\InactiveScopeException;
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
use Symfony\Component\DependencyInjection\Exception\LogicException;
use Symfony\Component\DependencyInjection\Exception\RuntimeException;
@@ -23,11 +22,7 @@ class LazyServiceProjectServiceContainer extends Container
*/
public function __construct()
{
- $this->services =
- $this->scopedServices =
- $this->scopeStacks = array();
- $this->scopes = array();
- $this->scopeChildren = array();
+ $this->services = array();
}
/**
@@ -43,7 +38,6 @@ class LazyServiceProjectServiceContainer extends Container
public function getFooService($lazyLoad = true)
{
if ($lazyLoad) {
-
return $this->services['foo'] = new stdClass_c1d194250ee2e2b7d2eab8b8212368a8(
function (&$wrappedInstance, \ProxyManager\Proxy\LazyLoadingInterface $proxy) {
$wrappedInstance = $this->getFooService(false);
diff --git a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/JsonDescriptor.php b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/JsonDescriptor.php
index 307a8e082a..807321352f 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/JsonDescriptor.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/JsonDescriptor.php
@@ -205,7 +205,6 @@ class JsonDescriptor extends Descriptor
{
$data = array(
'class' => (string) $definition->getClass(),
- 'scope' => $definition->getScope(false),
'public' => $definition->isPublic(),
'synthetic' => $definition->isSynthetic(),
'lazy' => $definition->isLazy(),
diff --git a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/MarkdownDescriptor.php b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/MarkdownDescriptor.php
index 4f50cf6388..d37146ee02 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/MarkdownDescriptor.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/MarkdownDescriptor.php
@@ -176,7 +176,6 @@ class MarkdownDescriptor extends Descriptor
protected function describeContainerDefinition(Definition $definition, array $options = array())
{
$output = '- Class: `'.$definition->getClass().'`'
- ."\n".'- Scope: `'.$definition->getScope(false).'`'
."\n".'- Public: '.($definition->isPublic() ? 'yes' : 'no')
."\n".'- Synthetic: '.($definition->isSynthetic() ? 'yes' : 'no')
."\n".'- Lazy: '.($definition->isLazy() ? 'yes' : 'no')
diff --git a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php
index 59efa47b0d..1796c1eaa2 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php
@@ -256,7 +256,6 @@ class TextDescriptor extends Descriptor
$description[] = 'Tags -';
}
- $description[] = sprintf('Scope %s', $definition->getScope(false));
$description[] = sprintf('Public %s', $definition->isPublic() ? 'yes' : 'no');
$description[] = sprintf('Synthetic %s', $definition->isSynthetic() ? 'yes' : 'no');
$description[] = sprintf('Lazy %s', $definition->isLazy() ? 'yes' : 'no');
diff --git a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/XmlDescriptor.php b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/XmlDescriptor.php
index 6d30245321..0fb9e1f21e 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/XmlDescriptor.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/XmlDescriptor.php
@@ -346,7 +346,6 @@ class XmlDescriptor extends Descriptor
}
}
- $serviceXML->setAttribute('scope', $definition->getScope(false));
$serviceXML->setAttribute('public', $definition->isPublic() ? 'true' : 'false');
$serviceXML->setAttribute('synthetic', $definition->isSynthetic() ? 'true' : 'false');
$serviceXML->setAttribute('lazy', $definition->isLazy() ? 'true' : 'false');
diff --git a/src/Symfony/Bundle/FrameworkBundle/FrameworkBundle.php b/src/Symfony/Bundle/FrameworkBundle/FrameworkBundle.php
index 499f39c6c9..14ebff9163 100644
--- a/src/Symfony/Bundle/FrameworkBundle/FrameworkBundle.php
+++ b/src/Symfony/Bundle/FrameworkBundle/FrameworkBundle.php
@@ -31,7 +31,6 @@ use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\SerializerPass;
use Symfony\Component\Debug\ErrorHandler;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Compiler\PassConfig;
-use Symfony\Component\DependencyInjection\Scope;
use Symfony\Component\EventDispatcher\DependencyInjection\RegisterListenersPass;
use Symfony\Component\HttpKernel\DependencyInjection\FragmentRendererPass;
use Symfony\Component\HttpFoundation\Request;
@@ -65,10 +64,6 @@ class FrameworkBundle extends Bundle
{
parent::build($container);
- // we need to add the request scope as early as possible so that
- // the compilation can find scope widening issues
- $container->addScope(new Scope('request'));
-
$container->addCompilerPass(new RoutingResolverPass());
$container->addCompilerPass(new ProfilerPass());
// must be registered before removing private services as some might be listeners/subscribers
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 62fde0800c..2c26e201c1 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
@@ -2,7 +2,6 @@
"definitions": {
"definition_1": {
"class": "Full\\Qualified\\Class1",
- "scope": "container",
"public": true,
"synthetic": false,
"lazy": true,
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 c12a6a30dd..3082fbe847 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
@@ -8,7 +8,6 @@ definition_1
~~~~~~~~~~~~
- Class: `Full\Qualified\Class1`
-- Scope: `container`
- Public: yes
- Synthetic: no
- Lazy: yes
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 6a7e789165..3cde8dbb67 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 4cf55be795..53019d6b22 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
@@ -2,7 +2,6 @@
"definitions": {
"definition_1": {
"class": "Full\\Qualified\\Class1",
- "scope": "container",
"public": true,
"synthetic": false,
"lazy": true,
@@ -17,7 +16,6 @@
},
"definition_2": {
"class": "Full\\Qualified\\Class2",
- "scope": "container",
"public": false,
"synthetic": true,
"lazy": false,
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 6adf4e3999..9deefcafcf 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
@@ -8,7 +8,6 @@ definition_1
~~~~~~~~~~~~
- Class: `Full\Qualified\Class1`
-- Scope: `container`
- Public: yes
- Synthetic: no
- Lazy: yes
@@ -21,7 +20,6 @@ definition_2
~~~~~~~~~~~~
- Class: `Full\Qualified\Class2`
-- Scope: `container`
- Public: no
- Synthetic: yes
- Lazy: no
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 2cabf08824..da1ca77c53 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 e0d77f545d..c04efede59 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
@@ -2,7 +2,6 @@
"definitions": {
"definition_2": {
"class": "Full\\Qualified\\Class2",
- "scope": "container",
"public": false,
"synthetic": true,
"lazy": false,
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 5c02a943c6..302372ea5b 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
@@ -8,7 +8,6 @@ definition_2
~~~~~~~~~~~~
- Class: `Full\Qualified\Class2`
-- Scope: `container`
- Public: no
- Synthetic: yes
- Lazy: no
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 8a364aa8eb..4c4c0e95bb 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 50bb792c3e..11418fdc18 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
@@ -2,7 +2,6 @@
"tag1": [
{
"class": "Full\\Qualified\\Class2",
- "scope": "container",
"public": false,
"synthetic": true,
"lazy": false,
@@ -16,7 +15,6 @@
"tag2": [
{
"class": "Full\\Qualified\\Class2",
- "scope": "container",
"public": false,
"synthetic": true,
"lazy": false,
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 a90c5cc7de..131377548c 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
@@ -8,7 +8,6 @@ definition_2
~~~~~~~~~~~~
- Class: `Full\Qualified\Class2`
-- Scope: `container`
- Public: no
- Synthetic: yes
- Lazy: no
@@ -26,7 +25,6 @@ definition_2
~~~~~~~~~~~~
- Class: `Full\Qualified\Class2`
-- Scope: `container`
- Public: no
- Synthetic: yes
- Lazy: no
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 c863b1df6c..78396aa4ef 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 d47d16406b..1900db80b8 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_1.json
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_1.json
@@ -1,6 +1,5 @@
{
"class": "Full\\Qualified\\Class1",
- "scope": "container",
"public": true,
"synthetic": false,
"lazy": true,
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 b9cce89955..a2662db199 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_1.md
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_1.md
@@ -1,5 +1,4 @@
- Class: `Full\Qualified\Class1`
-- Scope: `container`
- Public: yes
- Synthetic: no
- Lazy: yes
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 e2010085ef..768fa826b0 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_1.txt
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_1.txt
@@ -1,7 +1,6 @@
Service Id -
Class Full\Qualified\Class1
Tags -
-Scope container
Public yes
Synthetic no
Lazy yes
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 48ef04d82b..c58c67c681 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 3908d37410..39b857ca25 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_2.json
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_2.json
@@ -1,6 +1,5 @@
{
"class": "Full\\Qualified\\Class2",
- "scope": "container",
"public": false,
"synthetic": true,
"lazy": false,
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 838ed6ad23..3d85d9a33d 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_2.md
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_2.md
@@ -1,5 +1,4 @@
- Class: `Full\Qualified\Class2`
-- Scope: `container`
- Public: no
- Synthetic: yes
- Lazy: no
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 0ac99be010..cd411ea408 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_2.txt
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_2.txt
@@ -4,7 +4,6 @@
- tag1 (attr1: val1, attr2: val2)
- tag1 (attr3: val3)
- tag2 ()
-Scope container
Public no
Synthetic yes
Lazy no
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 698d864e8f..c7f6c360a1 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/Component/DependencyInjection/CHANGELOG.md b/src/Symfony/Component/DependencyInjection/CHANGELOG.md
index 02cb2d50ec..ed261e15e5 100644
--- a/src/Symfony/Component/DependencyInjection/CHANGELOG.md
+++ b/src/Symfony/Component/DependencyInjection/CHANGELOG.md
@@ -1,6 +1,11 @@
CHANGELOG
=========
+3.0.0
+-----
+
+ * removed all deprecated codes from 2.x versions
+
2.8.0
-----
diff --git a/src/Symfony/Component/DependencyInjection/Compiler/CheckDefinitionValidityPass.php b/src/Symfony/Component/DependencyInjection/Compiler/CheckDefinitionValidityPass.php
index eb3a78b296..0d21ef2844 100644
--- a/src/Symfony/Component/DependencyInjection/Compiler/CheckDefinitionValidityPass.php
+++ b/src/Symfony/Component/DependencyInjection/Compiler/CheckDefinitionValidityPass.php
@@ -11,7 +11,6 @@
namespace Symfony\Component\DependencyInjection\Compiler;
-use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Exception\RuntimeException;
@@ -24,8 +23,6 @@ use Symfony\Component\DependencyInjection\Exception\RuntimeException;
*
* - non synthetic, non abstract services always have a class set
* - synthetic services are always public
- * - synthetic services are always of non-prototype scope
- * - shared services are always of non-prototype scope
*
* @author Johannes M. Schmitt
*/
@@ -46,16 +43,6 @@ class CheckDefinitionValidityPass implements CompilerPassInterface
throw new RuntimeException(sprintf('A synthetic service ("%s") must be public.', $id));
}
- // synthetic service has non-prototype scope
- if ($definition->isSynthetic() && ContainerInterface::SCOPE_PROTOTYPE === $definition->getScope(false)) {
- throw new RuntimeException(sprintf('A synthetic service ("%s") cannot be of scope "prototype".', $id));
- }
-
- // shared service has non-prototype scope
- if ($definition->isShared() && ContainerInterface::SCOPE_PROTOTYPE === $definition->getScope(false)) {
- throw new RuntimeException(sprintf('A shared service ("%s") cannot be of scope "prototype".', $id));
- }
-
// non-synthetic, non-abstract service has class
if (!$definition->isAbstract() && !$definition->isSynthetic() && !$definition->getClass()) {
if ($definition->getFactory()) {
diff --git a/src/Symfony/Component/DependencyInjection/Compiler/CheckReferenceValidityPass.php b/src/Symfony/Component/DependencyInjection/Compiler/CheckReferenceValidityPass.php
index b4526edec8..4098ac1c3a 100644
--- a/src/Symfony/Component/DependencyInjection/Compiler/CheckReferenceValidityPass.php
+++ b/src/Symfony/Component/DependencyInjection/Compiler/CheckReferenceValidityPass.php
@@ -12,20 +12,15 @@
namespace Symfony\Component\DependencyInjection\Compiler;
use Symfony\Component\DependencyInjection\Definition;
-use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Exception\RuntimeException;
-use Symfony\Component\DependencyInjection\Exception\ScopeCrossingInjectionException;
-use Symfony\Component\DependencyInjection\Exception\ScopeWideningInjectionException;
/**
* Checks the validity of references.
*
* The following checks are performed by this pass:
* - target definitions are not abstract
- * - target definitions are of equal or wider scope
- * - target definitions are in the same scope hierarchy
*
* @author Johannes M. Schmitt
*/
@@ -33,9 +28,6 @@ class CheckReferenceValidityPass implements CompilerPassInterface
{
private $container;
private $currentId;
- private $currentScope;
- private $currentScopeAncestors;
- private $currentScopeChildren;
/**
* Processes the ContainerBuilder to validate References.
@@ -46,18 +38,8 @@ class CheckReferenceValidityPass implements CompilerPassInterface
{
$this->container = $container;
- $children = $this->container->getScopeChildren(false);
$ancestors = array();
- $scopes = $this->container->getScopes(false);
- foreach ($scopes as $name => $parent) {
- $ancestors[$name] = array($parent);
-
- while (isset($scopes[$parent])) {
- $ancestors[$name][] = $parent = $scopes[$parent];
- }
- }
-
foreach ($container->getDefinitions() as $id => $definition) {
if ($definition->isSynthetic() || $definition->isAbstract()) {
continue;
@@ -65,15 +47,6 @@ class CheckReferenceValidityPass implements CompilerPassInterface
$this->currentId = $id;
$this->currentDefinition = $definition;
- $this->currentScope = $scope = $definition->getScope(false);
-
- if (ContainerInterface::SCOPE_CONTAINER === $scope) {
- $this->currentScopeChildren = array_keys($scopes);
- $this->currentScopeAncestors = array();
- } elseif (ContainerInterface::SCOPE_PROTOTYPE !== $scope) {
- $this->currentScopeChildren = isset($children[$scope]) ? $children[$scope] : array();
- $this->currentScopeAncestors = isset($ancestors[$scope]) ? $ancestors[$scope] : array();
- }
$this->validateReferences($definition->getArguments());
$this->validateReferences($definition->getMethodCalls());
@@ -104,50 +77,10 @@ class CheckReferenceValidityPass implements CompilerPassInterface
$argument
));
}
-
- $this->validateScope($argument, $targetDefinition);
}
}
}
- /**
- * Validates the scope of a single Reference.
- *
- * @param Reference $reference
- * @param Definition $definition
- *
- * @throws ScopeWideningInjectionException when the definition references a service of a narrower scope
- * @throws ScopeCrossingInjectionException when the definition references a service of another scope hierarchy
- */
- private function validateScope(Reference $reference, Definition $definition = null)
- {
- if (ContainerInterface::SCOPE_PROTOTYPE === $this->currentScope) {
- return;
- }
-
- if (!$reference->isStrict(false)) {
- return;
- }
-
- if (null === $definition) {
- return;
- }
-
- if ($this->currentScope === $scope = $definition->getScope(false)) {
- return;
- }
-
- $id = (string) $reference;
-
- if (in_array($scope, $this->currentScopeChildren, true)) {
- throw new ScopeWideningInjectionException($this->currentId, $this->currentScope, $id, $scope);
- }
-
- if (!in_array($scope, $this->currentScopeAncestors, true)) {
- throw new ScopeCrossingInjectionException($this->currentId, $this->currentScope, $id, $scope);
- }
- }
-
/**
* Returns the Definition given an id.
*
diff --git a/src/Symfony/Component/DependencyInjection/Compiler/InlineServiceDefinitionsPass.php b/src/Symfony/Component/DependencyInjection/Compiler/InlineServiceDefinitionsPass.php
index 9b78db2be7..6d9a025354 100644
--- a/src/Symfony/Component/DependencyInjection/Compiler/InlineServiceDefinitionsPass.php
+++ b/src/Symfony/Component/DependencyInjection/Compiler/InlineServiceDefinitionsPass.php
@@ -76,7 +76,7 @@ class InlineServiceDefinitionsPass implements RepeatablePassInterface
if ($this->isInlineableDefinition($container, $id, $definition = $container->getDefinition($id))) {
$this->compiler->addLogMessage($this->formatter->formatInlineService($this, $id, $this->currentId));
- if ($definition->isShared() && ContainerInterface::SCOPE_PROTOTYPE !== $definition->getScope(false)) {
+ if ($definition->isShared()) {
$arguments[$k] = $definition;
} else {
$arguments[$k] = clone $definition;
@@ -109,7 +109,7 @@ class InlineServiceDefinitionsPass implements RepeatablePassInterface
*/
private function isInlineableDefinition(ContainerBuilder $container, $id, Definition $definition)
{
- if (!$definition->isShared() || ContainerInterface::SCOPE_PROTOTYPE === $definition->getScope(false)) {
+ if (!$definition->isShared()) {
return true;
}
@@ -138,6 +138,6 @@ class InlineServiceDefinitionsPass implements RepeatablePassInterface
return false;
}
- return $container->getDefinition(reset($ids))->getScope(false) === $definition->getScope(false);
+ return true;
}
}
diff --git a/src/Symfony/Component/DependencyInjection/Compiler/ResolveDefinitionTemplatesPass.php b/src/Symfony/Component/DependencyInjection/Compiler/ResolveDefinitionTemplatesPass.php
index 8925608e12..01236ce312 100644
--- a/src/Symfony/Component/DependencyInjection/Compiler/ResolveDefinitionTemplatesPass.php
+++ b/src/Symfony/Component/DependencyInjection/Compiler/ResolveDefinitionTemplatesPass.php
@@ -113,7 +113,7 @@ class ResolveDefinitionTemplatesPass implements CompilerPassInterface
$def = new Definition();
// merge in parent definition
- // purposely ignored attributes: scope, abstract, tags
+ // purposely ignored attributes: abstract, tags
$def->setClass($parentDef->getClass());
$def->setArguments($parentDef->getArguments());
$def->setMethodCalls($parentDef->getMethodCalls());
@@ -180,7 +180,6 @@ class ResolveDefinitionTemplatesPass implements CompilerPassInterface
// these attributes are always taken from the child
$def->setAbstract($definition->isAbstract());
- $def->setScope($definition->getScope(false), false);
$def->setTags($definition->getTags());
return $def;
diff --git a/src/Symfony/Component/DependencyInjection/Compiler/ResolveReferencesToAliasesPass.php b/src/Symfony/Component/DependencyInjection/Compiler/ResolveReferencesToAliasesPass.php
index 3111d7f091..f670f51e1d 100644
--- a/src/Symfony/Component/DependencyInjection/Compiler/ResolveReferencesToAliasesPass.php
+++ b/src/Symfony/Component/DependencyInjection/Compiler/ResolveReferencesToAliasesPass.php
@@ -68,7 +68,7 @@ class ResolveReferencesToAliasesPass implements CompilerPassInterface
$defId = $this->getDefinitionId($id = (string) $argument);
if ($defId !== $id) {
- $arguments[$k] = new Reference($defId, $argument->getInvalidBehavior(), $argument->isStrict(false));
+ $arguments[$k] = new Reference($defId, $argument->getInvalidBehavior());
}
}
}
diff --git a/src/Symfony/Component/DependencyInjection/Container.php b/src/Symfony/Component/DependencyInjection/Container.php
index 55906725e2..0586fca2e4 100644
--- a/src/Symfony/Component/DependencyInjection/Container.php
+++ b/src/Symfony/Component/DependencyInjection/Container.php
@@ -11,10 +11,7 @@
namespace Symfony\Component\DependencyInjection;
-use Symfony\Component\DependencyInjection\Exception\InactiveScopeException;
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
-use Symfony\Component\DependencyInjection\Exception\LogicException;
-use Symfony\Component\DependencyInjection\Exception\RuntimeException;
use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException;
use Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
@@ -71,10 +68,6 @@ class Container implements ResettableContainerInterface
protected $services = array();
protected $methodMap = array();
protected $aliases = array();
- protected $scopes = array();
- protected $scopeChildren = array();
- protected $scopedServices = array();
- protected $scopeStacks = array();
protected $loading = array();
private $underscoreMap = array('_' => '', '.' => '_', '\\' => '_');
@@ -181,48 +174,22 @@ class Container implements ResettableContainerInterface
* Setting a service to null resets the service: has() returns false and get()
* behaves in the same way as if the service was never created.
*
- * Note: The $scope parameter is deprecated since version 2.8 and will be removed in 3.0.
- *
* @param string $id The service identifier
* @param object $service The service instance
- * @param string $scope The scope of the service
- *
- * @throws RuntimeException When trying to set a service in an inactive scope
- * @throws InvalidArgumentException When trying to set a service in the prototype scope
*
* @api
*/
- public function set($id, $service, $scope = self::SCOPE_CONTAINER)
+ public function set($id, $service)
{
- if (!in_array($scope, array('container', 'request')) || ('request' === $scope && 'request' !== $id)) {
- @trigger_error('The concept of container scopes is deprecated since version 2.8 and will be removed in 3.0. Omit the third parameter.', E_USER_DEPRECATED);
- }
-
- if (self::SCOPE_PROTOTYPE === $scope) {
- throw new InvalidArgumentException(sprintf('You cannot set service "%s" of scope "prototype".', $id));
- }
-
$id = strtolower($id);
if ('service_container' === $id) {
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));
- }
-
- $this->scopedServices[$scope][$id] = $service;
- }
-
$this->services[$id] = $service;
if (null === $service) {
- if (self::SCOPE_CONTAINER !== $scope) {
- unset($this->scopedServices[$scope][$id]);
- }
-
unset($this->services[$id]);
}
}
@@ -333,10 +300,6 @@ class Container implements ResettableContainerInterface
unset($this->services[$id]);
}
- if ($e instanceof InactiveScopeException && self::EXCEPTION_ON_INVALID_REFERENCE !== $invalidBehavior) {
- return;
- }
-
throw $e;
}
@@ -373,10 +336,6 @@ class Container implements ResettableContainerInterface
*/
public function reset()
{
- if (!empty($this->scopedServices)) {
- throw new LogicException('Resetting the container is not allowed when a scope is active.');
- }
-
$this->services = array();
}
@@ -399,193 +358,6 @@ class Container implements ResettableContainerInterface
return array_unique(array_merge($ids, array_keys($this->services)));
}
- /**
- * This is called when you enter a scope.
- *
- * @param string $name
- *
- * @throws RuntimeException When the parent scope is inactive
- * @throws InvalidArgumentException When the scope does not exist
- *
- * @api
- *
- * @deprecated since version 2.8, to be removed in 3.0.
- */
- public function enterScope($name)
- {
- if ('request' !== $name) {
- @trigger_error('The '.__METHOD__.' method is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
- }
-
- if (!isset($this->scopes[$name])) {
- throw new InvalidArgumentException(sprintf('The scope "%s" does not exist.', $name));
- }
-
- if (self::SCOPE_CONTAINER !== $this->scopes[$name] && !isset($this->scopedServices[$this->scopes[$name]])) {
- throw new RuntimeException(sprintf('The parent scope "%s" must be active when entering this scope.', $this->scopes[$name]));
- }
-
- // check if a scope of this name is already active, if so we need to
- // remove all services of this scope, and those of any of its child
- // scopes from the global services map
- if (isset($this->scopedServices[$name])) {
- $services = array($this->services, $name => $this->scopedServices[$name]);
- unset($this->scopedServices[$name]);
-
- foreach ($this->scopeChildren[$name] as $child) {
- if (isset($this->scopedServices[$child])) {
- $services[$child] = $this->scopedServices[$child];
- unset($this->scopedServices[$child]);
- }
- }
-
- // update global map
- $this->services = call_user_func_array('array_diff_key', $services);
- array_shift($services);
-
- // add stack entry for this scope so we can restore the removed services later
- if (!isset($this->scopeStacks[$name])) {
- $this->scopeStacks[$name] = new \SplStack();
- }
- $this->scopeStacks[$name]->push($services);
- }
-
- $this->scopedServices[$name] = array();
- }
-
- /**
- * This is called to leave the current scope, and move back to the parent
- * scope.
- *
- * @param string $name The name of the scope to leave
- *
- * @throws InvalidArgumentException if the scope is not active
- *
- * @api
- *
- * @deprecated since version 2.8, to be removed in 3.0.
- */
- public function leaveScope($name)
- {
- if ('request' !== $name) {
- @trigger_error('The '.__METHOD__.' method is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
- }
-
- if (!isset($this->scopedServices[$name])) {
- throw new InvalidArgumentException(sprintf('The scope "%s" is not active.', $name));
- }
-
- // remove all services of this scope, or any of its child scopes from
- // the global service map
- $services = array($this->services, $this->scopedServices[$name]);
- unset($this->scopedServices[$name]);
-
- foreach ($this->scopeChildren[$name] as $child) {
- if (isset($this->scopedServices[$child])) {
- $services[] = $this->scopedServices[$child];
- unset($this->scopedServices[$child]);
- }
- }
-
- // update global map
- $this->services = call_user_func_array('array_diff_key', $services);
-
- // check if we need to restore services of a previous scope of this type
- if (isset($this->scopeStacks[$name]) && count($this->scopeStacks[$name]) > 0) {
- $services = $this->scopeStacks[$name]->pop();
- $this->scopedServices += $services;
-
- if ($this->scopeStacks[$name]->isEmpty()) {
- unset($this->scopeStacks[$name]);
- }
-
- foreach ($services as $array) {
- foreach ($array as $id => $service) {
- $this->set($id, $service, $name);
- }
- }
- }
- }
-
- /**
- * Adds a scope to the container.
- *
- * @param ScopeInterface $scope
- *
- * @throws InvalidArgumentException
- *
- * @api
- *
- * @deprecated since version 2.8, to be removed in 3.0.
- */
- public function addScope(ScopeInterface $scope)
- {
- $name = $scope->getName();
- $parentScope = $scope->getParentName();
-
- if ('request' !== $name) {
- @trigger_error('The '.__METHOD__.' method is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
- }
- if (self::SCOPE_CONTAINER === $name || self::SCOPE_PROTOTYPE === $name) {
- throw new InvalidArgumentException(sprintf('The scope "%s" is reserved.', $name));
- }
- if (isset($this->scopes[$name])) {
- throw new InvalidArgumentException(sprintf('A scope with name "%s" already exists.', $name));
- }
- if (self::SCOPE_CONTAINER !== $parentScope && !isset($this->scopes[$parentScope])) {
- throw new InvalidArgumentException(sprintf('The parent scope "%s" does not exist, or is invalid.', $parentScope));
- }
-
- $this->scopes[$name] = $parentScope;
- $this->scopeChildren[$name] = array();
-
- // normalize the child relations
- while ($parentScope !== self::SCOPE_CONTAINER) {
- $this->scopeChildren[$parentScope][] = $name;
- $parentScope = $this->scopes[$parentScope];
- }
- }
-
- /**
- * Returns whether this container has a certain scope.
- *
- * @param string $name The name of the scope
- *
- * @return bool
- *
- * @api
- *
- * @deprecated since version 2.8, to be removed in 3.0.
- */
- public function hasScope($name)
- {
- if ('request' !== $name) {
- @trigger_error('The '.__METHOD__.' method is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
- }
-
- return isset($this->scopes[$name]);
- }
-
- /**
- * Returns whether this scope is currently active.
- *
- * This does not actually check if the passed scope actually exists.
- *
- * @param string $name
- *
- * @return bool
- *
- * @api
- *
- * @deprecated since version 2.8, to be removed in 3.0.
- */
- public function isScopeActive($name)
- {
- @trigger_error('The '.__METHOD__.' method is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
-
- return isset($this->scopedServices[$name]);
- }
-
/**
* Camelizes a string.
*
diff --git a/src/Symfony/Component/DependencyInjection/ContainerBuilder.php b/src/Symfony/Component/DependencyInjection/ContainerBuilder.php
index c3013a3c02..af87140a23 100644
--- a/src/Symfony/Component/DependencyInjection/ContainerBuilder.php
+++ b/src/Symfony/Component/DependencyInjection/ContainerBuilder.php
@@ -15,7 +15,6 @@ use Symfony\Component\DependencyInjection\Compiler\Compiler;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\Compiler\PassConfig;
use Symfony\Component\DependencyInjection\Exception\BadMethodCallException;
-use Symfony\Component\DependencyInjection\Exception\InactiveScopeException;
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
use Symfony\Component\DependencyInjection\Exception\LogicException;
use Symfony\Component\DependencyInjection\Exception\RuntimeException;
@@ -352,56 +351,17 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
return $this->compiler;
}
- /**
- * Returns all Scopes.
- *
- * @return array An array of scopes
- *
- * @api
- *
- * @deprecated since version 2.8, to be removed in 3.0.
- */
- public function getScopes($triggerDeprecationError = true)
- {
- if ($triggerDeprecationError) {
- @trigger_error('The '.__METHOD__.' method is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
- }
-
- return $this->scopes;
- }
-
- /**
- * Returns all Scope children.
- *
- * @return array An array of scope children.
- *
- * @api
- *
- * @deprecated since version 2.8, to be removed in 3.0.
- */
- public function getScopeChildren($triggerDeprecationError = true)
- {
- if ($triggerDeprecationError) {
- @trigger_error('The '.__METHOD__.' method is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
- }
-
- return $this->scopeChildren;
- }
-
/**
* Sets a service.
*
- * Note: The $scope parameter is deprecated since version 2.8 and will be removed in 3.0.
- *
* @param string $id The service identifier
* @param object $service The service instance
- * @param string $scope The scope
*
* @throws BadMethodCallException When this ContainerBuilder is frozen
*
* @api
*/
- public function set($id, $service, $scope = self::SCOPE_CONTAINER)
+ public function set($id, $service)
{
$id = strtolower($id);
@@ -424,7 +384,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
unset($this->definitions[$id], $this->aliasDefinitions[$id]);
- parent::set($id, $service, $scope);
+ parent::set($id, $service);
}
/**
@@ -464,7 +424,6 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
* @return object The associated service
*
* @throws InvalidArgumentException when no definitions are available
- * @throws InactiveScopeException when the current scope is not active
* @throws LogicException when a circular dependency is detected
* @throws \Exception
*
@@ -501,10 +460,6 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
} catch (\Exception $e) {
unset($this->loading[$id]);
- if ($e instanceof InactiveScopeException && self::EXCEPTION_ON_INVALID_REFERENCE !== $invalidBehavior) {
- return;
- }
-
throw $e;
}
@@ -914,7 +869,6 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
*
* @return object The service described by the service definition
*
- * @throws RuntimeException When the scope is inactive
* @throws RuntimeException When the factory definition is incomplete
* @throws RuntimeException When the service is a synthetic service
* @throws InvalidArgumentException When configure callable is not callable
@@ -1135,21 +1089,11 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
* @param Definition $definition
* @param mixed $service
* @param string $id
- *
- * @throws InactiveScopeException
*/
private function shareService(Definition $definition, $service, $id)
{
- if ($definition->isShared() && self::SCOPE_PROTOTYPE !== $scope = $definition->getScope(false)) {
- if (self::SCOPE_CONTAINER !== $scope && !isset($this->scopedServices[$scope])) {
- throw new InactiveScopeException($id, $scope);
- }
-
+ if ($definition->isShared()) {
$this->services[$lowerId = strtolower($id)] = $service;
-
- if (self::SCOPE_CONTAINER !== $scope) {
- $this->scopedServices[$scope][$lowerId] = $service;
- }
}
}
diff --git a/src/Symfony/Component/DependencyInjection/ContainerInterface.php b/src/Symfony/Component/DependencyInjection/ContainerInterface.php
index e610f43f1b..a26343b644 100644
--- a/src/Symfony/Component/DependencyInjection/ContainerInterface.php
+++ b/src/Symfony/Component/DependencyInjection/ContainerInterface.php
@@ -28,21 +28,16 @@ interface ContainerInterface
const EXCEPTION_ON_INVALID_REFERENCE = 1;
const NULL_ON_INVALID_REFERENCE = 2;
const IGNORE_ON_INVALID_REFERENCE = 3;
- const SCOPE_CONTAINER = 'container';
- const SCOPE_PROTOTYPE = 'prototype';
/**
* Sets a service.
*
- * Note: The $scope parameter is deprecated since version 2.8 and will be removed in 3.0.
- *
* @param string $id The service identifier
* @param object $service The service instance
- * @param string $scope The scope of the service
*
* @api
*/
- public function set($id, $service, $scope = self::SCOPE_CONTAINER);
+ public function set($id, $service);
/**
* Gets a service.
@@ -114,65 +109,4 @@ interface ContainerInterface
* @api
*/
public function setParameter($name, $value);
-
- /**
- * Enters the given scope.
- *
- * @param string $name
- *
- * @api
- *
- * @deprecated since version 2.8, to be removed in 3.0.
- */
- public function enterScope($name);
-
- /**
- * Leaves the current scope, and re-enters the parent scope.
- *
- * @param string $name
- *
- * @api
- *
- * @deprecated since version 2.8, to be removed in 3.0.
- */
- public function leaveScope($name);
-
- /**
- * Adds a scope to the container.
- *
- * @param ScopeInterface $scope
- *
- * @api
- *
- * @deprecated since version 2.8, to be removed in 3.0.
- */
- public function addScope(ScopeInterface $scope);
-
- /**
- * Whether this container has the given scope.
- *
- * @param string $name
- *
- * @return bool
- *
- * @api
- *
- * @deprecated since version 2.8, to be removed in 3.0.
- */
- public function hasScope($name);
-
- /**
- * Determines whether the given scope is currently active.
- *
- * It does however not check if the scope actually exists.
- *
- * @param string $name
- *
- * @return bool
- *
- * @api
- *
- * @deprecated since version 2.8, to be removed in 3.0.
- */
- public function isScopeActive($name);
}
diff --git a/src/Symfony/Component/DependencyInjection/Definition.php b/src/Symfony/Component/DependencyInjection/Definition.php
index 37bf3de451..a13783792b 100644
--- a/src/Symfony/Component/DependencyInjection/Definition.php
+++ b/src/Symfony/Component/DependencyInjection/Definition.php
@@ -27,7 +27,6 @@ class Definition
private $file;
private $factory;
private $shared = true;
- private $scope = ContainerInterface::SCOPE_CONTAINER;
private $properties = array();
private $calls = array();
private $configurator;
@@ -514,50 +513,6 @@ class Definition
return $this->shared;
}
- /**
- * Sets the scope of the service.
- *
- * @param string $scope Whether the service must be shared or not
- *
- * @return Definition The current instance
- *
- * @api
- *
- * @deprecated since version 2.8, to be removed in 3.0.
- */
- public function setScope($scope, $triggerDeprecationError = true)
- {
- if ($triggerDeprecationError) {
- @trigger_error('The '.__METHOD__.' method is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
- }
-
- if (ContainerInterface::SCOPE_PROTOTYPE === $scope) {
- $this->setShared(false);
- }
-
- $this->scope = $scope;
-
- return $this;
- }
-
- /**
- * Returns the scope of the service.
- *
- * @return string
- *
- * @api
- *
- * @deprecated since version 2.8, to be removed in 3.0.
- */
- public function getScope($triggerDeprecationError = true)
- {
- if ($triggerDeprecationError) {
- @trigger_error('The '.__METHOD__.' method is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
- }
-
- return $this->scope;
- }
-
/**
* Sets the visibility of this service.
*
diff --git a/src/Symfony/Component/DependencyInjection/Dumper/GraphvizDumper.php b/src/Symfony/Component/DependencyInjection/Dumper/GraphvizDumper.php
index 9710e8b0d2..bf950dbc86 100644
--- a/src/Symfony/Component/DependencyInjection/Dumper/GraphvizDumper.php
+++ b/src/Symfony/Component/DependencyInjection/Dumper/GraphvizDumper.php
@@ -18,7 +18,6 @@ use Symfony\Component\DependencyInjection\Parameter;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
-use Symfony\Component\DependencyInjection\Scope;
/**
* GraphvizDumper dumps a service container as a graphviz file.
@@ -177,7 +176,7 @@ class GraphvizDumper extends Dumper
} catch (ParameterNotFoundException $e) {
}
- $nodes[$id] = array('class' => str_replace('\\', '\\\\', $class), 'attributes' => array_merge($this->options['node.definition'], array('style' => $definition->isShared() && ContainerInterface::SCOPE_PROTOTYPE !== $definition->getScope(false) ? 'filled' : 'dotted')));
+ $nodes[$id] = array('class' => str_replace('\\', '\\\\', $class), 'attributes' => array_merge($this->options['node.definition'], array('style' => $definition->isShared() ? 'filled' : 'dotted')));
$container->setDefinition($id, new Definition('stdClass'));
}
@@ -205,9 +204,6 @@ class GraphvizDumper extends Dumper
$container->setDefinitions($this->container->getDefinitions());
$container->setAliases($this->container->getAliases());
$container->setResources($this->container->getResources());
- foreach ($this->container->getScopes(false) as $scope => $parentScope) {
- $container->addScope(new Scope($scope, $parentScope));
- }
foreach ($this->container->getExtensions() as $extension) {
$container->registerExtension($extension);
}
diff --git a/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php b/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php
index a7494f5b16..2eb79b9679 100644
--- a/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php
+++ b/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php
@@ -382,10 +382,8 @@ class PhpDumper extends Dumper
$isProxyCandidate = $this->getProxyDumper()->isProxyCandidate($definition);
$instantiation = '';
- if (!$isProxyCandidate && $definition->isShared() && ContainerInterface::SCOPE_CONTAINER === $definition->getScope(false)) {
+ if (!$isProxyCandidate && $definition->isShared()) {
$instantiation = "\$this->services['$id'] = ".($simple ? '' : '$instance');
- } elseif (!$isProxyCandidate && $definition->isShared() && ContainerInterface::SCOPE_PROTOTYPE !== $scope = $definition->getScope(false)) {
- $instantiation = "\$this->services['$id'] = \$this->scopedServices['$scope']['$id'] = ".($simple ? '' : '$instance');
} elseif (!$simple) {
$instantiation = '$instance';
}
@@ -574,18 +572,10 @@ class PhpDumper extends Dumper
}
}
- $scope = $definition->getScope(false);
- if (!in_array($scope, array(ContainerInterface::SCOPE_CONTAINER, ContainerInterface::SCOPE_PROTOTYPE))) {
- if ($return && 0 === strpos($return[count($return) - 1], '@return')) {
- $return[] = '';
- }
- $return[] = sprintf("@throws InactiveScopeException when the '%s' service is requested while the '%s' scope is not active", $id, $scope);
- }
-
$return = implode("\n * ", $return);
$doc = '';
- if ($definition->isShared() && ContainerInterface::SCOPE_PROTOTYPE !== $scope) {
+ if ($definition->isShared()) {
$doc .= <<getProxyDumper()->getProxyFactoryCode($definition, $id) : '';
- if (!in_array($scope, array(ContainerInterface::SCOPE_CONTAINER, ContainerInterface::SCOPE_PROTOTYPE))) {
- $code .= <<scopedServices['$scope'])) {
- throw new InactiveScopeException('$id', '$scope');
- }
-
-
-EOF;
- }
-
if ($definition->isSynthetic()) {
$code .= sprintf(" throw new RuntimeException('You have requested a synthetic service (\"%s\"). The DIC does not know how to construct this service.');\n }\n", $id);
} else {
@@ -737,7 +717,6 @@ EOF;
$namespaceLine
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\DependencyInjection\Container;
-use Symfony\Component\DependencyInjection\Exception\InactiveScopeException;
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
use Symfony\Component\DependencyInjection\Exception\LogicException;
use Symfony\Component\DependencyInjection\Exception\RuntimeException;
@@ -778,12 +757,6 @@ EOF;
EOF;
- if (count($scopes = $this->container->getScopes(false)) > 0) {
- $code .= "\n";
- $code .= ' $this->scopes = '.$this->dumpValue($scopes).";\n";
- $code .= ' $this->scopeChildren = '.$this->dumpValue($this->container->getScopeChildren(false)).";\n";
- }
-
$code .= $this->addMethodMap();
$code .= $this->addAliases();
@@ -817,22 +790,7 @@ EOF;
$code .= "\n \$this->parameters = \$this->getDefaultParameters();\n";
}
- $code .= <<services =
- \$this->scopedServices =
- \$this->scopeStacks = array();
-EOF;
-
- $code .= "\n";
- if (count($scopes = $this->container->getScopes(false)) > 0) {
- $code .= ' $this->scopes = '.$this->dumpValue($scopes).";\n";
- $code .= ' $this->scopeChildren = '.$this->dumpValue($this->container->getScopeChildren(false)).";\n";
- } else {
- $code .= " \$this->scopes = array();\n";
- $code .= " \$this->scopeChildren = array();\n";
- }
-
+ $code .= "\n \$this->services = array();\n";
$code .= $this->addMethodMap();
$code .= $this->addAliases();
diff --git a/src/Symfony/Component/DependencyInjection/Dumper/XmlDumper.php b/src/Symfony/Component/DependencyInjection/Dumper/XmlDumper.php
index 19661df03c..001a341d06 100644
--- a/src/Symfony/Component/DependencyInjection/Dumper/XmlDumper.php
+++ b/src/Symfony/Component/DependencyInjection/Dumper/XmlDumper.php
@@ -124,9 +124,6 @@ class XmlDumper extends Dumper
if (!$definition->isShared()) {
$service->setAttribute('shared', 'false');
}
- if (ContainerInterface::SCOPE_CONTAINER !== $scope = $definition->getScope(false)) {
- $service->setAttribute('scope', $scope);
- }
if (!$definition->isPublic()) {
$service->setAttribute('public', 'false');
}
@@ -281,9 +278,6 @@ class XmlDumper extends Dumper
} elseif ($behaviour == ContainerInterface::IGNORE_ON_INVALID_REFERENCE) {
$element->setAttribute('on-invalid', 'ignore');
}
- if (!$value->isStrict(false)) {
- $element->setAttribute('strict', 'false');
- }
} elseif ($value instanceof Definition) {
$element->setAttribute('type', 'service');
$this->addService($value, null, $element);
diff --git a/src/Symfony/Component/DependencyInjection/Dumper/YamlDumper.php b/src/Symfony/Component/DependencyInjection/Dumper/YamlDumper.php
index c905117b37..e181a2670b 100644
--- a/src/Symfony/Component/DependencyInjection/Dumper/YamlDumper.php
+++ b/src/Symfony/Component/DependencyInjection/Dumper/YamlDumper.php
@@ -120,10 +120,6 @@ class YamlDumper extends Dumper
$code .= " shared: false\n";
}
- if (ContainerInterface::SCOPE_CONTAINER !== $scope = $definition->getScope(false)) {
- $code .= sprintf(" scope: %s\n", $scope);
- }
-
if (null !== $decorated = $definition->getDecoratedService()) {
list($decorated, $renamedId, $priority) = $decorated;
$code .= sprintf(" decorates: %s\n", $decorated);
diff --git a/src/Symfony/Component/DependencyInjection/Exception/InactiveScopeException.php b/src/Symfony/Component/DependencyInjection/Exception/InactiveScopeException.php
deleted file mode 100644
index 6b3dd3ebb1..0000000000
--- a/src/Symfony/Component/DependencyInjection/Exception/InactiveScopeException.php
+++ /dev/null
@@ -1,41 +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\Exception;
-
-/**
- * This exception is thrown when you try to create a service of an inactive scope.
- *
- * @author Johannes M. Schmitt
- */
-class InactiveScopeException extends RuntimeException
-{
- private $serviceId;
- private $scope;
-
- public function __construct($serviceId, $scope, \Exception $previous = null)
- {
- parent::__construct(sprintf('You cannot create a service ("%s") of an inactive scope ("%s").', $serviceId, $scope), 0, $previous);
-
- $this->serviceId = $serviceId;
- $this->scope = $scope;
- }
-
- public function getServiceId()
- {
- return $this->serviceId;
- }
-
- public function getScope()
- {
- return $this->scope;
- }
-}
diff --git a/src/Symfony/Component/DependencyInjection/Exception/ScopeCrossingInjectionException.php b/src/Symfony/Component/DependencyInjection/Exception/ScopeCrossingInjectionException.php
deleted file mode 100644
index 661fbab369..0000000000
--- a/src/Symfony/Component/DependencyInjection/Exception/ScopeCrossingInjectionException.php
+++ /dev/null
@@ -1,65 +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\Exception;
-
-/**
- * This exception is thrown when the a scope crossing injection is detected.
- *
- * @author Johannes M. Schmitt
- */
-class ScopeCrossingInjectionException extends RuntimeException
-{
- private $sourceServiceId;
- private $sourceScope;
- private $destServiceId;
- private $destScope;
-
- public function __construct($sourceServiceId, $sourceScope, $destServiceId, $destScope, \Exception $previous = null)
- {
- parent::__construct(sprintf(
- 'Scope Crossing Injection detected: The definition "%s" references the service "%s" which belongs to another scope hierarchy. '
- .'This service might not be available consistently. Generally, it is safer to either move the definition "%s" to scope "%s", or '
- .'declare "%s" as a child scope of "%s". If you can be sure that the other scope is always active, you can set the reference to strict=false to get rid of this error.',
- $sourceServiceId,
- $destServiceId,
- $sourceServiceId,
- $destScope,
- $sourceScope,
- $destScope
- ), 0, $previous);
-
- $this->sourceServiceId = $sourceServiceId;
- $this->sourceScope = $sourceScope;
- $this->destServiceId = $destServiceId;
- $this->destScope = $destScope;
- }
-
- public function getSourceServiceId()
- {
- return $this->sourceServiceId;
- }
-
- public function getSourceScope()
- {
- return $this->sourceScope;
- }
-
- public function getDestServiceId()
- {
- return $this->destServiceId;
- }
-
- public function getDestScope()
- {
- return $this->destScope;
- }
-}
diff --git a/src/Symfony/Component/DependencyInjection/Exception/ScopeWideningInjectionException.php b/src/Symfony/Component/DependencyInjection/Exception/ScopeWideningInjectionException.php
deleted file mode 100644
index 86a6684195..0000000000
--- a/src/Symfony/Component/DependencyInjection/Exception/ScopeWideningInjectionException.php
+++ /dev/null
@@ -1,64 +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\Exception;
-
-/**
- * Thrown when a scope widening injection is detected.
- *
- * @author Johannes M. Schmitt
- */
-class ScopeWideningInjectionException extends RuntimeException
-{
- private $sourceServiceId;
- private $sourceScope;
- private $destServiceId;
- private $destScope;
-
- public function __construct($sourceServiceId, $sourceScope, $destServiceId, $destScope, \Exception $previous = null)
- {
- parent::__construct(sprintf(
- 'Scope Widening Injection detected: The definition "%s" references the service "%s" which belongs to a narrower scope. '
- .'Generally, it is safer to either move "%s" to scope "%s" or alternatively rely on the provider pattern by injecting the container itself, and requesting the service "%s" each time it is needed. '
- .'In rare, special cases however that might not be necessary, then you can set the reference to strict=false to get rid of this error.',
- $sourceServiceId,
- $destServiceId,
- $sourceServiceId,
- $destScope,
- $destServiceId
- ), 0, $previous);
-
- $this->sourceServiceId = $sourceServiceId;
- $this->sourceScope = $sourceScope;
- $this->destServiceId = $destServiceId;
- $this->destScope = $destScope;
- }
-
- public function getSourceServiceId()
- {
- return $this->sourceServiceId;
- }
-
- public function getSourceScope()
- {
- return $this->sourceScope;
- }
-
- public function getDestServiceId()
- {
- return $this->destServiceId;
- }
-
- public function getDestScope()
- {
- return $this->destScope;
- }
-}
diff --git a/src/Symfony/Component/DependencyInjection/IntrospectableContainerInterface.php b/src/Symfony/Component/DependencyInjection/IntrospectableContainerInterface.php
deleted file mode 100644
index 36213b3db9..0000000000
--- a/src/Symfony/Component/DependencyInjection/IntrospectableContainerInterface.php
+++ /dev/null
@@ -1,25 +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;
-
-/**
- * IntrospectableContainerInterface defines additional introspection functionality
- * for containers, allowing logic to be implemented based on a Container's state.
- *
- * @author Evan Villemez
- *
- * @deprecated Since version 3.0, to be removed in 4.0. Use ContainerInterface
- * instead.
- */
-interface IntrospectableContainerInterface extends ContainerInterface
-{
-}
diff --git a/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php b/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php
index 16b3b98a55..517cddac08 100644
--- a/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php
+++ b/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php
@@ -167,13 +167,6 @@ class YamlFileLoader extends FileLoader
$definition->setShared($service['shared']);
}
- if (isset($service['scope'])) {
- if ('request' !== $id) {
- @trigger_error(sprintf('The "scope" key of service "%s" in file "%s" is deprecated since version 2.8 and will be removed in 3.0.', $id, $file), E_USER_DEPRECATED);
- }
- $definition->setScope($service['scope'], false);
- }
-
if (isset($service['synthetic'])) {
$definition->setSynthetic($service['synthetic']);
}
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 a53bc66ec9..0ce674ea64 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
@@ -88,7 +88,6 @@
-
diff --git a/src/Symfony/Component/DependencyInjection/Reference.php b/src/Symfony/Component/DependencyInjection/Reference.php
index 6bb117abb6..0fc1abc696 100644
--- a/src/Symfony/Component/DependencyInjection/Reference.php
+++ b/src/Symfony/Component/DependencyInjection/Reference.php
@@ -22,24 +22,19 @@ class Reference
{
private $id;
private $invalidBehavior;
- private $strict;
/**
* Constructor.
*
- * Note: The $strict parameter is deprecated since version 2.8 and will be removed in 3.0.
- *
* @param string $id The service identifier
* @param int $invalidBehavior The behavior when the service does not exist
- * @param bool $strict Sets how this reference is validated
*
* @see Container
*/
- public function __construct($id, $invalidBehavior = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, $strict = true)
+ public function __construct($id, $invalidBehavior = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE)
{
$this->id = strtolower($id);
$this->invalidBehavior = $invalidBehavior;
- $this->strict = $strict;
}
/**
@@ -61,20 +56,4 @@ class Reference
{
return $this->invalidBehavior;
}
-
- /**
- * Returns true when this Reference is strict.
- *
- * @return bool
- *
- * @deprecated since version 2.8, to be removed in 3.0.
- */
- public function isStrict($triggerDeprecationError = true)
- {
- if ($triggerDeprecationError) {
- @trigger_error('The '.__METHOD__.' method is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
- }
-
- return $this->strict;
- }
}
diff --git a/src/Symfony/Component/DependencyInjection/Scope.php b/src/Symfony/Component/DependencyInjection/Scope.php
deleted file mode 100644
index c97c887584..0000000000
--- a/src/Symfony/Component/DependencyInjection/Scope.php
+++ /dev/null
@@ -1,52 +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;
-
-/**
- * Scope class.
- *
- * @author Johannes M. Schmitt
- *
- * @api
- *
- * @deprecated since version 2.8, to be removed in 3.0.
- */
-class Scope implements ScopeInterface
-{
- private $name;
- private $parentName;
-
- /**
- * @api
- */
- public function __construct($name, $parentName = ContainerInterface::SCOPE_CONTAINER)
- {
- $this->name = $name;
- $this->parentName = $parentName;
- }
-
- /**
- * @api
- */
- public function getName()
- {
- return $this->name;
- }
-
- /**
- * @api
- */
- public function getParentName()
- {
- return $this->parentName;
- }
-}
diff --git a/src/Symfony/Component/DependencyInjection/ScopeInterface.php b/src/Symfony/Component/DependencyInjection/ScopeInterface.php
deleted file mode 100644
index 69d57685a2..0000000000
--- a/src/Symfony/Component/DependencyInjection/ScopeInterface.php
+++ /dev/null
@@ -1,34 +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;
-
-/**
- * Scope Interface.
- *
- * @author Johannes M. Schmitt
- *
- * @api
- *
- * @deprecated since version 2.8, to be removed in 3.0.
- */
-interface ScopeInterface
-{
- /**
- * @api
- */
- public function getName();
-
- /**
- * @api
- */
- public function getParentName();
-}
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/CheckDefinitionValidityPassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/CheckDefinitionValidityPassTest.php
index 1dfed9c757..71209472a4 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/CheckDefinitionValidityPassTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/CheckDefinitionValidityPassTest.php
@@ -28,30 +28,6 @@ class CheckDefinitionValidityPassTest extends \PHPUnit_Framework_TestCase
$this->process($container);
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\RuntimeException
- * @group legacy
- */
- public function testProcessDetectsSyntheticPrototypeDefinitions()
- {
- $container = new ContainerBuilder();
- $container->register('a')->setSynthetic(true)->setScope(ContainerInterface::SCOPE_PROTOTYPE);
-
- $this->process($container);
- }
-
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\RuntimeException
- * @group legacy
- */
- public function testProcessDetectsSharedPrototypeDefinitions()
- {
- $container = new ContainerBuilder();
- $container->register('a')->setShared(true)->setScope(ContainerInterface::SCOPE_PROTOTYPE);
-
- $this->process($container);
- }
-
/**
* @expectedException \Symfony\Component\DependencyInjection\Exception\RuntimeException
*/
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/CheckReferenceValidityPassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/CheckReferenceValidityPassTest.php
index 45cf279e37..5b10ae8243 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/CheckReferenceValidityPassTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/CheckReferenceValidityPassTest.php
@@ -11,7 +11,6 @@
namespace Symfony\Component\DependencyInjection\Tests\Compiler;
-use Symfony\Component\DependencyInjection\Scope;
use Symfony\Component\DependencyInjection\Compiler\CheckReferenceValidityPass;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\DependencyInjection\Reference;
@@ -19,62 +18,6 @@ use Symfony\Component\DependencyInjection\ContainerBuilder;
class CheckReferenceValidityPassTest extends \PHPUnit_Framework_TestCase
{
- /**
- * @group legacy
- */
- public function testProcessIgnoresScopeWideningIfNonStrictReference()
- {
- $container = new ContainerBuilder();
- $container->register('a')->addArgument(new Reference('b', ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, false));
- $container->register('b')->setScope('prototype');
-
- $this->process($container);
- }
-
- /**
- * @expectedException \RuntimeException
- * @group legacy
- */
- public function testProcessDetectsScopeWidening()
- {
- $container = new ContainerBuilder();
- $container->register('a')->addArgument(new Reference('b'));
- $container->register('b')->setScope('prototype');
-
- $this->process($container);
- }
-
- /**
- * @group legacy
- */
- public function testProcessIgnoresCrossScopeHierarchyReferenceIfNotStrict()
- {
- $container = new ContainerBuilder();
- $container->addScope(new Scope('a'));
- $container->addScope(new Scope('b'));
-
- $container->register('a')->setScope('a')->addArgument(new Reference('b', ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, false));
- $container->register('b')->setScope('b');
-
- $this->process($container);
- }
-
- /**
- * @expectedException \RuntimeException
- * @group legacy
- */
- public function testProcessDetectsCrossScopeHierarchyReference()
- {
- $container = new ContainerBuilder();
- $container->addScope(new Scope('a'));
- $container->addScope(new Scope('b'));
-
- $container->register('a')->setScope('a')->addArgument(new Reference('b'));
- $container->register('b')->setScope('b');
-
- $this->process($container);
- }
-
/**
* @expectedException \RuntimeException
*/
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/InlineServiceDefinitionsPassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/InlineServiceDefinitionsPassTest.php
index 0388434163..342a6baf83 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/InlineServiceDefinitionsPassTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/InlineServiceDefinitionsPassTest.php
@@ -11,7 +11,6 @@
namespace Symfony\Component\DependencyInjection\Tests\Compiler;
-use Symfony\Component\DependencyInjection\Scope;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Compiler\AnalyzeServiceReferencesPass;
use Symfony\Component\DependencyInjection\Compiler\RepeatedPass;
@@ -61,29 +60,6 @@ class InlineServiceDefinitionsPassTest extends \PHPUnit_Framework_TestCase
$this->assertSame($ref, $arguments[0]);
}
- /**
- * @group legacy
- */
- public function testProcessDoesNotInlineWhenAliasedServiceIsNotOfPrototypeScope()
- {
- $container = new ContainerBuilder();
- $container
- ->register('foo')
- ->setPublic(false)
- ;
- $container->setAlias('moo', 'foo');
-
- $container
- ->register('service')
- ->setArguments(array($ref = new Reference('foo')))
- ;
-
- $this->process($container);
-
- $arguments = $container->getDefinition('service')->getArguments();
- $this->assertSame($ref, $arguments[0]);
- }
-
public function testProcessDoesInlineNonSharedService()
{
$container = new ContainerBuilder();
@@ -113,38 +89,6 @@ class InlineServiceDefinitionsPassTest extends \PHPUnit_Framework_TestCase
$this->assertNotSame($container->getDefinition('bar'), $arguments[2]);
}
- /**
- * @group legacy
- */
- public function testProcessDoesInlineServiceOfPrototypeScope()
- {
- $container = new ContainerBuilder();
- $container
- ->register('foo')
- ->setScope('prototype')
- ;
- $container
- ->register('bar')
- ->setPublic(false)
- ->setScope('prototype')
- ;
- $container->setAlias('moo', 'bar');
-
- $container
- ->register('service')
- ->setArguments(array(new Reference('foo'), $ref = new Reference('moo'), new Reference('bar')))
- ;
-
- $this->process($container);
-
- $arguments = $container->getDefinition('service')->getArguments();
- $this->assertEquals($container->getDefinition('foo'), $arguments[0]);
- $this->assertNotSame($container->getDefinition('foo'), $arguments[0]);
- $this->assertSame($ref, $arguments[1]);
- $this->assertEquals($container->getDefinition('bar'), $arguments[2]);
- $this->assertNotSame($container->getDefinition('bar'), $arguments[2]);
- }
-
public function testProcessInlinesIfMultipleReferencesButAllFromTheSameDefinition()
{
$container = new ContainerBuilder();
@@ -243,23 +187,6 @@ class InlineServiceDefinitionsPassTest extends \PHPUnit_Framework_TestCase
$this->assertSame($ref, $args[0]);
}
- /**
- * @group legacy
- */
- public function testProcessInlinesOnlyIfSameScope()
- {
- $container = new ContainerBuilder();
-
- $container->addScope(new Scope('foo'));
- $a = $container->register('a')->setPublic(false)->setScope('foo');
- $b = $container->register('b')->addArgument(new Reference('a'));
-
- $this->process($container);
- $arguments = $b->getArguments();
- $this->assertEquals(new Reference('a'), $arguments[0]);
- $this->assertTrue($container->hasDefinition('a'));
- }
-
public function testProcessDoesNotInlineWhenServiceIsPrivateButLazy()
{
$container = new ContainerBuilder();
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveDefinitionTemplatesPassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveDefinitionTemplatesPassTest.php
index 2180483e2b..3bb4aac85b 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveDefinitionTemplatesPassTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveDefinitionTemplatesPassTest.php
@@ -79,28 +79,6 @@ class ResolveDefinitionTemplatesPassTest extends \PHPUnit_Framework_TestCase
$this->assertFalse($def->isAbstract());
}
- /**
- * @group legacy
- */
- public function testProcessDoesNotCopyScope()
- {
- $container = new ContainerBuilder();
-
- $container
- ->register('parent')
- ->setScope('foo')
- ;
-
- $container
- ->setDefinition('child', new DefinitionDecorator('parent'))
- ;
-
- $this->process($container);
-
- $def = $container->getDefinition('child');
- $this->assertEquals(ContainerInterface::SCOPE_CONTAINER, $def->getScope());
- }
-
public function testProcessDoesNotCopyTags()
{
$container = new ContainerBuilder();
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveInvalidReferencesPassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveInvalidReferencesPassTest.php
index 498baf82fc..a18ba73862 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveInvalidReferencesPassTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveInvalidReferencesPassTest.php
@@ -61,23 +61,6 @@ class ResolveInvalidReferencesPassTest extends \PHPUnit_Framework_TestCase
$this->assertEquals(array(), $def->getProperties());
}
- /**
- * @group legacy
- */
- public function testStrictFlagIsPreserved()
- {
- $container = new ContainerBuilder();
- $container->register('bar');
- $def = $container
- ->register('foo')
- ->addArgument(new Reference('bar', ContainerInterface::NULL_ON_INVALID_REFERENCE, false))
- ;
-
- $this->process($container);
-
- $this->assertFalse($def->getArgument(0)->isStrict());
- }
-
protected function process(ContainerBuilder $container)
{
$pass = new ResolveInvalidReferencesPass();
diff --git a/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php b/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php
index abe748924d..0bf767e625 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php
@@ -20,11 +20,9 @@ use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Exception\RuntimeException;
-use Symfony\Component\DependencyInjection\Exception\InactiveScopeException;
use Symfony\Component\DependencyInjection\Loader\ClosureLoader;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
-use Symfony\Component\DependencyInjection\Scope;
use Symfony\Component\Config\Resource\FileResource;
use Symfony\Component\ExpressionLanguage\Expression;
@@ -152,29 +150,6 @@ class ContainerBuilderTest extends \PHPUnit_Framework_TestCase
$builder->get('foo');
}
- /**
- * @covers Symfony\Component\DependencyInjection\ContainerBuilder::get
- * @group legacy
- */
- public function testGetReturnsNullOnInactiveScope()
- {
- $builder = new ContainerBuilder();
- $builder->register('foo', 'stdClass')->setScope('request');
-
- $this->assertNull($builder->get('foo', ContainerInterface::NULL_ON_INVALID_REFERENCE));
- }
-
- /**
- * @covers Symfony\Component\DependencyInjection\ContainerBuilder::get
- * @group legacy
- */
- public function testGetReturnsNullOnInactiveScopeWhenServiceIsCreatedByAMethod()
- {
- $builder = new ProjectContainer();
-
- $this->assertNull($builder->get('foobaz', ContainerInterface::NULL_ON_INVALID_REFERENCE));
- }
-
/**
* @covers Symfony\Component\DependencyInjection\ContainerBuilder::getServiceIds
*/
@@ -777,11 +752,3 @@ class ContainerBuilderTest extends \PHPUnit_Framework_TestCase
class FooClass
{
}
-
-class ProjectContainer extends ContainerBuilder
-{
- public function getFoobazService()
- {
- throw new InactiveScopeException('foo', 'request');
- }
-}
diff --git a/src/Symfony/Component/DependencyInjection/Tests/ContainerTest.php b/src/Symfony/Component/DependencyInjection/Tests/ContainerTest.php
index c0dbc5b821..0afe8abb64 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/ContainerTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/ContainerTest.php
@@ -11,11 +11,9 @@
namespace Symfony\Component\DependencyInjection\Tests;
-use Symfony\Component\DependencyInjection\Scope;
use Symfony\Component\DependencyInjection\Container;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
-use Symfony\Component\DependencyInjection\Exception\InactiveScopeException;
class ContainerTest extends \PHPUnit_Framework_TestCase
{
@@ -146,7 +144,7 @@ class ContainerTest extends \PHPUnit_Framework_TestCase
$sc = new ProjectServiceContainer();
$sc->set('foo', $obj = new \stdClass());
- $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()');
+ $this->assertEquals(array('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()');
}
/**
@@ -169,42 +167,6 @@ class ContainerTest extends \PHPUnit_Framework_TestCase
$this->assertFalse($sc->has('foo'), '->set() with null service resets the service');
}
- /**
- * @expectedException \InvalidArgumentException
- * @group legacy
- */
- public function testSetDoesNotAllowPrototypeScope()
- {
- $c = new Container();
- $c->set('foo', new \stdClass(), Container::SCOPE_PROTOTYPE);
- }
-
- /**
- * @expectedException \RuntimeException
- * @group legacy
- */
- public function testSetDoesNotAllowInactiveScope()
- {
- $c = new Container();
- $c->addScope(new Scope('foo'));
- $c->set('foo', new \stdClass(), 'foo');
- }
-
- /**
- * @group legacy
- */
- public function testSetAlsoSetsScopedService()
- {
- $c = new Container();
- $c->addScope(new Scope('foo'));
- $c->enterScope('foo');
- $c->set('foo', $foo = new \stdClass(), 'foo');
-
- $scoped = $this->getField($c, 'scopedServices');
- $this->assertTrue(isset($scoped['foo']['foo']), '->set() sets a scoped service');
- $this->assertSame($foo, $scoped['foo']['foo'], '->set() sets a scoped service');
- }
-
/**
* @covers Symfony\Component\DependencyInjection\Container::get
*/
@@ -267,16 +229,6 @@ class ContainerTest extends \PHPUnit_Framework_TestCase
}
}
- /**
- * @covers Symfony\Component\DependencyInjection\Container::get
- * @group legacy
- */
- public function testGetReturnsNullOnInactiveScope()
- {
- $sc = new ProjectServiceContainer();
- $this->assertNull($sc->get('inactive', ContainerInterface::NULL_ON_INVALID_REFERENCE));
- }
-
/**
* @covers Symfony\Component\DependencyInjection\Container::has
*/
@@ -318,292 +270,6 @@ class ContainerTest extends \PHPUnit_Framework_TestCase
$this->assertNull($c->get('bar', ContainerInterface::NULL_ON_INVALID_REFERENCE));
}
- /**
- * @expectedException \Symfony\Component\DependencyInjection\Exception\LogicException
- * @expectedExceptionMessage Resetting the container is not allowed when a scope is active.
- * @group legacy
- */
- public function testCannotResetInActiveScope()
- {
- $c = new Container();
- $c->addScope(new Scope('foo'));
- $c->set('bar', new \stdClass());
-
- $c->enterScope('foo');
-
- $c->reset();
- }
-
- /**
- * @group legacy
- */
- public function testResetAfterLeavingScope()
- {
- $c = new Container();
- $c->addScope(new Scope('foo'));
- $c->set('bar', new \stdClass());
-
- $c->enterScope('foo');
- $c->leaveScope('foo');
-
- $c->reset();
-
- $this->assertNull($c->get('bar', ContainerInterface::NULL_ON_INVALID_REFERENCE));
- }
-
- /**
- * @group legacy
- */
- public function testEnterLeaveCurrentScope()
- {
- $container = new ProjectServiceContainer();
- $container->addScope(new Scope('foo'));
-
- $container->enterScope('foo');
- $scoped1 = $container->get('scoped');
- $scopedFoo1 = $container->get('scoped_foo');
-
- $container->enterScope('foo');
- $scoped2 = $container->get('scoped');
- $scoped3 = $container->get('SCOPED');
- $scopedFoo2 = $container->get('scoped_foo');
-
- $container->leaveScope('foo');
- $scoped4 = $container->get('scoped');
- $scopedFoo3 = $container->get('scoped_foo');
-
- $this->assertNotSame($scoped1, $scoped2);
- $this->assertSame($scoped2, $scoped3);
- $this->assertSame($scoped1, $scoped4);
- $this->assertNotSame($scopedFoo1, $scopedFoo2);
- $this->assertSame($scopedFoo1, $scopedFoo3);
- }
-
- /**
- * @group legacy
- */
- public function testEnterLeaveScopeWithChildScopes()
- {
- $container = new Container();
- $container->addScope(new Scope('foo'));
- $container->addScope(new Scope('bar', 'foo'));
-
- $this->assertFalse($container->isScopeActive('foo'));
-
- $container->enterScope('foo');
- $container->enterScope('bar');
-
- $this->assertTrue($container->isScopeActive('foo'));
- $this->assertFalse($container->has('a'));
-
- $a = new \stdClass();
- $container->set('a', $a, 'bar');
-
- $scoped = $this->getField($container, 'scopedServices');
- $this->assertTrue(isset($scoped['bar']['a']));
- $this->assertSame($a, $scoped['bar']['a']);
- $this->assertTrue($container->has('a'));
-
- $container->leaveScope('foo');
-
- $scoped = $this->getField($container, 'scopedServices');
- $this->assertFalse(isset($scoped['bar']));
- $this->assertFalse($container->isScopeActive('foo'));
- $this->assertFalse($container->has('a'));
- }
-
- /**
- * @group legacy
- */
- public function testEnterScopeRecursivelyWithInactiveChildScopes()
- {
- $container = new Container();
- $container->addScope(new Scope('foo'));
- $container->addScope(new Scope('bar', 'foo'));
-
- $this->assertFalse($container->isScopeActive('foo'));
-
- $container->enterScope('foo');
-
- $this->assertTrue($container->isScopeActive('foo'));
- $this->assertFalse($container->isScopeActive('bar'));
- $this->assertFalse($container->has('a'));
-
- $a = new \stdClass();
- $container->set('a', $a, 'foo');
-
- $scoped = $this->getField($container, 'scopedServices');
- $this->assertTrue(isset($scoped['foo']['a']));
- $this->assertSame($a, $scoped['foo']['a']);
- $this->assertTrue($container->has('a'));
-
- $container->enterScope('foo');
-
- $scoped = $this->getField($container, 'scopedServices');
- $this->assertFalse(isset($scoped['a']));
- $this->assertTrue($container->isScopeActive('foo'));
- $this->assertFalse($container->isScopeActive('bar'));
- $this->assertFalse($container->has('a'));
-
- $container->enterScope('bar');
-
- $this->assertTrue($container->isScopeActive('bar'));
-
- $container->leaveScope('foo');
-
- $this->assertTrue($container->isScopeActive('foo'));
- $this->assertFalse($container->isScopeActive('bar'));
- $this->assertTrue($container->has('a'));
- }
-
- /**
- * @group legacy
- */
- public function testEnterChildScopeRecursively()
- {
- $container = new Container();
- $container->addScope(new Scope('foo'));
- $container->addScope(new Scope('bar', 'foo'));
-
- $container->enterScope('foo');
- $container->enterScope('bar');
-
- $this->assertTrue($container->isScopeActive('bar'));
- $this->assertFalse($container->has('a'));
-
- $a = new \stdClass();
- $container->set('a', $a, 'bar');
-
- $scoped = $this->getField($container, 'scopedServices');
- $this->assertTrue(isset($scoped['bar']['a']));
- $this->assertSame($a, $scoped['bar']['a']);
- $this->assertTrue($container->has('a'));
-
- $container->enterScope('bar');
-
- $scoped = $this->getField($container, 'scopedServices');
- $this->assertFalse(isset($scoped['a']));
- $this->assertTrue($container->isScopeActive('foo'));
- $this->assertTrue($container->isScopeActive('bar'));
- $this->assertFalse($container->has('a'));
-
- $container->leaveScope('bar');
-
- $this->assertTrue($container->isScopeActive('foo'));
- $this->assertTrue($container->isScopeActive('bar'));
- $this->assertTrue($container->has('a'));
- }
-
- /**
- * @expectedException \InvalidArgumentException
- * @group legacy
- */
- public function testEnterScopeNotAdded()
- {
- $container = new Container();
- $container->enterScope('foo');
- }
-
- /**
- * @expectedException \RuntimeException
- * @group legacy
- */
- public function testEnterScopeDoesNotAllowInactiveParentScope()
- {
- $container = new Container();
- $container->addScope(new Scope('foo'));
- $container->addScope(new Scope('bar', 'foo'));
- $container->enterScope('bar');
- }
-
- /**
- * @group legacy
- */
- public function testLeaveScopeNotActive()
- {
- $container = new Container();
- $container->addScope(new Scope('foo'));
-
- try {
- $container->leaveScope('foo');
- $this->fail('->leaveScope() throws a \LogicException if the scope is not active yet');
- } catch (\Exception $e) {
- $this->assertInstanceOf('\LogicException', $e, '->leaveScope() throws a \LogicException if the scope is not active yet');
- $this->assertEquals('The scope "foo" is not active.', $e->getMessage(), '->leaveScope() throws a \LogicException if the scope is not active yet');
- }
-
- try {
- $container->leaveScope('bar');
- $this->fail('->leaveScope() throws a \LogicException if the scope does not exist');
- } catch (\Exception $e) {
- $this->assertInstanceOf('\LogicException', $e, '->leaveScope() throws a \LogicException if the scope does not exist');
- $this->assertEquals('The scope "bar" is not active.', $e->getMessage(), '->leaveScope() throws a \LogicException if the scope does not exist');
- }
- }
-
- /**
- * @expectedException \InvalidArgumentException
- * @dataProvider getLegacyBuiltInScopes
- * @group legacy
- */
- public function testAddScopeDoesNotAllowBuiltInScopes($scope)
- {
- $container = new Container();
- $container->addScope(new Scope($scope));
- }
-
- /**
- * @expectedException \InvalidArgumentException
- * @group legacy
- */
- public function testAddScopeDoesNotAllowExistingScope()
- {
- $container = new Container();
- $container->addScope(new Scope('foo'));
- $container->addScope(new Scope('foo'));
- }
-
- /**
- * @expectedException \InvalidArgumentException
- * @dataProvider getLegacyInvalidParentScopes
- * @group legacy
- */
- public function testAddScopeDoesNotAllowInvalidParentScope($scope)
- {
- $c = new Container();
- $c->addScope(new Scope('foo', $scope));
- }
-
- /**
- * @group legacy
- */
- public function testAddScope()
- {
- $c = new Container();
- $c->addScope(new Scope('foo'));
- $c->addScope(new Scope('bar', 'foo'));
-
- $this->assertSame(array('foo' => 'container', 'bar' => 'foo'), $this->getField($c, 'scopes'));
- $this->assertSame(array('foo' => array('bar'), 'bar' => array()), $this->getField($c, 'scopeChildren'));
-
- $c->addScope(new Scope('baz', 'bar'));
-
- $this->assertSame(array('foo' => 'container', 'bar' => 'foo', 'baz' => 'bar'), $this->getField($c, 'scopes'));
- $this->assertSame(array('foo' => array('bar', 'baz'), 'bar' => array('baz'), 'baz' => array()), $this->getField($c, 'scopeChildren'));
- }
-
- /**
- * @group legacy
- */
- public function testHasScope()
- {
- $c = new Container();
-
- $this->assertFalse($c->hasScope('foo'));
- $c->addScope(new Scope('foo'));
- $this->assertTrue($c->hasScope('foo'));
- }
-
/**
* @expectedException Exception
* @expectedExceptionMessage Something went terribly wrong!
@@ -643,41 +309,6 @@ class ContainerTest extends \PHPUnit_Framework_TestCase
$this->assertFalse($c->initialized('throws_exception_on_service_configuration'));
}
- /**
- * @group legacy
- */
- public function testIsScopeActive()
- {
- $c = new Container();
-
- $this->assertFalse($c->isScopeActive('foo'));
- $c->addScope(new Scope('foo'));
-
- $this->assertFalse($c->isScopeActive('foo'));
- $c->enterScope('foo');
-
- $this->assertTrue($c->isScopeActive('foo'));
- $c->leaveScope('foo');
-
- $this->assertFalse($c->isScopeActive('foo'));
- }
-
- public function getLegacyInvalidParentScopes()
- {
- return array(
- array(ContainerInterface::SCOPE_PROTOTYPE),
- array('bar'),
- );
- }
-
- public function getLegacyBuiltInScopes()
- {
- return array(
- array(ContainerInterface::SCOPE_CONTAINER),
- array(ContainerInterface::SCOPE_PROTOTYPE),
- );
- }
-
protected function getField($obj, $field)
{
$reflection = new \ReflectionProperty($obj, $field);
@@ -717,29 +348,6 @@ class ProjectServiceContainer extends Container
$this->aliases = array('alias' => 'bar');
}
- protected function getScopedService()
- {
- if (!$this->isScopeActive('foo')) {
- throw new \RuntimeException('Invalid call');
- }
-
- return $this->services['scoped'] = $this->scopedServices['foo']['scoped'] = new \stdClass();
- }
-
- protected function getScopedFooService()
- {
- if (!$this->isScopeActive('foo')) {
- throw new \RuntimeException('invalid call');
- }
-
- return $this->services['scoped_foo'] = $this->scopedServices['foo']['scoped_foo'] = new \stdClass();
- }
-
- protected function getInactiveService()
- {
- throw new InactiveScopeException('request', 'request');
- }
-
protected function getBarService()
{
return $this->__bar;
diff --git a/src/Symfony/Component/DependencyInjection/Tests/DefinitionTest.php b/src/Symfony/Component/DependencyInjection/Tests/DefinitionTest.php
index 6f37a87cbd..3cecb5f852 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/DefinitionTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/DefinitionTest.php
@@ -147,31 +147,6 @@ class DefinitionTest extends \PHPUnit_Framework_TestCase
$this->assertFalse($def->isShared(), '->isShared() returns false if the instance must not be shared');
}
- /**
- * @group legacy
- */
- public function testPrototypeScopedDefinitionAreNotShared()
- {
- $def = new Definition('stdClass');
- $def->setScope(ContainerInterface::SCOPE_PROTOTYPE);
-
- $this->assertFalse($def->isShared());
- $this->assertEquals(ContainerInterface::SCOPE_PROTOTYPE, $def->getScope());
- }
-
- /**
- * @covers Symfony\Component\DependencyInjection\Definition::setScope
- * @covers Symfony\Component\DependencyInjection\Definition::getScope
- * @group legacy
- */
- public function testSetGetScope()
- {
- $def = new Definition('stdClass');
- $this->assertEquals('container', $def->getScope());
- $this->assertSame($def, $def->setScope('foo'));
- $this->assertEquals('foo', $def->getScope());
- }
-
/**
* @covers Symfony\Component\DependencyInjection\Definition::setPublic
* @covers Symfony\Component\DependencyInjection\Definition::isPublic
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Dumper/GraphvizDumperTest.php b/src/Symfony/Component/DependencyInjection/Tests/Dumper/GraphvizDumperTest.php
index 8f0b998c0f..99c6c71340 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Dumper/GraphvizDumperTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Dumper/GraphvizDumperTest.php
@@ -70,14 +70,4 @@ class GraphvizDumperTest extends \PHPUnit_Framework_TestCase
$this->assertEquals(str_replace('%path%', __DIR__, file_get_contents(self::$fixturesPath.'/graphviz/services17.dot')), $dumper->dump(), '->dump() dumps services');
}
-
- /**
- * @group legacy
- */
- public function testDumpWithScopes()
- {
- $container = include self::$fixturesPath.'/containers/legacy-container18.php';
- $dumper = new GraphvizDumper($container);
- $this->assertEquals(str_replace('%path%', __DIR__, file_get_contents(self::$fixturesPath.'/graphviz/services18.dot')), $dumper->dump(), '->dump() dumps services');
- }
}
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container14.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container14.php
index 56ea6c1ed2..191afb8cdd 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container14.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container14.php
@@ -4,7 +4,7 @@ namespace Container14;
use Symfony\Component\DependencyInjection\ContainerBuilder;
-/**
+/*
* This file is included in Tests\Dumper\GraphvizDumperTest::testDumpWithFrozenCustomClassContainer
* and Tests\Dumper\XmlDumperTest::testCompiledContainerCanBeDumped.
*/
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/legacy-container18.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/legacy-container18.php
deleted file mode 100644
index 0248ed4627..0000000000
--- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/legacy-container18.php
+++ /dev/null
@@ -1,14 +0,0 @@
-addScope(new Scope('request'));
-$container->
- register('foo', 'FooClass')->
- setScope('request')
-;
-$container->compile();
-
-return $container;
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services1-1.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services1-1.php
index f15771172e..0415d702a7 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services1-1.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services1-1.php
@@ -3,7 +3,6 @@ namespace Symfony\Component\DependencyInjection\Dump;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\DependencyInjection\Container;
-use Symfony\Component\DependencyInjection\Exception\InactiveScopeException;
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
use Symfony\Component\DependencyInjection\Exception\LogicException;
use Symfony\Component\DependencyInjection\Exception\RuntimeException;
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services1.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services1.php
index 5497a7587a..e95d960fab 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services1.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services1.php
@@ -2,7 +2,6 @@
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\DependencyInjection\Container;
-use Symfony\Component\DependencyInjection\Exception\InactiveScopeException;
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
use Symfony\Component\DependencyInjection\Exception\LogicException;
use Symfony\Component\DependencyInjection\Exception\RuntimeException;
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services10.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services10.php
index b9b8d5b386..6cecc4eb18 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services10.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services10.php
@@ -2,7 +2,6 @@
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\DependencyInjection\Container;
-use Symfony\Component\DependencyInjection\Exception\InactiveScopeException;
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
use Symfony\Component\DependencyInjection\Exception\LogicException;
use Symfony\Component\DependencyInjection\Exception\RuntimeException;
@@ -26,11 +25,7 @@ class ProjectServiceContainer extends Container
{
$this->parameters = $this->getDefaultParameters();
- $this->services =
- $this->scopedServices =
- $this->scopeStacks = array();
- $this->scopes = array();
- $this->scopeChildren = array();
+ $this->services = array();
$this->methodMap = array(
'test' => 'getTestService',
);
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services12.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services12.php
index a53f3a3e81..03f9f63e24 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services12.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services12.php
@@ -2,7 +2,6 @@
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\DependencyInjection\Container;
-use Symfony\Component\DependencyInjection\Exception\InactiveScopeException;
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
use Symfony\Component\DependencyInjection\Exception\LogicException;
use Symfony\Component\DependencyInjection\Exception\RuntimeException;
@@ -30,11 +29,7 @@ class ProjectServiceContainer extends Container
}
$this->parameters = $this->getDefaultParameters();
- $this->services =
- $this->scopedServices =
- $this->scopeStacks = array();
- $this->scopes = array();
- $this->scopeChildren = array();
+ $this->services = array();
$this->methodMap = array(
'test' => 'getTestService',
);
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services19.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services19.php
index 455600da7d..cc2a18dcd1 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services19.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services19.php
@@ -2,7 +2,6 @@
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\DependencyInjection\Container;
-use Symfony\Component\DependencyInjection\Exception\InactiveScopeException;
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
use Symfony\Component\DependencyInjection\Exception\LogicException;
use Symfony\Component\DependencyInjection\Exception\RuntimeException;
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services8.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services8.php
index c2c52fe335..252a35d03b 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services8.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services8.php
@@ -2,7 +2,6 @@
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\DependencyInjection\Container;
-use Symfony\Component\DependencyInjection\Exception\InactiveScopeException;
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
use Symfony\Component\DependencyInjection\Exception\LogicException;
use Symfony\Component\DependencyInjection\Exception\RuntimeException;
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9.php
index 5977c1c6e7..205e489891 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9.php
@@ -2,7 +2,6 @@
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\DependencyInjection\Container;
-use Symfony\Component\DependencyInjection\Exception\InactiveScopeException;
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
use Symfony\Component\DependencyInjection\Exception\LogicException;
use Symfony\Component\DependencyInjection\Exception\RuntimeException;
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 8c1e71f437..c4931e9fb9 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_compiled.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_compiled.php
@@ -2,7 +2,6 @@
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\DependencyInjection\Container;
-use Symfony\Component\DependencyInjection\Exception\InactiveScopeException;
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
use Symfony\Component\DependencyInjection\Exception\LogicException;
use Symfony\Component\DependencyInjection\Exception\RuntimeException;
@@ -26,11 +25,7 @@ class ProjectServiceContainer extends Container
{
$this->parameters = $this->getDefaultParameters();
- $this->services =
- $this->scopedServices =
- $this->scopeStacks = array();
- $this->scopes = array();
- $this->scopeChildren = array();
+ $this->services = array();
$this->methodMap = array(
'bar' => 'getBarService',
'baz' => 'getBazService',
diff --git a/src/Symfony/Component/EventDispatcher/Tests/ContainerAwareEventDispatcherTest.php b/src/Symfony/Component/EventDispatcher/Tests/ContainerAwareEventDispatcherTest.php
index 145d228f3e..c015a2e88c 100644
--- a/src/Symfony/Component/EventDispatcher/Tests/ContainerAwareEventDispatcherTest.php
+++ b/src/Symfony/Component/EventDispatcher/Tests/ContainerAwareEventDispatcherTest.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\EventDispatcher\Tests;
use Symfony\Component\DependencyInjection\Container;
-use Symfony\Component\DependencyInjection\Scope;
use Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher;
use Symfony\Component\EventDispatcher\Event;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
@@ -90,72 +89,6 @@ class ContainerAwareEventDispatcherTest extends AbstractEventDispatcherTest
$dispatcher->dispatch('onEvent', $event);
}
- /**
- * @expectedException \InvalidArgumentException
- * @group legacy
- */
- public function testTriggerAListenerServiceOutOfScope()
- {
- $service = $this->getMock('Symfony\Component\EventDispatcher\Tests\Service');
-
- $scope = new Scope('scope');
- $container = new Container();
- $container->addScope($scope);
- $container->enterScope('scope');
-
- $container->set('service.listener', $service, 'scope');
-
- $dispatcher = new ContainerAwareEventDispatcher($container);
- $dispatcher->addListenerService('onEvent', array('service.listener', 'onEvent'));
-
- $container->leaveScope('scope');
- $dispatcher->dispatch('onEvent');
- }
-
- /**
- * @group legacy
- */
- public function testReEnteringAScope()
- {
- $event = new Event();
-
- $service1 = $this->getMock('Symfony\Component\EventDispatcher\Tests\Service');
-
- $service1
- ->expects($this->exactly(2))
- ->method('onEvent')
- ->with($event)
- ;
-
- $scope = new Scope('scope');
- $container = new Container();
- $container->addScope($scope);
- $container->enterScope('scope');
-
- $container->set('service.listener', $service1, 'scope');
-
- $dispatcher = new ContainerAwareEventDispatcher($container);
- $dispatcher->addListenerService('onEvent', array('service.listener', 'onEvent'));
- $dispatcher->dispatch('onEvent', $event);
-
- $service2 = $this->getMock('Symfony\Component\EventDispatcher\Tests\Service');
-
- $service2
- ->expects($this->once())
- ->method('onEvent')
- ->with($event)
- ;
-
- $container->enterScope('scope');
- $container->set('service.listener', $service2, 'scope');
-
- $dispatcher->dispatch('onEvent', $event);
-
- $container->leaveScope('scope');
-
- $dispatcher->dispatch('onEvent');
- }
-
public function testHasListenersOnLazyLoad()
{
$event = new Event();