Commit 481b21eb authored by Fabien Potencier's avatar Fabien Potencier

merged branch catchamonkey/coding_standards (PR #351)

Commits
-------

c6b63758 Some CS fixes in line with the Symfony2 standards

Discussion
----------

Fixes a few small CS issues

* public/static ordering
* whitespace
* missing public declarations
parents e448d255 c6b63758
...@@ -605,7 +605,7 @@ class Application extends \Pimple implements HttpKernelInterface, EventSubscribe ...@@ -605,7 +605,7 @@ class Application extends \Pimple implements HttpKernelInterface, EventSubscribe
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
static public function getSubscribedEvents() public static function getSubscribedEvents()
{ {
return array( return array(
KernelEvents::REQUEST => array( KernelEvents::REQUEST => array(
......
...@@ -25,5 +25,5 @@ interface ControllerProviderInterface ...@@ -25,5 +25,5 @@ interface ControllerProviderInterface
* *
* @return ControllerCollection A ControllerCollection instance * @return ControllerCollection A ControllerCollection instance
*/ */
function connect(Application $app); public function connect(Application $app);
} }
...@@ -32,7 +32,7 @@ class ExceptionHandler implements EventSubscriberInterface ...@@ -32,7 +32,7 @@ class ExceptionHandler implements EventSubscriberInterface
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
static public function getSubscribedEvents() public static function getSubscribedEvents()
{ {
return array(SilexEvents::ERROR => array('onSilexError', -255)); return array(SilexEvents::ERROR => array('onSilexError', -255));
} }
......
...@@ -26,7 +26,7 @@ interface ServiceProviderInterface ...@@ -26,7 +26,7 @@ interface ServiceProviderInterface
* *
* @param Application $app An Application instance * @param Application $app An Application instance
*/ */
function register(Application $app); public function register(Application $app);
/** /**
* Bootstraps the application. * Bootstraps the application.
...@@ -35,5 +35,5 @@ interface ServiceProviderInterface ...@@ -35,5 +35,5 @@ interface ServiceProviderInterface
* and should be used for "dynamic" configuration (whenever * and should be used for "dynamic" configuration (whenever
* a service must be requested). * a service must be requested).
*/ */
function boot(Application $app); public function boot(Application $app);
} }
...@@ -160,7 +160,7 @@ EOF; ...@@ -160,7 +160,7 @@ EOF;
* *
* @return string The PHP string with the whitespace removed * @return string The PHP string with the whitespace removed
*/ */
static public function stripWhitespace($source) public static function stripWhitespace($source)
{ {
if (!function_exists('token_get_all')) { if (!function_exists('token_get_all')) {
return $source; return $source;
......
...@@ -43,7 +43,7 @@ abstract class WebTestCase extends \PHPUnit_Framework_TestCase ...@@ -43,7 +43,7 @@ abstract class WebTestCase extends \PHPUnit_Framework_TestCase
/** /**
* Creates a Client. * Creates a Client.
* *
* @param array $server An array of server parameters * @param array $server An array of server parameters
* *
* @return Client A Client instance * @return Client A Client instance
*/ */
......
...@@ -273,6 +273,7 @@ class ErrorHandlerTest extends \PHPUnit_Framework_TestCase ...@@ -273,6 +273,7 @@ class ErrorHandlerTest extends \PHPUnit_Framework_TestCase
// Since we throw a standard Exception above only // Since we throw a standard Exception above only
// the second error handler should fire // the second error handler should fire
$app->error(function (\LogicException $e) { // Extends \Exception $app->error(function (\LogicException $e) { // Extends \Exception
return "Caught LogicException"; return "Caught LogicException";
}); });
$app->error(function (\Exception $e) { $app->error(function (\Exception $e) {
...@@ -298,6 +299,7 @@ class ErrorHandlerTest extends \PHPUnit_Framework_TestCase ...@@ -298,6 +299,7 @@ class ErrorHandlerTest extends \PHPUnit_Framework_TestCase
// Since we throw a LogicException above // Since we throw a LogicException above
// the first error handler should fire // the first error handler should fire
$app->error(function (\LogicException $e) { // Extends \Exception $app->error(function (\LogicException $e) { // Extends \Exception
return "Caught LogicException"; return "Caught LogicException";
}); });
$app->error(function (\Exception $e) { $app->error(function (\Exception $e) {
...@@ -328,6 +330,7 @@ class ErrorHandlerTest extends \PHPUnit_Framework_TestCase ...@@ -328,6 +330,7 @@ class ErrorHandlerTest extends \PHPUnit_Framework_TestCase
return "Caught Exception"; return "Caught Exception";
}); });
$app->error(function (\LogicException $e) { // Extends \Exception $app->error(function (\LogicException $e) { // Extends \Exception
return "Caught LogicException"; return "Caught LogicException";
}); });
......
...@@ -13,7 +13,6 @@ namespace Silex\Tests; ...@@ -13,7 +13,6 @@ namespace Silex\Tests;
use Silex\Application; use Silex\Application;
/** /**
* JSON test cases. * JSON test cases.
* *
......
...@@ -146,7 +146,8 @@ class RouterTest extends \PHPUnit_Framework_TestCase ...@@ -146,7 +146,8 @@ class RouterTest extends \PHPUnit_Framework_TestCase
$this->checkRouteResponse($app, '/resource', 'delete resource', 'delete'); $this->checkRouteResponse($app, '/resource', 'delete resource', 'delete');
} }
public function testRequestShouldBeStoredRegardlessOfRouting() { public function testRequestShouldBeStoredRegardlessOfRouting()
{
$app = new Application(); $app = new Application();
$app->get('/foo', function () use ($app) { $app->get('/foo', function () use ($app) {
...@@ -240,7 +241,7 @@ class MyController ...@@ -240,7 +241,7 @@ class MyController
return 'foo'; return 'foo';
} }
static public function getBar() public static function getBar()
{ {
return 'bar'; return 'bar';
} }
......
...@@ -36,6 +36,7 @@ class WebTestCaseTest extends WebTestCase ...@@ -36,6 +36,7 @@ class WebTestCaseTest extends WebTestCase
$app->match('/server', function () use ($app) { $app->match('/server', function () use ($app) {
$user = $app['request']->server->get('PHP_AUTH_USER'); $user = $app['request']->server->get('PHP_AUTH_USER');
$pass = $app['request']->server->get('PHP_AUTH_PW'); $pass = $app['request']->server->get('PHP_AUTH_PW');
return "<h1>$user:$pass</h1>"; return "<h1>$user:$pass</h1>";
}); });
......
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