Skip to content

Commit 8a798a7

Browse files
committed
minor #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 7e80874 + 26ff3a7 commit 8a798a7

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

Expression/Glob.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public function toRegex($strictLeadingDot = true, $strictWildcardSlash = true)
105105
$inCurlies = 0;
106106
$regex = '';
107107
$sizeGlob = strlen($this->pattern);
108-
for ($i = 0; $i < $sizeGlob; $i++) {
108+
for ($i = 0; $i < $sizeGlob; ++$i) {
109109
$car = $this->pattern[$i];
110110
if ($firstByte) {
111111
if ($strictLeadingDot && '.' !== $car) {

Glob.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public static function toRegex($glob, $strictLeadingDot = true, $strictWildcardS
5151
$inCurlies = 0;
5252
$regex = '';
5353
$sizeGlob = strlen($glob);
54-
for ($i = 0; $i < $sizeGlob; $i++) {
54+
for ($i = 0; $i < $sizeGlob; ++$i) {
5555
$car = $glob[$i];
5656
if ($firstByte) {
5757
if ($strictLeadingDot && '.' !== $car) {

Tests/FinderTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,7 @@ public function testCountDirectories()
464464
$i = 0;
465465

466466
foreach ($directory as $dir) {
467-
$i++;
467+
++$i;
468468
}
469469

470470
$this->assertCount($i, $directory);
@@ -476,7 +476,7 @@ public function testCountFiles()
476476
$i = 0;
477477

478478
foreach ($files as $file) {
479-
$i++;
479+
++$i;
480480
}
481481

482482
$this->assertCount($i, $files);

Tests/Iterator/FilterIteratorTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public function testFilterFilesystemIterators()
3131

3232
$c = 0;
3333
foreach ($i as $item) {
34-
$c++;
34+
++$c;
3535
}
3636

3737
$this->assertEquals(1, $c);
@@ -40,7 +40,7 @@ public function testFilterFilesystemIterators()
4040

4141
$c = 0;
4242
foreach ($i as $item) {
43-
$c++;
43+
++$c;
4444
}
4545

4646
// This would fail with \FilterIterator but works with Symfony\Component\Finder\Iterator\FilterIterator

0 commit comments

Comments
 (0)