diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/routing.xml b/src/Symfony/Bundle/FrameworkBundle/Resources/config/routing.xml index 22aa26e2fb..62d77e0ca3 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/routing.xml +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/routing.xml @@ -56,9 +56,7 @@ - - diff --git a/src/Symfony/Bundle/FrameworkBundle/Routing/DelegatingLoader.php b/src/Symfony/Bundle/FrameworkBundle/Routing/DelegatingLoader.php index b37bee83d4..962de9125b 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Routing/DelegatingLoader.php +++ b/src/Symfony/Bundle/FrameworkBundle/Routing/DelegatingLoader.php @@ -34,14 +34,21 @@ class DelegatingLoader extends BaseDelegatingLoader /** * Constructor. * + * Ability to pass a LoggerInterface instance as second argument will be removed in 3.0. + * * @param ControllerNameParser $parser A ControllerNameParser instance - * @param LoggerInterface $logger A LoggerInterface instance * @param LoaderResolverInterface $resolver A LoaderResolverInterface instance */ - public function __construct(ControllerNameParser $parser, LoggerInterface $logger = null, LoaderResolverInterface $resolver) + public function __construct(ControllerNameParser $parser, $resolver, $r = null) { $this->parser = $parser; - $this->logger = $logger; + + if (!$resolver instanceof LoaderResolverInterface) { + $this->logger = $resolver; + $resolver = $r; + + @trigger_error('Passing a LoggerInterface instance a second argument of the '.__METHOD__.' method is deprecated since version 2.8 and will not be supported anymore in 3.0.', E_USER_DEPRECATED); + } parent::__construct($resolver); } diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Routing/DelegatingLoaderTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Routing/DelegatingLoaderTest.php new file mode 100644 index 0000000000..e446efcd89 --- /dev/null +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Routing/DelegatingLoaderTest.php @@ -0,0 +1,45 @@ +controllerNameParser = $this->getMockBuilder('Symfony\Bundle\FrameworkBundle\Controller\ControllerNameParser') + ->disableOriginalConstructor() + ->getMock(); + } + + /** + * @group legacy + */ + public function testLegacyConstructorApi() + { + new DelegatingLoader($this->controllerNameParser, new NullLogger(), new LoaderResolver()); + $this->assertTrue(true, '__construct() accepts a LoggerInterface instance as its second argument'); + } + + /** + * @group legacy + */ + public function testLegacyConstructorApiAcceptsNullAsSecondArgument() + { + new DelegatingLoader($this->controllerNameParser, null, new LoaderResolver()); + $this->assertTrue(true, '__construct() accepts null as its second argument'); + } + + public function testConstructorApi() + { + new DelegatingLoader($this->controllerNameParser, new LoaderResolver()); + $this->assertTrue(true, '__construct() takes a ControllerNameParser and LoaderResolverInterface respectively as its first and second argument.'); + } +}