From 05b223817e82d221ef6334e767a01fa01a55fa86 Mon Sep 17 00:00:00 2001 From: Joseph Bielawski Date: Sat, 14 Apr 2012 12:56:35 +0200 Subject: [PATCH] [DependencyInjection] Fix for issue introduced in 3ae826a --- .../Component/DependencyInjection/Loader/YamlFileLoader.php | 5 +++-- .../DependencyInjection/Loader/YamlFileLoaderTest.php | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php b/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php index 8433d53cde..7f770fa0f8 100644 --- a/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php +++ b/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php @@ -16,6 +16,7 @@ use Symfony\Component\DependencyInjection\Alias; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\Definition; use Symfony\Component\DependencyInjection\Reference; +use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; use Symfony\Component\Config\Resource\FileResource; use Symfony\Component\Yaml\Yaml; @@ -205,12 +206,12 @@ class YamlFileLoader extends FileLoader if (isset($service['tags'])) { if (!is_array($service['tags'])) { - throw new \InvalidArgumentException(sprintf('Parameter "tags" must be an array for service "%s" in %s.', $id, $file)); + throw new InvalidArgumentException(sprintf('Parameter "tags" must be an array for service "%s" in %s.', $id, $file)); } foreach ($service['tags'] as $tag) { if (!isset($tag['name'])) { - throw new \InvalidArgumentException(sprintf('A "tags" entry is missing a "name" key for service "%s" in %s.', $id, $file)); + throw new InvalidArgumentException(sprintf('A "tags" entry is missing a "name" key for service "%s" in %s.', $id, $file)); } $name = $tag['name']; diff --git a/tests/Symfony/Tests/Component/DependencyInjection/Loader/YamlFileLoaderTest.php b/tests/Symfony/Tests/Component/DependencyInjection/Loader/YamlFileLoaderTest.php index 2d952c655e..bd84b3f5ca 100644 --- a/tests/Symfony/Tests/Component/DependencyInjection/Loader/YamlFileLoaderTest.php +++ b/tests/Symfony/Tests/Component/DependencyInjection/Loader/YamlFileLoaderTest.php @@ -169,7 +169,7 @@ class YamlFileLoaderTest extends \PHPUnit_Framework_TestCase $loader->load('badtag1.yml'); $this->fail('->load() should throw an exception when the tags key of a service is not an array'); } catch (\Exception $e) { - $this->assertInstanceOf('\InvalidArgumentException', $e, '->load() throws an InvalidArgumentException if the tags key is not an array'); + $this->assertInstanceOf('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException', $e, '->load() throws an InvalidArgumentException if the tags key is not an array'); $this->assertStringStartsWith('Parameter "tags" must be an array for service', $e->getMessage(), '->load() throws an InvalidArgumentException if the tags key is not an array'); } } @@ -181,7 +181,7 @@ class YamlFileLoaderTest extends \PHPUnit_Framework_TestCase $loader->load('badtag2.yml'); $this->fail('->load() should throw an exception when a tag is missing the name key'); } catch (\Exception $e) { - $this->assertInstanceOf('\InvalidArgumentException', $e, '->load() throws an InvalidArgumentException if a tag is missing the name key'); + $this->assertInstanceOf('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException', $e, '->load() throws an InvalidArgumentException if a tag is missing the name key'); $this->assertStringStartsWith('A "tags" entry is missing a "name" key for service ', $e->getMessage(), '->load() throws an InvalidArgumentException if a tag is missing the name key'); } }