Commit 06d5555f authored by Fabien Potencier's avatar Fabien Potencier

fixed CS

parent 1cee7aa8
...@@ -4,7 +4,7 @@ require_once __DIR__.'/../vendor/autoload.php'; ...@@ -4,7 +4,7 @@ require_once __DIR__.'/../vendor/autoload.php';
$app = new Silex\Application(); $app = new Silex\Application();
$app->get('/hello', function() { $app->get('/hello', function () {
return 'Hello!'; return 'Hello!';
}); });
......
...@@ -31,11 +31,11 @@ trait SecurityTrait ...@@ -31,11 +31,11 @@ trait SecurityTrait
public function user() public function user()
{ {
if (null === $token = $this['security']->getToken()) { if (null === $token = $this['security']->getToken()) {
return null; return;
} }
if (!is_object($user = $token->getUser())) { if (!is_object($user = $token->getUser())) {
return null; return;
} }
return $user; return $user;
......
...@@ -16,7 +16,6 @@ use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface; ...@@ -16,7 +16,6 @@ use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface;
use Symfony\Component\HttpKernel\KernelEvents; use Symfony\Component\HttpKernel\KernelEvents;
use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent; use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent;
use Symfony\Component\HttpKernel\Event\GetResponseForControllerResultEvent; use Symfony\Component\HttpKernel\Event\GetResponseForControllerResultEvent;
use Silex\Application;
/** /**
* Wraps exception listeners. * Wraps exception listeners.
......
...@@ -148,7 +148,7 @@ class SecurityServiceProvider implements ServiceProviderInterface ...@@ -148,7 +148,7 @@ class SecurityServiceProvider implements ServiceProviderInterface
'security.authentication_provider.'.$name.'.'.$provider, 'security.authentication_provider.'.$name.'.'.$provider,
'security.authentication_listener.'.$name.'.'.$type, 'security.authentication_listener.'.$name.'.'.$type,
$entryPoint ? 'security.entry_point.'.$name.'.'.$entryPoint : null, $entryPoint ? 'security.entry_point.'.$name.'.'.$entryPoint : null,
$type $type,
); );
}); });
} }
......
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
namespace Silex\Tests\Application; namespace Silex\Tests\Application;
use Silex\Application;
use Silex\Provider\FormServiceProvider; use Silex\Provider\FormServiceProvider;
/** /**
......
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
namespace Silex\Tests\Application; namespace Silex\Tests\Application;
use Silex\Application;
use Silex\Provider\MonologServiceProvider; use Silex\Provider\MonologServiceProvider;
use Monolog\Handler\TestHandler; use Monolog\Handler\TestHandler;
use Monolog\Logger; use Monolog\Logger;
......
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
namespace Silex\Tests\Application; namespace Silex\Tests\Application;
use Silex\Application;
use Silex\Provider\SecurityServiceProvider; use Silex\Provider\SecurityServiceProvider;
use Symfony\Component\Security\Core\User\User; use Symfony\Component\Security\Core\User\User;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
......
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
namespace Silex\Tests\Application; namespace Silex\Tests\Application;
use Silex\Application;
use Silex\Provider\SwiftmailerServiceProvider; use Silex\Provider\SwiftmailerServiceProvider;
/** /**
......
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
namespace Silex\Tests\Application; namespace Silex\Tests\Application;
use Silex\Application;
use Silex\Provider\TranslationServiceProvider; use Silex\Provider\TranslationServiceProvider;
/** /**
......
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
namespace Silex\Tests\Application; namespace Silex\Tests\Application;
use Silex\Application;
use Silex\Provider\TwigServiceProvider; use Silex\Provider\TwigServiceProvider;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\StreamedResponse; use Symfony\Component\HttpFoundation\StreamedResponse;
......
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
namespace Silex\Tests\Application; namespace Silex\Tests\Application;
use Silex\Application;
use Silex\Provider\UrlGeneratorServiceProvider; use Silex\Provider\UrlGeneratorServiceProvider;
/** /**
......
...@@ -23,7 +23,7 @@ class CallbackResolverTest extends \PHPUnit_Framework_Testcase ...@@ -23,7 +23,7 @@ class CallbackResolverTest extends \PHPUnit_Framework_Testcase
public function testShouldResolveCallback() public function testShouldResolveCallback()
{ {
$this->app['some_service'] = function() { return new \stdClass(); }; $this->app['some_service'] = function () { return new \stdClass(); };
$this->assertTrue($this->resolver->isValid('some_service:methodName')); $this->assertTrue($this->resolver->isValid('some_service:methodName'));
$this->assertEquals( $this->assertEquals(
......
...@@ -168,9 +168,9 @@ class MiddlewareTest extends \PHPUnit_Framework_TestCase ...@@ -168,9 +168,9 @@ class MiddlewareTest extends \PHPUnit_Framework_TestCase
$app->before(function () { return new Response('app before'); }); $app->before(function () { return new Response('app before'); });
$app->get('/', function() { $app->get('/', function () {
return new Response('test'); return new Response('test');
})->before(function() { })->before(function () {
return new Response('middleware before'); return new Response('middleware before');
}); });
...@@ -247,14 +247,14 @@ class MiddlewareTest extends \PHPUnit_Framework_TestCase ...@@ -247,14 +247,14 @@ class MiddlewareTest extends \PHPUnit_Framework_TestCase
$middlewareTarget[] = 'application_before_middleware_triggered'; $middlewareTarget[] = 'application_before_middleware_triggered';
}; };
$applicationAfterMiddleware = function ($request, $response, $app) use (&$middlewareTarget, $test){ $applicationAfterMiddleware = function ($request, $response, $app) use (&$middlewareTarget, $test) {
$test->assertInstanceOf('\Symfony\Component\HttpFoundation\Request', $request); $test->assertInstanceOf('\Symfony\Component\HttpFoundation\Request', $request);
$test->assertInstanceOf('\Symfony\Component\HttpFoundation\Response', $response); $test->assertInstanceOf('\Symfony\Component\HttpFoundation\Response', $response);
$test->assertInstanceOf('\Silex\Application', $app); $test->assertInstanceOf('\Silex\Application', $app);
$middlewareTarget[] = 'application_after_middleware_triggered'; $middlewareTarget[] = 'application_after_middleware_triggered';
}; };
$applicationFinishMiddleware = function ($request, $response, $app) use (&$middlewareTarget, $test){ $applicationFinishMiddleware = function ($request, $response, $app) use (&$middlewareTarget, $test) {
$test->assertInstanceOf('\Symfony\Component\HttpFoundation\Request', $request); $test->assertInstanceOf('\Symfony\Component\HttpFoundation\Request', $request);
$test->assertInstanceOf('\Symfony\Component\HttpFoundation\Response', $response); $test->assertInstanceOf('\Symfony\Component\HttpFoundation\Response', $response);
$test->assertInstanceOf('\Silex\Application', $app); $test->assertInstanceOf('\Silex\Application', $app);
...@@ -267,7 +267,7 @@ class MiddlewareTest extends \PHPUnit_Framework_TestCase ...@@ -267,7 +267,7 @@ class MiddlewareTest extends \PHPUnit_Framework_TestCase
$middlewareTarget[] = 'route_before_middleware_triggered'; $middlewareTarget[] = 'route_before_middleware_triggered';
}; };
$routeAfterMiddleware = function ($request, $response, $app) use (&$middlewareTarget, $test){ $routeAfterMiddleware = function ($request, $response, $app) use (&$middlewareTarget, $test) {
$test->assertInstanceOf('\Symfony\Component\HttpFoundation\Request', $request); $test->assertInstanceOf('\Symfony\Component\HttpFoundation\Request', $request);
$test->assertInstanceOf('\Symfony\Component\HttpFoundation\Response', $response); $test->assertInstanceOf('\Symfony\Component\HttpFoundation\Response', $response);
$test->assertInstanceOf('\Silex\Application', $app); $test->assertInstanceOf('\Silex\Application', $app);
...@@ -290,4 +290,4 @@ class MiddlewareTest extends \PHPUnit_Framework_TestCase ...@@ -290,4 +290,4 @@ class MiddlewareTest extends \PHPUnit_Framework_TestCase
$this->assertSame(array('application_before_middleware_triggered', 'route_before_middleware_triggered', 'route_after_middleware_triggered', 'application_after_middleware_triggered', 'application_finish_middleware_triggered'), $middlewareTarget); $this->assertSame(array('application_before_middleware_triggered', 'route_before_middleware_triggered', 'route_after_middleware_triggered', 'application_after_middleware_triggered', 'application_finish_middleware_triggered'), $middlewareTarget);
} }
} }
\ No newline at end of file
...@@ -91,7 +91,7 @@ class FormServiceProviderTest extends \PHPUnit_Framework_TestCase ...@@ -91,7 +91,7 @@ class FormServiceProviderTest extends \PHPUnit_Framework_TestCase
$app->register(new TranslationServiceProvider()); $app->register(new TranslationServiceProvider());
$app['translator.domains'] = array( $app['translator.domains'] = array(
'messages' => array( 'messages' => array(
'de' => array ( 'de' => array(
'The CSRF token is invalid. Please try to resubmit the form.' => 'German translation', 'The CSRF token is invalid. Please try to resubmit the form.' => 'German translation',
), ),
), ),
......
...@@ -131,7 +131,7 @@ class SecurityServiceProviderTest extends WebTestCase ...@@ -131,7 +131,7 @@ class SecurityServiceProviderTest extends WebTestCase
'http' => true, 'http' => true,
'users' => array( 'users' => array(
'admin' => array('ROLE_ADMIN', '513aeb0121909'), 'admin' => array('ROLE_ADMIN', '513aeb0121909'),
) ),
), ),
), ),
)); ));
...@@ -217,13 +217,13 @@ class SecurityServiceProviderTest extends WebTestCase ...@@ -217,13 +217,13 @@ class SecurityServiceProviderTest extends WebTestCase
), ),
)); ));
$app->get('/login', function(Request $request) use ($app) { $app->get('/login', function (Request $request) use ($app) {
$app['session']->start(); $app['session']->start();
return $app['security.last_error']($request); return $app['security.last_error']($request);
}); });
$app->get('/', function() use ($app) { $app->get('/', function () use ($app) {
$user = $app['security']->getToken()->getUser(); $user = $app['security']->getToken()->getUser();
$content = is_object($user) ? $user->getUsername() : 'ANONYMOUS'; $content = is_object($user) ? $user->getUsername() : 'ANONYMOUS';
...@@ -239,7 +239,7 @@ class SecurityServiceProviderTest extends WebTestCase ...@@ -239,7 +239,7 @@ class SecurityServiceProviderTest extends WebTestCase
return $content; return $content;
}); });
$app->get('/admin', function() use ($app) { $app->get('/admin', function () use ($app) {
return 'admin'; return 'admin';
}); });
...@@ -268,7 +268,7 @@ class SecurityServiceProviderTest extends WebTestCase ...@@ -268,7 +268,7 @@ class SecurityServiceProviderTest extends WebTestCase
), ),
)); ));
$app->get('/', function() use ($app) { $app->get('/', function () use ($app) {
$user = $app['security']->getToken()->getUser(); $user = $app['security']->getToken()->getUser();
$content = is_object($user) ? $user->getUsername() : 'ANONYMOUS'; $content = is_object($user) ? $user->getUsername() : 'ANONYMOUS';
...@@ -284,7 +284,7 @@ class SecurityServiceProviderTest extends WebTestCase ...@@ -284,7 +284,7 @@ class SecurityServiceProviderTest extends WebTestCase
return $content; return $content;
}); });
$app->get('/admin', function() use ($app) { $app->get('/admin', function () use ($app) {
return 'admin'; return 'admin';
}); });
......
...@@ -38,7 +38,7 @@ class SwiftmailerServiceProviderTest extends \PHPUnit_Framework_TestCase ...@@ -38,7 +38,7 @@ class SwiftmailerServiceProviderTest extends \PHPUnit_Framework_TestCase
return new SpoolStub(); return new SpoolStub();
}); });
$app->get('/', function() use ($app) { $app->get('/', function () use ($app) {
$app['mailer']->send(\Swift_Message::newInstance()); $app['mailer']->send(\Swift_Message::newInstance());
}); });
...@@ -64,7 +64,7 @@ class SwiftmailerServiceProviderTest extends \PHPUnit_Framework_TestCase ...@@ -64,7 +64,7 @@ class SwiftmailerServiceProviderTest extends \PHPUnit_Framework_TestCase
return new SpoolStub(); return new SpoolStub();
}); });
$app->get('/', function() use ($app) { }); $app->get('/', function () use ($app) { });
$request = Request::create('/'); $request = Request::create('/');
$response = $app->handle($request); $response = $app->handle($request);
......
...@@ -31,22 +31,22 @@ class TranslationServiceProviderTest extends \PHPUnit_Framework_TestCase ...@@ -31,22 +31,22 @@ class TranslationServiceProviderTest extends \PHPUnit_Framework_TestCase
$app->register(new TranslationServiceProvider()); $app->register(new TranslationServiceProvider());
$app['translator.domains'] = array( $app['translator.domains'] = array(
'messages' => array( 'messages' => array(
'en' => array ( 'en' => array(
'key1' => 'The translation', 'key1' => 'The translation',
'key_only_english' => 'Foo', 'key_only_english' => 'Foo',
'key2' => 'One apple|%count% apples', 'key2' => 'One apple|%count% apples',
'test' => array( 'test' => array(
'key' => 'It works' 'key' => 'It works',
) ),
), ),
'de' => array ( 'de' => array(
'key1' => 'The german translation', 'key1' => 'The german translation',
'key2' => 'One german apple|%count% german apples', 'key2' => 'One german apple|%count% german apples',
'test' => array( 'test' => array(
'key' => 'It works in german' 'key' => 'It works in german',
) ),
) ),
) ),
); );
return $app; return $app;
......
...@@ -38,14 +38,14 @@ class ValidatorServiceProviderTest extends \PHPUnit_Framework_TestCase ...@@ -38,14 +38,14 @@ class ValidatorServiceProviderTest extends \PHPUnit_Framework_TestCase
{ {
$app = new Application(); $app = new Application();
$app['custom.validator'] = $app->share(function() { $app['custom.validator'] = $app->share(function () {
return new CustomValidator(); return new CustomValidator();
}); });
$app->register(new ValidatorServiceProvider(), array( $app->register(new ValidatorServiceProvider(), array(
'validator.validator_service_ids' => array( 'validator.validator_service_ids' => array(
'test.custom.validator' => 'custom.validator', 'test.custom.validator' => 'custom.validator',
) ),
)); ));
return $app; return $app;
...@@ -112,5 +112,4 @@ class ValidatorServiceProviderTest extends \PHPUnit_Framework_TestCase ...@@ -112,5 +112,4 @@ class ValidatorServiceProviderTest extends \PHPUnit_Framework_TestCase
array('email@sample.com', true, 0, 0), array('email@sample.com', true, 0, 0),
); );
} }
} }
...@@ -45,7 +45,7 @@ class ServiceControllerResolverTest extends \PHPUnit_Framework_Testcase ...@@ -45,7 +45,7 @@ class ServiceControllerResolverTest extends \PHPUnit_Framework_Testcase
->with('some_service:methodName') ->with('some_service:methodName')
->will($this->returnValue(array('callback'))); ->will($this->returnValue(array('callback')));
$this->app['some_service'] = function() { return new \stdClass(); }; $this->app['some_service'] = function () { return new \stdClass(); };
$req = Request::create('/'); $req = Request::create('/');
$req->attributes->set('_controller', 'some_service:methodName'); $req->attributes->set('_controller', 'some_service:methodName');
...@@ -79,6 +79,6 @@ class ServiceControllerResolverTest extends \PHPUnit_Framework_Testcase ...@@ -79,6 +79,6 @@ class ServiceControllerResolverTest extends \PHPUnit_Framework_Testcase
->with($req) ->with($req)
->will($this->returnValue(123)); ->will($this->returnValue(123));
$this->assertEquals(123, $this->resolver->getArguments($req, function() {})); $this->assertEquals(123, $this->resolver->getArguments($req, function () {}));
} }
} }
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