minor #12872 [2.6] CS Fixes And Removed An Unused Import (GrahamCampbell)

This PR was squashed before being merged into the 2.6 branch (closes #12872).

Discussion
----------

[2.6] CS Fixes And Removed An Unused Import

| 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

##### This pull request fixes some cs issues in symfony 2.6.

This is the sequel to #12856.

Commits
-------

2f10a0a [2.6] CS Fixes And Removed An Unused Import
This commit is contained in:
Fabien Potencier 2014-12-07 19:23:40 +01:00
commit b0ba74d49f
35 changed files with 116 additions and 112 deletions

View File

@ -54,17 +54,17 @@ class DoctrineExtensionTest extends \PHPUnit_Framework_TestCase
public function testFixManagersAutoMappingsWithTwoAutomappings() public function testFixManagersAutoMappingsWithTwoAutomappings()
{ {
$emConfigs = array( $emConfigs = array(
'em1'=> array( 'em1' => array(
'auto_mapping' => true 'auto_mapping' => true,
), ),
'em2'=> array( 'em2' => array(
'auto_mapping' => true 'auto_mapping' => true,
), ),
); );
$bundles = array( $bundles = array(
'FristBundle'=> 'My\FristBundle', 'FristBundle' => 'My\FristBundle',
'SecondBundle'=> 'My\SecondBundle', 'SecondBundle' => 'My\SecondBundle',
); );
$reflection = new \ReflectionClass(get_class($this->extension)); $reflection = new \ReflectionClass(get_class($this->extension));
@ -79,34 +79,34 @@ class DoctrineExtensionTest extends \PHPUnit_Framework_TestCase
return array( return array(
array( array(
array( // no auto mapping on em1 array( // no auto mapping on em1
'auto_mapping' => false 'auto_mapping' => false,
), ),
array( // no auto mapping on em2 array( // no auto mapping on em2
'auto_mapping' => false 'auto_mapping' => false,
), ),
array(), array(),
array() array(),
), ),
array( array(
array( // no auto mapping on em1 array( // no auto mapping on em1
'auto_mapping' => false 'auto_mapping' => false,
), ),
array( // auto mapping enabled on em2 array( // auto mapping enabled on em2
'auto_mapping' => true 'auto_mapping' => true,
), ),
array(), array(),
array( array(
'mappings' => array( 'mappings' => array(
'FristBundle' => array( 'FristBundle' => array(
'mapping' => true, 'mapping' => true,
'is_bundle' => true 'is_bundle' => true,
), ),
'SecondBundle' => array( 'SecondBundle' => array(
'mapping' => true, 'mapping' => true,
'is_bundle' => true 'is_bundle' => true,
) ),
) ),
) ),
), ),
array( array(
array( // no auto mapping on em1, but it defines SecondBundle as own array( // no auto mapping on em1, but it defines SecondBundle as own
@ -114,30 +114,30 @@ class DoctrineExtensionTest extends \PHPUnit_Framework_TestCase
'mappings' => array( 'mappings' => array(
'SecondBundle' => array( 'SecondBundle' => array(
'mapping' => true, 'mapping' => true,
'is_bundle' => true 'is_bundle' => true,
) ),
) ),
), ),
array( // auto mapping enabled on em2 array( // auto mapping enabled on em2
'auto_mapping' => true 'auto_mapping' => true,
), ),
array( array(
'mappings' => array( 'mappings' => array(
'SecondBundle' => array( 'SecondBundle' => array(
'mapping' => true, 'mapping' => true,
'is_bundle' => true 'is_bundle' => true,
) ),
) ),
), ),
array( array(
'mappings' => array( 'mappings' => array(
'FristBundle' => array( 'FristBundle' => array(
'mapping' => true, 'mapping' => true,
'is_bundle' => true 'is_bundle' => true,
) ),
) ),
) ),
) ),
); );
} }
@ -147,13 +147,13 @@ class DoctrineExtensionTest extends \PHPUnit_Framework_TestCase
public function testFixManagersAutoMappings(array $originalEm1, array $originalEm2, array $expectedEm1, array $expectedEm2) public function testFixManagersAutoMappings(array $originalEm1, array $originalEm2, array $expectedEm1, array $expectedEm2)
{ {
$emConfigs = array( $emConfigs = array(
'em1'=> $originalEm1, 'em1' => $originalEm1,
'em2'=> $originalEm2, 'em2' => $originalEm2,
); );
$bundles = array( $bundles = array(
'FristBundle'=> 'My\FristBundle', 'FristBundle' => 'My\FristBundle',
'SecondBundle'=> 'My\SecondBundle', 'SecondBundle' => 'My\SecondBundle',
); );
$reflection = new \ReflectionClass(get_class($this->extension)); $reflection = new \ReflectionClass(get_class($this->extension));
@ -163,10 +163,10 @@ class DoctrineExtensionTest extends \PHPUnit_Framework_TestCase
$newEmConfigs = $method->invoke($this->extension, $emConfigs, $bundles); $newEmConfigs = $method->invoke($this->extension, $emConfigs, $bundles);
$this->assertEquals($newEmConfigs["em1"], array_merge(array( $this->assertEquals($newEmConfigs["em1"], array_merge(array(
'auto_mapping' => false 'auto_mapping' => false,
), $expectedEm1)); ), $expectedEm1));
$this->assertEquals($newEmConfigs["em2"], array_merge(array( $this->assertEquals($newEmConfigs["em2"], array_merge(array(
'auto_mapping' => false 'auto_mapping' => false,
), $expectedEm2)); ), $expectedEm2));
} }

