8000 do not stumble upon empty tags · symfony/symfony@da0cc73 · GitHub
[go: up one dir, main page]

Skip to content

Commit da0cc73

Browse files
committed
do not stumble upon empty tags
1 parent e18a42a commit da0cc73

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/UnusedTagsPassTest.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
namespace Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\Compiler;
1313

1414
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\UnusedTagsPass;
15+
use Symfony\Component\DependencyInjection\ContainerBuilder;
16+
use Symfony\Component\DependencyInjection\Definition;
1517

1618
class UnusedTagsPassTest extends \PHPUnit_Framework_TestCase
1719
{
@@ -49,4 +51,15 @@ public function testProcess()
4951

5052
$pass->process($container);
5153
}
54+
55+
public function testEmptyTagNameIsIgnored()
56+
{
57+
$pass = new UnusedTagsPass();
58+
$container = new ContainerBuilder();
59+
60+
$definition = $container->register('foo');
61+
$definition->addTag('', array('bar' => 'baz'));
62+
63+
$pass->process($container);
64+
}
5265
}

src/Symfony/Component/DependencyInjection/ContainerBuilder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1040,7 +1040,7 @@ public function findTags()
10401040
*/
10411041
public function findUnusedTags()
10421042
{
1043-
return array_values(array_diff($this->findTags(), $this->usedTags));
1043+
return array_filter(array_values(array_diff($this->findTags(), $this->usedTags)));
10441044
}
10451045

10461046
public function addExpressionLanguageProvider(ExpressionFunctionProviderInterface $provider)

0 commit comments

Comments
 (0)
0