Skip to content

Commit 9629e8d

Browse files
committed
Merge branch '3.4' into 4.1
* 3.4: fix compatibility with Twig >= 2.6.1 [Form] SA fix fix compatibility with PHPUnit 4.8 remove return type hint for PHP 5 compatibility Component CssSelector tests [DebugClassLoader] Readd findFile() method [Console] Fix composer.json suggest/provide Revert "bug #29597 [DI] fix reporting bindings on overriden services as unused (nicolas-grekas)" Fixed exception wording Fix SwiftMailerHandler to support Monolog's latest reset functionality
2 parents e73fc6d + bf7fb47 commit 9629e8d

File tree

7 files changed

+17
-69
lines changed

7 files changed

+17
-69
lines changed

Compiler/ResolveBindingsPass.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@ class ResolveBindingsPass extends AbstractRecursivePass
3434
*/
3535
public function process(ContainerBuilder $container)
3636
{
37-
$this->usedBindings = $container->getRemovedBindingIds();
38-
3937
try {
4038
parent::process($container);
4139

ContainerBuilder.php

Lines changed: 7 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,6 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
122122

123123
private $removedIds = array();
124124

125-
private $removedBindingIds = array();
126-
127125
private static $internalTypes = array(
128126
'int' => true,
129127
'float' => true,
@@ -500,8 +498,7 @@ public function set($id, $service)
500498
throw new BadMethodCallException(sprintf('Setting service "%s" for an unknown or non-synthetic service definition on a compiled container is not allowed.', $id));
501499
}
502500

503-
$this->removeId($id);
504-
unset($this->removedIds[$id]);
501+
unset($this->definitions[$id], $this->aliasDefinitions[$id], $this->removedIds[$id]);
505502

506503
parent::set($id, $service);
507504
}
@@ -514,7 +511,8 @@ public function set($id, $service)
514511
public function removeDefinition($id)
515512
{
516513
if (isset($this->definitions[$id = (string) $id])) {
517-
$this->removeId($id);
514+
unset($this->definitions[$id]);
515+
$this->removedIds[$id] = true;
518516
}
519517
}
520518

@@ -836,8 +834,7 @@ public function setAlias($alias, $id)
836834
throw new InvalidArgumentException(sprintf('An alias can not reference itself, got a circular reference on "%s".', $alias));
837835
}
838836

839-
$this->removeId($alias);
840-
unset($this->removedIds[$alias]);
837+
unset($this->definitions[$alias], $this->removedIds[$alias]);
841838

842839
return $this->aliasDefinitions[$alias] = $id;
843840
}
@@ -850,7 +847,8 @@ public function setAlias($alias, $id)
850847
public function removeAlias($alias)
851848
{
852849
if (isset($this->aliasDefinitions[$alias = (string) $alias])) {
853-
$this->removeId($alias);
850+
unset($this->aliasDefinitions[$alias]);
851+
$this->removedIds[$alias] = true;
854852
}
855853
}
856854

@@ -979,8 +977,7 @@ public function setDefinition($id, Definition $definition)
979977

980978
$id = (string) $id;
981979

982-
$this->removeId($id);
983-
unset($this->removedIds[$id]);
980+
unset($this->aliasDefinitions[$id], $this->removedIds[$id]);
984981

985982
return $this->definitions[$id] = $definition;
986983
}
@@ -1482,18 +1479,6 @@ public static function getInitializedConditionals($value)
14821479
return $services;
14831480
}
14841481