View File

@ -141,5 +141,4 @@ EOT
// We use a custom iterator to ignore VCS files // We use a custom iterator to ignore VCS files
$filesystem->mirror($originDir, $targetDir, Finder::create()->ignoreDotFiles(false)->in($originDir)); $filesystem->mirror($originDir, $targetDir, Finder::create()->ignoreDotFiles(false)->in($originDir));
} }
} }

View File

@ -122,6 +122,7 @@ class ControllerNameParser
* Attempts to find a bundle that is *similar* to the given bundle name * Attempts to find a bundle that is *similar* to the given bundle name
* *
* @param string $nonExistentBundleName * @param string $nonExistentBundleName
*
* @return string * @return string
*/ */
private function findAlternative($nonExistentBundleName) private function findAlternative($nonExistentBundleName)

View File

@ -12,9 +12,7 @@
namespace Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory; namespace Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory;
use Symfony\Component\Config\Definition\Builder\NodeDefinition; use Symfony\Component\Config\Definition\Builder\NodeDefinition;
use Symfony\Component\DependencyInjection\DefinitionDecorator; use Symfony\Component\DependencyInjection\DefinitionDecorator;
use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference; use Symfony\Component\DependencyInjection\Reference;

View File

@ -43,7 +43,7 @@ class FileLoaderLoadException extends \Exception
if (null === $sourceResource) { if (null === $sourceResource) {
$message .= sprintf('(which is loaded in resource "%s")', $this->varToString($resource)); $message .= sprintf('(which is loaded in resource "%s")', $this->varToString($resource));
} else { } else {
$message .= sprintf('(which is being imported from "%s")',$this->varToString($sourceResource)); $message .= sprintf('(which is being imported from "%s")', $this->varToString($sourceResource));
} }
$message .= '.'; $message .= '.';
@ -51,14 +51,14 @@ class FileLoaderLoadException extends \Exception
} elseif (null === $sourceResource) { } elseif (null === $sourceResource) {
$message .= sprintf('Cannot load resource "%s".', $this->varToString($resource)); $message .= sprintf('Cannot load resource "%s".', $this->varToString($resource));
} else { } else {
$message .= sprintf('Cannot import resource "%s" from "%s".',$this->varToString($resource),$this->varToString($sourceResource)); $message .= sprintf('Cannot import resource "%s" from "%s".', $this->varToString($resource), $this->varToString($sourceResource));
} }
// Is the resource located inside a bundle? // Is the resource located inside a bundle?
if ('@' === $resource[0]) { if ('@' === $resource[0]) {
$parts = explode(DIRECTORY_SEPARATOR, $resource); $parts = explode(DIRECTORY_SEPARATOR, $resource);
$bundle = substr($parts[0], 1); $bundle = substr($parts[0], 1);
$message .= ' '.sprintf('Make sure the "%s" bundle is correctly registered and loaded in the application kernel class.',$bundle); $message .= ' '.sprintf('Make sure the "%s" bundle is correctly registered and loaded in the application kernel class.', $bundle);
} }
parent::__construct($message, $code, $previous); parent::__construct($message, $code, $previous);

