Commit 03a326b3 authored by Fabien Potencier's avatar Fabien Potencier

minor #823 [RFR] various clean ups (cordoval)

This PR was squashed before being merged into the master branch (closes #823).

Discussion
----------

[RFR] various clean ups

- [x] fixing typos and typehinting checkroute method
- [x] remove unused use statements
- [x] make consistent test use statement without line break separation

Commits
-------

727f5b7a [RFR] various clean ups
parents 9f45ef24 727f5b7a
...@@ -13,7 +13,6 @@ namespace Silex; ...@@ -13,7 +13,6 @@ namespace Silex;
use Symfony\Component\Routing\RouteCollection; use Symfony\Component\Routing\RouteCollection;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Silex\Controller;
/** /**
* Builds Silex controllers. * Builds Silex controllers.
......
...@@ -30,7 +30,8 @@ class ConverterListener implements EventSubscriberInterface ...@@ -30,7 +30,8 @@ class ConverterListener implements EventSubscriberInterface
/** /**
* Constructor. * Constructor.
* *
* @param RouteCollection $routes A RouteCollection instance * @param RouteCollection $routes A RouteCollection instance
* @param CallbackResolver $callbackResolver A CallbackResolver instance
*/ */
public function __construct(RouteCollection $routes, CallbackResolver $callbackResolver) public function __construct(RouteCollection $routes, CallbackResolver $callbackResolver)
{ {
......
...@@ -13,7 +13,6 @@ namespace Silex\Provider; ...@@ -13,7 +13,6 @@ namespace Silex\Provider;
use Silex\Application; use Silex\Application;
use Silex\ServiceProviderInterface; use Silex\ServiceProviderInterface;
use Symfony\Component\HttpKernel\Fragment\FragmentHandler; use Symfony\Component\HttpKernel\Fragment\FragmentHandler;
use Symfony\Component\HttpKernel\Fragment\InlineFragmentRenderer; use Symfony\Component\HttpKernel\Fragment\InlineFragmentRenderer;
use Symfony\Component\HttpKernel\Fragment\EsiFragmentRenderer; use Symfony\Component\HttpKernel\Fragment\EsiFragmentRenderer;
......
...@@ -13,7 +13,6 @@ namespace Silex\Provider; ...@@ -13,7 +13,6 @@ namespace Silex\Provider;
use Silex\Application; use Silex\Application;
use Silex\ServiceProviderInterface; use Silex\ServiceProviderInterface;
use Symfony\Component\Security\Core\Authentication\Provider\RememberMeAuthenticationProvider; use Symfony\Component\Security\Core\Authentication\Provider\RememberMeAuthenticationProvider;
use Symfony\Component\Security\Http\Firewall\RememberMeListener; use Symfony\Component\Security\Http\Firewall\RememberMeListener;
use Symfony\Component\Security\Http\RememberMe\TokenBasedRememberMeServices; use Symfony\Component\Security\Http\RememberMe\TokenBasedRememberMeServices;
......
...@@ -13,7 +13,6 @@ namespace Silex\Provider; ...@@ -13,7 +13,6 @@ namespace Silex\Provider;
use Silex\Application; use Silex\Application;
use Silex\ServiceProviderInterface; use Silex\ServiceProviderInterface;
use Symfony\Component\HttpFoundation\RequestMatcher; use Symfony\Component\HttpFoundation\RequestMatcher;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Security\Core\SecurityContext; use Symfony\Component\Security\Core\SecurityContext;
......
...@@ -13,7 +13,6 @@ namespace Silex\Provider; ...@@ -13,7 +13,6 @@ namespace Silex\Provider;
use Silex\Application; use Silex\Application;
use Silex\ServiceProviderInterface; use Silex\ServiceProviderInterface;
use Symfony\Component\HttpFoundation\Session\Storage\Handler\NativeFileSessionHandler; use Symfony\Component\HttpFoundation\Session\Storage\Handler\NativeFileSessionHandler;
use Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage; use Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage;
use Symfony\Component\HttpFoundation\Session\Storage\MockFileSessionStorage; use Symfony\Component\HttpFoundation\Session\Storage\MockFileSessionStorage;
......
...@@ -13,7 +13,6 @@ namespace Silex\Provider; ...@@ -13,7 +13,6 @@ namespace Silex\Provider;
use Silex\Application; use Silex\Application;
use Silex\ServiceProviderInterface; use Silex\ServiceProviderInterface;
use Symfony\Component\Translation\Translator; use Symfony\Component\Translation\Translator;
use Symfony\Component\Translation\MessageSelector; use Symfony\Component\Translation\MessageSelector;
use Symfony\Component\Translation\Loader\ArrayLoader; use Symfony\Component\Translation\Loader\ArrayLoader;
......
...@@ -13,7 +13,6 @@ namespace Silex\Provider; ...@@ -13,7 +13,6 @@ namespace Silex\Provider;
use Silex\Application; use Silex\Application;
use Silex\ServiceProviderInterface; use Silex\ServiceProviderInterface;
use Symfony\Bridge\Twig\Extension\RoutingExtension; use Symfony\Bridge\Twig\Extension\RoutingExtension;
use Symfony\Bridge\Twig\Extension\TranslationExtension; use Symfony\Bridge\Twig\Extension\TranslationExtension;
use Symfony\Bridge\Twig\Extension\FormExtension; use Symfony\Bridge\Twig\Extension\FormExtension;
......
...@@ -13,7 +13,6 @@ namespace Silex\Provider; ...@@ -13,7 +13,6 @@ namespace Silex\Provider;
use Silex\Application; use Silex\Application;
use Silex\ServiceProviderInterface; use Silex\ServiceProviderInterface;
use Symfony\Component\Routing\Generator\UrlGenerator; use Symfony\Component\Routing\Generator\UrlGenerator;
/** /**
......
...@@ -14,7 +14,6 @@ namespace Silex\Provider; ...@@ -14,7 +14,6 @@ namespace Silex\Provider;
use Silex\Application; use Silex\Application;
use Silex\ServiceProviderInterface; use Silex\ServiceProviderInterface;
use Silex\ConstraintValidatorFactory; use Silex\ConstraintValidatorFactory;
use Symfony\Component\Validator\Validator; use Symfony\Component\Validator\Validator;
use Symfony\Component\Validator\DefaultTranslator; use Symfony\Component\Validator\DefaultTranslator;
use Symfony\Component\Validator\Mapping\ClassMetadataFactory; use Symfony\Component\Validator\Mapping\ClassMetadataFactory;
......
...@@ -13,7 +13,6 @@ namespace Silex; ...@@ -13,7 +13,6 @@ namespace Silex;
use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\Routing\Matcher\RedirectableUrlMatcher as BaseRedirectableUrlMatcher; use Symfony\Component\Routing\Matcher\RedirectableUrlMatcher as BaseRedirectableUrlMatcher;
use Symfony\Component\Routing\Matcher\RedirectableUrlMatcherInterface;
/** /**
* Implements the RedirectableUrlMatcherInterface for Silex. * Implements the RedirectableUrlMatcherInterface for Silex.
......
...@@ -15,7 +15,6 @@ use Silex\Application; ...@@ -15,7 +15,6 @@ use Silex\Application;
use Silex\ControllerCollection; use Silex\ControllerCollection;
use Silex\Route; use Silex\Route;
use Silex\Provider\MonologServiceProvider; use Silex\Provider\MonologServiceProvider;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Exception\HttpException; use Symfony\Component\HttpKernel\Exception\HttpException;
use Symfony\Component\Debug\ErrorHandler; use Symfony\Component\Debug\ErrorHandler;
......
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
namespace Silex\Tests; namespace Silex\Tests;
use Silex\Application; use Silex\Application;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
......
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
namespace Silex\Tests; namespace Silex\Tests;
use Silex\Application; use Silex\Application;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
class LazyDispatcherTest extends \PHPUnit_Framework_TestCase class LazyDispatcherTest extends \PHPUnit_Framework_TestCase
......
...@@ -85,7 +85,7 @@ class LazyUrlMatcherTest extends \PHPUnit_Framework_TestCase ...@@ -85,7 +85,7 @@ class LazyUrlMatcherTest extends \PHPUnit_Framework_TestCase
$matcher = new LazyUrlMatcher(function () use ($urlMatcher) { $matcher = new LazyUrlMatcher(function () use ($urlMatcher) {
return $urlMatcher; return $urlMatcher;
}); });
$result = $matcher->setContext($context); $matcher->setContext($context);
} }
/** /**
......
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
namespace Silex\Tests; namespace Silex\Tests;
use Silex\Application; use Silex\Application;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
......
...@@ -13,7 +13,6 @@ namespace Silex\Tests\Provider; ...@@ -13,7 +13,6 @@ namespace Silex\Tests\Provider;
use Silex\Application; use Silex\Application;
use Silex\Provider\FormServiceProvider; use Silex\Provider\FormServiceProvider;
use Symfony\Component\Form\AbstractTypeExtension; use Symfony\Component\Form\AbstractTypeExtension;
use Symfony\Component\Form\FormTypeGuesserChain; use Symfony\Component\Form\FormTypeGuesserChain;
use Symfony\Component\OptionsResolver\OptionsResolverInterface; use Symfony\Component\OptionsResolver\OptionsResolverInterface;
......
...@@ -13,7 +13,6 @@ namespace Silex\Tests\Provider; ...@@ -13,7 +13,6 @@ namespace Silex\Tests\Provider;
use Silex\Application; use Silex\Application;
use Silex\Provider\HttpCacheServiceProvider; use Silex\Provider\HttpCacheServiceProvider;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
......
...@@ -17,7 +17,6 @@ use Silex\Provider\RememberMeServiceProvider; ...@@ -17,7 +17,6 @@ use Silex\Provider\RememberMeServiceProvider;
use Silex\Provider\SecurityServiceProvider; use Silex\Provider\SecurityServiceProvider;
use Silex\Provider\SessionServiceProvider; use Silex\Provider\SessionServiceProvider;
use Symfony\Component\HttpKernel\Client; use Symfony\Component\HttpKernel\Client;
use Symfony\Component\HttpFoundation\Request;
/** /**
* SecurityServiceProvider * SecurityServiceProvider
......
...@@ -13,9 +13,7 @@ namespace Silex\Tests\Provider; ...@@ -13,9 +13,7 @@ namespace Silex\Tests\Provider;
use Silex\Application; use Silex\Application;
use Silex\Provider\SwiftmailerServiceProvider; use Silex\Provider\SwiftmailerServiceProvider;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
class SwiftmailerServiceProviderTest extends \PHPUnit_Framework_TestCase class SwiftmailerServiceProviderTest extends \PHPUnit_Framework_TestCase
{ {
......
...@@ -14,8 +14,6 @@ namespace Silex\Tests\Provider; ...@@ -14,8 +14,6 @@ namespace Silex\Tests\Provider;
use Silex\Application; use Silex\Application;
use Silex\Provider\TranslationServiceProvider; use Silex\Provider\TranslationServiceProvider;
use Symfony\Component\HttpFoundation\Request;
/** /**
* TranslationProvider test cases. * TranslationProvider test cases.
* *
......
...@@ -13,7 +13,6 @@ namespace Silex\Tests\Provider; ...@@ -13,7 +13,6 @@ namespace Silex\Tests\Provider;
use Silex\Application; use Silex\Application;
use Silex\Provider\TwigServiceProvider; use Silex\Provider\TwigServiceProvider;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
/** /**
......
...@@ -13,7 +13,6 @@ namespace Silex\Tests\Provider; ...@@ -13,7 +13,6 @@ namespace Silex\Tests\Provider;
use Silex\Application; use Silex\Application;
use Silex\Provider\UrlGeneratorServiceProvider; use Silex\Provider\UrlGeneratorServiceProvider;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
/** /**
......
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
namespace Silex\Tests; namespace Silex\Tests;
use Silex\Application; use Silex\Application;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\RedirectResponse;
...@@ -180,10 +179,6 @@ class RouterTest extends \PHPUnit_Framework_TestCase ...@@ -180,10 +179,6 @@ class RouterTest extends \PHPUnit_Framework_TestCase
public function testHostSpecification() public function testHostSpecification()
{ {
if (!method_exists('Symfony\Component\Routing\Route', 'setHost')) {
$this->markTestSkipped('host() is only supported in the Symfony Routing 2.2+');
}
$route = new \Silex\Route(); $route = new \Silex\Route();
$this->assertSame($route, $route->host('{locale}.example.com')); $this->assertSame($route, $route->host('{locale}.example.com'));
...@@ -250,7 +245,7 @@ class RouterTest extends \PHPUnit_Framework_TestCase ...@@ -250,7 +245,7 @@ class RouterTest extends \PHPUnit_Framework_TestCase
$this->checkRouteResponse($app, '/bar', 'bar'); $this->checkRouteResponse($app, '/bar', 'bar');
} }
protected function checkRouteResponse($app, $path, $expectedContent, $method = 'get', $message = null) protected function checkRouteResponse(Application $app, $path, $expectedContent, $method = 'get', $message = null)
{ {
$request = Request::create($path, $method); $request = Request::create($path, $method);
$response = $app->handle($request); $response = $app->handle($request);
......
...@@ -33,7 +33,7 @@ class ServiceControllerResolverRouterTest extends RouterTest ...@@ -33,7 +33,7 @@ class ServiceControllerResolverRouterTest extends RouterTest
$this->checkRouteResponse($app, '/bar', 'bar'); $this->checkRouteResponse($app, '/bar', 'bar');
} }
protected function checkRouteResponse($app, $path, $expectedContent, $method = 'get', $message = null) protected function checkRouteResponse(Application $app, $path, $expectedContent, $method = 'get', $message = null)
{ {
$app->register(new ServiceControllerServiceProvider()); $app->register(new ServiceControllerServiceProvider());
......
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
namespace Silex\Tests; namespace Silex\Tests;
use Silex\Application; use Silex\Application;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment