minor #16790 CS: general fixes (keradus)

This PR was merged into the 2.3 branch.

Discussion
----------

CS: general fixes

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | ?
| Fixed tickets | N/A
| License       | MIT
| Doc PR        | N/A

Commits
-------

d3f671e CS: general fixes
This commit is contained in:
Christophe Coevoet 2015-12-05 13:33:53 +01:00
commit 2d14689485
13 changed files with 47 additions and 39 deletions

View File

@ -92,12 +92,16 @@ class DoctrineTokenProvider implements TokenProviderInterface
{
$sql = 'UPDATE rememberme_token SET value=:value, lastUsed=:lastUsed'
.' WHERE series=:series';
$paramValues = array('value' => $tokenValue,
'lastUsed' => $lastUsed,
'series' => $series,);
$paramTypes = array('value' => \PDO::PARAM_STR,
'lastUsed' => DoctrineType::DATETIME,
'series' => \PDO::PARAM_STR,);
$paramValues = array(
'value' => $tokenValue,
'lastUsed' => $lastUsed,
'series' => $series,
);
$paramTypes = array(
'value' => \PDO::PARAM_STR,
'lastUsed' => DoctrineType::DATETIME,
'series' => \PDO::PARAM_STR,
);
$updated = $this->conn->executeUpdate($sql, $paramValues, $paramTypes);
if ($updated < 1) {
throw new TokenNotFoundException('No token found.');
@ -112,16 +116,20 @@ class DoctrineTokenProvider implements TokenProviderInterface
$sql = 'INSERT INTO rememberme_token'
.' (class, username, series, value, lastUsed)'
.' VALUES (:class, :username, :series, :value, :lastUsed)';
$paramValues = array('class' => $token->getClass(),
'username' => $token->getUsername(),
'series' => $token->getSeries(),
'value' => $token->getTokenValue(),
'lastUsed' => $token->getLastUsed(),);
$paramTypes = array('class' => \PDO::PARAM_STR,
'username' => \PDO::PARAM_STR,
'series' => \PDO::PARAM_STR,
'value' => \PDO::PARAM_STR,
'lastUsed' => DoctrineType::DATETIME,);
$paramValues = array(
'class' => $token->getClass(),
'username' => $token->getUsername(),
'series' => $token->getSeries(),
'value' => $token->getTokenValue(),
'lastUsed' => $token->getLastUsed(),
);
$paramTypes = array(
'class' => \PDO::PARAM_STR,
'username' => \PDO::PARAM_STR,
'series' => \PDO::PARAM_STR,
'value' => \PDO::PARAM_STR,
'lastUsed' => DoctrineType::DATETIME,
);
$this->conn->executeUpdate($sql, $paramValues, $paramTypes);
}
}

View File

@ -32,7 +32,7 @@ class TranslationExtensionTest extends TestCase
public function testTrans($template, $expected, array $variables = array())
{
if ($expected != $this->getTemplate($template)->render($variables)) {
print $template."\n";
echo $template."\n";
$loader = new \Twig_Loader_Array(array('index' => $template));
$twig = new \Twig_Environment($loader, array('debug' => true, 'cache' => false));
$twig->addExtension(new TranslationExtension(new Translator('en', new MessageSelector())));

View File

@ -48,9 +48,9 @@ class TemplateManagerTest extends TestCase
$profiler = $this->mockProfiler();
$twigEnvironment = $this->mockTwigEnvironment();
$templates = array(
'data_collector.foo' => array('foo','FooBundle:Collector:foo'),
'data_collector.bar' => array('bar','FooBundle:Collector:bar'),
'data_collector.baz' => array('baz','FooBundle:Collector:baz'),
'data_collector.foo' => array('foo', 'FooBundle:Collector:foo'),
'data_collector.bar' => array('bar', 'FooBundle:Collector:bar'),
'data_collector.baz' => array('baz', 'FooBundle:Collector:baz'),
);
$this->templateManager = new TemplateManager($profiler, $twigEnvironment, $templates);

View File

@ -97,7 +97,7 @@ class ClassLoader
$paths
));
} elseif (!in_array($paths, $this->prefixes[$prefix])) {
$this->prefixes[$prefix][] = $paths;
$this->prefixes[$prefix][] = $paths;
}
} else {
$this->prefixes[$prefix] = array_unique((array) $paths);

View File

@ -54,7 +54,7 @@ class StringInputTest extends \PHPUnit_Framework_TestCase
array('"quoted"', array('quoted'), '->tokenize() parses quoted arguments'),
array("'quoted'", array('quoted'), '->tokenize() parses quoted arguments'),
array("'a\rb\nc\td'", array("a\rb\nc\td"), '->tokenize() parses whitespace chars in strings'),
array("'a'\r'b'\n'c'\t'd'", array('a','b','c','d'), '->tokenize() parses whitespace chars between args as spaces'),
array("'a'\r'b'\n'c'\t'd'", array('a', 'b', 'c', 'd'), '->tokenize() parses whitespace chars between args as spaces'),
array('\"quoted\"', array('"quoted"'), '->tokenize() parses escaped-quoted arguments'),
array("\'quoted\'", array('\'quoted\''), '->tokenize() parses escaped-quoted arguments'),
array('-a', array('-a'), '->tokenize() parses short options'),

View File

@ -29,7 +29,7 @@ class ElementNodeTest extends AbstractNodeTest
return array(
array(new ElementNode(), 0),
array(new ElementNode(null, 'element'), 1),
array(new ElementNode('namespace', 'element'),1),
array(new ElementNode('namespace', 'element'), 1),
);
}
}

