CS: Pre incrementation/decrementation should be used if possible
This commit is contained in:
parent
89f6e1e115
commit
c5123d6881
@ -121,7 +121,7 @@ class DbalLoggerTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
$shortString = '';
|
||||
$longString = '';
|
||||
for ($i = 1; $i <= DbalLogger::MAX_STRING_LENGTH; $i++) {
|
||||
for ($i = 1; $i <= DbalLogger::MAX_STRING_LENGTH; ++$i) {
|
||||
$shortString .= $testStringArray[$i % $testStringCount];
|
||||
$longString .= $testStringArray[$i % $testStringCount];
|
||||
}
|
||||
|
@ -141,7 +141,7 @@ class CodeExtension extends \Twig_Extension
|
||||
$content = preg_split('#<br />#', $code);
|
||||
|
||||
$lines = array();
|
||||
for ($i = max($line - 3, 1), $max = min($line + 3, count($content)); $i <= $max; $i++) {
|
||||
for ($i = max($line - 3, 1), $max = min($line + 3, count($content)); $i <= $max; ++$i) {
|
||||
$lines[] = '<li'.($i == $line ? ' class="selected"' : '').'><code>'.self::fixCodeMarkup($content[$i - 1]).'</code></li>';
|
||||
}
|
||||
|
||||
|
@ -143,7 +143,7 @@ EOF
|
||||
$optionsCount = 0;
|
||||
foreach ($options as $option) {
|
||||
if ($input->getOption($option)) {
|
||||
$optionsCount++;
|
||||
++$optionsCount;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -135,7 +135,7 @@ class CodeHelper extends Helper
|
||||
$content = preg_split('#<br />#', $code);
|
||||
|
||||
$lines = array();
|
||||
for ($i = max($line - 3, 1), $max = min($line + 3, count($content)); $i <= $max; $i++) {
|
||||
for ($i = max($line - 3, 1), $max = min($line + 3, count($content)); $i <= $max; ++$i) {
|
||||
$lines[] = '<li'.($i == $line ? ' class="selected"' : '').'><code>'.self::fixCodeMarkup($content[$i - 1]).'</code></li>';
|
||||
}
|
||||
|
||||
|
@ -148,7 +148,7 @@ class PhpExtractor implements ExtractorInterface
|
||||
{
|
||||
$tokenIterator = new \ArrayIterator($tokens);
|
||||
|
||||
for ($key = 0; $key < $tokenIterator->count(); $key++) {
|
||||
for ($key = 0; $key < $tokenIterator->count(); ++$key) {
|
||||
foreach ($this->sequences as $sequence) {
|
||||
$message = '';
|
||||
$tokenIterator->seek($key);
|
||||
|
@ -142,7 +142,7 @@ EOF
|
||||
$result = array();
|
||||
while ($position < $max) {
|
||||
$result[$position + 1] = $lines[$position];
|
||||
$position++;
|
||||
++$position;
|
||||
}
|
||||
|
||||
return $result;
|
||||
|
@ -95,7 +95,7 @@ class ClassMapGenerator
|
||||
$classes = array();
|
||||
|
||||
$namespace = '';
|
||||
for ($i = 0, $max = count($tokens); $i < $max; $i++) {
|
||||
for ($i = 0, $max = count($tokens); $i < $max; ++$i) {
|
||||
$token = $tokens[$i];
|
||||
|
||||
if (is_string($token)) {
|
||||
|
@ -91,7 +91,7 @@ abstract class FileLoader extends Loader
|
||||
}
|
||||
|
||||
$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));
|
||||
|
@ -759,7 +759,7 @@ class Application
|
||||
'args' => array(),
|
||||
));
|
||||
|
||||
for ($i = 0, $count = count($trace); $i < $count; $i++) {
|
||||
for ($i = 0, $count = count($trace); $i < $count; ++$i) {
|
||||
$class = isset($trace[$i]['class']) ? $trace[$i]['class'] : '';
|
||||
$type = isset($trace[$i]['type']) ? $trace[$i]['type'] : '';
|
||||
$function = $trace[$i]['function'];
|
||||
|
@ -131,7 +131,7 @@ class DialogHelper extends Helper
|
||||
// Backspace Character
|
||||
if ("\177" === $c) {
|
||||
if (0 === $numMatches && 0 !== $i) {
|
||||
$i--;
|
||||
--$i;
|
||||
// Move cursor backwards
|
||||
$output->write("\033[1D");
|
||||
}
|
||||
@ -184,7 +184,7 @@ class DialogHelper extends Helper
|
||||
} else {
|
||||
$output->write($c);
|
||||
$ret .= $c;
|
||||
$i++;
|
||||
++$i;
|
||||
|
||||
$numMatches = 0;
|
||||
$ofs = 0;
|
||||
|
@ -334,7 +334,7 @@ class TableHelper extends Helper
|
||||
}
|
||||
|
||||
$markup = $this->crossingChar;
|
||||
for ($column = 0; $column < $count; $column++) {
|
||||
for ($column = 0; $column < $count; ++$column) {
|
||||
$markup .= str_repeat($this->horizontalBorderChar, $this->getColumnWidth($column))
|
||||
.$this->crossingChar
|
||||
;
|
||||
@ -366,7 +366,7 @@ class TableHelper extends Helper
|
||||
}
|
||||
|
||||
$this->renderColumnSeparator();
|
||||
for ($column = 0, $count = $this->getNumberOfColumns(); $column < $count; $column++) {
|
||||
for ($column = 0, $count = $this->getNumberOfColumns(); $column < $count; ++$column) {
|
||||
$this->renderCell($row, $column, $cellFormat);
|
||||
$this->renderColumnSeparator();
|
||||
}
|
||||
|
@ -123,7 +123,7 @@ class ArgvInput extends Input
|
||||
private function parseShortOptionSet($name)
|
||||
{
|
||||
$len = strlen($name);
|
||||
for ($i = 0; $i < $len; $i++) {
|
||||
for ($i = 0; $i < $len; ++$i) {
|
||||
if (!$this->definition->hasShortcut($name[$i])) {
|
||||
throw new \RuntimeException(sprintf('The "-%s" option does not exist.', $name[$i]));
|
||||
}
|
||||
|
@ -100,7 +100,7 @@ class TokenStream
|
||||
throw new InternalErrorException('Unexpected token stream end.');
|
||||
}
|
||||
|
||||
return $this->tokens[$this->cursor ++];
|
||||
return $this->tokens[$this->cursor++];
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -84,7 +84,7 @@ class FunctionExtension extends AbstractExtension
|
||||
|
||||
if ($last) {
|
||||
$expr = 'last() - '.$expr;
|
||||
$b--;
|
||||
--$b;
|
||||
}
|
||||
|
||||
if (0 !== $b) {
|
||||
|
@ -189,9 +189,9 @@ class FlattenExceptionTest extends \PHPUnit_Framework_TestCase
|
||||
public function testTooBigArray()
|
||||
{
|
||||
$a = array();
|
||||
for ($i = 0; $i < 20; $i++) {
|
||||
for ($j = 0; $j < 50; $j++) {
|
||||
for ($k = 0; $k < 10; $k++) {
|
||||
for ($i = 0; $i < 20; ++$i) {
|
||||
for ($j = 0; $j < 50; ++$j) {
|
||||
for ($k = 0; $k < 10; ++$k) {
|
||||
$a[$i][$j][$k] = 'value';
|
||||
}
|
||||
}
|
||||
|
@ -125,7 +125,7 @@ class EventDispatcherTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
$invoked = 0;
|
||||
$listener = function () use (&$invoked) {
|
||||
$invoked++;
|
||||
++$invoked;
|
||||
};
|
||||
$this->dispatcher->addListener('pre.foo', $listener);
|
||||
$this->dispatcher->addListener('post.foo', $listener);
|
||||
|
@ -324,7 +324,7 @@ class Filesystem
|
||||
// Find for which directory the common path stops
|
||||
$index = 0;
|
||||
while (isset($startPathArr[$index]) && isset($endPathArr[$index]) && $startPathArr[$index] === $endPathArr[$index]) {
|
||||
$index++;
|
||||
++$index;
|
||||
}
|
||||
|
||||
// Determine how deep the start path is relative to the common path (ie, "web/bundles" = 2 levels)
|
||||
|
@ -105,7 +105,7 @@ class Glob implements ValueInterface
|
||||
$inCurlies = 0;
|
||||
$regex = '';
|
||||
$sizeGlob = strlen($this->pattern);
|
||||
for ($i = 0; $i < $sizeGlob; $i++) {
|
||||
for ($i = 0; $i < $sizeGlob; ++$i) {
|
||||
$car = $this->pattern[$i];
|
||||
if ($firstByte) {
|
||||
if ($strictLeadingDot && '.' !== $car) {
|
||||
|
@ -51,7 +51,7 @@ class Glob
|
||||
$inCurlies = 0;
|
||||
$regex = '';
|
||||
$sizeGlob = strlen($glob);
|
||||
for ($i = 0; $i < $sizeGlob; $i++) {
|
||||
for ($i = 0; $i < $sizeGlob; ++$i) {
|
||||
$car = $glob[$i];
|
||||
if ($firstByte) {
|
||||
if ($strictLeadingDot && '.' !== $car) {
|
||||
|
@ -466,7 +466,7 @@ class FinderTest extends Iterator\RealIteratorTestCase
|
||||
$i = 0;
|
||||
|
||||
foreach ($directory as $dir) {
|
||||
$i++;
|
||||
++$i;
|
||||
}
|
||||
|
||||
$this->assertCount($i, $directory);
|
||||
@ -478,7 +478,7 @@ class FinderTest extends Iterator\RealIteratorTestCase
|
||||
$i = 0;
|
||||
|
||||
foreach ($files as $file) {
|
||||
$i++;
|
||||
++$i;
|
||||
}
|
||||
|
||||
$this->assertCount($i, $files);
|
||||
|
@ -31,7 +31,7 @@ class FilterIteratorTest extends RealIteratorTestCase
|
||||
|
||||
$c = 0;
|
||||
foreach ($i as $item) {
|
||||
$c++;
|
||||
++$c;
|
||||
}
|
||||
|
||||
$this->assertEquals(1, $c);
|
||||
@ -40,7 +40,7 @@ class FilterIteratorTest extends RealIteratorTestCase
|
||||
|
||||
$c = 0;
|
||||
foreach ($i as $item) {
|
||||
$c++;
|
||||
++$c;
|
||||
}
|
||||
|
||||
// This would fail with \FilterIterator but works with Symfony\Component\Finder\Iterator\FilterIterator
|
||||
|
@ -110,7 +110,7 @@ class IpUtils
|
||||
$bytesAddr = unpack('n*', inet_pton($address));
|
||||
$bytesTest = unpack('n*', inet_pton($requestIp));
|
||||
|
||||
for ($i = 1, $ceil = ceil($netmask / 16); $i <= $ceil; $i++) {
|
||||
for ($i = 1, $ceil = ceil($netmask / 16); $i <= $ceil; ++$i) {
|
||||
$left = $netmask - 16 * ($i - 1);
|
||||
$left = ($left <= 16) ? $left : 16;
|
||||
$mask = ~(0xffff >> $left) & 0xffff;
|
||||
|
@ -113,7 +113,7 @@ class ParameterBag implements \IteratorAggregate, \Countable
|
||||
|
||||
$value = $this->parameters[$root];
|
||||
$currentKey = null;
|
||||
for ($i = $pos, $c = strlen($path); $i < $c; $i++) {
|
||||
for ($i = $pos, $c = strlen($path); $i < $c; ++$i) {
|
||||
$char = $path[$i];
|
||||
|
||||
if ('[' === $char) {
|
||||
|
@ -1557,7 +1557,7 @@ class Request
|
||||
$lang = $codes[1];
|
||||
}
|
||||
} else {
|
||||
for ($i = 0, $max = count($codes); $i < $max; $i++) {
|
||||
for ($i = 0, $max = count($codes); $i < $max; ++$i) {
|
||||
if ($i === 0) {
|
||||
$lang = strtolower($codes[0]);
|
||||
} else {
|
||||
|
@ -196,7 +196,7 @@ class HeaderBagTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
$i = 0;
|
||||
foreach ($headerBag as $key => $val) {
|
||||
$i++;
|
||||
++$i;
|
||||
$this->assertEquals(array($headers[$key]), $val);
|
||||
}
|
||||
|
||||
|
@ -233,7 +233,7 @@ class ParameterBagTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
$i = 0;
|
||||
foreach ($bag as $key => $val) {
|
||||
$i++;
|
||||
++$i;
|
||||
$this->assertEquals($parameters[$key], $val);
|
||||
}
|
||||
|
||||
|
@ -177,7 +177,7 @@ class AttributeBagTest extends \PHPUnit_Framework_TestCase
|
||||
$i = 0;
|
||||
foreach ($this->bag as $key => $val) {
|
||||
$this->assertEquals($this->array[$key], $val);
|
||||
$i++;
|
||||
++$i;
|
||||
}
|
||||
|
||||
$this->assertEquals(count($this->array), $i);
|
||||
|
@ -145,7 +145,7 @@ class FlashBagTest extends \PHPUnit_Framework_TestCase
|
||||
$i = 0;
|
||||
foreach ($this->bag as $key => $val) {
|
||||
$this->assertEquals(array($flashes[$key]), $val);
|
||||
$i++;
|
||||
++$i;
|
||||
}
|
||||
|
||||
$this->assertEquals(count($flashes), $i);
|
||||
|
@ -203,7 +203,7 @@ class SessionTest extends \PHPUnit_Framework_TestCase
|
||||
$i = 0;
|
||||
foreach ($this->session as $key => $val) {
|
||||
$this->assertEquals($attributes[$key], $val);
|
||||
$i++;
|
||||
++$i;
|
||||
}
|
||||
|
||||
$this->assertEquals(count($attributes), $i);
|
||||
|
@ -116,7 +116,7 @@ class LoggerDataCollector extends DataCollector
|
||||
$count = 0;
|
||||
foreach ($this->logger->getLogs() as $log) {
|
||||
if (isset($log['context']['type']) && ErrorHandler::TYPE_DEPRECATION === $log['context']['type']) {
|
||||
$count++;
|
||||
++$count;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -45,7 +45,7 @@ class EsiResponseCacheStrategy implements EsiResponseCacheStrategyInterface
|
||||
$this->maxAges[] = $response->getMaxAge();
|
||||
}
|
||||
|
||||
$this->embeddedResponses++;
|
||||
++$this->embeddedResponses;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -17,7 +17,7 @@ abstract class AbstractProfilerStorageTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testStore()
|
||||
{
|
||||
for ($i = 0; $i < 10; $i++) {
|
||||
for ($i = 0; $i < 10; ++$i) {
|
||||
$profile = new Profile('token_'.$i);
|
||||
$profile->setIp('127.0.0.1');
|
||||
$profile->setUrl('http://foo.bar');
|
||||
@ -159,7 +159,7 @@ abstract class AbstractProfilerStorageTest extends \PHPUnit_Framework_TestCase
|
||||
$dt = new \DateTime('now');
|
||||
$start = $dt->getTimestamp();
|
||||
|
||||
for ($i = 0; $i < 3; $i++) {
|
||||
for ($i = 0; $i < 3; ++$i) {
|
||||
$dt->modify('+1 minute');
|
||||
$profile = new Profile('time_'.$i);
|
||||
$profile->setIp('127.0.0.1');
|
||||
@ -181,7 +181,7 @@ abstract class AbstractProfilerStorageTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testRetrieveByEmptyUrlAndIp()
|
||||
{
|
||||
for ($i = 0; $i < 5; $i++) {
|
||||
for ($i = 0; $i < 5; ++$i) {
|
||||
$profile = new Profile('token_'.$i);
|
||||
$profile->setMethod('GET');
|
||||
$this->getStorage()->write($profile);
|
||||
@ -193,7 +193,7 @@ abstract class AbstractProfilerStorageTest extends \PHPUnit_Framework_TestCase
|
||||
public function testRetrieveByMethodAndLimit()
|
||||
{
|
||||
foreach (array('POST', 'GET') as $method) {
|
||||
for ($i = 0; $i < 5; $i++) {
|
||||
for ($i = 0; $i < 5; ++$i) {
|
||||
$profile = new Profile('token_'.$i.$method);
|
||||
$profile->setMethod($method);
|
||||
$this->getStorage()->write($profile);
|
||||
@ -233,7 +233,7 @@ abstract class AbstractProfilerStorageTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testDuplicates()
|
||||
{
|
||||
for ($i = 1; $i <= 5; $i++) {
|
||||
for ($i = 1; $i <= 5; ++$i) {
|
||||
$profile = new Profile('foo'.$i);
|
||||
$profile->setIp('127.0.0.1');
|
||||
$profile->setUrl('http://example.net/');
|
||||
|
@ -62,7 +62,7 @@ class FileProfilerStorageTest extends AbstractProfilerStorageTest
|
||||
public function testMultiRowIndexFile()
|
||||
{
|
||||
$iteration = 3;
|
||||
for ($i = 0; $i < $iteration; $i++) {
|
||||
for ($i = 0; $i < $iteration; ++$i) {
|
||||
$profile = new Profile('token'.$i);
|
||||
$profile->setIp('127.0.0.'.$i);
|
||||
$profile->setUrl('http://foo.bar/'.$i);
|
||||
@ -74,7 +74,7 @@ class FileProfilerStorageTest extends AbstractProfilerStorageTest
|
||||
}
|
||||
|
||||
$handle = fopen(self::$tmpDir.'/index.csv', 'r');
|
||||
for ($i = 0; $i < $iteration; $i++) {
|
||||
for ($i = 0; $i < $iteration; ++$i) {
|
||||
$row = fgetcsv($handle);
|
||||
$this->assertEquals('token'.$i, $row[0]);
|
||||
$this->assertEquals('127.0.0.'.$i, $row[1]);
|
||||
|
@ -100,7 +100,7 @@ class MongoDbProfilerStorageTest extends AbstractProfilerStorageTest
|
||||
public function testCleanup()
|
||||
{
|
||||
$dt = new \DateTime('-2 day');
|
||||
for ($i = 0; $i < 3; $i++) {
|
||||
for ($i = 0; $i < 3; ++$i) {
|
||||
$dt->modify('-1 day');
|
||||
$profile = new Profile('time_'.$i);
|
||||
$profile->setTime($dt->getTimestamp());
|
||||
|
@ -490,7 +490,7 @@ abstract class AbstractNumberFormatterTest extends \PHPUnit_Framework_TestCase
|
||||
$r->setAccessible(true);
|
||||
$expected = $r->getValue('Symfony\Component\Intl\NumberFormatter\NumberFormatter');
|
||||
|
||||
for ($i = 0; $i <= 17; $i++) {
|
||||
for ($i = 0; $i <= 17; ++$i) {
|
||||
$this->assertSame($expected[1][$i], $decimalFormatter->getSymbol($i));
|
||||
$this->assertSame($expected[2][$i], $currencyFormatter->getSymbol($i));
|
||||
}
|
||||
@ -505,7 +505,7 @@ abstract class AbstractNumberFormatterTest extends \PHPUnit_Framework_TestCase
|
||||
$r->setAccessible(true);
|
||||
$expected = $r->getValue('Symfony\Component\Intl\NumberFormatter\NumberFormatter');
|
||||
|
||||
for ($i = 0; $i <= 5; $i++) {
|
||||
for ($i = 0; $i <= 5; ++$i) {
|
||||
$this->assertSame($expected[1][$i], $decimalFormatter->getTextAttribute($i));
|
||||
$this->assertSame($expected[2][$i], $currencyFormatter->getTextAttribute($i));
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ $n = 0;
|
||||
// ticks require activity to work - sleep(4); does not work
|
||||
while ($n < 400) {
|
||||
usleep(10000);
|
||||
$n++;
|
||||
++$n;
|
||||
}
|
||||
|
||||
return;
|
||||
|
@ -237,7 +237,7 @@ abstract class AnnotationClassLoader implements LoaderInterface
|
||||
if ($this->defaultRouteIndex > 0) {
|
||||
$name .= '_'.$this->defaultRouteIndex;
|
||||
}
|
||||
$this->defaultRouteIndex++;
|
||||
++$this->defaultRouteIndex;
|
||||
|
||||
return $name;
|
||||
}
|
||||
|
@ -88,7 +88,7 @@ class AnnotationFileLoader extends FileLoader
|
||||
$class = false;
|
||||
$namespace = false;
|
||||
$tokens = token_get_all(file_get_contents($file));
|
||||
for ($i = 0, $count = count($tokens); $i < $count; $i++) {
|
||||
for ($i = 0, $count = count($tokens); $i < $count; ++$i) {
|
||||
$token = $tokens[$i];
|
||||
|
||||
if (!is_array($token)) {
|
||||
|
@ -55,7 +55,7 @@ class ApacheMatcherDumper extends MatcherDumper
|
||||
|
||||
if (null !== $hostRegex && $prevHostRegex !== $hostRegex) {
|
||||
$prevHostRegex = $hostRegex;
|
||||
$hostRegexUnique++;
|
||||
++$hostRegexUnique;
|
||||
|
||||
$rule = array();
|
||||
|
||||
|
@ -145,7 +145,7 @@ class RouteCompiler implements RouteCompilerInterface
|
||||
// find the first optional token
|
||||
$firstOptional = PHP_INT_MAX;
|
||||
if (!$isHost) {
|
||||
for ($i = count($tokens) - 1; $i >= 0; $i--) {
|
||||
for ($i = count($tokens) - 1; $i >= 0; --$i) {
|
||||
$token = $tokens[$i];
|
||||
if ('variable' === $token[0] && $route->hasDefault($token[3])) {
|
||||
$firstOptional = $i;
|
||||
@ -157,7 +157,7 @@ class RouteCompiler implements RouteCompilerInterface
|
||||
|
||||
// compute the matching regexp
|
||||
$regexp = '';
|
||||
for ($i = 0, $nbToken = count($tokens); $i < $nbToken; $i++) {
|
||||
for ($i = 0, $nbToken = count($tokens); $i < $nbToken; ++$i) {
|
||||
$regexp .= self::computeRegexp($tokens, $i, $firstOptional);
|
||||
}
|
||||
|
||||
|
@ -104,7 +104,7 @@ class AclProvider implements AclProviderInterface
|
||||
$currentBatch = array();
|
||||
$oidLookup = array();
|
||||
|
||||
for ($i = 0, $c = count($oids); $i < $c; $i++) {
|
||||
for ($i = 0, $c = count($oids); $i < $c; ++$i) {
|
||||
$oid = $oids[$i];
|
||||
$oidLookupKey = $oid->getIdentifier().$oid->getType();
|
||||
$oidLookup[$oidLookupKey] = $oid;
|
||||
@ -280,7 +280,7 @@ SELECTCLAUSE;
|
||||
|
||||
$types = array();
|
||||
$count = count($batch);
|
||||
for ($i = 0; $i < $count; $i++) {
|
||||
for ($i = 0; $i < $count; ++$i) {
|
||||
if (!isset($types[$batch[$i]->getType()])) {
|
||||
$types[$batch[$i]->getType()] = true;
|
||||
|
||||
@ -295,7 +295,7 @@ SELECTCLAUSE;
|
||||
|
||||
if (1 === count($types)) {
|
||||
$ids = array();
|
||||
for ($i = 0; $i < $count; $i++) {
|
||||
for ($i = 0; $i < $count; ++$i) {
|
||||
$ids[] = $this->connection->quote($batch[$i]->getIdentifier());
|
||||
}
|
||||
|
||||
@ -306,7 +306,7 @@ SELECTCLAUSE;
|
||||
);
|
||||
} else {
|
||||
$where = '(o.object_identifier = %s AND c.class_type = %s)';
|
||||
for ($i = 0; $i < $count; $i++) {
|
||||
for ($i = 0; $i < $count; ++$i) {
|
||||
$sql .= sprintf(
|
||||
$where,
|
||||
$this->connection->quote($batch[$i]->getIdentifier()),
|
||||
|
@ -786,7 +786,7 @@ QUERY;
|
||||
$sids = new \SplObjectStorage();
|
||||
$classIds = new \SplObjectStorage();
|
||||
foreach ($changes[1] as $field => $new) {
|
||||
for ($i = 0, $c = count($new); $i < $c; $i++) {
|
||||
for ($i = 0, $c = count($new); $i < $c; ++$i) {
|
||||
$ace = $new[$i];
|
||||
|
||||
if (null === $ace->getId()) {
|
||||
@ -827,7 +827,7 @@ QUERY;
|
||||
{
|
||||
$currentIds = array();
|
||||
foreach ($changes[1] as $field => $new) {
|
||||
for ($i = 0, $c = count($new); $i < $c; $i++) {
|
||||
for ($i = 0, $c = count($new); $i < $c; ++$i) {
|
||||
$ace = $new[$i];
|
||||
|
||||
if (null !== $ace->getId()) {
|
||||
@ -837,7 +837,7 @@ QUERY;
|
||||
}
|
||||
|
||||
foreach ($changes[0] as $old) {
|
||||
for ($i = 0, $c = count($old); $i < $c; $i++) {
|
||||
for ($i = 0, $c = count($old); $i < $c; ++$i) {
|
||||
$ace = $old[$i];
|
||||
|
||||
if (!isset($currentIds[$ace->getId()])) {
|
||||
@ -860,7 +860,7 @@ QUERY;
|
||||
|
||||
$sids = new \SplObjectStorage();
|
||||
$classIds = new \SplObjectStorage();
|
||||
for ($i = 0, $c = count($new); $i < $c; $i++) {
|
||||
for ($i = 0, $c = count($new); $i < $c; ++$i) {
|
||||
$ace = $new[$i];
|
||||
|
||||
if (null === $ace->getId()) {
|
||||
@ -901,7 +901,7 @@ QUERY;
|
||||
list($old, $new) = $changes;
|
||||
$currentIds = array();
|
||||
|
||||
for ($i = 0, $c = count($new); $i < $c; $i++) {
|
||||
for ($i = 0, $c = count($new); $i < $c; ++$i) {
|
||||
$ace = $new[$i];
|
||||
|
||||
if (null !== $ace->getId()) {
|
||||
@ -909,7 +909,7 @@ QUERY;
|
||||
}
|
||||
}
|
||||
|
||||
for ($i = 0, $c = count($old); $i < $c; $i++) {
|
||||
for ($i = 0, $c = count($old); $i < $c; ++$i) {
|
||||
$ace = $old[$i];
|
||||
|
||||
if (!isset($currentIds[$ace->getId()])) {
|
||||
|
@ -415,7 +415,7 @@ class Acl implements AuditableAclInterface, NotifyPropertyChanged
|
||||
$this->$property = array_values($this->$property);
|
||||
$this->onPropertyChanged($property, $oldValue, $this->$property);
|
||||
|
||||
for ($i = $index, $c = count($this->$property); $i < $c; $i++) {
|
||||
for ($i = $index, $c = count($this->$property); $i < $c; ++$i) {
|
||||
$this->onEntryPropertyChanged($aces[$i], 'aceOrder', $i + 1, $i);
|
||||
}
|
||||
}
|
||||
@ -441,7 +441,7 @@ class Acl implements AuditableAclInterface, NotifyPropertyChanged
|
||||
$aces[$field] = array_values($aces[$field]);
|
||||
$this->onPropertyChanged($property, $oldValue, $this->$property);
|
||||
|
||||
for ($i = $index, $c = count($aces[$field]); $i < $c; $i++) {
|
||||
for ($i = $index, $c = count($aces[$field]); $i < $c; ++$i) {
|
||||
$this->onEntryPropertyChanged($aces[$field][$i], 'aceOrder', $i + 1, $i);
|
||||
}
|
||||
}
|
||||
@ -486,7 +486,7 @@ class Acl implements AuditableAclInterface, NotifyPropertyChanged
|
||||
array_slice($this->$property, $index)
|
||||
);
|
||||
|
||||
for ($i = $index, $c = count($this->$property) - 1; $i < $c; $i++) {
|
||||
for ($i = $index, $c = count($this->$property) - 1; $i < $c; ++$i) {
|
||||
$this->onEntryPropertyChanged($aces[$i + 1], 'aceOrder', $i, $i + 1);
|
||||
}
|
||||
}
|
||||
@ -544,7 +544,7 @@ class Acl implements AuditableAclInterface, NotifyPropertyChanged
|
||||
array_slice($aces[$field], $index)
|
||||
);
|
||||
|
||||
for ($i = $index, $c = count($aces[$field]) - 1; $i < $c; $i++) {
|
||||
for ($i = $index, $c = count($aces[$field]) - 1; $i < $c; ++$i) {
|
||||
$this->onEntryPropertyChanged($aces[$field][$i + 1], 'aceOrder', $i, $i + 1);
|
||||
}
|
||||
}
|
||||
|
@ -128,7 +128,7 @@ class MaskBuilder
|
||||
$length = strlen($pattern);
|
||||
$bitmask = str_pad(decbin($this->mask), $length, '0', STR_PAD_LEFT);
|
||||
|
||||
for ($i = $length - 1; $i >= 0; $i--) {
|
||||
for ($i = $length - 1; $i >= 0; --$i) {
|
||||
if ('1' === $bitmask[$i]) {
|
||||
try {
|
||||
$pattern[$i] = self::getCode(1 << ($length - $i - 1));
|
||||
|
@ -55,7 +55,7 @@ class MessageDigestPasswordEncoder extends BasePasswordEncoder
|
||||
$digest = hash($this->algorithm, $salted, true);
|
||||
|
||||
// "stretch" hash
|
||||
for ($i = 1; $i < $this->iterations; $i++) {
|
||||
for ($i = 1; $i < $this->iterations; ++$i) {
|
||||
$digest = hash($this->algorithm, $digest.$salted, true);
|
||||
}
|
||||
|
||||
|
@ -87,11 +87,11 @@ class Pbkdf2PasswordEncoder extends BasePasswordEncoder
|
||||
$blocks = ceil($length / strlen(hash($algorithm, null, true)));
|
||||
$digest = '';
|
||||
|
||||
for ($i = 1; $i <= $blocks; $i++) {
|
||||
for ($i = 1; $i <= $blocks; ++$i) {
|
||||
$ib = $block = hash_hmac($algorithm, $salt.pack('N', $i), $password, true);
|
||||
|
||||
// Iterations
|
||||
for ($j = 1; $j < $iterations; $j++) {
|
||||
for ($j = 1; $j < $iterations; ++$j) {
|
||||
$ib ^= ($block = hash_hmac($algorithm, $block, $password, true));
|
||||
}
|
||||
|
||||
|
@ -60,7 +60,7 @@ class StringUtils
|
||||
|
||||
$result = 0;
|
||||
|
||||
for ($i = 0; $i < $knownLen; $i++) {
|
||||
for ($i = 0; $i < $knownLen; ++$i) {
|
||||
$result |= (ord($knownString[$i]) ^ ord($userInput[$i]));
|
||||
}
|
||||
|
||||
|
@ -82,7 +82,7 @@ class TokenBasedRememberMeServices extends AbstractRememberMeServices
|
||||
}
|
||||
|
||||
$result = 0;
|
||||
for ($i = 0; $i < $c; $i++) {
|
||||
for ($i = 0; $i < $c; ++$i) {
|
||||
$result |= ord($hash1[$i]) ^ ord($hash2[$i]);
|
||||
}
|
||||
|
||||
|
@ -92,7 +92,7 @@ class AclProviderBenchmarkTest extends \PHPUnit_Framework_TestCase
|
||||
$this->insertEntryStmt = $this->con->prepare('INSERT INTO acl_entries (id, class_id, object_identity_id, field_name, ace_order, security_identity_id, mask, granting, granting_strategy, audit_success, audit_failure) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)');
|
||||
$this->insertOidAncestorStmt = $this->con->prepare('INSERT INTO acl_object_identity_ancestors (object_identity_id, ancestor_id) VALUES (?, ?)');
|
||||
|
||||
for ($i = 0; $i < 40000; $i++) {
|
||||
for ($i = 0; $i < 40000; ++$i) {
|
||||
$this->generateAclHierarchy();
|
||||
}
|
||||
}
|
||||
@ -107,7 +107,7 @@ class AclProviderBenchmarkTest extends \PHPUnit_Framework_TestCase
|
||||
protected function generateAclLevel($depth, $parentId, $ancestors)
|
||||
{
|
||||
$level = count($ancestors);
|
||||
for ($i = 0, $t = rand(1, 10); $i < $t; $i++) {
|
||||
for ($i = 0, $t = rand(1, 10); $i < $t; ++$i) {
|
||||
$id = $this->generateAcl($this->chooseClassId(), $parentId, $ancestors);
|
||||
|
||||
if ($level < $depth) {
|
||||
@ -178,7 +178,7 @@ class AclProviderBenchmarkTest extends \PHPUnit_Framework_TestCase
|
||||
$sids = array();
|
||||
$fieldOrder = array();
|
||||
|
||||
for ($i = 0; $i <= 30; $i++) {
|
||||
for ($i = 0; $i <= 30; ++$i) {
|
||||
$fieldName = rand(0, 1) ? null : $this->getRandomString(rand(10, 20));
|
||||
|
||||
do {
|
||||
@ -226,7 +226,7 @@ class AclProviderBenchmarkTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
while ($i <= 30) {
|
||||
$mask |= 1 << rand(0, 30);
|
||||
$i++;
|
||||
++$i;
|
||||
}
|
||||
|
||||
return $mask;
|
||||
|
@ -130,7 +130,7 @@ class AclProviderTest extends \PHPUnit_Framework_TestCase
|
||||
$i = 0;
|
||||
foreach ($aces as $index => $ace) {
|
||||
$this->assertEquals($i, $index);
|
||||
$i++;
|
||||
++$i;
|
||||
}
|
||||
|
||||
$sid = $aces[0]->getSecurityIdentity();
|
||||
|
@ -72,7 +72,7 @@ class DoctrineAclCacheTest extends \PHPUnit_Framework_TestCase
|
||||
$acl->insertClassFieldAce('foo', $sid, 1);
|
||||
$acl->insertObjectAce($sid, 1);
|
||||
$acl->insertObjectFieldAce('foo', $sid, 1);
|
||||
$id++;
|
||||
++$id;
|
||||
|
||||
if ($depth > 0) {
|
||||
$acl->setParentAcl($this->getAcl($depth - 1));
|
||||
|
@ -145,13 +145,13 @@ class AccessDecisionManagerTest extends \PHPUnit_Framework_TestCase
|
||||
protected function getVoters($grants, $denies, $abstains)
|
||||
{
|
||||
$voters = array();
|
||||
for ($i = 0; $i < $grants; $i++) {
|
||||
for ($i = 0; $i < $grants; ++$i) {
|
||||
$voters[] = $this->getVoter(VoterInterface::ACCESS_GRANTED);
|
||||
}
|
||||
for ($i = 0; $i < $denies; $i++) {
|
||||
for ($i = 0; $i < $denies; ++$i) {
|
||||
$voters[] = $this->getVoter(VoterInterface::ACCESS_DENIED);
|
||||
}
|
||||
for ($i = 0; $i < $abstains; $i++) {
|
||||
for ($i = 0; $i < $abstains; ++$i) {
|
||||
$voters[] = $this->getVoter(VoterInterface::ACCESS_ABSTAIN);
|
||||
}
|
||||
|
||||
|
@ -40,7 +40,7 @@ class BCryptPasswordEncoderTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testCostInRange()
|
||||
{
|
||||
for ($cost = 4; $cost <= 31; $cost++) {
|
||||
for ($cost = 4; $cost <= 31; ++$cost) {
|
||||
new BCryptPasswordEncoder($cost);
|
||||
}
|
||||
}
|
||||
|
@ -35,17 +35,17 @@ class SecureRandomTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
$b = $this->getBitSequence($secureRandom, 20000);
|
||||
$c = array();
|
||||
for ($i = 0; $i <= 15; $i++) {
|
||||
for ($i = 0; $i <= 15; ++$i) {
|
||||
$c[$i] = 0;
|
||||
}
|
||||
|
||||
for ($j = 1; $j <= 5000; $j++) {
|
||||
for ($j = 1; $j <= 5000; ++$j) {
|
||||
$k = 4 * $j - 1;
|
||||
++$c[8 * $b[$k - 3] + 4 * $b[$k - 2] + 2 * $b[$k - 1] + $b[$k]];
|
||||
}
|
||||
|
||||
$f = 0;
|
||||
for ($i = 0; $i <= 15; $i++) {
|
||||
for ($i = 0; $i <= 15; ++$i) {
|
||||
$f += $c[$i] * $c[$i];
|
||||
}
|
||||
|
||||
@ -64,7 +64,7 @@ class SecureRandomTest extends \PHPUnit_Framework_TestCase
|
||||
$b = $this->getBitSequence($secureRandom, 20000);
|
||||
|
||||
$runs = array();
|
||||
for ($i = 1; $i <= 6; $i++) {
|
||||
for ($i = 1; $i <= 6; ++$i) {
|
||||
$runs[$i] = 0;
|
||||
}
|
||||
|
||||
@ -78,7 +78,7 @@ class SecureRandomTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
$currentRun = 0;
|
||||
$lastBit = null;
|
||||
for ($i = 0; $i < 20000; $i++) {
|
||||
for ($i = 0; $i < 20000; ++$i) {
|
||||
if ($lastBit === $b[$i]) {
|
||||
++$currentRun;
|
||||
} else {
|
||||
@ -113,7 +113,7 @@ class SecureRandomTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
$longestRun = $currentRun = 0;
|
||||
$lastBit = null;
|
||||
for ($i = 0; $i < 20000; $i++) {
|
||||
for ($i = 0; $i < 20000; ++$i) {
|
||||
if ($lastBit === $b[$i]) {
|
||||
++$currentRun;
|
||||
} else {
|
||||
@ -142,7 +142,7 @@ class SecureRandomTest extends \PHPUnit_Framework_TestCase
|
||||
$b = $this->getBitSequence($secureRandom, 20000);
|
||||
|
||||
$Z = 0;
|
||||
for ($i = 0; $i < 5000; $i++) {
|
||||
for ($i = 0; $i < 5000; ++$i) {
|
||||
$Z += $b[$i] === $b[$i + $shift] ? 1 : 0;
|
||||
}
|
||||
|
||||
|
@ -113,7 +113,7 @@ class MoFileLoader extends ArrayLoader
|
||||
|
||||
$messages = array();
|
||||
|
||||
for ($i = 0; $i < $count; $i++) {
|
||||
for ($i = 0; $i < $count; ++$i) {
|
||||
$singularId = $pluralId = null;
|
||||
$translated = null;
|
||||
|
||||
|
@ -112,7 +112,7 @@ class PluralizationRulesTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
$matrix = array();
|
||||
foreach ($langCodes as $langCode) {
|
||||
for ($count = 0; $count < 200; $count++) {
|
||||
for ($count = 0; $count < 200; ++$count) {
|
||||
$plural = PluralizationRules::get($count, $langCode);
|
||||
$matrix[$langCode][$count] = $plural;
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ abstract class FilesLoader extends BaseFilesLoader
|
||||
|
||||
protected function getFileLoaderInstance($file)
|
||||
{
|
||||
$this->timesCalled++;
|
||||
++$this->timesCalled;
|
||||
|
||||
return $this->loader;
|
||||
}
|
||||
|
Reference in New Issue
Block a user