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

@ -196,7 +196,7 @@ abstract class RegisterMappingsPass implements CompilerPassInterface
* @return string a service definition name
*
* @throws ParameterNotFoundException if none of the managerParameters has a
* non-empty value.
* non-empty value.
*/
private function getConfigurationServiceName(ContainerBuilder $container)
{

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

@ -189,16 +189,16 @@ abstract class Descriptor implements DescriptorInterface
* Common options are:
* * name: name of listened event
*
* @param EventDispatcherInterface $eventDispatcher
* @param array $options
* @param EventDispatcherInterface $eventDispatcher
* @param array $options
*/
abstract protected function describeEventDispatcherListeners(EventDispatcherInterface $eventDispatcher, array $options = array());
/**
* Describes a callable.
*
* @param callable $callable
* @param array $options
* @param callable $callable
* @param array $options
*/
abstract protected function describeCallable($callable, array $options = array());

View File

@ -242,7 +242,7 @@ class JsonDescriptor extends Descriptor
/**
* @param EventDispatcherInterface $eventDispatcher
* @param string|null $event
* @param string|null $event
*
* @return array
*/
@ -270,7 +270,7 @@ class JsonDescriptor extends Descriptor
/**
* @param callable $callable
* @param array $options
* @param array $options
*
* @return array
*/

View File

@ -412,8 +412,8 @@ class XmlDescriptor extends Descriptor
}
/**
* @param EventDispatcherInterface $eventDispatcher
* @param string|null $event
* @param EventDispatcherInterface $eventDispatcher
* @param string|null $event
*
* @return \DOMDocument
*/

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

@ -382,7 +382,7 @@ class ProgressBar
/**
* Sets the current progress.
*
* @param int $step The current progress
* @param int $step The current progress
*
* @throws \LogicException
*/

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

@ -338,7 +338,7 @@ class ErrorHandler
/**
* Handles errors by filtering then logging them according to the configured bit fields.
*
* @param int $type One of the E_* constants
* @param int $type One of the E_* constants
* @param string $file
* @param int $line
* @param array $context
@ -584,7 +584,7 @@ class ErrorHandler
/**
* Sets the level at which the conversion to Exception is done.
*
* @param int|null $level The level (null to use the error_reporting() value and 0 to disable)
* @param int|null $level The level (null to use the error_reporting() value and 0 to disable)
*
* @deprecated since 2.6, to be removed in 3.0. Use throwAt() instead.
*/
@ -597,7 +597,7 @@ class ErrorHandler
/**
* Sets the display_errors flag value.
*
* @param int $displayErrors The display_errors flag value
* @param int $displayErrors The display_errors flag value
*
* @deprecated since 2.6, to be removed in 3.0. Use throwAt() instead.
*/

View File

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

View File

@ -41,25 +41,25 @@ class ExpressionFunction
* @param callable $compiler A callable able to compile the function
* @param callable $evaluator A callable able to evaluate the function
*/
public function __construct($name, $compiler, $evaluator)
{
$this->name = $name;
$this->compiler = $compiler;
$this->evaluator = $evaluator;
}
public function __construct($name, $compiler, $evaluator)
{
$this->name = $name;
$this->compiler = $compiler;
$this->evaluator = $evaluator;
}
public function getName()
{
return $this->name;
}
public function getName()
{
return $this->name;
}
public function getCompiler()
{
return $this->compiler;
}
public function getCompiler()
{
return $this->compiler;
}
public function getEvaluator()
{
return $this->evaluator;
}
public function getEvaluator()
{
return $this->evaluator;
}
}

View File

@ -32,7 +32,7 @@ class ExpressionLanguage
protected $functions = array();
/**
* @param ParserCacheInterface $cache
* @param ParserCacheInterface $cache
* @param ExpressionFunctionProviderInterface[] $providers
*/
public function __construct(ParserCacheInterface $cache = null, array $providers = array())

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

