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

View File

@ -141,5 +141,4 @@ EOT
// We use a custom iterator to ignore VCS files
$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
*
* @param string $nonExistentBundleName
*
* @return string
*/
private function findAlternative($nonExistentBundleName)

View File

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

View File

@ -43,7 +43,7 @@ class FileLoaderLoadException extends \Exception
if (null === $sourceResource) {
$message .= sprintf('(which is loaded in resource "%s")', $this->varToString($resource));
} else {
$message .= sprintf('(which is being imported from "%s")',$this->varToString($sourceResource));
$message .= sprintf('(which is being imported from "%s")', $this->varToString($sourceResource));
}
$message .= '.';
@ -51,14 +51,14 @@ class FileLoaderLoadException extends \Exception
} elseif (null === $sourceResource) {
$message .= sprintf('Cannot load resource "%s".', $this->varToString($resource));
} 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?
if ('@' === $resource[0]) {
$parts = explode(DIRECTORY_SEPARATOR, $resource);
$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);

View File

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

View File

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

View File

@ -57,7 +57,7 @@ class ExpressionLanguageTest extends \PHPUnit_Framework_TestCase
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->compile('identity("foo")'));
}

View File

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

View File

@ -167,6 +167,7 @@ class HttpCache implements HttpKernelInterface, TerminableInterface
* Gets the Esi instance
*
* @throws \LogicException
*
* @return Esi An Esi instance
*
* @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());
$collector->dump($data); $line = __LINE__;
$collector->dump($data);
$line = __LINE__;
$this->assertSame(1, $collector->getDumpsCount());
$dump = $collector->getDumps('html');
@ -61,7 +62,8 @@ class DumpDataCollectorTest extends \PHPUnit_Framework_TestCase
{
$data = new Data(array(array(456)));
$collector = new DumpDataCollector();
$collector->dump($data); $line = __LINE__;
$collector->dump($data);
$line = __LINE__;
ob_start();
$collector = null;

View File

@ -121,7 +121,7 @@ class UnixPipes extends AbstractPipes
$r = $this->pipes;
}
// discard read on stdin
unset ($r[0]);
unset($r[0]);
$w = isset($this->pipes[0]) ? array($this->pipes[0]) : 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\Dumper\MatcherDumperInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\ExpressionLanguage\ExpressionLanguage;
use Symfony\Component\ExpressionLanguage\ExpressionFunctionProviderInterface;
/**

View File

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

View File

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

View File

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

View File

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

View File

@ -47,7 +47,7 @@ class LoggingTranslator implements TranslatorInterface
*/
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);
return $trans;