Skip to content

Commit

Permalink
PSR-2 fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
GrahamCampbell committed Dec 2, 2014
1 parent b604b0a commit eda746b
Show file tree
Hide file tree
Showing 44 changed files with 127 additions and 128 deletions.
2 changes: 1 addition & 1 deletion src/Symfony/Bridge/Twig/Extension/HttpKernelExtension.php
Expand Up @@ -36,7 +36,7 @@ public function __construct(FragmentHandler $handler)
public function getFunctions()
{
return array(
new \Twig_SimpleFunction('render',array($this, 'renderFragment'), array('is_safe' => array('html'))),
new \Twig_SimpleFunction('render', array($this, 'renderFragment'), array('is_safe' => array('html'))),
new \Twig_SimpleFunction('render_*', array($this, 'renderFragmentStrategy'), array('is_safe' => array('html'))),
new \Twig_SimpleFunction('controller', array($this, 'controller')),
);
Expand Down
Expand Up @@ -226,7 +226,7 @@ private function registerProfilerConfiguration(array $config, ContainerBuilder $
'memcached' => 'Symfony\Component\HttpKernel\Profiler\MemcachedProfilerStorage',
'redis' => 'Symfony\Component\HttpKernel\Profiler\RedisProfilerStorage',
);
list($class, ) = explode(':', $config['dsn'], 2);
list($class,) = explode(':', $config['dsn'], 2);
if (!isset($supported[$class])) {
throw new \LogicException(sprintf('Driver "%s" is not supported for the profiler.', $class));
}
Expand Down Expand Up @@ -663,7 +663,7 @@ private function getValidatorYamlMappingFiles(ContainerBuilder $container)
return $files;
}

private function registerAnnotationsConfiguration(array $config, ContainerBuilder $container,$loader)
private function registerAnnotationsConfiguration(array $config, ContainerBuilder $container, $loader)
{
$loader->load('annotations.xml');

Expand Down
Expand Up @@ -100,9 +100,9 @@ public function testGetTemplates()
->will($this->returnCallback(array($this, 'profileHasCollectorCallback')));

$result = $this->templateManager->getTemplates($profile);
$this->assertArrayHasKey('foo',$result);
$this->assertArrayNotHasKey('bar',$result);
$this->assertArrayNotHasKey('baz',$result);
$this->assertArrayHasKey('foo', $result);
$this->assertArrayNotHasKey('bar', $result);
$this->assertArrayNotHasKey('baz', $result);
}

public function profilerHasCallback($panel)
Expand Down
16 changes: 8 additions & 8 deletions src/Symfony/Component/BrowserKit/Tests/CookieJarTest.php
Expand Up @@ -202,9 +202,9 @@ public function testCookieGetWithSubdomain()
$cookieJar->set($cookie1 = new Cookie('foo', 'bar', null, '/', '.example.com'));
$cookieJar->set($cookie2 = new Cookie('foo1', 'bar', null, '/', 'test.example.com'));

$this->assertEquals($cookie1, $cookieJar->get('foo','/','foo.example.com'));
$this->assertEquals($cookie1, $cookieJar->get('foo','/','example.com'));
$this->assertEquals($cookie2, $cookieJar->get('foo1','/','test.example.com'));
$this->assertEquals($cookie1, $cookieJar->get('foo', '/', 'foo.example.com'));
$this->assertEquals($cookie1, $cookieJar->get('foo', '/', 'example.com'));
$this->assertEquals($cookie2, $cookieJar->get('foo1', '/', 'test.example.com'));
}

public function testCookieGetWithSubdirectory()
Expand All @@ -213,11 +213,11 @@ public function testCookieGetWithSubdirectory()
$cookieJar->set($cookie1 = new Cookie('foo', 'bar', null, '/test', '.example.com'));
$cookieJar->set($cookie2 = new Cookie('foo1', 'bar1', null, '/', '.example.com'));