@ -256,11 +256,11 @@ class ParameterBag implements \IteratorAggregate, \Countable
/**
* Returns the parameter value converted to boolean.
*
* @param string $key The parameter key
* @param mixed $default The default value if the parameter key does not exist
* @param bool $deep If true, a path like foo[bar] will find deeper items
* @param string $key The parameter key
* @param mixed $default The default value if the parameter key does not exist
* @param bool $deep If true, a path like foo[bar] will find deeper items
*
* @return bool The filtered value
* @return bool The filtered value
*/
public function getBoolean($key, $default = false, $deep = false)
{

View File

@ -28,8 +28,8 @@ class DumpListener implements EventSubscriberInterface
private $dumper;
/**
* @param ClonerInterface $cloner Cloner service.
* @param DataDumperInterface $dumper Dumper service.
* @param ClonerInterface $cloner Cloner service.
* @param DataDumperInterface $dumper Dumper service.
*/
public function __construct(ClonerInterface $cloner, DataDumperInterface $dumper)
{

View File

@ -73,7 +73,7 @@ class Esi implements SurrogateInterface
*
* @param Request $request A Request instance
*
* @return bool true if one surrogate has ESI/1.0 capability, false otherwise
* @return bool true if one surrogate has ESI/1.0 capability, false otherwise
*
* @deprecated Deprecated since version 2.6, to be removed in 3.0. Use hasSurrogateCapability() instead
*/
@ -142,7 +142,7 @@ class Esi implements SurrogateInterface
*
* @param Response $response A Response instance
*
* @return bool true if the Response needs to be parsed, false otherwise
* @return bool true if the Response needs to be parsed, false otherwise
*
* @deprecated Deprecated since version 2.6, to be removed in 3.0. Use needsParsing() instead
*/

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

@ -35,7 +35,7 @@ interface SurrogateInterface
*
* @param Request $request A Request instance
*
* @return bool true if one surrogate has Surrogate capability, false otherwise
* @return bool true if one surrogate has Surrogate capability, false otherwise
*/
public function hasSurrogateCapability(Request $request);
@ -60,17 +60,17 @@ interface SurrogateInterface
*
* @param Response $response A Response instance
*
* @return bool true if the Response needs to be parsed, false otherwise
* @return bool true if the Response needs to be parsed, false otherwise
*/
public function needsParsing(Response $response);
/**
* Renders a Surrogate tag.
*
* @param string $uri A URI
* @param string $alt An alternate URI
* @param bool $ignoreErrors Whether to ignore errors or not
* @param string $comment A comment to add as an esi:include tag
* @param string $uri A URI
* @param string $alt An alternate URI
* @param bool $ignoreErrors Whether to ignore errors or not
* @param string $comment A comment to add as an esi:include tag
*
* @return string
*/

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

@ -54,7 +54,7 @@ abstract class AbstractVoter implements VoterInterface
* @param object $object The object to secure
* @param array $attributes An array of attributes associated with the method being invoked
*
* @return int either ACCESS_GRANTED, ACCESS_ABSTAIN, or ACCESS_DENIED
* @return int either ACCESS_GRANTED, ACCESS_ABSTAIN, or ACCESS_DENIED
*/
public function vote(TokenInterface $token, $object, array $attributes)
{
@ -85,14 +85,14 @@ abstract class AbstractVoter implements VoterInterface
/**
* Return an array of supported classes. This will be called by supportsClass
*
* @return array an array of supported classes, i.e. array('Acme\DemoBundle\Model\Product')
* @return array an array of supported classes, i.e. array('Acme\DemoBundle\Model\Product')
*/
abstract protected function getSupportedClasses();
/**
* Return an array of supported attributes. This will be called by supportsAttribute
*
* @return array an array of supported attributes, i.e. array('CREATE', 'READ')
* @return array an array of supported attributes, i.e. array('CREATE', 'READ')
*/
abstract protected function getSupportedAttributes();

View File

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

View File

@ -24,8 +24,8 @@ class CustomAuthenticationFailureHandler implements AuthenticationFailureHandler
/**
* Constructor.
*
* @param AuthenticationFailureHandlerInterface $handler An AuthenticationFailureHandlerInterface instance
* @param array $options Options for processing a successful authentication attempt
* @param AuthenticationFailureHandlerInterface $handler An AuthenticationFailureHandlerInterface instance
* @param array $options Options for processing a successful authentication attempt
*/
public function __construct(AuthenticationFailureHandlerInterface $handler, array $options)
{

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

@ -180,7 +180,7 @@ class PropertyNormalizer extends SerializerAwareNormalizer implements Normalizer
/**
* Format an attribute name, for example to convert a snake_case name to camelCase.
*
* @param string $attributeName
* @param string $attributeName
*
* @return string
*/

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;

View File

@ -172,8 +172,8 @@ abstract class AbstractCloner implements ClonerInterface
/**
* Casts an object to an array representation.
*
* @param Stub $stub The Stub for the casted object.
* @param bool $isNested True if the object is nested in the dumped structure.
* @param Stub $stub The Stub for the casted object.
* @param bool $isNested True if the object is nested in the dumped structure.
*
* @return array The object casted as array.
*/
@ -223,8 +223,8 @@ abstract class AbstractCloner implements ClonerInterface
/**
* Casts a resource to an array representation.
*
* @param Stub $stub The Stub for the casted resource.
* @param bool $isNested True if the object is nested in the dumped structure.
* @param Stub $stub The Stub for the casted resource.
* @param bool $isNested True if the object is nested in the dumped structure.
*
* @return array The resource casted as array.
*/

View File

@ -41,10 +41,10 @@ class Parser
/**
* Parses a YAML string to a PHP value.
*
* @param string $value A YAML string
* @param bool $exceptionOnInvalidType true if an exception must be thrown on invalid types (a PHP resource or object), false otherwise
* @param bool $objectSupport true if object support is enabled, false otherwise
* @param bool $objectForMap true if maps should return a stdClass instead of array()
* @param string $value A YAML string
* @param bool $exceptionOnInvalidType true if an exception must be thrown on invalid types (a PHP resource or object), false otherwise
* @param bool $objectSupport true if object support is enabled, false otherwise
* @param bool $objectForMap true if maps should return a stdClass instead of array()
*
* @return mixed A PHP value
*