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 269367872eaa..872779c2f841 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/Logger/DbalLoggerTest.php +++ b/src/Symfony/Bridge/Doctrine/Tests/Logger/DbalLoggerTest.php @@ -121,7 +121,7 @@ public function testLogUTF8LongString() $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 b5f619d327a0..49bb72844607 100644 --- a/src/Symfony/Bridge/Twig/Extension/CodeExtension.php +++ b/src/Symfony/Bridge/Twig/Extension/CodeExtension.php @@ -141,7 +141,7 @@ public function fileExcerpt($file, $line) $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 d58031fb7de0..a10760a1b9c2 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/ContainerDebugCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/ContainerDebugCommand.php @@ -143,7 +143,7 @@ protected function validateInput(InputInterface $input) $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 e7042e0dc353..bb7e0298cbf5 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/CodeHelper.php +++ b/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/CodeHelper.php @@ -135,7 +135,7 @@ public function fileExcerpt($file, $line) $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 5007a86bcaa0..8084b0fd7ada 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Translation/PhpExtractor.php +++ b/src/Symfony/Bundle/FrameworkBundle/Translation/PhpExtractor.php @@ -148,7 +148,7 @@ protected function parseTokens($tokens, MessageCatalogue $catalog) { $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 308d53b54eca..f2e9324010f2 100644 --- a/src/Symfony/Bundle/TwigBundle/Command/LintCommand.php +++ b/src/Symfony/Bundle/TwigBundle/Command/LintCommand.php @@ -142,7 +142,7 @@ protected function getContext($template, $line, $context = 3) $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 4c2aeab3ac79..112bee87bddc 100644 --- a/src/Symfony/Component/ClassLoader/ClassMapGenerator.php +++ b/src/Symfony/Component/ClassLoader/ClassMapGenerator.php @@ -95,7 +95,7 @@ private static function findClasses($path) $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 c1add20cea5d..2f3cc3bd08f7 100644 --- a/src/Symfony/Component/Config/Loader/FileLoader.php +++ b/src/Symfony/Component/Config/Loader/FileLoader.php @@ -91,7 +91,7 @@ public function import($resource, $type = null, $ignoreErrors = false, $sourceRe } $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 9daff3f3019b..b4c710901298 100644 --- a/src/Symfony/Component/Console/Application.php +++ b/src/Symfony/Component/Console/Application.php @@ -759,7 +759,7 @@ public function renderException($e, $output) '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 7c00cb82f501..4b395d9a7f71 100644 --- a/src/Symfony/Component/Console/Helper/DialogHelper.php +++ b/src/Symfony/Component/Console/Helper/DialogHelper.php @@ -131,7 +131,7 @@ public function ask(OutputInterface $output, $question, $default = null, array $ // Backspace Character if ("\177" === $c) { if (0 === $numMatches && 0 !== $i) { - $i--; + --$i; // Move cursor backwards $output->write("\033[1D"); } @@ -184,7 +184,7 @@ public function ask(OutputInterface $output, $question, $default = null, array $ } 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 90357cc21408..0904a1016953 100644 --- a/src/Symfony/Component/Console/Helper/TableHelper.php +++ b/src/Symfony/Component/Console/Helper/TableHelper.php @@ -334,7 +334,7 @@ private function renderRowSeparator() } $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 @@ private function renderRow(array $row, $cellFormat) } $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 f5cc5d136bd3..97b0cfc05d21 100644 --- a/src/Symfony/Component/Console/Input/ArgvInput.php +++ b/src/Symfony/Component/Console/Input/ArgvInput.php @@ -123,7 +123,7 @@ private function parseShortOption($token) 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 8184b832b3c2..c0525d7a8336 100644 --- a/src/Symfony/Component/CssSelector/Parser/TokenStream.php +++ b/src/Symfony/Component/CssSelector/Parser/TokenStream.php @@ -100,7 +100,7 @@ public function getNext() 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 0086240c81fd..41ece8a42208 100644 --- a/src/Symfony/Component/CssSelector/XPath/Extension/FunctionExtension.php +++ b/src/Symfony/Component/CssSelector/XPath/Extension/FunctionExtension.php @@ -84,7 +84,7 @@ public function translateNthChild(XPathExpr $xpath, FunctionNode $function, $las 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 923c47ffa073..99eaf497d5b4 100644 --- a/src/Symfony/Component/Debug/Tests/Exception/FlattenExceptionTest.php +++ b/src/Symfony/Component/Debug/Tests/Exception/FlattenExceptionTest.php @@ -189,9 +189,9 @@ public function testRecursionInArguments() 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 b543de5eff41..839e8ea611cf 100644 --- a/src/Symfony/Component/EventDispatcher/Tests/EventDispatcherTest.php +++ b/src/Symfony/Component/EventDispatcher/Tests/EventDispatcherTest.php @@ -125,7 +125,7 @@ public function testDispatchForClosure() { $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 b7ae31bb7198..de5cafc46bec 100644 --- a/src/Symfony/Component/Filesystem/Filesystem.php +++ b/src/Symfony/Component/Filesystem/Filesystem.php @@ -324,7 +324,7 @@ public function makePathRelative($endPath, $startPath) // 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 3023ceea69a3..a6984b82e393 100644 --- a/src/Symfony/Component/Finder/Expression/Glob.php +++ b/src/Symfony/Component/Finder/Expression/Glob.php @@ -105,7 +105,7 @@ public function toRegex($strictLeadingDot = true, $strictWildcardSlash = true) $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 c2030c9232fd..fedcc5e708ec 100644 --- a/src/Symfony/Component/Finder/Glob.php +++ b/src/Symfony/Component/Finder/Glob.php @@ -51,7 +51,7 @@ public static function toRegex($glob, $strictLeadingDot = true, $strictWildcardS $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 67625e968162..61c2a6ab3c8a 100644 --- a/src/Symfony/Component/Finder/Tests/FinderTest.php +++ b/src/Symfony/Component/Finder/Tests/FinderTest.php @@ -466,7 +466,7 @@ public function testCountDirectories() $i = 0; foreach ($directory as $dir) { - $i++; + ++$i; } $this->assertCount($i, $directory); @@ -478,7 +478,7 @@ public function testCountFiles() $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 029a266b7be6..41e05a0a7b39 100644 --- a/src/Symfony/Component/Finder/Tests/Iterator/FilterIteratorTest.php +++ b/src/Symfony/Component/Finder/Tests/Iterator/FilterIteratorTest.php @@ -31,7 +31,7 @@ public function testFilterFilesystemIterators() $c = 0; foreach ($i as $item) { - $c++; + ++$c; } $this->assertEquals(1, $c); @@ -40,7 +40,7 @@ public function testFilterFilesystemIterators() $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 ea68e2ea8ba9..68e9421d942a 100644 --- a/src/Symfony/Component/HttpFoundation/IpUtils.php +++ b/src/Symfony/Component/HttpFoundation/IpUtils.php @@ -110,7 +110,7 @@ public static function checkIp6($requestIp, $ip) $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 7c13866d8c09..26ca7986370e 100644 --- a/src/Symfony/Component/HttpFoundation/ParameterBag.php +++ b/src/Symfony/Component/HttpFoundation/ParameterBag.php @@ -113,7 +113,7 @@ public function get($path, $default = null, $deep = false) $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 75ef72d0c750..25e195068dd6 100644 --- a/src/Symfony/Component/HttpFoundation/Request.php +++ b/src/Symfony/Component/HttpFoundation/Request.php @@ -1557,7 +1557,7 @@ public function getLanguages() $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 9b925d70f038..ada9ac0d1eaa 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/HeaderBagTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/HeaderBagTest.php @@ -196,7 +196,7 @@ public function testGetIterator() $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 fdbab026b798..2044d97a6fcb 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/ParameterBagTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/ParameterBagTest.php @@ -233,7 +233,7 @@ public function testGetIterator() $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 d291590fd9e4..5515003b4073 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 @@ public function testGetIterator() $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 6b529ab41f5d..c424591755e0 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 @@ public function testGetIterator() $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 4e1667cf9e5b..385df1e46a95 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/SessionTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/SessionTest.php @@ -203,7 +203,7 @@ public function testGetIterator() $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 2c0e907ec0dd..c0a95f51f7aa 100644 --- a/src/Symfony/Component/HttpKernel/DataCollector/LoggerDataCollector.php +++ b/src/Symfony/Component/HttpKernel/DataCollector/LoggerDataCollector.php @@ -116,7 +116,7 @@ private function computeDeprecationCount() $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 6384af9660a8..4b28acff4af8 100644 --- a/src/Symfony/Component/HttpKernel/HttpCache/EsiResponseCacheStrategy.php +++ b/src/Symfony/Component/HttpKernel/HttpCache/EsiResponseCacheStrategy.php @@ -45,7 +45,7 @@ public function add(Response $response) $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 07dff696d60f..aa2b31dbc381 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 @@ public function testStoreTime() $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 @@ public function testStoreTime() 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 @@ public function testRetrieveByEmptyUrlAndIp() 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 @@ public function testPurge() 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 6c7462141978..d5edc7003286 100644 --- a/src/Symfony/Component/HttpKernel/Tests/Profiler/FileProfilerStorageTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/Profiler/FileProfilerStorageTest.php @@ -62,7 +62,7 @@ protected function getStorage() 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 @@ public function testMultiRowIndexFile() } $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 c72732563c67..29525fe6bdf7 100644 --- a/src/Symfony/Component/HttpKernel/Tests/Profiler/MongoDbProfilerStorageTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/Profiler/MongoDbProfilerStorageTest.php @@ -100,7 +100,7 @@ public function getDsns() 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 c172653d5bb4..a2b90324f514 100644 --- a/src/Symfony/Component/Intl/Tests/NumberFormatter/AbstractNumberFormatterTest.php +++ b/src/Symfony/Component/Intl/Tests/NumberFormatter/AbstractNumberFormatterTest.php @@ -490,7 +490,7 @@ public function testGetSymbol() $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 @@ public function testGetTextAttribute() $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 335ac6027e8e..bd4d138b0476 100644 --- a/src/Symfony/Component/Process/Tests/SignalListener.php +++ b/src/Symfony/Component/Process/Tests/SignalListener.php @@ -10,7 +10,7 @@ // 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 82fe6abd9531..e35f807b4c39 100644 --- a/src/Symfony/Component/Routing/Loader/AnnotationClassLoader.php +++ b/src/Symfony/Component/Routing/Loader/AnnotationClassLoader.php @@ -237,7 +237,7 @@ protected function getDefaultRouteName(\ReflectionClass $class, \ReflectionMetho 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 e54a0181c786..8ce57ac18ca5 100644 --- a/src/Symfony/Component/Routing/Loader/AnnotationFileLoader.php +++ b/src/Symfony/Component/Routing/Loader/AnnotationFileLoader.php @@ -88,7 +88,7 @@ protected function findClass($file) $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 219f2fc03608..84b1944926a9 100644 --- a/src/Symfony/Component/Routing/Matcher/Dumper/ApacheMatcherDumper.php +++ b/src/Symfony/Component/Routing/Matcher/Dumper/ApacheMatcherDumper.php @@ -55,7 +55,7 @@ public function dump(array $options = array()) 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 e998b93e938a..f6637da666b8 100644 --- a/src/Symfony/Component/Routing/RouteCompiler.php +++ b/src/Symfony/Component/Routing/RouteCompiler.php @@ -145,7 +145,7 @@ private static function compilePattern(Route $route, $pattern, $isHost) // 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 @@ private static function compilePattern(Route $route, $pattern, $isHost) // 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 750a304d37a5..7c512adc7c86 100644 --- a/src/Symfony/Component/Security/Acl/Dbal/AclProvider.php +++ b/src/Symfony/Component/Security/Acl/Dbal/AclProvider.php @@ -104,7 +104,7 @@ public function findAcls(array $oids, array $sids = array()) $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 @@ protected function getAncestorLookupSql(array $batch) $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 @@ protected function getAncestorLookupSql(array $batch) 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 @@ protected function getAncestorLookupSql(array $batch) ); } 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 74f52ce32151..30772b46bf81 100644 --- a/src/Symfony/Component/Security/Acl/Dbal/MutableAclProvider.php +++ b/src/Symfony/Component/Security/Acl/Dbal/MutableAclProvider.php @@ -786,7 +786,7 @@ private function updateNewFieldAceProperty($name, array $changes) $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 @@ private function updateOldFieldAceProperty($name, array $changes) { $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 @@ private function updateOldFieldAceProperty($name, array $changes) } 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 @@ private function updateNewAceProperty($name, array $changes) $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 @@ private function updateOldAceProperty($name, array $changes) 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 @@ private function updateOldAceProperty($name, array $changes) } } - 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 63a58c733d2f..365fc376d623 100644 --- a/src/Symfony/Component/Security/Acl/Domain/Acl.php +++ b/src/Symfony/Component/Security/Acl/Domain/Acl.php @@ -415,7 +415,7 @@ private function deleteAce($property, $index) $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 @@ private function deleteFieldAce($property, $index, $field) $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 @@ private function insertAce($property, $index, $mask, SecurityIdentityInterface $ 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 @@ private function insertFieldAce($property, $index, $field, $mask, SecurityIdenti 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 c45e2f9741ce..45d89aa71064 100644 --- a/src/Symfony/Component/Security/Acl/Permission/MaskBuilder.php +++ b/src/Symfony/Component/Security/Acl/Permission/MaskBuilder.php @@ -128,7 +128,7 @@ public function getPattern() $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 03de2284ac94..1706fc86a8eb 100644 --- a/src/Symfony/Component/Security/Core/Encoder/MessageDigestPasswordEncoder.php +++ b/src/Symfony/Component/Security/Core/Encoder/MessageDigestPasswordEncoder.php @@ -55,7 +55,7 @@ public function encodePassword($raw, $salt) $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 dac1cad6000e..6f24c4f1e279 100644 --- a/src/Symfony/Component/Security/Core/Encoder/Pbkdf2PasswordEncoder.php +++ b/src/Symfony/Component/Security/Core/Encoder/Pbkdf2PasswordEncoder.php @@ -87,11 +87,11 @@ private function hashPbkdf2($algorithm, $password, $salt, $iterations, $length = $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 e68347f3935d..343585c88c50 100644 --- a/src/Symfony/Component/Security/Core/Util/StringUtils.php +++ b/src/Symfony/Component/Security/Core/Util/StringUtils.php @@ -60,7 +60,7 @@ public static function equals($knownString, $userInput) $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 8283a7c28701..3d2cf12cb075 100644 --- a/src/Symfony/Component/Security/Http/RememberMe/TokenBasedRememberMeServices.php +++ b/src/Symfony/Component/Security/Http/RememberMe/TokenBasedRememberMeServices.php @@ -82,7 +82,7 @@ private function compareHashes($hash1, $hash2) } $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 265700167cbd..0c354758e82a 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 @@ protected function generateTestData() $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 @@ protected function generateAclHierarchy() 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 @@ protected function generateAces($classId, $objectId) $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 @@ protected function generateMask() 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 d701e226cefc..ecd53db122d0 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 @@ public function testFindAcl() $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 93c87c149444..54f932d4561e 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 @@ protected function getAcl($depth = 0) $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 cbb39c4052ca..b416e9577cdc 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 @@ public function getStrategyTests() 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 61e2afef18c2..3f8ba8646700 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 @@ public function testCostAboveRange() 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 316b049166b8..9fd1c163b351 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 @@ public function testPoker($secureRandom) { $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 @@ public function testRun($secureRandom) $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 @@ public function testRun($secureRandom) $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 @@ public function testLongRun($secureRandom) $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 @@ public function testSerialCorrelation($secureRandom) $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 9cab3f0d8da7..728a810b28dc 100644 --- a/src/Symfony/Component/Translation/Loader/MoFileLoader.php +++ b/src/Symfony/Component/Translation/Loader/MoFileLoader.php @@ -113,7 +113,7 @@ private function parse($resource) $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 1e8ee704fa95..066e07f5ab3f 100644 --- a/src/Symfony/Component/Translation/Tests/PluralizationRulesTest.php +++ b/src/Symfony/Component/Translation/Tests/PluralizationRulesTest.php @@ -112,7 +112,7 @@ protected function generateTestData($plural, $langCodes) { $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 59d8ee8b3973..a4d6a6ab474a 100644 --- a/src/Symfony/Component/Validator/Tests/Fixtures/FilesLoader.php +++ b/src/Symfony/Component/Validator/Tests/Fixtures/FilesLoader.php @@ -27,7 +27,7 @@ public function __construct(array $paths, LoaderInterface $loader) protected function getFileLoaderInstance($file) { - $this->timesCalled++; + ++$this->timesCalled; return $this->loader; }