Skip to content

Commit a1813cb

Browse files
committed
minor symfony#10234 Various minor changes (fabpot)
This PR was merged into the 2.3 branch. Discussion ---------- Various minor changes | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | n/a | License | MIT | Doc PR | n/a Commits ------- eb3f6c6 fixed various inconsistencies
2 parents f964cc8 + eb3f6c6 commit a1813cb

File tree

59 files changed

+143
-145
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+143
-145
lines changed

src/Symfony/Bridge/Doctrine/Security/User/EntityUserProvider.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,8 @@ public function refreshUser(UserInterface $user)
9292
);
9393
}
9494

95-
if (null === $refreshedUser = $this->repository->find($id)) {
95+
$refreshedUser = $this->repository->find($id);
96+
if (null === $refreshedUser) {
9697
throw new UsernameNotFoundException(sprintf('User with id %s not found', json_encode($id)));
9798
}
9899
}

src/Symfony/Bridge/Doctrine/Tests/Fixtures/AssociationEntity.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
namespace Symfony\Bridge\Doctrine\Tests\Fixtures;
1313

14-
use Doctrine\ORM\Mapping AS ORM;
14+
use Doctrine\ORM\Mapping as ORM;
1515

1616
/**
1717
* @ORM\Entity

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/CompilerDebugDumpPass.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public function process(ContainerBuilder $container)
2222
{
2323
$filesystem = new Filesystem();
2424
$filesystem->dumpFile(
25-
$this->getCompilerLogFilename($container),
25+
self::getCompilerLogFilename($container),
2626
implode("\n", $container->getCompiler()->getLog()),
2727
0666 & ~umask()
2828
);

src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/TemplateFinderTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public function testFindAllTemplates()
3737
->will($this->returnValue(array('BaseBundle' => new BaseBundle())))
3838
;
3939

40-
$parser = new TemplateFilenameParser($kernel);
40+
$parser = new TemplateFilenameParser();
4141

4242
$finder = new TemplateFinder($kernel, $parser, __DIR__.'/../Fixtures/Resources');
4343

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public function testDefaultConfig()
3333
public function testValidTrustedProxies($trustedProxies, $processedProxies)
3434
{
3535
$processor = new Processor();
36-
$configuration = new Configuration(array());
36+
$configuration = new Configuration();
3737
$config = $processor->processConfiguration($configuration, array(array(
3838
'secret' => 's3cr3t',
3939
'trusted_proxies' => $trustedProxies
@@ -62,7 +62,7 @@ public function getTestValidTrustedProxiesData()
6262
public function testInvalidTypeTrustedProxies()
6363
{
6464
$processor = new Processor();
65-
$configuration = new Configuration(array());
65+
$configuration = new Configuration();
6666
$processor->processConfiguration($configuration, array(
6767
array(
6868
'secret' => 's3cr3t',
@@ -77,7 +77,7 @@ public function testInvalidTypeTrustedProxies()
7777
public function testInvalidValueTrustedProxies()
7878
{
7979
$processor = new Processor();
80-
$configuration = new Configuration(array());
80+
$configuration = new Configuration();
8181
$processor->processConfiguration($configuration, array(
8282
array(
8383
'secret' => 's3cr3t',

src/Symfony/Bundle/FrameworkBundle/Tests/Functional/WebTestCase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ protected static function getKernelClass()
4646
{
4747
require_once __DIR__.'/app/AppKernel.php';
4848

49-
return 'Symfony\Bundle\FrameworkBundle\Tests\Functional\AppKernel';
49+
return 'Symfony\Bundle\FrameworkBundle\Tests\Functional\app\AppKernel';
5050
}
5151

5252
protected static function createKernel(array $options = array())

src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/AppKernel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* file that was distributed with this source code.
1010
*/
1111

12-
namespace Symfony\Bundle\FrameworkBundle\Tests\Functional;
12+
namespace Symfony\Bundle\FrameworkBundle\Tests\Functional\app;
1313

1414
// get the autoload file
1515
$dir = __DIR__;

src/Symfony/Bundle/SecurityBundle/Tests/Functional/WebTestCase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ protected static function getKernelClass()
4646
{
4747
require_once __DIR__.'/app/AppKernel.php';
4848

49-
return 'Symfony\Bundle\SecurityBundle\Tests\Functional\AppKernel';
49+
return 'Symfony\Bundle\SecurityBundle\Tests\Functional\app\AppKernel';
5050
}
5151

5252
protected static function createKernel(array $options = array())

src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/AppKernel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* file that was distributed with this source code.
1010
*/
1111

