This commit is contained in:
Fabien Potencier 2012-05-20 18:15:10 +02:00
parent cf11cc067f
commit 26b489f499
23 changed files with 48 additions and 96 deletions

View File

@ -48,8 +48,7 @@ class DoctrineOrmTypeGuesser implements FormTypeGuesserInterface
return new TypeGuess('entity', array('em' => $name, 'class' => $mapping['targetEntity'], 'multiple' => $multiple), Guess::HIGH_CONFIDENCE); return new TypeGuess('entity', array('em' => $name, 'class' => $mapping['targetEntity'], 'multiple' => $multiple), Guess::HIGH_CONFIDENCE);
} }
switch ($metadata->getTypeOfField($property)) switch ($metadata->getTypeOfField($property)) {
{
//case 'array': //case 'array':
// return new TypeGuess('Collection', array(), Guess::HIGH_CONFIDENCE); // return new TypeGuess('Collection', array(), Guess::HIGH_CONFIDENCE);
case 'boolean': case 'boolean':

View File

@ -177,8 +177,7 @@ class Configuration implements ConfigurationInterface
private function addTemplatingSection(ArrayNodeDefinition $rootNode) private function addTemplatingSection(ArrayNodeDefinition $rootNode)
{ {
$organizeUrls = function($urls) $organizeUrls = function($urls) {
{
$urls += array( $urls += array(
'http' => array(), 'http' => array(),
'ssl' => array(), 'ssl' => array(),

View File

@ -48,8 +48,7 @@ class HttpKernelTest extends \PHPUnit_Framework_TestCase
$resolver = $this->getMock('Symfony\\Component\\HttpKernel\\Controller\\ControllerResolverInterface'); $resolver = $this->getMock('Symfony\\Component\\HttpKernel\\Controller\\ControllerResolverInterface');
$kernel = new HttpKernel($dispatcher, $container, $resolver); $kernel = new HttpKernel($dispatcher, $container, $resolver);
$controller = function() use($expected) $controller = function() use($expected) {
{
return $expected; return $expected;
}; };
@ -96,8 +95,7 @@ class HttpKernelTest extends \PHPUnit_Framework_TestCase
$resolver = $this->getMock('Symfony\\Component\\HttpKernel\\Controller\\ControllerResolverInterface'); $resolver = $this->getMock('Symfony\\Component\\HttpKernel\\Controller\\ControllerResolverInterface');
$kernel = new HttpKernel($dispatcher, $container, $resolver); $kernel = new HttpKernel($dispatcher, $container, $resolver);
$controller = function() use ($expected) $controller = function() use ($expected) {
{
throw $expected; throw $expected;
}; };

View File

@ -154,8 +154,7 @@ class Tokenizer
*/ */
private function unescapeStringLiteral($literal) private function unescapeStringLiteral($literal)
{ {
return preg_replace_callback('#(\\\\(?:[A-Fa-f0-9]{1,6}(?:\r\n|\s)?|[^A-Fa-f0-9]))#', function ($matches) use ($literal) return preg_replace_callback('#(\\\\(?:[A-Fa-f0-9]{1,6}(?:\r\n|\s)?|[^A-Fa-f0-9]))#', function ($matches) use ($literal) {
{
if ($matches[0][0] == '\\' && strlen($matches[0]) > 1) { if ($matches[0][0] == '\\' && strlen($matches[0]) > 1) {
$matches[0] = substr($matches[0], 1); $matches[0] = substr($matches[0], 1);
if (in_array($matches[0][0], array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'a', 'b', 'c', 'd', 'e', 'f'))) { if (in_array($matches[0][0], array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'a', 'b', 'c', 'd', 'e', 'f'))) {

View File

@ -1034,8 +1034,7 @@ EOF;
return $this->dumpParameter(strtolower($match[1])); return $this->dumpParameter(strtolower($match[1]));
} else { } else {
$that = $this; $that = $this;
$replaceParameters = function ($match) use ($that) $replaceParameters = function ($match) use ($that) {
{
return "'.".$that->dumpParameter(strtolower($match[2])).".'"; return "'.".$that->dumpParameter(strtolower($match[2])).".'";
}; };

View File

@ -46,8 +46,7 @@ class CsrfType extends AbstractType
$csrfProvider = $options['csrf_provider']; $csrfProvider = $options['csrf_provider'];
$intention = $options['intention']; $intention = $options['intention'];
$validator = function (FormInterface $form) use ($csrfProvider, $intention) $validator = function (FormInterface $form) use ($csrfProvider, $intention) {
{
if ((!$form->hasParent() || $form->getParent()->isRoot()) if ((!$form->hasParent() || $form->getParent()->isRoot())
&& !$csrfProvider->isCsrfTokenValid($intention, $form->getData())) { && !$csrfProvider->isCsrfTokenValid($intention, $form->getData())) {
$form->addError(new FormError('The CSRF token is invalid. Please try to resubmit the form')); $form->addError(new FormError('The CSRF token is invalid. Please try to resubmit the form'));

View File

@ -168,8 +168,7 @@ class DelegatingValidator implements FormValidatorInterface
if ($child->hasChildren() || isset($parts[1])) { if ($child->hasChildren() || isset($parts[1])) {
$nestedFormPath = $formPath.'['.trim($parts[0], '[]').']'; $nestedFormPath = $formPath.'['.trim($parts[0], '[]').']';
} } else {
else {
$nestedFormPath = $formPath.'.data.'.$parts[0]; $nestedFormPath = $formPath.'.data.'.$parts[0];
} }

View File

@ -441,8 +441,7 @@ foreach ($bundle->get('Currencies') as $code => $data) {
} }
// Countries. // Countries.
$countriesConstraint = function($code) $countriesConstraint = function($code) {
{
// Global countries (f.i. "America") have numeric codes // Global countries (f.i. "America") have numeric codes
// Countries have alphabetic codes // Countries have alphabetic codes
// "ZZ" is the code for unknown country // "ZZ" is the code for unknown country
@ -456,8 +455,7 @@ $countriesConstraint = function($code)
$countries = get_data('Countries', 'region', $defaultLocale, $countriesConstraint); $countries = get_data('Countries', 'region', $defaultLocale, $countriesConstraint);
// Languages // Languages
$languagesConstraint = function($code) $languagesConstraint = function($code) {
{
// "mul" is the code for multiple languages // "mul" is the code for multiple languages
if ('mul' !== $code) { if ('mul' !== $code) {
return true; return true;

View File

@ -91,8 +91,7 @@ class Process
$this->stdout = ''; $this->stdout = '';
$this->stderr = ''; $this->stderr = '';
$that = $this; $that = $this;
$callback = function ($type, $data) use ($that, $callback) $callback = function ($type, $data) use ($that, $callback) {
{
if ('out' == $type) { if ('out' == $type) {
$that->addOutput($data); $that->addOutput($data);
} else { } else {

View File

@ -441,8 +441,7 @@ class PhpEngine implements EngineInterface, \ArrayAccess
* *
* @return string the escaped value * @return string the escaped value
*/ */
function ($value) use ($that) function ($value) use ($that) {
{
// Numbers and Boolean values get turned into strings which can cause problems // Numbers and Boolean values get turned into strings which can cause problems
// with type comparisons (e.g. === or is_int() etc). // with type comparisons (e.g. === or is_int() etc).
return is_string($value) ? htmlspecialchars($value, ENT_QUOTES, $that->getCharset(), false) : $value; return is_string($value) ? htmlspecialchars($value, ENT_QUOTES, $that->getCharset(), false) : $value;
@ -456,14 +455,12 @@ class PhpEngine implements EngineInterface, \ArrayAccess
* @param string $value the value to escape * @param string $value the value to escape
* @return string the escaped value * @return string the escaped value
*/ */
function ($value) use ($that) function ($value) use ($that) {
{
if ('UTF-8' != $that->getCharset()) { if ('UTF-8' != $that->getCharset()) {
$value = $that->convertEncoding($value, 'UTF-8', $that->getCharset()); $value = $that->convertEncoding($value, 'UTF-8', $that->getCharset());
} }
$callback = function ($matches) use ($that) $callback = function ($matches) use ($that) {
{
$char = $matches[0]; $char = $matches[0];
// \xHH // \xHH

View File

@ -31,8 +31,7 @@ class ArrayNodeTest extends \PHPUnit_Framework_TestCase
{ {
$node = new ArrayNode('root'); $node = new ArrayNode('root');
try try {
{
$node->normalize(array('foo' => 'bar')); $node->normalize(array('foo' => 'bar'));
$this->fail('An exception should have been throw for a bad child node'); $this->fail('An exception should have been throw for a bad child node');
} catch (\Exception $e) { } catch (\Exception $e) {

View File

@ -216,8 +216,7 @@ class CommandTest extends \PHPUnit_Framework_TestCase
public function testSetCode() public function testSetCode()
{ {
$command = new \TestCommand(); $command = new \TestCommand();
$ret = $command->setCode(function (InputInterface $input, OutputInterface $output) $ret = $command->setCode(function (InputInterface $input, OutputInterface $output) {
{
$output->writeln('from the code...'); $output->writeln('from the code...');
}); });
$this->assertEquals($command, $ret, '->setCode() implements a fluent interface'); $this->assertEquals($command, $ret, '->setCode() implements a fluent interface');

View File

@ -34,8 +34,7 @@ class ClosureLoaderTest extends \PHPUnit_Framework_TestCase
{ {
$loader = new ClosureLoader($container = new ContainerBuilder()); $loader = new ClosureLoader($container = new ContainerBuilder());
$loader->load(function ($container) $loader->load(function ($container) {
{
$container->setParameter('foo', 'foo'); $container->setParameter('foo', 'foo');
}); });

View File

@ -177,8 +177,7 @@ class CrawlerTest extends \PHPUnit_Framework_TestCase
public function testEach() public function testEach()
{ {
$data = $this->createTestCrawler()->filter('ul.first li')->each(function ($node, $i) $data = $this->createTestCrawler()->filter('ul.first li')->each(function ($node, $i) {
{
return $i.'-'.$node->nodeValue; return $i.'-'.$node->nodeValue;
}); });
@ -188,8 +187,7 @@ class CrawlerTest extends \PHPUnit_Framework_TestCase
public function testReduce() public function testReduce()
{ {
$crawler = $this->createTestCrawler()->filter('ul.first li'); $crawler = $this->createTestCrawler()->filter('ul.first li');
$nodes = $crawler->reduce(function ($node, $i) $nodes = $crawler->reduce(function ($node, $i) {
{
return $i == 1 ? false : true; return $i == 1 ? false : true;
}); });
$this->assertNotSame($nodes, $crawler, '->reduce() returns a new instance of a crawler'); $this->assertNotSame($nodes, $crawler, '->reduce() returns a new instance of a crawler');

View File

@ -48,12 +48,10 @@ class CheckboxTypeTest extends TypeTestCase
{ {
// present a binary status field as a checkbox // present a binary status field as a checkbox
$transformer = new CallbackTransformer( $transformer = new CallbackTransformer(
function ($value) function ($value) {
{
return 'expedited' == $value; return 'expedited' == $value;
}, },
function ($value) function ($value) {
{
return $value ? 'expedited' : 'standard'; return $value ? 'expedited' : 'standard';
} }
); );

View File

@ -334,8 +334,7 @@ class ResponseTest extends \PHPUnit_Framework_TestCase
public function testIsRedirectRedirection() public function testIsRedirectRedirection()
{ {
foreach (array(301, 302, 303, 307) as $code) foreach (array(301, 302, 303, 307) as $code) {
{
$response = new Response('', $code); $response = new Response('', $code);
$this->assertTrue($response->isRedirection()); $this->assertTrue($response->isRedirection());
$this->assertTrue($response->isRedirect()); $this->assertTrue($response->isRedirect());
@ -369,8 +368,7 @@ class ResponseTest extends \PHPUnit_Framework_TestCase
public function testIsEmpty() public function testIsEmpty()
{ {
foreach (array(201, 204, 304) as $code) foreach (array(201, 204, 304) as $code) {
{
$response = new Response('', $code); $response = new Response('', $code);
$this->assertTrue($response->isEmpty()); $this->assertTrue($response->isEmpty());
} }

View File

@ -124,8 +124,7 @@ class HttpCacheTest extends HttpCacheTestCase
{ {
$time = new \DateTime(); $time = new \DateTime();
$this->setNextResponse(200, array(), '', function ($request, $response) use ($time) $this->setNextResponse(200, array(), '', function ($request, $response) use ($time) {
{
$response->setStatusCode(200); $response->setStatusCode(200);
$response->headers->set('ETag', '12345'); $response->headers->set('ETag', '12345');
$response->headers->set('Last-Modified', $time->format(DATE_RFC2822)); $response->headers->set('Last-Modified', $time->format(DATE_RFC2822));
@ -152,8 +151,7 @@ class HttpCacheTest extends HttpCacheTestCase
public function testValidatesPrivateResponsesCachedOnTheClient() public function testValidatesPrivateResponsesCachedOnTheClient()
{ {
$this->setNextResponse(200, array(), '', function ($request, $response) $this->setNextResponse(200, array(), '', function ($request, $response) {
{
$etags = preg_split('/\s*,\s*/', $request->headers->get('IF_NONE_MATCH')); $etags = preg_split('/\s*,\s*/', $request->headers->get('IF_NONE_MATCH'));
if ($request->cookies->has('authenticated')) { if ($request->cookies->has('authenticated')) {
$response->headers->set('Cache-Control', 'private, no-store'); $response->headers->set('Cache-Control', 'private, no-store');
@ -212,8 +210,7 @@ class HttpCacheTest extends HttpCacheTestCase
{ {
$count = 0; $count = 0;
$this->setNextResponse(200, array('Cache-Control' => 'public, max-age=10000'), '', function ($request, $response) use (&$count) $this->setNextResponse(200, array('Cache-Control' => 'public, max-age=10000'), '', function ($request, $response) use (&$count) {
{
++$count; ++$count;
$response->setContent(1 == $count ? 'Hello World' : 'Goodbye World'); $response->setContent(1 == $count ? 'Hello World' : 'Goodbye World');
}); });
@ -240,8 +237,7 @@ class HttpCacheTest extends HttpCacheTestCase
{ {
$count = 0; $count = 0;
$this->setNextResponse(200, array('Cache-Control' => 'public, max-age=10000'), '', function ($request, $response) use (&$count) $this->setNextResponse(200, array('Cache-Control' => 'public, max-age=10000'), '', function ($request, $response) use (&$count) {
{
++$count; ++$count;
$response->setContent(1 == $count ? 'Hello World' : 'Goodbye World'); $response->setContent(1 == $count ? 'Hello World' : 'Goodbye World');
}); });
@ -272,8 +268,7 @@ class HttpCacheTest extends HttpCacheTestCase
{ {
$count = 0; $count = 0;
$this->setNextResponse(200, array(), '', function ($request, $response) use (&$count) $this->setNextResponse(200, array(), '', function ($request, $response) use (&$count) {
{
++$count; ++$count;
$response->headers->set('Cache-Control', 'public, max-age=10000'); $response->headers->set('Cache-Control', 'public, max-age=10000');
$response->setETag($count); $response->setETag($count);
@ -303,8 +298,7 @@ class HttpCacheTest extends HttpCacheTestCase
{ {
$count = 0; $count = 0;
$this->setNextResponse(200, array(), '', function ($request, $response) use (&$count) $this->setNextResponse(200, array(), '', function ($request, $response) use (&$count) {
{
++$count; ++$count;
$response->headers->set('Cache-Control', 'public, max-age=10000'); $response->headers->set('Cache-Control', 'public, max-age=10000');
$response->setETag($count); $response->setETag($count);
@ -613,8 +607,7 @@ class HttpCacheTest extends HttpCacheTestCase
public function testValidatesCachedResponsesWithLastModifiedAndNoFreshnessInformation() public function testValidatesCachedResponsesWithLastModifiedAndNoFreshnessInformation()
{ {
$time = \DateTime::createFromFormat('U', time()); $time = \DateTime::createFromFormat('U', time());
$this->setNextResponse(200, array(), 'Hello World', function ($request, $response) use ($time) $this->setNextResponse(200, array(), 'Hello World', function ($request, $response) use ($time) {
{
$response->headers->set('Cache-Control', 'public'); $response->headers->set('Cache-Control', 'public');
$response->headers->set('Last-Modified', $time->format(DATE_RFC2822)); $response->headers->set('Last-Modified', $time->format(DATE_RFC2822));
if ($time->format(DATE_RFC2822) == $request->headers->get('IF_MODIFIED_SINCE')) { if ($time->format(DATE_RFC2822) == $request->headers->get('IF_MODIFIED_SINCE')) {
@ -650,8 +643,7 @@ class HttpCacheTest extends HttpCacheTestCase
public function testValidatesCachedResponsesWithETagAndNoFreshnessInformation() public function testValidatesCachedResponsesWithETagAndNoFreshnessInformation()
{ {
$this->setNextResponse(200, array(), 'Hello World', function ($request, $response) $this->setNextResponse(200, array(), 'Hello World', function ($request, $response) {
{
$response->headers->set('Cache-Control', 'public'); $response->headers->set('Cache-Control', 'public');
$response->headers->set('ETag', '"12345"'); $response->headers->set('ETag', '"12345"');
if ($response->getETag() == $request->headers->get('IF_NONE_MATCH')) { if ($response->getETag() == $request->headers->get('IF_NONE_MATCH')) {
@ -688,8 +680,7 @@ class HttpCacheTest extends HttpCacheTestCase
{ {
$time = \DateTime::createFromFormat('U', time()); $time = \DateTime::createFromFormat('U', time());
$count = 0; $count = 0;
$this->setNextResponse(200, array(), 'Hello World', function ($request, $response) use ($time, &$count) $this->setNextResponse(200, array(), 'Hello World', function ($request, $response) use ($time, &$count) {
{
$response->headers->set('Last-Modified', $time->format(DATE_RFC2822)); $response->headers->set('Last-Modified', $time->format(DATE_RFC2822));
$response->headers->set('Cache-Control', 'public'); $response->headers->set('Cache-Control', 'public');
switch (++$count) { switch (++$count) {
@ -727,8 +718,7 @@ class HttpCacheTest extends HttpCacheTestCase
public function testPassesHeadRequestsThroughDirectlyOnPass() public function testPassesHeadRequestsThroughDirectlyOnPass()
{ {
$that = $this; $that = $this;
$this->setNextResponse(200, array(), 'Hello World', function ($request, $response) use ($that) $this->setNextResponse(200, array(), 'Hello World', function ($request, $response) use ($that) {
{
$response->setContent(''); $response->setContent('');
$response->setStatusCode(200); $response->setStatusCode(200);
$that->assertEquals('HEAD', $request->getMethod()); $that->assertEquals('HEAD', $request->getMethod());
@ -742,8 +732,7 @@ class HttpCacheTest extends HttpCacheTestCase
public function testUsesCacheToRespondToHeadRequestsWhenFresh() public function testUsesCacheToRespondToHeadRequestsWhenFresh()
{ {
$that = $this; $that = $this;
$this->setNextResponse(200, array(), 'Hello World', function ($request, $response) use ($that) $this->setNextResponse(200, array(), 'Hello World', function ($request, $response) use ($that) {
{
$response->headers->set('Cache-Control', 'public, max-age=10'); $response->headers->set('Cache-Control', 'public, max-age=10');
$response->setContent('Hello World'); $response->setContent('Hello World');
$response->setStatusCode(200); $response->setStatusCode(200);
@ -765,8 +754,7 @@ class HttpCacheTest extends HttpCacheTestCase
{ {
$time = \DateTime::createFromFormat('U', time()); $time = \DateTime::createFromFormat('U', time());
$that = $this; $that = $this;
$this->setNextResponse(200, array(), 'Hello World', function ($request, $response) use ($that, $time) $this->setNextResponse(200, array(), 'Hello World', function ($request, $response) use ($that, $time) {
{
$response->headers->set('Cache-Control', 'public, max-age=10'); $response->headers->set('Cache-Control', 'public, max-age=10');
$response->headers->set('Last-Modified', $time->format(DATE_RFC2822)); $response->headers->set('Last-Modified', $time->format(DATE_RFC2822));
}); });
@ -783,8 +771,7 @@ class HttpCacheTest extends HttpCacheTestCase
public function testInvalidatesCachedResponsesOnPost() public function testInvalidatesCachedResponsesOnPost()
{ {
$this->setNextResponse(200, array(), 'Hello World', function ($request, $response) $this->setNextResponse(200, array(), 'Hello World', function ($request, $response) {
{
if ('GET' == $request->getMethod()) { if ('GET' == $request->getMethod()) {
$response->setStatusCode(200); $response->setStatusCode(200);
$response->headers->set('Cache-Control', 'public, max-age=500'); $response->headers->set('Cache-Control', 'public, max-age=500');
@ -833,8 +820,7 @@ class HttpCacheTest extends HttpCacheTestCase
public function testServesFromCacheWhenHeadersMatch() public function testServesFromCacheWhenHeadersMatch()
{ {
$count = 0; $count = 0;
$this->setNextResponse(200, array('Cache-Control' => 'max-age=10000'), '', function ($request, $response) use (&$count) $this->setNextResponse(200, array('Cache-Control' => 'max-age=10000'), '', function ($request, $response) use (&$count) {
{
$response->headers->set('Vary', 'Accept User-Agent Foo'); $response->headers->set('Vary', 'Accept User-Agent Foo');
$response->headers->set('Cache-Control', 'public, max-age=10'); $response->headers->set('Cache-Control', 'public, max-age=10');
$response->headers->set('X-Response-Count', ++$count); $response->headers->set('X-Response-Count', ++$count);
@ -858,8 +844,7 @@ class HttpCacheTest extends HttpCacheTestCase
public function testStoresMultipleResponsesWhenHeadersDiffer() public function testStoresMultipleResponsesWhenHeadersDiffer()
{ {
$count = 0; $count = 0;
$this->setNextResponse(200, array('Cache-Control' => 'max-age=10000'), '', function ($request, $response) use (&$count) $this->setNextResponse(200, array('Cache-Control' => 'max-age=10000'), '', function ($request, $response) use (&$count) {
{
$response->headers->set('Vary', 'Accept User-Agent Foo'); $response->headers->set('Vary', 'Accept User-Agent Foo');
$response->headers->set('Cache-Control', 'public, max-age=10'); $response->headers->set('Cache-Control', 'public, max-age=10');
$response->headers->set('X-Response-Count', ++$count); $response->headers->set('X-Response-Count', ++$count);

View File

@ -161,8 +161,7 @@ class HttpCacheTestCase extends \PHPUnit_Framework_TestCase
$fp = opendir($directory); $fp = opendir($directory);
while (false !== $file = readdir($fp)) { while (false !== $file = readdir($fp)) {
if (!in_array($file, array('.', '..'))) if (!in_array($file, array('.', '..'))) {
{
if (is_link($directory.'/'.$file)) { if (is_link($directory.'/'.$file)) {
unlink($directory.'/'.$file); unlink($directory.'/'.$file);
} elseif (is_dir($directory.'/'.$file)) { } elseif (is_dir($directory.'/'.$file)) {

View File

@ -43,8 +43,7 @@ class HttpKernelTest extends \PHPUnit_Framework_TestCase
public function testHandleWhenControllerThrowsAnExceptionAndRawIsFalse() public function testHandleWhenControllerThrowsAnExceptionAndRawIsFalse()
{ {
$dispatcher = new EventDispatcher(); $dispatcher = new EventDispatcher();
$dispatcher->addListener(KernelEvents::EXCEPTION, function ($event) $dispatcher->addListener(KernelEvents::EXCEPTION, function ($event) {
{
$event->setResponse(new Response($event->getException()->getMessage())); $event->setResponse(new Response($event->getException()->getMessage()));
}); });
@ -56,8 +55,7 @@ class HttpKernelTest extends \PHPUnit_Framework_TestCase
public function testHandleWhenAListenerReturnsAResponse() public function testHandleWhenAListenerReturnsAResponse()
{ {
$dispatcher = new EventDispatcher(); $dispatcher = new EventDispatcher();
$dispatcher->addListener(KernelEvents::REQUEST, function ($event) $dispatcher->addListener(KernelEvents::REQUEST, function ($event) {
{
$event->setResponse(new Response('hello')); $event->setResponse(new Response('hello'));
}); });
@ -143,8 +141,7 @@ class HttpKernelTest extends \PHPUnit_Framework_TestCase
public function testHandleWhenTheControllerDoesNotReturnAResponseButAViewIsRegistered() public function testHandleWhenTheControllerDoesNotReturnAResponseButAViewIsRegistered()
{ {
$dispatcher = new EventDispatcher(); $dispatcher = new EventDispatcher();
$dispatcher->addListener(KernelEvents::VIEW, function ($event) $dispatcher->addListener(KernelEvents::VIEW, function ($event) {
{
$event->setResponse(new Response($event->getControllerResult())); $event->setResponse(new Response($event->getControllerResult()));
}); });
$kernel = new HttpKernel($dispatcher, $this->getResolver(function () { return 'foo'; })); $kernel = new HttpKernel($dispatcher, $this->getResolver(function () { return 'foo'; }));
@ -155,8 +152,7 @@ class HttpKernelTest extends \PHPUnit_Framework_TestCase
public function testHandleWithAResponseListener() public function testHandleWithAResponseListener()
{ {
$dispatcher = new EventDispatcher(); $dispatcher = new EventDispatcher();
$dispatcher->addListener(KernelEvents::RESPONSE, function ($event) $dispatcher->addListener(KernelEvents::RESPONSE, function ($event) {
{
$event->setResponse(new Response('foo')); $event->setResponse(new Response('foo'));
}); });
$kernel = new HttpKernel($dispatcher, $this->getResolver()); $kernel = new HttpKernel($dispatcher, $this->getResolver());

View File

@ -87,8 +87,7 @@ class ProcessTest extends \PHPUnit_Framework_TestCase
$baseData = str_repeat('*', 1024); $baseData = str_repeat('*', 1024);
$codes = array(); $codes = array();
foreach (array(1, 16, 64, 1024, 4096) as $size) foreach (array(1, 16, 64, 1024, 4096) as $size) {
{
$data = str_repeat($baseData, $size) . '!'; $data = str_repeat($baseData, $size) . '!';
foreach ($variations as $code) { foreach ($variations as $code) {
$codes[] = array($data, $code); $codes[] = array($data, $code);

View File

@ -25,8 +25,7 @@ while ($read || $write) {
die(ERR_TIMEOUT); die(ERR_TIMEOUT);
} }
if (in_array(STDOUT, $w) && strlen($out) > 0) if (in_array(STDOUT, $w) && strlen($out) > 0) {
{
$written = fwrite(STDOUT, (binary) $out, 1024); $written = fwrite(STDOUT, (binary) $out, 1024);
if (false === $written) { if (false === $written) {
die(ERR_WRITE_FAILED); die(ERR_WRITE_FAILED);
@ -37,8 +36,7 @@ while ($read || $write) {
$write = array_diff($write, array(STDOUT)); $write = array_diff($write, array(STDOUT));
} }
if (in_array(STDERR, $w) && strlen($err) > 0) if (in_array(STDERR, $w) && strlen($err) > 0) {
{
$written = fwrite(STDERR, (binary) $err, 1024); $written = fwrite(STDERR, (binary) $err, 1024);
if (false === $written) { if (false === $written) {
die(ERR_WRITE_FAILED); die(ERR_WRITE_FAILED);

View File

@ -41,8 +41,7 @@ class ClosureLoaderTest extends \PHPUnit_Framework_TestCase
$loader = new ClosureLoader(); $loader = new ClosureLoader();
$route = new Route('/'); $route = new Route('/');
$routes = $loader->load(function () use ($route) $routes = $loader->load(function () use ($route) {
{
$routes = new RouteCollection(); $routes = new RouteCollection();
$routes->add('foo', $route); $routes->add('foo', $route);

View File

@ -183,8 +183,7 @@ class AclProviderBenchmarkTest extends \PHPUnit_Framework_TestCase
do { do {
$sid = $this->chooseSid(); $sid = $this->chooseSid();
} } while (array_key_exists($sid, $sids) && in_array($fieldName, $sids[$sid], true));
while (array_key_exists($sid, $sids) && in_array($fieldName, $sids[$sid], true));
$fieldOrder[$fieldName] = array_key_exists($fieldName, $fieldOrder) ? $fieldOrder[$fieldName]+1 : 0; $fieldOrder[$fieldName] = array_key_exists($fieldName, $fieldOrder) ? $fieldOrder[$fieldName]+1 : 0;
if (!isset($sids[$sid])) { if (!isset($sids[$sid])) {