1485-
/**
1486-
* Gets removed binding ids.
1487-
*
1488-
* @return array
1489-
*
1490-
* @internal
1491-
*/
1492-
public function getRemovedBindingIds()
1493-
{
1494-
return $this->removedBindingIds;
1495-
}
1496-
14971482
/**
14981483
* Computes a reasonably unique hash of a value.
14991484
*
@@ -1598,21 +1583,4 @@ private function inVendors($path)
15981583

15991584
return false;
16001585
}
1601-
1602-
private function removeId($id)
1603-
{
1604-
$this->removedIds[$id] = true;
1605-
unset($this->aliasDefinitions[$id]);
1606-
1607-
if (!isset($this->definitions[$id])) {
1608-
return;
1609-
}
1610-
1611-
foreach ($this->definitions[$id]->getBindings() as $binding) {
1612-
list(, $identifier) = $binding->getValues();
1613-
$this->removedBindingIds[$identifier] = true;
1614-
}
1615-
1616-
unset($this->definitions[$id]);
1617-
}
16181586
}

Tests/Compiler/ResolveBindingsPassTest.php

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -111,22 +111,4 @@ public function testScalarSetter()
111111

112112
$this->assertEquals(array(array('setDefaultLocale', array('fr'))), $definition->getMethodCalls());
113113
}
114-
115-
public function testOverriddenBindings()
116-
{
117-
$container = new ContainerBuilder();
118-
119-
$binding = new BoundArgument('bar');
120-
121-
$container->register('foo', 'stdClass')
122-
->setBindings(array('$foo' => clone $binding));
123-
$container->register('bar', 'stdClass')
124-
->setBindings(array('$foo' => clone $binding));
125-
126-
$container->register('foo', 'stdClass');
127-
128-
(new ResolveBindingsPass())->process($container);
129-
130-
$this->assertInstanceOf('stdClass', $container->get('foo'));
131-
}
132114
}

Tests/Compiler/ResolveChildDefinitionsPassTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ protected function process(ContainerBuilder $container)
399399

400400
/**
401401
* @expectedException \Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException
402-
* @expectedExceptionMessageRegExp /^Circular reference detected for service "a", path: "a -> c -> b -> a"./
402+
* @expectedExceptionMessageRegExp /^Circular reference detected for service "c", path: "c -> b -> a -> c"./
403403
*/
404404
public function testProcessDetectsChildDefinitionIndirectCircularReference()
405405
{

Tests/ContainerBuilderTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -559,7 +559,7 @@ public function testMerge()
559559
$config->setDefinition('baz', new Definition('BazClass'));
560560
$config->setAlias('alias_for_foo', 'foo');
561561
$container->merge($config);
562-
$this->assertEquals(array('foo', 'bar', 'service_container', 'baz'), array_keys($container->getDefinitions()), '->merge() merges definitions already defined ones');
562+
$this->assertEquals(array('service_container', 'foo', 'bar', 'baz'), array_keys($container->getDefinitions()), '->merge() merges definitions already defined ones');
563563

564564
$aliases = $container->getAliases();
565565
$this->assertArrayHasKey('alias_for_foo', $aliases);

Tests/Fixtures/config/instanceof.expected.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@ services:
44
class: Symfony\Component\DependencyInjection\ContainerInterface
55
public: true
66
synthetic: true
7-
foo:
8-
class: App\FooService
9-
public: true
107
Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\Foo:
118
class: Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\Foo
129
public: true
@@ -19,3 +16,6 @@ services:
1916

2017
shared: false
2118
configurator: c
19+
foo:
20+
class: App\FooService
21+
public: true

Tests/Fixtures/config/prototype.expected.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,22 @@ services:
44
class: Symfony\Component\DependencyInjection\ContainerInterface
55
public: true
66
synthetic: true
7-
Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\Sub\Bar:
8-
class: Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\Sub\Bar
7+
Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\Foo:
8+
class: Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\Foo
99
public: true
1010
tags:
1111
- { name: foo }
1212
- { name: baz }
1313
deprecated: '%service_id%'
14-
lazy: true
1514
arguments: [1]
1615
factory: f
17-
Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\Foo:
18-
class: Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\Foo
16+
Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\Sub\Bar:
17+
class: Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\Sub\Bar
1918
public: true
2019
tags:
2120
- { name: foo }
2221
- { name: baz }
2322
deprecated: '%service_id%'
23+
lazy: true
2424
arguments: [1]
2525
factory: f

0 commit comments

Comments
 (0)