View File

@ -340,7 +340,7 @@ class RequestTest extends \PHPUnit_Framework_TestCase
array('json', array('application/json', 'application/x-json')),
array('xml', array('text/xml', 'application/xml', 'application/x-xml')),
array('rdf', array('application/rdf+xml')),
array('atom',array('application/atom+xml')),
array('atom', array('application/atom+xml')),
);
}

View File

@ -86,7 +86,7 @@ class PhpGeneratorDumperTest extends \PHPUnit_Framework_TestCase
public function testDumpWithTooManyRoutes()
{
$this->routeCollection->add('Test', new Route('/testing/{foo}'));
for ( $i = 0; $i < 32769; ++$i ) {
for ($i = 0; $i < 32769; ++$i) {
$this->routeCollection->add('route_'.$i, new Route('/route_'.$i));
}
$this->routeCollection->add('Test2', new Route('/testing2'));

View File

@ -571,7 +571,7 @@ QUERY;
$oidCache[$oidLookupKey] = new ObjectIdentity($objectIdentifier, $classType);
}
$acl = new Acl((int) $aclId, $oidCache[$oidLookupKey], $permissionGrantingStrategy, $emptyArray, !!$entriesInheriting);
$acl = new Acl((int) $aclId, $oidCache[$oidLookupKey], $permissionGrantingStrategy, $emptyArray, (bool) $entriesInheriting);
// keep a local, and global reference to this ACL
$loadedAcls[$classType][$objectIdentifier] = $acl;
@ -613,9 +613,9 @@ QUERY;
}
if (null === $fieldName) {
$loadedAces[$aceId] = new Entry((int) $aceId, $acl, $sids[$key], $grantingStrategy, (int) $mask, !!$granting, !!$auditFailure, !!$auditSuccess);
$loadedAces[$aceId] = new Entry((int) $aceId, $acl, $sids[$key], $grantingStrategy, (int) $mask, (bool) $granting, (bool) $auditFailure, (bool) $auditSuccess);
} else {
$loadedAces[$aceId] = new FieldEntry((int) $aceId, $acl, $fieldName, $sids[$key], $grantingStrategy, (int) $mask, !!$granting, !!$auditFailure, !!$auditSuccess);
$loadedAces[$aceId] = new FieldEntry((int) $aceId, $acl, $fieldName, $sids[$key], $grantingStrategy, (int) $mask, (bool) $granting, (bool) $auditFailure, (bool) $auditSuccess);
}
}
$ace = $loadedAces[$aceId];

View File

@ -97,7 +97,7 @@ class InMemoryUserProvider implements UserProviderInterface
/**
* Returns the user by given username.
*
* @param string $username The username.
* @param string $username The username.
*
* @return User
*

View File

@ -74,7 +74,7 @@ class XmlEncoderTest extends \PHPUnit_Framework_TestCase
'@Type' => 'test',
),
'föo_bär' => 'a',
'Bar' => array(1,2,3),
'Bar' => array(1, 2, 3),
'a' => 'b',
);
$expected = '<?xml version="1.0"?>'."\n".
@ -283,7 +283,7 @@ class XmlEncoderTest extends \PHPUnit_Framework_TestCase
'@Type' => 'test',
),
'föo_bär' => 'a',
'Bar' => array(1,2,3),
'Bar' => array(1, 2, 3),
'a' => 'b',
);
$expected = array(
@ -296,7 +296,7 @@ class XmlEncoderTest extends \PHPUnit_Framework_TestCase
'@Type' => 'test',
),
'föo_bär' => 'a',
'Bar' => array(1,2,3),
'Bar' => array(1, 2, 3),
'a' => 'b',
);
$xml = $this->encoder->encode($obj, 'xml');

View File

@ -91,9 +91,9 @@ class GetSetMethodNormalizerTest extends \PHPUnit_Framework_TestCase
public function attributeProvider()
{
return array(
array('attribute_test', array('attribute_test'),'AttributeTest'),
array('attribute_test', array('any'),'attribute_test'),
array('attribute', array('attribute'),'Attribute'),
array('attribute_test', array('attribute_test'), 'AttributeTest'),
array('attribute_test', array('any'), 'attribute_test'),
array('attribute', array('attribute'), 'Attribute'),
array('attribute', array(), 'attribute'),
);
}

View File

@ -60,10 +60,10 @@ class PluralizationRulesTest extends \PHPUnit_Framework_TestCase
public function successLangcodes()
{
return array(
array('1', array('ay','bo', 'cgg','dz','id', 'ja', 'jbo', 'ka','kk','km','ko','ky')),
array('1', array('ay', 'bo', 'cgg', 'dz', 'id', 'ja', 'jbo', 'ka', 'kk', 'km', 'ko', 'ky')),
array('2', array('nl', 'fr', 'en', 'de', 'de_GE', 'hy', 'hy_AM')),
array('3', array('be','bs','cs','hr')),
array('4', array('cy','mt', 'sl')),
array('3', array('be', 'bs', 'cs', 'hr')),
array('4', array('cy', 'mt', 'sl')),
array('5', array()),
array('6', array('ar')),
);
@ -83,7 +83,7 @@ class PluralizationRulesTest extends \PHPUnit_Framework_TestCase
array('1', array('fa')),
array('2', array('jbo')),
array('3', array('cbs')),
array('4', array('gd','kw')),
array('4', array('gd', 'kw')),
array('5', array('ga')),
array('6', array()),
);