Skip to content

Commit 984d82c

Browse files
committed
minor symfony#14121 CS: Pre incrementation/decrementation should be used if possible (gharlan)
This PR was merged into the 2.3 branch. Discussion ---------- CS: Pre incrementation/decrementation should be used if possible | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | n/a | License | MIT | Doc PR | n/a Fixes provided by new fixer: PHP-CS-Fixer/PHP-CS-Fixer#1113 If this pr is merged I would change the level of the fixer to `symfony`. Commits ------- c5123d6 CS: Pre incrementation/decrementation should be used if possible
2 parents ebe78bb + c5123d6 commit 984d82c

File tree

56 files changed

+92
-92
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+92
-92
lines changed

src/Symfony/Bridge/Doctrine/Tests/Logger/DbalLoggerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ public function testLogUTF8LongString()
121121

122122
$shortString = '';
123123
$longString = '';
124-
for ($i = 1; $i <= DbalLogger::MAX_STRING_LENGTH; $i++) {
124+
for ($i = 1; $i <= DbalLogger::MAX_STRING_LENGTH; ++$i) {
125125
$shortString .= $testStringArray[$i % $testStringCount];
126126
$longString .= $testStringArray[$i % $testStringCount];
127127
}

src/Symfony/Bridge/Twig/Extension/CodeExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ public function fileExcerpt($file, $line)
141141
$content = preg_split('#<br />#', $code);
142142

143143
$lines = array();
144-
for ($i = max($line - 3, 1), $max = min($line + 3, count($content)); $i <= $max; $i++) {
144+
for ($i = max($line - 3, 1), $max = min($line + 3, count($content)); $i <= $max; ++$i) {
145145
$lines[] = '<li'.($i == $line ? ' class="selected"' : '').'><code>'.self::fixCodeMarkup($content[$i - 1]).'</code></li>';
146146
}
147147

src/Symfony/Bundle/FrameworkBundle/Command/ContainerDebugCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ protected function validateInput(InputInterface $input)
143143
$optionsCount = 0;
144144
foreach ($options as $option) {
145145
if ($input->getOption($option)) {
146-
$optionsCount++;
146+
++$optionsCount;
147147
}
148148
}
149149

src/Symfony/Bundle/FrameworkBundle/Templating/Helper/CodeHelper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ public function fileExcerpt($file, $line)
135135
$content = preg_split('#<br />#', $code);
136136

137137
$lines = array();
138-
for ($i = max($line - 3, 1), $max = min($line + 3, count($content)); $i <= $max; $i++) {
138+
for ($i = max($line - 3, 1), $max = min($line + 3, count($content)); $i <= $max; ++$i) {
139139
$lines[] = '<li'.($i == $line ? ' class="selected"' : '').'><code>'.self::fixCodeMarkup($content[$i - 1]).'</code></li>';
140140
}
141141

src/Symfony/Bundle/FrameworkBundle/Translation/PhpExtractor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ protected function parseTokens($tokens, MessageCatalogue $catalog)
148148
{
149149
$tokenIterator = new \ArrayIterator($tokens);
150150

151-
for ($key = 0; $key < $tokenIterator->count(); $key++) {
151+
for ($key = 0; $key < $tokenIterator->count(); ++$key) {
152152
foreach ($this->sequences as $sequence) {
153153
$message = '';
154154
$tokenIterator->seek($key);

src/Symfony/Bundle/TwigBundle/Command/LintCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ protected function getContext($template, $line, $context = 3)
142142
$result = array();
143143
while ($position < $max) {
144144
$result[$position + 1] = $lines[$position];
145-
$position++;
145+
++$position;
146146
}
147147

148148
return $result;

src/Symfony/Component/ClassLoader/ClassMapGenerator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ private static function findClasses($path)
9595
$classes = array();
9696

9797
$namespace = '';
98-
for ($i = 0, $max = count($tokens); $i < $max; $i++) {
98+
for ($i = 0, $max = count($tokens); $i < $max; ++$i) {
9999
$token = $tokens[$i];
100100

101101
if (is_string($token)) {

src/Symfony/Component/Config/Loader/FileLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public function import($resource, $type = null, $ignoreErrors = false, $sourceRe
9191
}
9292

9393
$resources = is_array($resource) ? $resource : array($resource);
94-
for ($i = 0; $i < $resourcesCount = count($resources); $i++) {
94+
for ($i = 0; $i < $resourcesCount = count($resources); ++$i) {
9595
if (isset(self::$loading[$resources[$i]])) {
9696
if ($i == $resourcesCount - 1) {
9797
throw new FileLoaderImportCircularReferenceException(array_keys(self::$loading));

src/Symfony/Component/Console/Application.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -759,7 +759,7 @@ public function renderException($e, $output)
759759
'args' => array(),
760760
));
761761

762-
for ($i = 0, $count = count($trace); $i < $count; $i++) {
762+
for ($i = 0, $count = count($trace); $i < $count; ++$i) {
763763
$class = isset($trace[$i]['class']) ? $trace[$i]['class'] : '';
764764
$type = isset($trace[$i]['type']) ? $trace[$i]['type'] : '';
765765
$function = $trace[$i]['function'];

src/Symfony/Component/Console/Helper/DialogHelper.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ public function ask(OutputInterface $output, $question, $default = null, array $
131131
// Backspace Character
132132
if ("\177" === $c) {
133133
if (0 === $numMatches && 0 !== $i) {
134-
$i--;
134+
--$i;
135135
// Move cursor backwards
136136
$output->write("\033[1D");
137137
}
@@ -184,7 +184,7 @@ public function ask(OutputInterface $output, $question, $default = null, array $
184184
} else {
185185
$output->write($c);
186186
$ret .= $c;
187-
$i++;
187+
++$i;
188188

189189
$numMatches = 0;
190190
$ofs = 0;

0 commit comments

Comments
 (0)