View File

@ -81,6 +81,7 @@ class Specificity
* 0 if they are equal, and 1 if the argument is lower * 0 if they are equal, and 1 if the argument is lower
* *
* @param Specificity $specificity * @param Specificity $specificity
*
* @return int * @return int
*/ */
public function compareTo(Specificity $specificity) public function compareTo(Specificity $specificity)

View File

@ -22,6 +22,7 @@ class ContainerAwareEventDispatcherTest extends AbstractEventDispatcherTest
protected function createEventDispatcher() protected function createEventDispatcher()
{ {
$container = new Container(); $container = new Container();
return new ContainerAwareEventDispatcher($container); return new ContainerAwareEventDispatcher($container);
} }

View File

@ -57,7 +57,7 @@ class ExpressionLanguageTest extends \PHPUnit_Framework_TestCase
public function testProviders() public function testProviders()
{ {
$expressionLanguage = new ExpressionLanguage(null, array(new TestProvider)); $expressionLanguage = new ExpressionLanguage(null, array(new TestProvider()));
$this->assertEquals('foo', $expressionLanguage->evaluate('identity("foo")')); $this->assertEquals('foo', $expressionLanguage->evaluate('identity("foo")'));
$this->assertEquals('"foo"', $expressionLanguage->compile('identity("foo")')); $this->assertEquals('"foo"', $expressionLanguage->compile('identity("foo")'));
} }

View File

@ -290,6 +290,7 @@ class Filesystem
if ($onWindows && $copyOnWindows) { if ($onWindows && $copyOnWindows) {
$this->mirror($originDir, $targetDir); $this->mirror($originDir, $targetDir);
return; return;
} }

View File

@ -167,6 +167,7 @@ class HttpCache implements HttpKernelInterface, TerminableInterface
* Gets the Esi instance * Gets the Esi instance
* *
* @throws \LogicException * @throws \LogicException
*
* @return Esi An Esi instance * @return Esi An Esi instance
* *
* @deprecated Deprecated since version 2.6, to be removed in 3.0. Use getSurrogate() instead * @deprecated Deprecated since version 2.6, to be removed in 3.0. Use getSurrogate() instead

View File

@ -29,7 +29,8 @@ class DumpDataCollectorTest extends \PHPUnit_Framework_TestCase
$this->assertSame('dump', $collector->getName()); $this->assertSame('dump', $collector->getName());
$collector->dump($data); $line = __LINE__; $collector->dump($data);
$line = __LINE__;
$this->assertSame(1, $collector->getDumpsCount()); $this->assertSame(1, $collector->getDumpsCount());
$dump = $collector->getDumps('html'); $dump = $collector->getDumps('html');
@ -61,7 +62,8 @@ class DumpDataCollectorTest extends \PHPUnit_Framework_TestCase
{ {
$data = new Data(array(array(456))); $data = new Data(array(array(456)));
$collector = new DumpDataCollector(); $collector = new DumpDataCollector();
$collector->dump($data); $line = __LINE__; $collector->dump($data);
$line = __LINE__;
ob_start(); ob_start();
$collector = null; $collector = null;

View File

@ -121,7 +121,7 @@ class UnixPipes extends AbstractPipes
$r = $this->pipes; $r = $this->pipes;
} }
// discard read on stdin // discard read on stdin
unset ($r[0]); unset($r[0]);
$w = isset($this->pipes[0]) ? array($this->pipes[0]) : null; $w = isset($this->pipes[0]) ? array($this->pipes[0]) : null;
$e = null; $e = null;

