Skip to content

Commit 9b7aab5

Browse files
committed
merged 2.0
2 parents f433f6b + 26b489f commit 9b7aab5

File tree

19 files changed

+42
-84
lines changed

19 files changed

+42
-84
lines changed

src/Symfony/Bridge/Doctrine/Form/DoctrineOrmTypeGuesser.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,7 @@ public function guessType($class, $property)
4848
return new TypeGuess('entity', array('em' => $name, 'class' => $mapping['targetEntity'], 'multiple' => $multiple), Guess::HIGH_CONFIDENCE);
4949
}
5050

51-
switch ($metadata->getTypeOfField($property))
52-
{
51+
switch ($metadata->getTypeOfField($property)) {
5352
case 'array':
5453
return new TypeGuess('collection', array(), Guess::MEDIUM_CONFIDENCE);
5554
case 'boolean':

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,7 @@ private function addSessionSection(ArrayNodeDefinition $rootNode)
195195

196196
private function addTemplatingSection(ArrayNodeDefinition $rootNode)
197197
{
198-
$organizeUrls = function($urls)
199-
{
198+
$organizeUrls = function($urls) {
200199
$urls += array(
201200
'http' => array(),
202201
'ssl' => array(),

src/Symfony/Bundle/FrameworkBundle/Tests/HttpKernelTest.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,7 @@ public function testHandle($type)
4848
$resolver = $this->getMock('Symfony\\Component\\HttpKernel\\Controller\\ControllerResolverInterface');
4949
$kernel = new HttpKernel($dispatcher, $container, $resolver);
5050

51-
$controller = function() use($expected)
52-
{
51+
$controller = function() use($expected) {
5352
return $expected;
5453
};
5554

@@ -96,8 +95,7 @@ public function testHandleRestoresThePreviousRequestOnException($type)
9695
$resolver = $this->getMock('Symfony\\Component\\HttpKernel\\Controller\\ControllerResolverInterface');
9796
$kernel = new HttpKernel($dispatcher, $container, $resolver);
9897

99-
$controller = function() use ($expected)
100-
{
98+
$controller = function() use ($expected) {
10199
throw $expected;
102100
};
103101

src/Symfony/Component/Config/Tests/Definition/ArrayNodeTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ public function testExceptionThrownOnUnrecognizedChild()
3131
{
3232
$node = new ArrayNode('root');
3333

34-
try
35-
{
34+
try {
3635
$node->normalize(array('foo' => 'bar'));
3736
$this->fail('An exception should have been throw for a bad child node');
3837
} catch (\Exception $e) {

src/Symfony/Component/Console/Tests/Command/CommandTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,8 +224,7 @@ public function testRun()
224224
public function testSetCode()
225225
{
226226
$command = new \TestCommand();
227-
$ret = $command->setCode(function (InputInterface $input, OutputInterface $output)
228-
{
227+
$ret = $command->setCode(function (InputInterface $input, OutputInterface $output) {
229228
$output->writeln('from the code...');
230229
});
231230
$this->assertEquals($command, $ret, '->setCode() implements a fluent interface');

src/Symfony/Component/CssSelector/Tokenizer.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,7 @@ private function tokenizeEscapedString($s, $pos)
154154
*/
155155
private function unescapeStringLiteral($literal)
156156
{
157-
return preg_replace_callback('#(\\\\(?:[A-Fa-f0-9]{1,6}(?:\r\n|\s)?|[^A-Fa-f0-9]))#', function ($matches) use ($literal)
158-
{
157+
return preg_replace_callback('#(\\\\(?:[A-Fa-f0-9]{1,6}(?:\r\n|\s)?|[^A-Fa-f0-9]))#', function ($matches) use ($literal) {
159158
if ($matches[0][0] == '\\' && strlen($matches[0]) > 1) {
160159
$matches[0] = substr($matches[0], 1);
161160
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'))) {

src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1037,8 +1037,7 @@ private function dumpValue($value, $interpolate = true)
10371037
return $this->dumpParameter(strtolower($match[1]));
10381038
} else {
10391039
$that = $this;
1040-
$replaceParameters = function ($match) use ($that)
1041-
{
1040+
$replaceParameters = function ($match) use ($that) {
10421041
return "'.".$that->dumpParameter(strtolower($match[2])).".'";
10431042
};
10441043

src/Symfony/Component/DependencyInjection/Tests/Loader/ClosureLoaderTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,7 @@ public function testLoad()
4141
{
4242
$loader = new ClosureLoader($container = new ContainerBuilder());
4343

44-
$loader->load(function ($container)
45-
{
44+
$loader->load(function ($container) {
4645
$container->setParameter('foo', 'foo');
4746
});
4847

src/Symfony/Component/DomCrawler/Tests/CrawlerTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,8 +263,7 @@ public function testEach()
263263
public function testReduce()
264264
{
265265
$crawler = $this->createTestCrawler()->filterXPath('//ul[1]/li');
266-
$nodes = $crawler->reduce(function ($node, $i)
267-
{
266+
$nodes = $crawler->reduce(function ($node, $i) {
268267
return $i == 1 ? false : true;
269268
});
270269
$this->assertNotSame($nodes, $crawler, '->reduce() returns a new instance of a crawler');

src/Symfony/Component/HttpFoundation/Tests/ResponseTest.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -378,8 +378,7 @@ public function testIsInformational()
378378

379379
public function testIsRedirectRedirection()
380380
{
381-
foreach (array(301, 302, 303, 307) as $code)
382-
{
381+
foreach (array(301, 302, 303, 307) as $code) {
383382
$response = new Response('', $code);
384383
$this->assertTrue($response->isRedirection());
385384
$this->assertTrue($response->isRedirect());
@@ -413,8 +412,7 @@ public function testIsNotFound()
413412

414413
public function testIsEmpty()
415414
{
416-
foreach (array(201, 204, 304) as $code)
417-
{
415+
foreach (array(201, 204, 304) as $code) {
418416
$response = new Response('', $code);
419417
$this->assertTrue($response->isEmpty());
420418
}

src/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTest.php

Lines changed: 15 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,7 @@ public function testRespondsWith304OnlyIfIfNoneMatchAndIfModifiedSinceBothMatch(
169169
{
170170
$time = new \DateTime();
171171

172-
$this->setNextResponse(200, array(), '', function ($request, $response) use ($time)
173-
{
172+
$this->setNextResponse(200, array(), '', function ($request, $response) use ($time) {
174173
$response->setStatusCode(200);
175174
$response->headers->set('ETag', '12345');
176175
$response->headers->set('Last-Modified', $time->format(DATE_RFC2822));
@@ -197,8 +196,7 @@ public function testRespondsWith304OnlyIfIfNoneMatchAndIfModifiedSinceBothMatch(
197196

198197
public function testValidatesPrivateResponsesCachedOnTheClient()
199198
{
200-
$this->setNextResponse(200, array(), '', function ($request, $response)
201-
{
199+
$this->setNextResponse(200, array(), '', function ($request, $response) {
202200
$etags = preg_split('/\s*,\s*/', $request->headers->get('IF_NONE_MATCH'));
203201
if ($request->cookies->has('authenticated')) {
204202
$response->headers->set('Cache-Control', 'private, no-store');
@@ -257,8 +255,7 @@ public function testReloadsResponsesWhenCacheHitsButNoCacheRequestDirectivePrese
257255
{
258256
$count = 0;
259257

260-
$this->setNextResponse(200, array('Cache-Control' => 'public, max-age=10000'), '', function ($request, $response) use (&$count)
261-
{
258+
$this->setNextResponse(200, array('Cache-Control' => 'public, max-age=10000'), '', function ($request, $response) use (&$count) {
262259
++$count;
263260
$response->setContent(1 == $count ? 'Hello World' : 'Goodbye World');
264261
});
@@ -285,8 +282,7 @@ public function testDoesNotReloadResponsesWhenAllowReloadIsSetFalseDefault()
285282
{
286283
$count = 0;
287284

288-
$this->setNextResponse(200, array('Cache-Control' => 'public, max-age=10000'), '', function ($request, $response) use (&$count)
289-
{
285+
$this->setNextResponse(200, array('Cache-Control' => 'public, max-age=10000'), '', function ($request, $response) use (&$count) {
290286
++$count;
291287
$response->setContent(1 == $count ? 'Hello World' : 'Goodbye World');
292288
});
@@ -317,8 +313,7 @@ public function testRevalidatesFreshCacheEntryWhenMaxAgeRequestDirectiveIsExceed
317313
{
318314
$count = 0;
319315

320-
$this->setNextResponse(200, array(), '', function ($request, $response) use (&$count)
321-
{
316+
$this->setNextResponse(200, array(), '', function ($request, $response) use (&$count) {
322317
++$count;
323318
$response->headers->set('Cache-Control', 'public, max-age=10000');
324319
$response->setETag($count);
@@ -348,8 +343,7 @@ public function testDoesNotRevalidateFreshCacheEntryWhenEnableRevalidateOptionIs
348343
{
349344
$count = 0;
350345

351-
$this->setNextResponse(200, array(), '', function ($request, $response) use (&$count)
352-
{
346+
$this->setNextResponse(200, array(), '', function ($request, $response) use (&$count) {
353347
++$count;
354348
$response->headers->set('Cache-Control', 'public, max-age=10000');
355349
$response->setETag($count);
@@ -658,8 +652,7 @@ public function testFetchesFullResponseWhenCacheStaleAndNoValidatorsPresent()
658652
public function testValidatesCachedResponsesWithLastModifiedAndNoFreshnessInformation()
659653
{
660654
$time = \DateTime::createFromFormat('U', time());
661-
$this->setNextResponse(200, array(), 'Hello World', function ($request, $response) use ($time)
662-
{
655+
$this->setNextResponse(200, array(), 'Hello World', function ($request, $response) use ($time) {
663656
$response->headers->set('Cache-Control', 'public');
664657
$response->headers->set('Last-Modified', $time->format(DATE_RFC2822));
665658
if ($time->format(DATE_RFC2822) == $request->headers->get('IF_MODIFIED_SINCE')) {
@@ -695,8 +688,7 @@ public function testValidatesCachedResponsesWithLastModifiedAndNoFreshnessInform
695688

696689
public function testValidatesCachedResponsesWithETagAndNoFreshnessInformation()
697690
{
698-
$this->setNextResponse(200, array(), 'Hello World', function ($request, $response)
699-
{
691+
$this->setNextResponse(200, array(), 'Hello World', function ($request, $response) {
700692
$response->headers->set('Cache-Control', 'public');
701693
$response->headers->set('ETag', '"12345"');
702694
if ($response->getETag() == $request->headers->get('IF_NONE_MATCH')) {
@@ -733,8 +725,7 @@ public function testReplacesCachedResponsesWhenValidationResultsInNon304Response
733725
{
734726
$time = \DateTime::createFromFormat('U', time());
735727
$count = 0;
736-
$this->setNextResponse(200, array(), 'Hello World', function ($request, $response) use ($time, &$count)
737-
{
728+
$this->setNextResponse(200, array(), 'Hello World', function ($request, $response) use ($time, &$count) {
738729
$response->headers->set('Last-Modified', $time->format(DATE_RFC2822));
739730
$response->headers->set('Cache-Control', 'public');
740731
switch (++$count) {
@@ -772,8 +763,7 @@ public function testReplacesCachedResponsesWhenValidationResultsInNon304Response
772763
public function testPassesHeadRequestsThroughDirectlyOnPass()
773764
{
774765
$that = $this;
775-
$this->setNextResponse(200, array(), 'Hello World', function ($request, $response) use ($that)
776-
{
766+
$this->setNextResponse(200, array(), 'Hello World', function ($request, $response) use ($that) {
777767
$response->setContent('');
778768
$response->setStatusCode(200);
779769
$that->assertEquals('HEAD', $request->getMethod());
@@ -787,8 +777,7 @@ public function testPassesHeadRequestsThroughDirectlyOnPass()
787777
public function testUsesCacheToRespondToHeadRequestsWhenFresh()
788778
{
789779
$that = $this;
790-
$this->setNextResponse(200, array(), 'Hello World', function ($request, $response) use ($that)
791-
{
780+
$this->setNextResponse(200, array(), 'Hello World', function ($request, $response) use ($that) {
792781
$response->headers->set('Cache-Control', 'public, max-age=10');
793782
$response->setContent('Hello World');
794783
$response->setStatusCode(200);
@@ -810,8 +799,7 @@ public function testSendsNoContentWhenFresh()
810799
{
811800
$time = \DateTime::createFromFormat('U', time());
812801
$that = $this;
813-
$this->setNextResponse(200, array(), 'Hello World', function ($request, $response) use ($that, $time)
814-
{
802+
$this->setNextResponse(200, array(), 'Hello World', function ($request, $response) use ($that, $time) {
815803
$response->headers->set('Cache-Control', 'public, max-age=10');
816804
$response->headers->set('Last-Modified', $time->format(DATE_RFC2822));
817805
});
@@ -828,8 +816,7 @@ public function testSendsNoContentWhenFresh()
828816

829817
public function testInvalidatesCachedResponsesOnPost()
830818
{
831-
$this->setNextResponse(200, array(), 'Hello World', function ($request, $response)
832-
{
819+
$this->setNextResponse(200, array(), 'Hello World', function ($request, $response) {
833820
if ('GET' == $request->getMethod()) {
834821
$response->setStatusCode(200);
835822
$response->headers->set('Cache-Control', 'public, max-age=500');
@@ -878,8 +865,7 @@ public function testInvalidatesCachedResponsesOnPost()
878865
public function testServesFromCacheWhenHeadersMatch()
879866
{
880867
$count = 0;
881-
$this->setNextResponse(200, array('Cache-Control' => 'max-age=10000'), '', function ($request, $response) use (&$count)
882-
{
868+
$this->setNextResponse(200, array('Cache-Control' => 'max-age=10000'), '', function ($request, $response) use (&$count) {
883869
$response->headers->set('Vary', 'Accept User-Agent Foo');
884870
$response->headers->set('Cache-Control', 'public, max-age=10');
885871
$response->headers->set('X-Response-Count', ++$count);
@@ -903,8 +889,7 @@ public function testServesFromCacheWhenHeadersMatch()
903889
public function testStoresMultipleResponsesWhenHeadersDiffer()
904890
{
905891
$count = 0;
906-
$this->setNextResponse(200, array('Cache-Control' => 'max-age=10000'), '', function ($request, $response) use (&$count)
907-
{
892+
$this->setNextResponse(200, array('Cache-Control' => 'max-age=10000'), '', function ($request, $response) use (&$count) {
908893
$response->headers->set('Vary', 'Accept User-Agent Foo');
909894
$response->headers->set('Cache-Control', 'public, max-age=10');
910895
$response->headers->set('X-Response-Count', ++$count);

src/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTestCase.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,7 @@ static public function clearDirectory($directory)
162162

163163
$fp = opendir($directory);
164164
while (false !== $file = readdir($fp)) {
165-
if (!in_array($file, array('.', '..')))
166-
{
165+
if (!in_array($file, array('.', '..'))) {
167166
if (is_link($directory.'/'.$file)) {
168167
unlink($directory.'/'.$file);
169168
} elseif (is_dir($directory.'/'.$file)) {

src/Symfony/Component/HttpKernel/Tests/HttpKernelTest.php

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,7 @@ public function testHandleWhenControllerThrowsAnExceptionAndRawIsFalseAndNoListe
5454
public function testHandleWhenControllerThrowsAnExceptionAndRawIsFalse()
5555
{
5656
$dispatcher = new EventDispatcher();
57-
$dispatcher->addListener(KernelEvents::EXCEPTION, function ($event)
58-
{
57+
$dispatcher->addListener(KernelEvents::EXCEPTION, function ($event) {
5958
$event->setResponse(new Response($event->getException()->getMessage()));
6059
});
6160

@@ -67,8 +66,7 @@ public function testHandleWhenControllerThrowsAnExceptionAndRawIsFalse()
6766
public function testHandleWhenAListenerReturnsAResponse()
6867
{
6968
$dispatcher = new EventDispatcher();
70-
$dispatcher->addListener(KernelEvents::REQUEST, function ($event)
71-
{
69+
$dispatcher->addListener(KernelEvents::REQUEST, function ($event) {
7270
$event->setResponse(new Response('hello'));
7371
});
7472

@@ -154,8 +152,7 @@ public function testHandleWhenTheControllerDoesNotReturnAResponse()
154152
public function testHandleWhenTheControllerDoesNotReturnAResponseButAViewIsRegistered()
155153
{
156154
$dispatcher = new EventDispatcher();
157-
$dispatcher->addListener(KernelEvents::VIEW, function ($event)
158-
{
155+
$dispatcher->addListener(KernelEvents::VIEW, function ($event) {
159156
$event->setResponse(new Response($event->getControllerResult()));
160157
});
161158
$kernel = new HttpKernel($dispatcher, $this->getResolver(function () { return 'foo'; }));
@@ -166,8 +163,7 @@ public function testHandleWhenTheControllerDoesNotReturnAResponseButAViewIsRegis
166163
public function testHandleWithAResponseListener()
167164
{
168165
$dispatcher = new EventDispatcher();
169-
$dispatcher->addListener(KernelEvents::RESPONSE, function ($event)
170-
{
166+
$dispatcher->addListener(KernelEvents::RESPONSE, function ($event) {
171167
$event->setResponse(new Response('foo'));
172168
});
173169
$kernel = new HttpKernel($dispatcher, $this->getResolver());

src/Symfony/Component/Locale/Resources/data/update-data.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -441,8 +441,7 @@ function create_stub_datafile($locale, $target, $data) {
441441
}
442442

443443
// Countries.
444-
$countriesConstraint = function($code)
445-
{
444+
$countriesConstraint = function($code) {
446445
// Global countries (f.i. "America") have numeric codes
447446
// Countries have alphabetic codes
448447
// "ZZ" is the code for unknown country
@@ -456,8 +455,7 @@ function create_stub_datafile($locale, $target, $data) {
456455
$countries = get_data('Countries', 'region', $defaultLocale, $countriesConstraint);
457456

458457
// Languages
459-
$languagesConstraint = function($code)
460-
{
458+
$languagesConstraint = function($code) {
461459
// "mul" is the code for multiple languages
462460
if ('mul' !== $code) {
463461
return true;

src/Symfony/Component/Process/Tests/ProcessTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,7 @@ public function pipesCodeProvider()
152152
$baseData = str_repeat('*', 1024);
153153

154154
$codes = array();
155-
foreach (array(1, 16, 64, 1024, 4096) as $size)
156-
{
155+
foreach (array(1, 16, 64, 1024, 4096) as $size) {
157156
$data = str_repeat($baseData, $size) . '!';
158157
foreach ($variations as $code) {
159158
$codes[] = array($data, $code);

src/Symfony/Component/Process/Tests/ProcessTestHelper.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@
2525
die(ERR_TIMEOUT);
2626
}
2727

28-
if (in_array(STDOUT, $w) && strlen($out) > 0)
29-
{
28+
if (in_array(STDOUT, $w) && strlen($out) > 0) {
3029
$written = fwrite(STDOUT, (binary) $out, 1024);
3130
if (false === $written) {
3231
die(ERR_WRITE_FAILED);
@@ -37,8 +36,7 @@
3736
$write = array_diff($write, array(STDOUT));
3837
}
3938

40-
if (in_array(STDERR, $w) && strlen($err) > 0)
41-
{
39+
if (in_array(STDERR, $w) && strlen($err) > 0) {
4240
$written = fwrite(STDERR, (binary) $err, 1024);
4341
if (false === $written) {
4442
die(ERR_WRITE_FAILED);

src/Symfony/Component/Routing/Tests/Loader/ClosureLoaderTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,7 @@ public function testLoad()
4848
$loader = new ClosureLoader();
4949

5050
$route = new Route('/');
51-
$routes = $loader->load(function () use ($route)
52-
{
51+
$routes = $loader->load(function () use ($route) {
5352
$routes = new RouteCollection();
5453

5554
$routes->add('foo', $route);

src/Symfony/Component/Security/Tests/Acl/Dbal/AclProviderBenchmarkTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,7 @@ protected function generateAces($classId, $objectId)
187187

188188
do {
189189
$sid = $this->chooseSid();
190-
}
191-
while (array_key_exists($sid, $sids) && in_array($fieldName, $sids[$sid], true));
190+
} while (array_key_exists($sid, $sids) && in_array($fieldName, $sids[$sid], true));
192191

193192
$fieldOrder[$fieldName] = array_key_exists($fieldName, $fieldOrder) ? $fieldOrder[$fieldName]+1 : 0;
194193
if (!isset($sids[$sid])) {

0 commit comments

Comments
 (0)