Skip to content
This repository was archived by the owner on May 31, 2024. It is now read-only.

Commit f81b1cd

Browse files
committed
Merge branch '2.3' into 2.6
* 2.3: Fix tests in HHVM CS: Pre incrementation/decrementation should be used if possible Conflicts: src/Symfony/Bundle/TwigBundle/Command/LintCommand.php src/Symfony/Component/Console/Helper/TableHelper.php src/Symfony/Component/EventDispatcher/Tests/EventDispatcherTest.php src/Symfony/Component/HttpKernel/DataCollector/LoggerDataCollector.php src/Symfony/Component/HttpKernel/HttpCache/EsiResponseCacheStrategy.php src/Symfony/Component/Security/Acl/Dbal/AclProvider.php src/Symfony/Component/Security/Http/RememberMe/TokenBasedRememberMeServices.php
2 parents db95dbe + c29b2f6 commit f81b1cd

14 files changed

+37
-37
lines changed

Acl/Dbal/AclProvider.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ public function findAcls(array $oids, array $sids = array())
104104
$currentBatch = array();
105105
$oidLookup = array();
106106

107-
for ($i = 0, $c = count($oids); $i < $c; $i++) {
107+
for ($i = 0, $c = count($oids); $i < $c; ++$i) {
108108
$oid = $oids[$i];
109109
$oidLookupKey = $oid->getIdentifier().$oid->getType();
110110
$oidLookup[$oidLookupKey] = $oid;
@@ -281,7 +281,7 @@ protected function getAncestorLookupSql(array $batch)
281281

282282
$types = array();
283283
$count = count($batch);
284-
for ($i = 0; $i < $count; $i++) {
284+
for ($i = 0; $i < $count; ++$i) {
285285
if (!isset($types[$batch[$i]->getType()])) {
286286
$types[$batch[$i]->getType()] = true;
287287

@@ -296,7 +296,7 @@ protected function getAncestorLookupSql(array $batch)
296296

297297
if (1 === count($types)) {
298298
$ids = array();
299-
for ($i = 0; $i < $count; $i++) {
299+
for ($i = 0; $i < $count; ++$i) {
300300
$identifier = (string) $batch[$i]->getIdentifier();
301301
$ids[] = $this->connection->quote($identifier);
302302
}
@@ -308,7 +308,7 @@ protected function getAncestorLookupSql(array $batch)
308308
);
309309
} else {
310310
$where = '(o.object_identifier = %s AND c.class_type = %s)';
311-
for ($i = 0; $i < $count; $i++) {
311+
for ($i = 0; $i < $count; ++$i) {
312312
$sql .= sprintf(
313313
$where,
314314
$this->connection->quote($batch[$i]->getIdentifier()),

Acl/Dbal/MutableAclProvider.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -854,7 +854,7 @@ private function updateNewFieldAceProperty($name, array $changes)
854854
$sids = new \SplObjectStorage();
855855
$classIds = new \SplObjectStorage();
856856
foreach ($changes[1] as $field => $new) {
857-
for ($i = 0, $c = count($new); $i < $c; $i++) {
857+
for ($i = 0, $c = count($new); $i < $c; ++$i) {
858858
$ace = $new[$i];
859859

860860
if (null === $ace->getId()) {
@@ -895,7 +895,7 @@ private function updateOldFieldAceProperty($name, array $changes)
895895
{
896896
$currentIds = array();
897897
foreach ($changes[1] as $field => $new) {
898-
for ($i = 0, $c = count($new); $i < $c; $i++) {
898+
for ($i = 0, $c = count($new); $i < $c; ++$i) {
899899
$ace = $new[$i];
900900

901901
if (null !== $ace->getId()) {
@@ -905,7 +905,7 @@ private function updateOldFieldAceProperty($name, array $changes)
905905
}
906906

907907
foreach ($changes[0] as $old) {
908-
for ($i = 0, $c = count($old); $i < $c; $i++) {
908+
for ($i = 0, $c = count($old); $i < $c; ++$i) {
909909
$ace = $old[$i];
910910

911911
if (!isset($currentIds[$ace->getId()])) {
@@ -928,7 +928,7 @@ private function updateNewAceProperty($name, array $changes)
928928

929929
$sids = new \SplObjectStorage();
930930
$classIds = new \SplObjectStorage();
931-
for ($i = 0, $c = count($new); $i < $c; $i++) {
931+
for ($i = 0, $c = count($new); $i < $c; ++$i) {
932932
$ace = $new[$i];
933933

934934
if (null === $ace->getId()) {
@@ -969,15 +969,15 @@ private function updateOldAceProperty($name, array $changes)
969969
list($old, $new) = $changes;
970970
$currentIds = array();
971971

972-
for ($i = 0, $c = count($new); $i < $c; $i++) {
972+
for ($i = 0, $c = count($new); $i < $c; ++$i) {
973973
$ace = $new[$i];
974974

975975
if (null !== $ace->getId()) {
976976
$currentIds[$ace->getId()] = true;
977977
}
978978
}
979979

980-
for ($i = 0, $c = count($old); $i < $c; $i++) {
980+
for ($i = 0, $c = count($old); $i < $c; ++$i) {
981981
$ace = $old[$i];
982982

983983
if (!isset($currentIds[$ace->getId()])) {

Acl/Domain/Acl.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ private function deleteAce($property, $index)
409409
$this->$property = array_values($this->$property);
410410
$this->onPropertyChanged($property, $oldValue, $this->$property);
411411

412-
for ($i = $index, $c = count($this->$property); $i < $c; $i++) {
412+
for ($i = $index, $c = count($this->$property); $i < $c; ++$i) {
413413
$this->onEntryPropertyChanged($aces[$i], 'aceOrder', $i + 1, $i);
414414
}
415415
}
@@ -435,7 +435,7 @@ private function deleteFieldAce($property, $index, $field)
435435
$aces[$field] = array_values($aces[$field]);
436436
$this->onPropertyChanged($property, $oldValue, $this->$property);
437437

438-
for ($i = $index, $c = count($aces[$field]); $i < $c; $i++) {
438+
for ($i = $index, $c = count($aces[$field]); $i < $c; ++$i) {
439439
$this->onEntryPropertyChanged($aces[$field][$i], 'aceOrder', $i + 1, $i);
440440
}
441441
}
@@ -480,7 +480,7 @@ private function insertAce($property, $index, $mask, SecurityIdentityInterface $
480480
array_slice($this->$property, $index)
481481
);
482482

483-
for ($i = $index, $c = count($this->$property) - 1; $i < $c; $i++) {
483+
for ($i = $index, $c = count($this->$property) - 1; $i < $c; ++$i) {
484484
$this->onEntryPropertyChanged($aces[$i + 1], 'aceOrder', $i, $i + 1);
485485
}
486486
}
@@ -538,7 +538,7 @@ private function insertFieldAce($property, $index, $field, $mask, SecurityIdenti
538538
array_slice($aces[$field], $index)
539539
);
540540

541-
for ($i = $index, $c = count($aces[$field]) - 1; $i < $c; $i++) {
541+
for ($i = $index, $c = count($aces[$field]) - 1; $i < $c; ++$i) {
542542
$this->onEntryPropertyChanged($aces[$field][$i + 1], 'aceOrder', $i, $i + 1);
543543
}
544544
}

Acl/Permission/MaskBuilder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ public function getPattern()
122122
$length = strlen($pattern);
123123
$bitmask = str_pad(decbin($this->mask), $length, '0', STR_PAD_LEFT);
124124

125-
for ($i = $length - 1; $i >= 0; $i--) {
125+
for ($i = $length - 1; $i >= 0; --$i) {
126126
if ('1' === $bitmask[$i]) {
127127
try {
128128
$pattern[$i] = self::getCode(1 << ($length - $i - 1));

Acl/Tests/Dbal/AclProviderBenchmarkTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ protected function generateTestData()
9292
$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 (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)');
9393
$this->insertOidAncestorStmt = $this->con->prepare('INSERT INTO acl_object_identity_ancestors (object_identity_id, ancestor_id) VALUES (?, ?)');
9494

95-
for ($i = 0; $i < 40000; $i++) {
95+
for ($i = 0; $i < 40000; ++$i) {
9696
$this->generateAclHierarchy();
9797
}
9898
}
@@ -107,7 +107,7 @@ protected function generateAclHierarchy()
107107
protected function generateAclLevel($depth, $parentId, $ancestors)
108108
{
109109
$level = count($ancestors);
110-
for ($i = 0, $t = rand(1, 10); $i < $t; $i++) {
110+
for ($i = 0, $t = rand(1, 10); $i < $t; ++$i) {
111111
$id = $this->generateAcl($this->chooseClassId(), $parentId, $ancestors);
112112

113113
if ($level < $depth) {
@@ -178,7 +178,7 @@ protected function generateAces($classId, $objectId)
178178
$sids = array();
179179
$fieldOrder = array();
180180

181-
for ($i = 0; $i <= 30; $i++) {
181+
for ($i = 0; $i <= 30; ++$i) {
182182
$fieldName = rand(0, 1) ? null : $this->getRandomString(rand(10, 20));
183183

184184
do {
@@ -226,7 +226,7 @@ protected function generateMask()
226226

227227
while ($i <= 30) {
228228
$mask |= 1 << rand(0, 30);
229-
$i++;
229+
++$i;
230230
}
231231

232232
return $mask;

Acl/Tests/Dbal/AclProviderTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ public function testFindAcl()
130130
$i = 0;
131131
foreach ($aces as $index => $ace) {
132132
$this->assertEquals($i, $index);
133-
$i++;
133+
++$i;
134134
}
135135

136136
$sid = $aces[0]->getSecurityIdentity();

Acl/Tests/Domain/DoctrineAclCacheTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ protected function getAcl($depth = 0)
7272
$acl->insertClassFieldAce('foo', $sid, 1);
7373
$acl->insertObjectAce($sid, 1);
7474
$acl->insertObjectFieldAce('foo', $sid, 1);
75-
$id++;
75+
++$id;
7676

7777
if ($depth > 0) {
7878
$acl->setParentAcl($this->getAcl($depth - 1));

Core/Encoder/MessageDigestPasswordEncoder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public function encodePassword($raw, $salt)
5555
$digest = hash($this->algorithm, $salted, true);
5656

5757
// "stretch" hash
58-
for ($i = 1; $i < $this->iterations; $i++) {
58+
for ($i = 1; $i < $this->iterations; ++$i) {
5959
$digest = hash($this->algorithm, $digest.$salted, true);
6060
}
6161

Core/Encoder/Pbkdf2PasswordEncoder.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,11 @@ private function hashPbkdf2($algorithm, $password, $salt, $iterations, $length =
8787
$blocks = ceil($length / strlen(hash($algorithm, null, true)));
8888
$digest = '';
8989

90-
for ($i = 1; $i <= $blocks; $i++) {
90+
for ($i = 1; $i <= $blocks; ++$i) {
9191
$ib = $block = hash_hmac($algorithm, $salt.pack('N', $i), $password, true);
9292

9393
// Iterations
94-
for ($j = 1; $j < $iterations; $j++) {
94+
for ($j = 1; $j < $iterations; ++$j) {
9595
$ib ^= ($block = hash_hmac($algorithm, $block, $password, true));
9696
}
9797

Core/Tests/Authorization/AccessDecisionManagerTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,13 +153,13 @@ public function getStrategyTests()
153153
protected function getVoters($grants, $denies, $abstains)
154154
{
155155
$voters = array();
156-
for ($i = 0; $i < $grants; $i++) {
156+
for ($i = 0; $i < $grants; ++$i) {
157157
$voters[] = $this->getVoter(VoterInterface::ACCESS_GRANTED);
158158
}
159-
for ($i = 0; $i < $denies; $i++) {
159+
for ($i = 0; $i < $denies; ++$i) {
160160
$voters[] = $this->getVoter(VoterInterface::ACCESS_DENIED);
161161
}
162-
for ($i = 0; $i < $abstains; $i++) {
162+
for ($i = 0; $i < $abstains; ++$i) {
163163
$voters[] = $this->getVoter(VoterInterface::ACCESS_ABSTAIN);
164164
}
165165

0 commit comments

Comments
 (0)