From c5123d6881a010680cfb0370507a3f8cbad5adf7 Mon Sep 17 00:00:00 2001 From: Gregor Harlan Date: Tue, 31 Mar 2015 01:07:44 +0200 Subject: [PATCH] CS: Pre incrementation/decrementation should be used if possible --- .../Doctrine/Tests/Logger/DbalLoggerTest.php | 2 +- .../Bridge/Twig/Extension/CodeExtension.php | 2 +- .../Command/ContainerDebugCommand.php | 2 +- .../Templating/Helper/CodeHelper.php | 2 +- .../FrameworkBundle/Translation/PhpExtractor.php | 2 +- .../Bundle/TwigBundle/Command/LintCommand.php | 2 +- .../Component/ClassLoader/ClassMapGenerator.php | 2 +- src/Symfony/Component/Config/Loader/FileLoader.php | 2 +- src/Symfony/Component/Console/Application.php | 2 +- .../Component/Console/Helper/DialogHelper.php | 4 ++-- .../Component/Console/Helper/TableHelper.php | 4 ++-- src/Symfony/Component/Console/Input/ArgvInput.php | 2 +- .../Component/CssSelector/Parser/TokenStream.php | 2 +- .../XPath/Extension/FunctionExtension.php | 2 +- .../Debug/Tests/Exception/FlattenExceptionTest.php | 6 +++--- .../EventDispatcher/Tests/EventDispatcherTest.php | 2 +- src/Symfony/Component/Filesystem/Filesystem.php | 2 +- src/Symfony/Component/Finder/Expression/Glob.php | 2 +- src/Symfony/Component/Finder/Glob.php | 2 +- src/Symfony/Component/Finder/Tests/FinderTest.php | 4 ++-- .../Finder/Tests/Iterator/FilterIteratorTest.php | 4 ++-- src/Symfony/Component/HttpFoundation/IpUtils.php | 2 +- .../Component/HttpFoundation/ParameterBag.php | 2 +- src/Symfony/Component/HttpFoundation/Request.php | 2 +- .../HttpFoundation/Tests/HeaderBagTest.php | 2 +- .../HttpFoundation/Tests/ParameterBagTest.php | 2 +- .../Tests/Session/Attribute/AttributeBagTest.php | 2 +- .../Tests/Session/Flash/FlashBagTest.php | 2 +- .../HttpFoundation/Tests/Session/SessionTest.php | 2 +- .../DataCollector/LoggerDataCollector.php | 2 +- .../HttpCache/EsiResponseCacheStrategy.php | 2 +- .../Tests/Profiler/AbstractProfilerStorageTest.php | 10 +++++----- .../Tests/Profiler/FileProfilerStorageTest.php | 4 ++-- .../Tests/Profiler/MongoDbProfilerStorageTest.php | 2 +- .../AbstractNumberFormatterTest.php | 4 ++-- .../Component/Process/Tests/SignalListener.php | 2 +- .../Routing/Loader/AnnotationClassLoader.php | 2 +- .../Routing/Loader/AnnotationFileLoader.php | 2 +- .../Routing/Matcher/Dumper/ApacheMatcherDumper.php | 2 +- src/Symfony/Component/Routing/RouteCompiler.php | 4 ++-- .../Component/Security/Acl/Dbal/AclProvider.php | 8 ++++---- .../Security/Acl/Dbal/MutableAclProvider.php | 12 ++++++------ src/Symfony/Component/Security/Acl/Domain/Acl.php | 8 ++++---- .../Security/Acl/Permission/MaskBuilder.php | 2 +- .../Core/Encoder/MessageDigestPasswordEncoder.php | 2 +- .../Core/Encoder/Pbkdf2PasswordEncoder.php | 4 ++-- .../Component/Security/Core/Util/StringUtils.php | 2 +- .../RememberMe/TokenBasedRememberMeServices.php | 2 +- .../Tests/Acl/Dbal/AclProviderBenchmarkTest.php | 8 ++++---- .../Security/Tests/Acl/Dbal/AclProviderTest.php | 2 +- .../Tests/Acl/Domain/DoctrineAclCacheTest.php | 2 +- .../Authorization/AccessDecisionManagerTest.php | 6 +++--- .../Core/Encoder/BCryptPasswordEncoderTest.php | 2 +- .../Security/Tests/Core/Util/SecureRandomTest.php | 14 +++++++------- .../Component/Translation/Loader/MoFileLoader.php | 2 +- .../Translation/Tests/PluralizationRulesTest.php | 2 +- .../Validator/Tests/Fixtures/FilesLoader.php | 2 +- 57 files changed, 93 insertions(+), 93 deletions(-) diff --git a/src/Symfony/Bridge/Doctrine/Tests/Logger/DbalLoggerTest.php b/src/Symfony/Bridge/Doctrine/Tests/Logger/DbalLoggerTest.php index 269367872e..872779c2f8 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/Logger/DbalLoggerTest.php +++ b/src/Symfony/Bridge/Doctrine/Tests/Logger/DbalLoggerTest.php @@ -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]; } diff --git a/src/Symfony/Bridge/Twig/Extension/CodeExtension.php b/src/Symfony/Bridge/Twig/Extension/CodeExtension.php index b5f619d327..49bb728446 100644 --- a/src/Symfony/Bridge/Twig/Extension/CodeExtension.php +++ b/src/Symfony/Bridge/Twig/Extension/CodeExtension.php @@ -141,7 +141,7 @@ class CodeExtension extends \Twig_Extension $content = preg_split('#
#', $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[] = ''.self::fixCodeMarkup($content[$i - 1]).''; } diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/ContainerDebugCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/ContainerDebugCommand.php index d58031fb7d..a10760a1b9 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/ContainerDebugCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/ContainerDebugCommand.php @@ -143,7 +143,7 @@ EOF $optionsCount = 0; foreach ($options as $option) { if ($input->getOption($option)) { - $optionsCount++; + ++$optionsCount; } } diff --git a/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/CodeHelper.php b/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/CodeHelper.php index e7042e0dc3..bb7e0298cb 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/CodeHelper.php +++ b/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/CodeHelper.php @@ -135,7 +135,7 @@ class CodeHelper extends Helper $content = preg_split('#
#', $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[] = ''.self::fixCodeMarkup($content[$i - 1]).''; } diff --git a/src/Symfony/Bundle/FrameworkBundle/Translation/PhpExtractor.php b/src/Symfony/Bundle/FrameworkBundle/Translation/PhpExtractor.php index 5007a86bca..8084b0fd7a 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Translation/PhpExtractor.php +++ b/src/Symfony/Bundle/FrameworkBundle/Translation/PhpExtractor.php @@ -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); diff --git a/src/Symfony/Bundle/TwigBundle/Command/LintCommand.php b/src/Symfony/Bundle/TwigBundle/Command/LintCommand.php index 308d53b54e..f2e9324010 100644 --- a/src/Symfony/Bundle/TwigBundle/Command/LintCommand.php +++ b/src/Symfony/Bundle/TwigBundle/Command/LintCommand.php @@ -142,7 +142,7 @@ EOF $result = array(); while ($position < $max) { $result[$position + 1] = $lines[$position]; - $position++; + ++$position; } return $result; diff --git a/src/Symfony/Component/ClassLoader/ClassMapGenerator.php b/src/Symfony/Component/ClassLoader/ClassMapGenerator.php index 4c2aeab3ac..112bee87bd 100644 --- a/src/Symfony/Component/ClassLoader/ClassMapGenerator.php +++ b/src/Symfony/Component/ClassLoader/ClassMapGenerator.php @@ -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)) { diff --git a/src/Symfony/Component/Config/Loader/FileLoader.php b/src/Symfony/Component/Config/Loader/FileLoader.php index c1add20cea..2f3cc3bd08 100644 --- a/src/Symfony/Component/Config/Loader/FileLoader.php +++ b/src/Symfony/Component/Config/Loader/FileLoader.php @@ -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)); diff --git a/src/Symfony/Component/Console/Application.php b/src/Symfony/Component/Console/Application.php index 9daff3f301..b4c7109012 100644 --- a/src/Symfony/Component/Console/Application.php +++ b/src/Symfony/Component/Console/Application.php @@ -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']; diff --git a/src/Symfony/Component/Console/Helper/DialogHelper.php b/src/Symfony/Component/Console/Helper/DialogHelper.php index 7c00cb82f5..4b395d9a7f 100644 --- a/src/Symfony/Component/Console/Helper/DialogHelper.php +++ b/src/Symfony/Component/Console/Helper/DialogHelper.php @@ -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; diff --git a/src/Symfony/Component/Console/Helper/TableHelper.php b/src/Symfony/Component/Console/Helper/TableHelper.php index 90357cc214..0904a10169 100644 --- a/src/Symfony/Component/Console/Helper/TableHelper.php +++ b/src/Symfony/Component/Console/Helper/TableHelper.php @@ -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(); } diff --git a/src/Symfony/Component/Console/Input/ArgvInput.php b/src/Symfony/Component/Console/Input/ArgvInput.php index f5cc5d136b..97b0cfc05d 100644 --- a/src/Symfony/Component/Console/Input/ArgvInput.php +++ b/src/Symfony/Component/Console/Input/ArgvInput.php @@ -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])); } diff --git a/src/Symfony/Component/CssSelector/Parser/TokenStream.php b/src/Symfony/Component/CssSelector/Parser/TokenStream.php index 8184b832b3..c0525d7a83 100644 --- a/src/Symfony/Component/CssSelector/Parser/TokenStream.php +++ b/src/Symfony/Component/CssSelector/Parser/TokenStream.php @@ -100,7 +100,7 @@ class TokenStream throw new InternalErrorException('Unexpected token stream end.'); } - return $this->tokens[$this->cursor ++]; + return $this->tokens[$this->cursor++]; } /** diff --git a/src/Symfony/Component/CssSelector/XPath/Extension/FunctionExtension.php b/src/Symfony/Component/CssSelector/XPath/Extension/FunctionExtension.php index 0086240c81..41ece8a422 100644 --- a/src/Symfony/Component/CssSelector/XPath/Extension/FunctionExtension.php +++ b/src/Symfony/Component/CssSelector/XPath/Extension/FunctionExtension.php @@ -84,7 +84,7 @@ class FunctionExtension extends AbstractExtension if ($last) { $expr = 'last() - '.$expr; - $b--; + --$b; } if (0 !== $b) { diff --git a/src/Symfony/Component/Debug/Tests/Exception/FlattenExceptionTest.php b/src/Symfony/Component/Debug/Tests/Exception/FlattenExceptionTest.php index 923c47ffa0..99eaf497d5 100644 --- a/src/Symfony/Component/Debug/Tests/Exception/FlattenExceptionTest.php +++ b/src/Symfony/Component/Debug/Tests/Exception/FlattenExceptionTest.php @@ -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'; } } diff --git a/src/Symfony/Component/EventDispatcher/Tests/EventDispatcherTest.php b/src/Symfony/Component/EventDispatcher/Tests/EventDispatcherTest.php index b543de5eff..839e8ea611 100644 --- a/src/Symfony/Component/EventDispatcher/Tests/EventDispatcherTest.php +++ b/src/Symfony/Component/EventDispatcher/Tests/EventDispatcherTest.php @@ -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); diff --git a/src/Symfony/Component/Filesystem/Filesystem.php b/src/Symfony/Component/Filesystem/Filesystem.php index b7ae31bb71..de5cafc46b 100644 --- a/src/Symfony/Component/Filesystem/Filesystem.php +++ b/src/Symfony/Component/Filesystem/Filesystem.php @@ -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) diff --git a/src/Symfony/Component/Finder/Expression/Glob.php b/src/Symfony/Component/Finder/Expression/Glob.php index 3023ceea69..a6984b82e3 100644 --- a/src/Symfony/Component/Finder/Expression/Glob.php +++ b/src/Symfony/Component/Finder/Expression/Glob.php @@ -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) { diff --git a/src/Symfony/Component/Finder/Glob.php b/src/Symfony/Component/Finder/Glob.php index c2030c9232..fedcc5e708 100644 --- a/src/Symfony/Component/Finder/Glob.php +++ b/src/Symfony/Component/Finder/Glob.php @@ -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) { diff --git a/src/Symfony/Component/Finder/Tests/FinderTest.php b/src/Symfony/Component/Finder/Tests/FinderTest.php index 67625e9681..61c2a6ab3c 100644 --- a/src/Symfony/Component/Finder/Tests/FinderTest.php +++ b/src/Symfony/Component/Finder/Tests/FinderTest.php @@ -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); diff --git a/src/Symfony/Component/Finder/Tests/Iterator/FilterIteratorTest.php b/src/Symfony/Component/Finder/Tests/Iterator/FilterIteratorTest.php index 029a266b7b..41e05a0a7b 100644 --- a/src/Symfony/Component/Finder/Tests/Iterator/FilterIteratorTest.php +++ b/src/Symfony/Component/Finder/Tests/Iterator/FilterIteratorTest.php @@ -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 diff --git a/src/Symfony/Component/HttpFoundation/IpUtils.php b/src/Symfony/Component/HttpFoundation/IpUtils.php index ea68e2ea8b..68e9421d94 100644 --- a/src/Symfony/Component/HttpFoundation/IpUtils.php +++ b/src/Symfony/Component/HttpFoundation/IpUtils.php @@ -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; diff --git a/src/Symfony/Component/HttpFoundation/ParameterBag.php b/src/Symfony/Component/HttpFoundation/ParameterBag.php index 7c13866d8c..26ca798637 100644 --- a/src/Symfony/Component/HttpFoundation/ParameterBag.php +++ b/src/Symfony/Component/HttpFoundation/ParameterBag.php @@ -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) { diff --git a/src/Symfony/Component/HttpFoundation/Request.php b/src/Symfony/Component/HttpFoundation/Request.php index 75ef72d0c7..25e195068d 100644 --- a/src/Symfony/Component/HttpFoundation/Request.php +++ b/src/Symfony/Component/HttpFoundation/Request.php @@ -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 { diff --git a/src/Symfony/Component/HttpFoundation/Tests/HeaderBagTest.php b/src/Symfony/Component/HttpFoundation/Tests/HeaderBagTest.php index 9b925d70f0..ada9ac0d1e 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/HeaderBagTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/HeaderBagTest.php @@ -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); } diff --git a/src/Symfony/Component/HttpFoundation/Tests/ParameterBagTest.php b/src/Symfony/Component/HttpFoundation/Tests/ParameterBagTest.php index fdbab026b7..2044d97a6f 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/ParameterBagTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/ParameterBagTest.php @@ -233,7 +233,7 @@ class ParameterBagTest extends \PHPUnit_Framework_TestCase $i = 0; foreach ($bag as $key => $val) { - $i++; + ++$i; $this->assertEquals($parameters[$key], $val); } diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Attribute/AttributeBagTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Attribute/AttributeBagTest.php index d291590fd9..5515003b40 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/Attribute/AttributeBagTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Attribute/AttributeBagTest.php @@ -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); diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Flash/FlashBagTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Flash/FlashBagTest.php index 6b529ab41f..c424591755 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/Flash/FlashBagTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Flash/FlashBagTest.php @@ -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); diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/SessionTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/SessionTest.php index 4e1667cf9e..385df1e46a 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/SessionTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/SessionTest.php @@ -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); diff --git a/src/Symfony/Component/HttpKernel/DataCollector/LoggerDataCollector.php b/src/Symfony/Component/HttpKernel/DataCollector/LoggerDataCollector.php index 2c0e907ec0..c0a95f51f7 100644 --- a/src/Symfony/Component/HttpKernel/DataCollector/LoggerDataCollector.php +++ b/src/Symfony/Component/HttpKernel/DataCollector/LoggerDataCollector.php @@ -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; } } diff --git a/src/Symfony/Component/HttpKernel/HttpCache/EsiResponseCacheStrategy.php b/src/Symfony/Component/HttpKernel/HttpCache/EsiResponseCacheStrategy.php index 6384af9660..4b28acff4a 100644 --- a/src/Symfony/Component/HttpKernel/HttpCache/EsiResponseCacheStrategy.php +++ b/src/Symfony/Component/HttpKernel/HttpCache/EsiResponseCacheStrategy.php @@ -45,7 +45,7 @@ class EsiResponseCacheStrategy implements EsiResponseCacheStrategyInterface $this->maxAges[] = $response->getMaxAge(); } - $this->embeddedResponses++; + ++$this->embeddedResponses; } /** diff --git a/src/Symfony/Component/HttpKernel/Tests/Profiler/AbstractProfilerStorageTest.php b/src/Symfony/Component/HttpKernel/Tests/Profiler/AbstractProfilerStorageTest.php index 07dff696d6..aa2b31dbc3 100644 --- a/src/Symfony/Component/HttpKernel/Tests/Profiler/AbstractProfilerStorageTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/Profiler/AbstractProfilerStorageTest.php @@ -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/'); diff --git a/src/Symfony/Component/HttpKernel/Tests/Profiler/FileProfilerStorageTest.php b/src/Symfony/Component/HttpKernel/Tests/Profiler/FileProfilerStorageTest.php index 6c74621419..d5edc70032 100644 --- a/src/Symfony/Component/HttpKernel/Tests/Profiler/FileProfilerStorageTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/Profiler/FileProfilerStorageTest.php @@ -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]); diff --git a/src/Symfony/Component/HttpKernel/Tests/Profiler/MongoDbProfilerStorageTest.php b/src/Symfony/Component/HttpKernel/Tests/Profiler/MongoDbProfilerStorageTest.php index c72732563c..29525fe6bd 100644 --- a/src/Symfony/Component/HttpKernel/Tests/Profiler/MongoDbProfilerStorageTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/Profiler/MongoDbProfilerStorageTest.php @@ -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()); diff --git a/src/Symfony/Component/Intl/Tests/NumberFormatter/AbstractNumberFormatterTest.php b/src/Symfony/Component/Intl/Tests/NumberFormatter/AbstractNumberFormatterTest.php index c172653d5b..a2b90324f5 100644 --- a/src/Symfony/Component/Intl/Tests/NumberFormatter/AbstractNumberFormatterTest.php +++ b/src/Symfony/Component/Intl/Tests/NumberFormatter/AbstractNumberFormatterTest.php @@ -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)); } diff --git a/src/Symfony/Component/Process/Tests/SignalListener.php b/src/Symfony/Component/Process/Tests/SignalListener.php index 335ac6027e..bd4d138b04 100644 --- a/src/Symfony/Component/Process/Tests/SignalListener.php +++ b/src/Symfony/Component/Process/Tests/SignalListener.php @@ -10,7 +10,7 @@ $n = 0; // ticks require activity to work - sleep(4); does not work while ($n < 400) { usleep(10000); - $n++; + ++$n; } return; diff --git a/src/Symfony/Component/Routing/Loader/AnnotationClassLoader.php b/src/Symfony/Component/Routing/Loader/AnnotationClassLoader.php index 82fe6abd95..e35f807b4c 100644 --- a/src/Symfony/Component/Routing/Loader/AnnotationClassLoader.php +++ b/src/Symfony/Component/Routing/Loader/AnnotationClassLoader.php @@ -237,7 +237,7 @@ abstract class AnnotationClassLoader implements LoaderInterface if ($this->defaultRouteIndex > 0) { $name .= '_'.$this->defaultRouteIndex; } - $this->defaultRouteIndex++; + ++$this->defaultRouteIndex; return $name; } diff --git a/src/Symfony/Component/Routing/Loader/AnnotationFileLoader.php b/src/Symfony/Component/Routing/Loader/AnnotationFileLoader.php index e54a0181c7..8ce57ac18c 100644 --- a/src/Symfony/Component/Routing/Loader/AnnotationFileLoader.php +++ b/src/Symfony/Component/Routing/Loader/AnnotationFileLoader.php @@ -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)) { diff --git a/src/Symfony/Component/Routing/Matcher/Dumper/ApacheMatcherDumper.php b/src/Symfony/Component/Routing/Matcher/Dumper/ApacheMatcherDumper.php index 219f2fc036..84b1944926 100644 --- a/src/Symfony/Component/Routing/Matcher/Dumper/ApacheMatcherDumper.php +++ b/src/Symfony/Component/Routing/Matcher/Dumper/ApacheMatcherDumper.php @@ -55,7 +55,7 @@ class ApacheMatcherDumper extends MatcherDumper if (null !== $hostRegex && $prevHostRegex !== $hostRegex) { $prevHostRegex = $hostRegex; - $hostRegexUnique++; + ++$hostRegexUnique; $rule = array(); diff --git a/src/Symfony/Component/Routing/RouteCompiler.php b/src/Symfony/Component/Routing/RouteCompiler.php index e998b93e93..f6637da666 100644 --- a/src/Symfony/Component/Routing/RouteCompiler.php +++ b/src/Symfony/Component/Routing/RouteCompiler.php @@ -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); } diff --git a/src/Symfony/Component/Security/Acl/Dbal/AclProvider.php b/src/Symfony/Component/Security/Acl/Dbal/AclProvider.php index 750a304d37..7c512adc7c 100644 --- a/src/Symfony/Component/Security/Acl/Dbal/AclProvider.php +++ b/src/Symfony/Component/Security/Acl/Dbal/AclProvider.php @@ -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()), diff --git a/src/Symfony/Component/Security/Acl/Dbal/MutableAclProvider.php b/src/Symfony/Component/Security/Acl/Dbal/MutableAclProvider.php index 74f52ce321..30772b46bf 100644 --- a/src/Symfony/Component/Security/Acl/Dbal/MutableAclProvider.php +++ b/src/Symfony/Component/Security/Acl/Dbal/MutableAclProvider.php @@ -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()])) { diff --git a/src/Symfony/Component/Security/Acl/Domain/Acl.php b/src/Symfony/Component/Security/Acl/Domain/Acl.php index 63a58c733d..365fc376d6 100644 --- a/src/Symfony/Component/Security/Acl/Domain/Acl.php +++ b/src/Symfony/Component/Security/Acl/Domain/Acl.php @@ -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); } } diff --git a/src/Symfony/Component/Security/Acl/Permission/MaskBuilder.php b/src/Symfony/Component/Security/Acl/Permission/MaskBuilder.php index c45e2f9741..45d89aa710 100644 --- a/src/Symfony/Component/Security/Acl/Permission/MaskBuilder.php +++ b/src/Symfony/Component/Security/Acl/Permission/MaskBuilder.php @@ -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)); diff --git a/src/Symfony/Component/Security/Core/Encoder/MessageDigestPasswordEncoder.php b/src/Symfony/Component/Security/Core/Encoder/MessageDigestPasswordEncoder.php index 03de2284ac..1706fc86a8 100644 --- a/src/Symfony/Component/Security/Core/Encoder/MessageDigestPasswordEncoder.php +++ b/src/Symfony/Component/Security/Core/Encoder/MessageDigestPasswordEncoder.php @@ -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); } diff --git a/src/Symfony/Component/Security/Core/Encoder/Pbkdf2PasswordEncoder.php b/src/Symfony/Component/Security/Core/Encoder/Pbkdf2PasswordEncoder.php index dac1cad600..6f24c4f1e2 100644 --- a/src/Symfony/Component/Security/Core/Encoder/Pbkdf2PasswordEncoder.php +++ b/src/Symfony/Component/Security/Core/Encoder/Pbkdf2PasswordEncoder.php @@ -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)); } diff --git a/src/Symfony/Component/Security/Core/Util/StringUtils.php b/src/Symfony/Component/Security/Core/Util/StringUtils.php index e68347f393..343585c88c 100644 --- a/src/Symfony/Component/Security/Core/Util/StringUtils.php +++ b/src/Symfony/Component/Security/Core/Util/StringUtils.php @@ -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])); } diff --git a/src/Symfony/Component/Security/Http/RememberMe/TokenBasedRememberMeServices.php b/src/Symfony/Component/Security/Http/RememberMe/TokenBasedRememberMeServices.php index 8283a7c287..3d2cf12cb0 100644 --- a/src/Symfony/Component/Security/Http/RememberMe/TokenBasedRememberMeServices.php +++ b/src/Symfony/Component/Security/Http/RememberMe/TokenBasedRememberMeServices.php @@ -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]); } diff --git a/src/Symfony/Component/Security/Tests/Acl/Dbal/AclProviderBenchmarkTest.php b/src/Symfony/Component/Security/Tests/Acl/Dbal/AclProviderBenchmarkTest.php index 265700167c..0c354758e8 100644 --- a/src/Symfony/Component/Security/Tests/Acl/Dbal/AclProviderBenchmarkTest.php +++ b/src/Symfony/Component/Security/Tests/Acl/Dbal/AclProviderBenchmarkTest.php @@ -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; diff --git a/src/Symfony/Component/Security/Tests/Acl/Dbal/AclProviderTest.php b/src/Symfony/Component/Security/Tests/Acl/Dbal/AclProviderTest.php index d701e226ce..ecd53db122 100644 --- a/src/Symfony/Component/Security/Tests/Acl/Dbal/AclProviderTest.php +++ b/src/Symfony/Component/Security/Tests/Acl/Dbal/AclProviderTest.php @@ -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(); diff --git a/src/Symfony/Component/Security/Tests/Acl/Domain/DoctrineAclCacheTest.php b/src/Symfony/Component/Security/Tests/Acl/Domain/DoctrineAclCacheTest.php index 93c87c1494..54f932d456 100644 --- a/src/Symfony/Component/Security/Tests/Acl/Domain/DoctrineAclCacheTest.php +++ b/src/Symfony/Component/Security/Tests/Acl/Domain/DoctrineAclCacheTest.php @@ -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)); diff --git a/src/Symfony/Component/Security/Tests/Core/Authorization/AccessDecisionManagerTest.php b/src/Symfony/Component/Security/Tests/Core/Authorization/AccessDecisionManagerTest.php index cbb39c4052..b416e9577c 100644 --- a/src/Symfony/Component/Security/Tests/Core/Authorization/AccessDecisionManagerTest.php +++ b/src/Symfony/Component/Security/Tests/Core/Authorization/AccessDecisionManagerTest.php @@ -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); } diff --git a/src/Symfony/Component/Security/Tests/Core/Encoder/BCryptPasswordEncoderTest.php b/src/Symfony/Component/Security/Tests/Core/Encoder/BCryptPasswordEncoderTest.php index 61e2afef18..3f8ba86467 100644 --- a/src/Symfony/Component/Security/Tests/Core/Encoder/BCryptPasswordEncoderTest.php +++ b/src/Symfony/Component/Security/Tests/Core/Encoder/BCryptPasswordEncoderTest.php @@ -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); } } diff --git a/src/Symfony/Component/Security/Tests/Core/Util/SecureRandomTest.php b/src/Symfony/Component/Security/Tests/Core/Util/SecureRandomTest.php index 316b049166..9fd1c163b3 100644 --- a/src/Symfony/Component/Security/Tests/Core/Util/SecureRandomTest.php +++ b/src/Symfony/Component/Security/Tests/Core/Util/SecureRandomTest.php @@ -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; } diff --git a/src/Symfony/Component/Translation/Loader/MoFileLoader.php b/src/Symfony/Component/Translation/Loader/MoFileLoader.php index 9cab3f0d8d..728a810b28 100644 --- a/src/Symfony/Component/Translation/Loader/MoFileLoader.php +++ b/src/Symfony/Component/Translation/Loader/MoFileLoader.php @@ -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; diff --git a/src/Symfony/Component/Translation/Tests/PluralizationRulesTest.php b/src/Symfony/Component/Translation/Tests/PluralizationRulesTest.php index 1e8ee704fa..066e07f5ab 100644 --- a/src/Symfony/Component/Translation/Tests/PluralizationRulesTest.php +++ b/src/Symfony/Component/Translation/Tests/PluralizationRulesTest.php @@ -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; } diff --git a/src/Symfony/Component/Validator/Tests/Fixtures/FilesLoader.php b/src/Symfony/Component/Validator/Tests/Fixtures/FilesLoader.php index 59d8ee8b39..a4d6a6ab47 100644 --- a/src/Symfony/Component/Validator/Tests/Fixtures/FilesLoader.php +++ b/src/Symfony/Component/Validator/Tests/Fixtures/FilesLoader.php @@ -27,7 +27,7 @@ abstract class FilesLoader extends BaseFilesLoader protected function getFileLoaderInstance($file) { - $this->timesCalled++; + ++$this->timesCalled; return $this->loader; }