$this->assertNull($cookieJar->get('foo','/','.example.com'));
$this->assertNull($cookieJar->get('foo','/bar','.example.com'));
$this->assertEquals($cookie1, $cookieJar->get('foo','/test','example.com'));
$this->assertEquals($cookie2, $cookieJar->get('foo1','/','example.com'));
$this->assertEquals($cookie2, $cookieJar->get('foo1','/bar','example.com'));
$this->assertNull($cookieJar->get('foo', '/', '.example.com'));
$this->assertNull($cookieJar->get('foo', '/bar', '.example.com'));
$this->assertEquals($cookie1, $cookieJar->get('foo', '/test', 'example.com'));
$this->assertEquals($cookie2, $cookieJar->get('foo1', '/', 'example.com'));
$this->assertEquals($cookie2, $cookieJar->get('foo1', '/bar', 'example.com'));
}

public function testCookieWithWildcardDomain()
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Config/Loader/FileLoader.php
Expand Up @@ -91,7 +91,7 @@ public function import($resource, $type = null, $ignoreErrors = false, $sourceRe
}

$resources = is_array($resource) ? $resource : array($resource);
for ($i = 0; $i < $resourcesCount = count($resources); $i++ ) {
for ($i = 0; $i < $resourcesCount = count($resources); $i++) {
if (isset(self::$loading[$resources[$i]])) {
if ($i == $resourcesCount-1) {
throw new FileLoaderImportCircularReferenceException(array_keys(self::$loading));
Expand Down
Expand Up @@ -116,10 +116,10 @@ public function getZeroNamedNodeExamplesData()
'string_key' => 'just value',
),
array(
0 => array (
0 => array(
'name' => 'something',
),
5 => array (
5 => array(
0 => 'this won\'t work too',
'new_key' => 'some other value',
),
Expand Down
Expand Up @@ -33,16 +33,16 @@ public function testIfTrueExpression()
$this->assertFinalizedValueIs('new_value', $test, array('key' => true));

$test = $this->getTestBuilder()
->ifTrue( function ($v) { return true; })
->ifTrue(function ($v) { return true; })
->then($this->returnClosure('new_value'))
->end();
$this->assertFinalizedValueIs('new_value', $test);

$test = $this->getTestBuilder()
->ifTrue( function ($v) { return false; })
->ifTrue(function ($v) { return false; })
->then($this->returnClosure('new_value'))
->end();
$this->assertFinalizedValueIs('value',$test);
$this->assertFinalizedValueIs('value', $test);
}

public function testIfStringExpression()
Expand Down
Expand Up @@ -117,7 +117,7 @@ protected function describeApplication(Application $application, array $options

$blocks[] = implode("\n", array_map(function ($commandName) {
return '* '.$commandName;
} , $namespace['commands']));
}, $namespace['commands']));
}

foreach ($description->getCommands() as $command) {
Expand Down
Expand Up @@ -126,9 +126,9 @@ public function testPrevious(\Exception $exception, $statusCode)

$flattened->setPrevious($flattened2);

$this->assertSame($flattened2,$flattened->getPrevious());
$this->assertSame($flattened2, $flattened->getPrevious());

$this->assertSame(array($flattened2),$flattened->getAllPrevious());
$this->assertSame(array($flattened2), $flattened->getAllPrevious());
}

/**
Expand Down Expand Up @@ -162,7 +162,7 @@ public function testToArray(\Exception $exception, $statusCode)
'message' => 'test',
'class' => 'Exception',
'trace' => array(array(
'namespace' => '', 'short_class' => '', 'class' => '','type' => '','function' => '', 'file' => 'foo.php', 'line' => 123,
'namespace' => '', 'short_class' => '', 'class' => '', 'type' => '', 'function' => '', 'file' => 'foo.php', 'line' => 123,
'args' => array(),
)),
),
Expand Down Expand Up @@ -214,12 +214,12 @@ public function testSetTraceIncompleteClass()
'class' => 'Exception',
'trace' => array(
array(
'namespace' => '', 'short_class' => '', 'class' => '','type' => '','function' => '',
'namespace' => '', 'short_class' => '', 'class' => '', 'type' => '', 'function' => '',
'file' => 'foo.php', 'line' => 123,
'args' => array(),
),
array(
'namespace' => '', 'short_class' => '', 'class' => '','type' => '','function' => 'test',
'namespace' => '', 'short_class' => '', 'class' => '', 'type' => '', 'function' => 'test',
'file' => __FILE__, 'line' => 123,
'args' => array(
array(
Expand Down
Expand Up @@ -147,9 +147,9 @@ public function testSetLazyOnServiceHasParent()
{
$container = new ContainerBuilder();

$container->register('parent','stdClass');
$container->register('parent', 'stdClass');

$container->setDefinition('child1',new DefinitionDecorator('parent'))
$container->setDefinition('child1', new DefinitionDecorator('parent'))
->setLazy(true)
;

Expand All @@ -162,11 +162,11 @@ public function testSetLazyOnServiceIsParent()
{
$container = new ContainerBuilder();

$container->register('parent','stdClass')
$container->register('parent', 'stdClass')
->setLazy(true)
;

$container->setDefinition('child1',new DefinitionDecorator('parent'));
$container->setDefinition('child1', new DefinitionDecorator('parent'));

$this->process($container);

Expand Down
Expand Up @@ -6,7 +6,7 @@
}

$phar = new Phar($file, 0, 'ProjectWithXsdExtensionInPhar.phar');
$phar->addFromString('ProjectWithXsdExtensionInPhar.php',<<<EOT
$phar->addFromString('ProjectWithXsdExtensionInPhar.php', <<<EOT
<?php
class ProjectWithXsdExtensionInPhar extends ProjectExtension
Expand Down
3 changes: 1 addition & 2 deletions src/Symfony/Component/DomCrawler/Tests/CrawlerTest.php
Expand Up @@ -351,8 +351,7 @@ public function testText()
public function testHtml()
{
$this->assertEquals('<img alt="Bar">', $this->createTestCrawler()->filterXPath('//a[5]')->html());
$this->assertEquals('<input type="text" value="TextValue" name="TextName"><input type="submit" value="FooValue" name="FooName" id="FooId"><input type="button" value="BarValue" name="BarName" id="BarId"><button value="ButtonValue" name="ButtonName" id="ButtonId"></button>'
, trim($this->createTestCrawler()->filterXPath('//form[@id="FooFormId"]')->html()));
$this->assertEquals('<input type="text" value="TextValue" name="TextName"><input type="submit" value="FooValue" name="FooName" id="FooId"><input type="button" value="BarValue" name="BarName" id="BarId"><button value="ButtonValue" name="ButtonName" id="ButtonId"></button>', trim($this->createTestCrawler()->filterXPath('//form[@id="FooFormId"]')->html()));

try {
$this->createTestCrawler()->filterXPath('//ol')->html();
Expand Down
Expand Up @@ -53,28 +53,28 @@ public function getTestFilterData()
'name' => 'a.txt',
'contents' => 'Lorem ipsum...',
'type' => 'file',
'mode' => 'r+',)
'mode' => 'r+', )
);

$inner[] = new MockSplFileInfo(array(
'name' => 'b.yml',
'contents' => 'dolor sit...',
'type' => 'file',
'mode' => 'r+',)
'mode' => 'r+', )
);

$inner[] = new MockSplFileInfo(array(
'name' => 'some/other/dir/third.php',
'contents' => 'amet...',
'type' => 'file',
'mode' => 'r+',)
'mode' => 'r+', )
);

$inner[] = new MockSplFileInfo(array(
'name' => 'unreadable-file.txt',
'contents' => false,
'type' => 'file',
'mode' => 'r+',)
'mode' => 'r+', )
);

return array(
Expand Down
Expand Up @@ -32,7 +32,7 @@ public function transform($array)
$array = array();
}

if (!is_array($array) ) {
if (!is_array($array)) {
throw new TransformationFailedException('Expected an array.');
}

Expand All @@ -51,7 +51,7 @@ public function transform($array)

public function reverseTransform($array)
{
if (!is_array($array) ) {
if (!is_array($array)) {
throw new TransformationFailedException('Expected an array.');
}

Expand Down
Expand Up @@ -113,7 +113,7 @@ public function testGuessMaxLengthForConstraintWithMinValue()

public function maxLengthTypeProvider()
{
return array (
return array(
array('double'),
array('float'),
array('numeric'),
Expand Down
Expand Up @@ -168,7 +168,7 @@ public function testAbortMappingIfNotSynchronized()
$child = $this->getForm('address', 'address', null, array(), false, false);
// even though "street" is synchronized, it should not have any errors
// due to its parent not being synchronized
$grandChild = $this->getForm('street' , 'street');
$grandChild = $this->getForm('street', 'street');

$parent->add($child);
$child->add($grandChild);
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/HttpFoundation/Tests/CookieTest.php
Expand Up @@ -51,7 +51,7 @@ public function testInstantiationThrowsExceptionIfCookieNameContainsInvalidChara
*/
public function testInvalidExpiration()
{
$cookie = new Cookie('MyCookie', 'foo','bar');
$cookie = new Cookie('MyCookie', 'foo', 'bar');
}

/**
Expand Down
Expand Up @@ -116,7 +116,7 @@ public function testMoveWithNonLatinName($filename, $sanitizedFilename)
copy(__DIR__.'/Fixtures/test.gif', $path);

$file = new File($path);
$movedFile = $file->move($targetDir,$filename);
$movedFile = $file->move($targetDir, $filename);
$this->assertInstanceOf('Symfony\Component\HttpFoundation\File\File', $movedFile);

$this->assertTrue(file_exists($targetPath));
Expand Down
28 changes: 14 additions & 14 deletions src/Symfony/Component/HttpFoundation/Tests/HeaderBagTest.php
Expand Up @@ -97,18 +97,18 @@ public function testReplace()
public function testGet()
{
$bag = new HeaderBag(array('foo' => 'bar', 'fuzz' => 'bizz'));
$this->assertEquals( 'bar', $bag->get('foo'), '->get return current value');
$this->assertEquals( 'bar', $bag->get('FoO'), '->get key in case insensitive');
$this->assertEquals( array('bar'), $bag->get('foo', 'nope', false), '->get return the value as array');
$this->assertEquals('bar', $bag->get('foo'), '->get return current value');
$this->assertEquals('bar', $bag->get('FoO'), '->get key in case insensitive');
$this->assertEquals(array('bar'), $bag->get('foo', 'nope', false), '->get return the value as array');

// defaults
$this->assertNull($bag->get('none'), '->get unknown values returns null');
$this->assertEquals( 'default', $bag->get('none', 'default'), '->get unknown values returns default');
$this->assertEquals( array('default'), $bag->get('none', 'default', false), '->get unknown values returns default as array');
$this->assertEquals('default', $bag->get('none', 'default'), '->get unknown values returns default');
$this->assertEquals(array('default'), $bag->get('none', 'default', false), '->get unknown values returns default as array');

$bag->set('foo', 'bor', false);
$this->assertEquals( 'bar', $bag->get('foo'), '->get return first value');
$this->assertEquals( array('bar', 'bor'), $bag->get('foo', 'nope', false), '->get return all values as array');
$this->assertEquals('bar', $bag->get('foo'), '->get return first value');
$this->assertEquals(array('bar', 'bor'), $bag->get('foo', 'nope', false), '->get return all values as array');
}

public function testSetAssociativeArray()
Expand All @@ -125,16 +125,16 @@ public function testSetAssociativeArray()
public function testContains()
{
$bag = new HeaderBag(array('foo' => 'bar', 'fuzz' => 'bizz'));
$this->assertTrue( $bag->contains('foo', 'bar'), '->contains first value');
$this->assertTrue( $bag->contains('fuzz', 'bizz'), '->contains second value');
$this->assertFalse( $bag->contains('nope', 'nope'), '->contains unknown value');
$this->assertFalse( $bag->contains('foo', 'nope'), '->contains unknown value');
$this->assertTrue($bag->contains('foo', 'bar'), '->contains first value');
$this->assertTrue($bag->contains('fuzz', 'bizz'), '->contains second value');
$this->assertFalse($bag->contains('nope', 'nope'), '->contains unknown value');
$this->assertFalse($bag->contains('foo', 'nope'), '->contains unknown value');

// Multiple values
$bag->set('foo', 'bor', false);
$this->assertTrue( $bag->contains('foo', 'bar'), '->contains first value');
$this->assertTrue( $bag->contains('foo', 'bor'), '->contains second value');
$this->assertFalse( $bag->contains('foo', 'nope'), '->contains unknown value');
$this->assertTrue($bag->contains('foo', 'bar'), '->contains first value');
$this->assertTrue($bag->contains('foo', 'bor'), '->contains second value');
$this->assertFalse($bag->contains('foo', 'nope'), '->contains unknown value');
}

public function testCacheControlDirectiveAccessors()
Expand Down
Expand Up @@ -212,12 +212,12 @@ public function testFilter()

$this->assertFalse($bag->filter('dec', '', false, FILTER_VALIDATE_INT, array(
'flags' => FILTER_FLAG_ALLOW_HEX,
'options' => array('min_range' => 1, 'max_range' => 0xff),)
'options' => array('min_range' => 1, 'max_range' => 0xff))
), '->filter() gets a value of parameter as integer between boundaries');

$this->assertFalse($bag->filter('hex', '', false, FILTER_VALIDATE_INT, array(
'flags' => FILTER_FLAG_ALLOW_HEX,
'options' => array('min_range' => 1, 'max_range' => 0xff),)
'options' => array('min_range' => 1, 'max_range' => 0xff))
), '->filter() gets a value of parameter as integer between boundaries');

$this->assertEquals(array('bang'), $bag->filter('array', '', false), '->filter() gets a value of parameter as an array');
Expand Down
4 changes: 2 additions & 2 deletions src/Symfony/Component/HttpFoundation/Tests/RequestTest.php
Expand Up @@ -217,7 +217,7 @@ public function testCreate()
$this->assertEquals(80, $request->getPort());
$this->assertEquals('test.com', $request->getHttpHost());
$this->assertEquals('username', $request->getUser());
$this->assertSame('',$request->getPassword());
$this->assertSame('', $request->getPassword());
$this->assertFalse($request->isSecure());

$request = Request::create('http://test.com/?foo');
Expand Down Expand Up @@ -501,7 +501,7 @@ public function testGetUriForPath()

$request = new Request();

$request->initialize(array(), array(), array(), array(), array(),$server);
$request->initialize(array(), array(), array(), array(), array(), $server);

$this->assertEquals('http://host:8080/index.php/some/path', $request->getUriForPath('/some/path'), '->getUriForPath() with non default port');

Expand Down
Expand Up @@ -91,7 +91,7 @@ public function testAll()
$this->bag->set('error', 'Bar');
$this->assertEquals(array(
'notice' => array('Foo'),
'error' => array('Bar'),), $this->bag->all()
'error' => array('Bar'), ), $this->bag->all()
);

$this->assertEquals(array(), $this->bag->all());
Expand Down
Expand Up @@ -33,12 +33,12 @@ public function testCollect()
$c->setKernel($kernel);
$c->collect(new Request(), new Response());

$this->assertSame('test',$c->getEnv());
$this->assertSame('test', $c->getEnv());
$this->assertTrue($c->isDebug());
$this->assertSame('config',$c->getName());
$this->assertSame('testkernel',$c->getAppName());
$this->assertSame(PHP_VERSION,$c->getPhpVersion());
$this->assertSame(Kernel::VERSION,$c->getSymfonyVersion());
$this->assertSame('config', $c->getName());
$this->assertSame('testkernel', $c->getAppName());
$this->assertSame(PHP_VERSION, $c->getPhpVersion());
$this->assertSame(Kernel::VERSION, $c->getSymfonyVersion());
$this->assertNull($c->getToken());

// if else clause because we don't know it
Expand Down

0 comments on commit eda746b

Please sign in to comment.