From f15d179fbd447b50d646aad2ba18885730058ebe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aar=C3=B3n=20Nieves=20Fern=C3=A1ndez?= Date: Tue, 29 Sep 2015 18:57:23 +0200 Subject: [PATCH 1/2] The 'config' variable is already used as an array expression less... --- src/Symfony/Component/Routing/Loader/YamlFileLoader.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Symfony/Component/Routing/Loader/YamlFileLoader.php b/src/Symfony/Component/Routing/Loader/YamlFileLoader.php index 32c3bde18d..c069385da3 100644 --- a/src/Symfony/Component/Routing/Loader/YamlFileLoader.php +++ b/src/Symfony/Component/Routing/Loader/YamlFileLoader.php @@ -58,7 +58,7 @@ class YamlFileLoader extends FileLoader } try { - $config = $this->yamlParser->parse(file_get_contents($path)); + $parsedConfig = $this->yamlParser->parse(file_get_contents($path)); } catch (ParseException $e) { throw new \InvalidArgumentException(sprintf('The file "%s" does not contain valid YAML.', $path), 0, $e); } @@ -67,16 +67,16 @@ class YamlFileLoader extends FileLoader $collection->addResource(new FileResource($path)); // empty file - if (null === $config) { + if (null === $parsedConfig) { return $collection; } // not an array - if (!is_array($config)) { + if (!is_array($parsedConfig)) { throw new \InvalidArgumentException(sprintf('The file "%s" must contain a YAML array.', $path)); } - foreach ($config as $name => $config) { + foreach ($parsedConfig as $name => $config) { if (isset($config['pattern'])) { if (isset($config['path'])) { throw new \InvalidArgumentException(sprintf('The file "%s" cannot define both a "path" and a "pattern" attribute. Use only "path".', $path)); From d94dd1679a2410d59b7bea4c847544a55c92bcc6 Mon Sep 17 00:00:00 2001 From: Tobias Schultze Date: Thu, 1 Oct 2015 16:53:49 +0200 Subject: [PATCH 2/2] [TwigBundle] fix useless and failing test --- .../Controller/ExceptionControllerTest.php | 44 ------------------- 1 file changed, 44 deletions(-) delete mode 100644 src/Symfony/Bundle/TwigBundle/Tests/Controller/ExceptionControllerTest.php diff --git a/src/Symfony/Bundle/TwigBundle/Tests/Controller/ExceptionControllerTest.php b/src/Symfony/Bundle/TwigBundle/Tests/Controller/ExceptionControllerTest.php deleted file mode 100644 index 20646f74aa..0000000000 --- a/src/Symfony/Bundle/TwigBundle/Tests/Controller/ExceptionControllerTest.php +++ /dev/null @@ -1,44 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Bundle\TwigBundle\Tests\Controller; - -use Symfony\Bundle\TwigBundle\Tests\TestCase; -use Symfony\Bundle\TwigBundle\Controller\ExceptionController; -use Symfony\Component\HttpFoundation\Request; - -class ExceptionControllerTest extends TestCase -{ - public function testOnlyClearOwnOutputBuffers() - { - $flatten = $this->getMock('Symfony\Component\Debug\Exception\FlattenException'); - $flatten - ->expects($this->once()) - ->method('getStatusCode') - ->will($this->returnValue(404)); - $twig = $this->getMockBuilder('\Twig_Environment') - ->disableOriginalConstructor() - ->getMock(); - $twig - ->expects($this->any()) - ->method('render') - ->will($this->returnValue($this->getMock('Symfony\Component\HttpFoundation\Response'))); - $twig - ->expects($this->any()) - ->method('getLoader') - ->will($this->returnValue($this->getMock('\Twig_LoaderInterface'))); - $request = Request::create('/'); - $request->headers->set('X-Php-Ob-Level', 1); - - $controller = new ExceptionController($twig, false); - $controller->showAction($request, $flatten); - } -}