View File

@ -21,7 +21,6 @@ use Symfony\Component\Routing\Matcher\RequestMatcherInterface;
use Symfony\Component\Routing\Matcher\UrlMatcherInterface; use Symfony\Component\Routing\Matcher\UrlMatcherInterface;
use Symfony\Component\Routing\Matcher\Dumper\MatcherDumperInterface; use Symfony\Component\Routing\Matcher\Dumper\MatcherDumperInterface;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\ExpressionLanguage\ExpressionLanguage;
use Symfony\Component\ExpressionLanguage\ExpressionFunctionProviderInterface; use Symfony\Component\ExpressionLanguage\ExpressionFunctionProviderInterface;
/** /**

View File

@ -38,7 +38,8 @@ class AuthenticationUtils
/** /**
* @param bool $clearSession * @param bool $clearSession
* @return null|AuthenticationException *
* @return AuthenticationException|null
*/ */
public function getLastAuthenticationError($clearSession = true) public function getLastAuthenticationError($clearSession = true)
{ {

View File

@ -183,7 +183,7 @@ class RememberMeListenerTest extends \PHPUnit_Framework_TestCase
public function testOnCoreSecurityInteractiveLoginEventIsDispatchedIfDispatcherIsPresent() public function testOnCoreSecurityInteractiveLoginEventIsDispatchedIfDispatcherIsPresent()
{ {
list($listener, $context, $service, $manager,, $dispatcher) = $this->getListener(true); list($listener, $context, $service, $manager, , $dispatcher) = $this->getListener(true);
$context $context
->expects($this->once()) ->expects($this->once())

View File

@ -19,7 +19,7 @@ class RemoteUserAuthenticationListenerTest extends \PHPUnit_Framework_TestCase
public function testGetPreAuthenticatedData() public function testGetPreAuthenticatedData()
{ {
$serverVars = array( $serverVars = array(
'REMOTE_USER' => 'TheUser' 'REMOTE_USER' => 'TheUser',
); );
$request = new Request(array(), array(), array(), array(), array(), $serverVars); $request = new Request(array(), array(), array(), array(), array(), $serverVars);
@ -69,7 +69,7 @@ class RemoteUserAuthenticationListenerTest extends \PHPUnit_Framework_TestCase
$userCredentials = array('TheUser', null); $userCredentials = array('TheUser', null);
$request = new Request(array(), array(), array(), array(), array(), array( $request = new Request(array(), array(), array(), array(), array(), array(
'TheUserKey' => 'TheUser' 'TheUserKey' => 'TheUser',
)); ));
$context = $this->getMock('Symfony\Component\Security\Core\SecurityContextInterface'); $context = $this->getMock('Symfony\Component\Security\Core\SecurityContextInterface');

View File

@ -151,12 +151,12 @@ class PropertyNormalizerTest extends \PHPUnit_Framework_TestCase
array( array(
array( array(
'bar' => function ($bar) { 'bar' => function ($bar) {
return null; return;
}, },
), ),
'baz', 'baz',
array('foo' => '', 'bar' => null), array('foo' => '', 'bar' => null),
'Null an item' 'Null an item',
), ),
array( array(
array( array(

View File

@ -47,7 +47,7 @@ class LoggingTranslator implements TranslatorInterface
*/ */
public function trans($id, array $parameters = array(), $domain = null, $locale = null) public function trans($id, array $parameters = array(), $domain = null, $locale = null)
{ {
$trans = $this->translator->trans($id, $parameters , $domain , $locale); $trans = $this->translator->trans($id, $parameters, $domain, $locale);
$this->log($id, $domain, $locale); $this->log($id, $domain, $locale);
return $trans; return $trans;