12-
namespace Symfony\Bundle\SecurityBundle\Tests\Functional;
12+
namespace Symfony\Bundle\SecurityBundle\Tests\Functional\app;
1313

1414
// get the autoload file
1515
$dir = __DIR__;

src/Symfony/Bundle/WebProfilerBundle/Tests/DependencyInjection/ConfigurationTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class ConfigurationTest extends \PHPUnit_Framework_TestCase
2222
public function testConfigTree($options, $results)
2323
{
2424
$processor = new Processor();
25-
$configuration = new Configuration(array());
25+
$configuration = new Configuration();
2626
$config = $processor->processConfiguration($configuration, array($options));
2727

2828
$this->assertEquals($results, $config);

src/Symfony/Component/ClassLoader/XcacheClassLoader.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,8 @@ public function findFile($class)
116116
if (xcache_isset($this->prefix.$class)) {
117117
$file = xcache_get($this->prefix.$class);
118118
} else {
119-
xcache_set($this->prefix.$class, $file = $this->classFinder->findFile($class));
119+
$file = $this->classFinder->findFile($class);
120+
xcache_set($this->prefix.$class, $file);
120121
}
121122

122123
return $file;

src/Symfony/Component/Console/Helper/ProgressHelper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ private function generate($finish = false)
352352
$vars = array();
353353
$percent = 0;
354354
if ($this->max > 0) {
355-
$percent = (double) $this->current / $this->max;
355+
$percent = (float) $this->current / $this->max;
356356
}
357357

358358
if (isset($this->formatVars['bar'])) {

src/Symfony/Component/Console/Tests/ApplicationTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ public function testSetCatchExceptions()
417417
public function testAsText()
418418
{
419419
$application = new Application();
420-
$application->add(new \FooCommand);
420+
$application->add(new \FooCommand());
421421
$this->ensureStaticCommandHelp($application);
422422
$this->assertStringEqualsFile(self::$fixturesPath.'/application_astext1.txt', $this->normalizeLineBreaks($application->asText()), '->asText() returns a text representation of the application');
423423
$this->assertStringEqualsFile(self::$fixturesPath.'/application_astext2.txt', $this->normalizeLineBreaks($application->asText('foo')), '->asText() returns a text representation of the application');
@@ -426,7 +426,7 @@ public function testAsText()
426426
public function testAsXml()
427427
{
428428
$application = new Application();
429-
$application->add(new \FooCommand);
429+
$application->add(new \FooCommand());
430430
$this->ensureStaticCommandHelp($application);
431431
$this->assertXmlStringEqualsXmlFile(self::$fixturesPath.'/application_asxml1.txt', $application->asXml(), '->asXml() returns an XML representation of the application');
432432
$this->assertXmlStringEqualsXmlFile(self::$fixturesPath.'/application_asxml2.txt', $application->asXml('foo'), '->asXml() returns an XML representation of the application');
@@ -450,7 +450,7 @@ public function testRenderException()
450450
$tester->run(array('command' => 'list', '--foo' => true), array('decorated' => false));
451451
$this->assertStringEqualsFile(self::$fixturesPath.'/application_renderexception2.txt', $tester->getDisplay(true), '->renderException() renders the command synopsis when an exception occurs in the context of a command');
452452

453-
$application->add(new \Foo3Command);
453+
$application->add(new \Foo3Command());
454454
$tester = new ApplicationTester($application);
455455
$tester->run(array('command' => 'foo3:bar'), array('decorated' => false));
456456
$this->assertStringEqualsFile(self::$fixturesPath.'/application_renderexception3.txt', $tester->getDisplay(true), '->renderException() renders a pretty exceptions with previous exceptions');
@@ -797,7 +797,7 @@ public function testRunDispatchesAllEventsWithException()
797797

798798
protected function getDispatcher()
799799
{
800-
$dispatcher = new EventDispatcher;
800+
$dispatcher = new EventDispatcher();
801801
$dispatcher->addListener('console.command', function (ConsoleCommandEvent $event) {
802802
$event->getOutput()->write('before.');
803803
});

src/Symfony/Component/CssSelector/Tests/Parser/Handler/NumberHandlerTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
use Symfony\Component\CssSelector\Parser\Handler\NumberHandler;
1515
use Symfony\Component\CssSelector\Parser\Token;
1616
use Symfony\Component\CssSelector\Parser\Tokenizer\TokenizerPatterns;
17-
use Symfony\Component\CssSelector\Parser\Tokenizer\TokenizerEscaping;
1817

1918
class NumberHandlerTest extends AbstractHandlerTest
2019
{
@@ -46,6 +45,6 @@ protected function generateHandler()
4645
{
4746
$patterns = new TokenizerPatterns();
4847

49-
return new NumberHandler($patterns, new TokenizerEscaping($patterns));
48+
return new NumberHandler($patterns);
5049
}
5150
}

src/Symfony/Component/Debug/Tests/ExceptionHandlerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,6 @@ public function testHeaders()
6464
public function testNestedExceptions()
6565
{
6666
$handler = new ExceptionHandler(true);
67-
$response = $handler->createResponse(new \RuntimeException('Foo', null, new \RuntimeException('Bar')));
67+
$response = $handler->createResponse(new \RuntimeException('Foo', 0, new \RuntimeException('Bar')));
6868
}
6969
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public function __construct(ContainerBuilder $container)
6666
{
6767
parent::__construct($container);
6868

69-
$this->inlinedDefinitions = new \SplObjectStorage;
69+
$this->inlinedDefinitions = new \SplObjectStorage();
7070
}
7171

7272
/**

src/Symfony/Component/EventDispatcher/Tests/EventDispatcherTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,7 @@ public function testRemoveSubscriberWithMultipleListeners()
238238
public function testEventReceivesTheDispatcherInstance()
239239
{
240240
$test = $this;
241+
$dispatcher = null;
241242
$this->dispatcher->addListener('test', function ($event) use (&$dispatcher) {
242243
$dispatcher = $event->getDispatcher();
243244
});

src/Symfony/Component/EventDispatcher/Tests/EventTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class EventTest extends \PHPUnit_Framework_TestCase
3535
*/
3636
protected function setUp()
3737
{
38-
$this->event = new Event;
38+
$this->event = new Event();
3939
$this->dispatcher = new EventDispatcher();
4040
}
4141

src/Symfony/Component/Form/Extension/DependencyInjection/DependencyInjectionExtension.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,11 @@
1919
class DependencyInjectionExtension implements FormExtensionInterface
2020
{
2121
private $container;
22-
2322
private $typeServiceIds;
24-
2523
private $guesserServiceIds;
26-
2724
private $guesser;
28-
2925
private $guesserLoaded = false;
26+
private $typeExtensionServiceIds;
3027

3128
public function __construct(ContainerInterface $container,
3229
array $typeServiceIds, array $typeExtensionServiceIds,

src/Symfony/Component/Form/Test/FormPerformanceTestCase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public function setMaxRunningTime($maxRunningTime)
5555
if (is_integer($maxRunningTime) && $maxRunningTime >= 0) {
5656
$this->maxRunningTime = $maxRunningTime;
5757
} else {
58-
throw new \InvalidArgumentException;
58+
throw new \InvalidArgumentException();
5959
}
6060
}
6161

src/Symfony/Component/Form/Tests/FormFactoryBuilderTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ protected function setUp()
2727
$this->registry->setAccessible(true);
2828

2929
$this->guesser = $this->getMock('Symfony\Component\Form\FormTypeGuesserInterface');
30-
$this->type = new FooType;
30+
$this->type = new FooType();
3131
}
3232

3333
public function testAddType()
3434
{
35-
$factoryBuilder = new FormFactoryBuilder;
35+
$factoryBuilder = new FormFactoryBuilder();
3636
$factoryBuilder->addType($this->type);
3737

3838
$factory = $factoryBuilder->getFormFactory();
@@ -46,7 +46,7 @@ public function testAddType()
4646

4747
public function testAddTypeGuesser()
4848
{
49-
$factoryBuilder = new FormFactoryBuilder;
49+
$factoryBuilder = new FormFactoryBuilder();
5050
$factoryBuilder->addTypeGuesser($this->guesser);
5151

5252
$factory = $factoryBuilder->getFormFactory();

src/Symfony/Component/HttpFoundation/File/MimeType/ExtensionGuesser.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,18 +82,15 @@ public function register(ExtensionGuesserInterface $guesser)
8282
* value.
8383
*
8484
* @param string $mimeType The mime type
85+
*
8586
* @return string The guessed extension or NULL, if none could be guessed
8687
*/
8788
public function guess($mimeType)
8889
{
8990
foreach ($this->guessers as $guesser) {
90-
$extension = $guesser->guess($mimeType);
91-
92-
if (null !== $extension) {
93-
break;
91+
if (null !== $extension = $guesser->guess($mimeType)) {
92+
return $extension;
9493
}
9594
}
96-
97-
return $extension;
9895
}
9996
}

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -881,14 +881,14 @@ public function testGetClientIpsProvider()
881881

882882
public function testGetContentWorksTwiceInDefaultMode()
883883
{
884-
$req = new Request;
884+
$req = new Request();
885885
$this->assertEquals('', $req->getContent());
886886
$this->assertEquals('', $req->getContent());
887887
}
888888

889889
public function testGetContentReturnsResource()
890890
{
891-
$req = new Request;
891+
$req = new Request();
892892
$retval = $req->getContent(true);
893893
$this->assertInternalType('resource', $retval);
894894
$this->assertEquals("", fread($retval, 1));
@@ -901,7 +901,7 @@ public function testGetContentReturnsResource()
901901
*/
902902
public function testGetContentCantBeCalledTwiceWithResources($first, $second)
903903
{
904-
$req = new Request;
904+
$req = new Request();
905905
$req->getContent($first);
906906
$req->getContent($second);
907907
}
@@ -1339,7 +1339,7 @@ public function getBaseUrlData()
13391339
*/
13401340
public function testUrlencodedStringPrefix($string, $prefix, $expect)
13411341
{
1342-
$request = new Request;
1342+
$request = new Request();
13431343

13441344
$me = new \ReflectionMethod($request, 'getUrlencodedPrefix');
13451345
$me->setAccessible(true);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -652,7 +652,7 @@ public function testSettersAreChainable()
652652
'setCharset' => 'UTF-8',
653653
'setPublic' => null,
654654
'setPrivate' => null,
655-
'setDate' => new \DateTime,
655+
'setDate' => new \DateTime(),
656656
'expire' => null,
657657
'setMaxAge' => 1,
658658
'setSharedMaxAge' => 1,

src/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ protected function tearDown()
5959
protected function getStorage(array $options = array())
6060
{
6161
$storage = new NativeSessionStorage($options);
62-
$storage->registerBag(new AttributeBag);
62+
$storage->registerBag(new AttributeBag());
6363

6464
return $storage;
6565
}
@@ -158,7 +158,7 @@ public function testCookieOptions()
158158
public function testSetSaveHandlerException()
159159
{
160160
$storage = $this->getStorage();
161-
$storage->setSaveHandler(new \stdClass);
161+
$storage->setSaveHandler(new \stdClass());
162162
}
163163

164164
public function testSetSaveHandler53()

src/Symfony/Component/HttpFoundation/Tests/Session/Storage/PhpBridgeSessionStorageTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ protected function tearDown()
5353
protected function getStorage()
5454
{
5555
$storage = new PhpBridgeSessionStorage();
56-
$storage->registerBag(new AttributeBag);
56+
$storage->registerBag(new AttributeBag());
5757

5858
return $storage;
5959
}

src/Symfony/Component/HttpKernel/Controller/ControllerResolver.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public function getController(Request $request)
7070

7171
if (false === strpos($controller, ':')) {
7272
if (method_exists($controller, '__invoke')) {
73-
return new $controller;
73+
return new $controller();
7474
} elseif (function_exists($controller)) {
7575
return $controller;
7676
}

src/Symfony/Component/HttpKernel/Profiler/MemcacheProfilerStorage.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ protected function getMemcache()
4242
$host = $matches[1] ?: $matches[2];
4343
$port = $matches[3];
4444

45-
$memcache = new Memcache;
45+
$memcache = new Memcache();
4646
$memcache->addServer($host, $port);
4747

4848
$this->memcache = $memcache;

src/Symfony/Component/HttpKernel/Profiler/MemcachedProfilerStorage.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ protected function getMemcached()
4242
$host = $matches[1] ?: $matches[2];
4343
$port = $matches[3];
4444

45-
$memcached = new Memcached;
45+
$memcached = new Memcached();
4646

4747
//disable compression to allow appending
4848
$memcached->setOption(Memcached::OPT_COMPRESSION, false);

src/Symfony/Component/HttpKernel/Profiler/RedisProfilerStorage.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ protected function getRedis()
214214
throw new \RuntimeException('RedisProfilerStorage requires that the redis extension is loaded.');
215215
}
216216

217-
$redis = new \Redis;
217+
$redis = new \Redis();
218218
$redis->connect($data['host'], $data['port']);
219219

220220
if (isset($data['path'])) {

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ public function testUploadedFile()
121121
new UploadedFile($source, 'original', 'mime/original', 123, UPLOAD_ERR_OK, true),
122122
);
123123

124+
$file = null;
124125
foreach ($files as $file) {
125126
$client->request('POST', '/', array(), array('foo' => $file));
126127

0 commit comments

Comments
 (0)