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

Commit 06dbcd5

Browse files
committed
Merge branch '2.3' into 2.6
* 2.3: [Validator] Add missing pt_BR translations Add parsing of hexadecimal strings for PHP 7 [Configuration] improve description for ignoreExtraKeys on ArrayNodeDefinition [Validator] Added missing Hungarian translation [Validator] Fixed grammar in Hungarian translation CS: Unary operators should be placed adjacent to their operands CS: Binary operators should be arounded by at least one space remove useless tests that fail in php 7 [Translator] fix test for php 7 compatibility Update phpdoc of ProcessBuilder#setPrefix() Conflicts: src/Symfony/Component/HttpFoundation/Session/Attribute/NamespacedAttributeBag.php src/Symfony/Component/PropertyAccess/PropertyAccessor.php src/Symfony/Component/Validator/Resources/translations/validators.pt_BR.xlf src/Symfony/Component/Yaml/Parser.php
2 parents 94465e0 + 25e914f commit 06dbcd5

File tree

9 files changed

+36
-53
lines changed

9 files changed

+36
-53
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;
@@ -315,7 +315,7 @@ protected function getAncestorLookupSql(array $batch)
315315
$this->connection->quote($batch[$i]->getType())
316316
);
317317

318-
if ($i+1 < $count) {
318+
if ($i + 1 < $count) {
319319
$sql .= ' OR ';
320320
}
321321
}
@@ -509,8 +509,8 @@ private function hydrateObjectIdentities(Statement $stmt, array $oidLookup, arra
509509
$acls = $aces = $emptyArray = array();
510510
$oidCache = $oidLookup;
511511
$result = new \SplObjectStorage();
512-
$loadedAces = & $this->loadedAces;
513-
$loadedAcls = & $this->loadedAcls;
512+
$loadedAces = &$this->loadedAces;
513+
$loadedAcls = &$this->loadedAcls;
514514
$permissionGrantingStrategy = $this->permissionGrantingStrategy;
515515

516516
// we need these to set protected properties on hydrated objects

Acl/Dbal/MutableAclProvider.php

Lines changed: 3 additions & 3 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()) {
@@ -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,7 +969,7 @@ 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()) {

Acl/Domain/Acl.php

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ public function updateObjectFieldAuditing($index, $field, $auditSuccess, $auditF
399399
*/
400400
private function deleteAce($property, $index)
401401
{
402-
$aces = & $this->$property;
402+
$aces = &$this->$property;
403403
if (!isset($aces[$index])) {
404404
throw new \OutOfBoundsException(sprintf('The index "%d" does not exist.', $index));
405405
}
@@ -409,8 +409,8 @@ 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++) {
413-
$this->onEntryPropertyChanged($aces[$i], 'aceOrder', $i+1, $i);
412+
for ($i = $index, $c = count($this->$property); $i < $c; $i++) {
413+
$this->onEntryPropertyChanged($aces[$i], 'aceOrder', $i + 1, $i);
414414
}
415415
}
416416

@@ -425,7 +425,7 @@ private function deleteAce($property, $index)
425425
*/
426426
private function deleteFieldAce($property, $index, $field)
427427
{
428-
$aces = & $this->$property;
428+
$aces = &$this->$property;
429429
if (!isset($aces[$field][$index])) {
430430
throw new \OutOfBoundsException(sprintf('The index "%d" does not exist.', $index));
431431
}
@@ -435,8 +435,8 @@ 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++) {
439-
$this->onEntryPropertyChanged($aces[$field][$i], 'aceOrder', $i+1, $i);
438+
for ($i = $index, $c = count($aces[$field]); $i < $c; $i++) {
439+
$this->onEntryPropertyChanged($aces[$field][$i], 'aceOrder', $i + 1, $i);
440440
}
441441
}
442442

@@ -471,7 +471,7 @@ private function insertAce($property, $index, $mask, SecurityIdentityInterface $
471471
}
472472
}
473473

474-
$aces = & $this->$property;
474+
$aces = &$this->$property;
475475
$oldValue = $this->$property;
476476
if (isset($aces[$index])) {
477477
$this->$property = array_merge(
@@ -480,8 +480,8 @@ 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++) {
484-
$this->onEntryPropertyChanged($aces[$i+1], 'aceOrder', $i, $i+1);
483+
for ($i = $index, $c = count($this->$property) - 1; $i < $c; $i++) {
484+
$this->onEntryPropertyChanged($aces[$i + 1], 'aceOrder', $i, $i + 1);
485485
}
486486
}
487487

@@ -521,7 +521,7 @@ private function insertFieldAce($property, $index, $field, $mask, SecurityIdenti
521521
}
522522
}
523523

524-
$aces = & $this->$property;
524+
$aces = &$this->$property;
525525
if (!isset($aces[$field])) {
526526
$aces[$field] = array();
527527
}
@@ -538,8 +538,8 @@ 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++) {
542-
$this->onEntryPropertyChanged($aces[$field][$i+1], 'aceOrder', $i, $i+1);
541+
for ($i = $index, $c = count($aces[$field]) - 1; $i < $c; $i++) {
542+
$this->onEntryPropertyChanged($aces[$field][$i + 1], 'aceOrder', $i, $i + 1);
543543
}
544544
}
545545

@@ -559,7 +559,7 @@ private function insertFieldAce($property, $index, $field, $mask, SecurityIdenti
559559
*/
560560
private function updateAce($property, $index, $mask, $strategy = null)
561561
{
562-
$aces = & $this->$property;
562+
$aces = &$this->$property;
563563
if (!isset($aces[$index])) {
564564
throw new \OutOfBoundsException(sprintf('The index "%d" does not exist.', $index));
565565
}
@@ -620,7 +620,7 @@ private function updateFieldAce($property, $index, $field, $mask, $strategy = nu
620620
throw new \InvalidArgumentException('$field cannot be empty.');
621621
}
622622

623-
$aces = & $this->$property;
623+
$aces = &$this->$property;
624624
if (!isset($aces[$field][$index])) {
625625
throw new \OutOfBoundsException(sprintf('The index "%d" does not exist.', $index));
626626
}

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: 9 additions & 9 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) {
@@ -124,9 +124,9 @@ protected function chooseClassId()
124124
$this->insertClassStmt->execute(array($id, $this->getRandomString(rand(20, 100), 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\\_')));
125125
++$id;
126126

127-
return $id-1;
127+
return $id - 1;
128128
} else {
129-
return rand(1000, $id-1);
129+
return rand(1000, $id - 1);
130130
}
131131
}
132132

@@ -150,7 +150,7 @@ protected function generateAcl($classId, $parentId, $ancestors)
150150
$this->generateAces($classId, $id);
151151
++$id;
152152

153-
return $id-1;
153+
return $id - 1;
154154
}
155155

156156
protected function chooseSid()
@@ -165,9 +165,9 @@ protected function chooseSid()
165165
));
166166
++$id;
167167

168-
return $id-1;
168+
return $id - 1;
169169
} else {
170-
return rand(1000, $id-1);
170+
return rand(1000, $id - 1);
171171
}
172172
}
173173

@@ -185,7 +185,7 @@ protected function generateAces($classId, $objectId)
185185
$sid = $this->chooseSid();
186186
} while (array_key_exists($sid, $sids) && in_array($fieldName, $sids[$sid], true));
187187

188-
$fieldOrder[$fieldName] = array_key_exists($fieldName, $fieldOrder) ? $fieldOrder[$fieldName]+1 : 0;
188+
$fieldOrder[$fieldName] = array_key_exists($fieldName, $fieldOrder) ? $fieldOrder[$fieldName] + 1 : 0;
189189
if (!isset($sids[$sid])) {
190190
$sids[$sid] = array();
191191
}
@@ -238,7 +238,7 @@ protected function getRandomString($length, $chars = 'abcdefghijklmnopqrstuvwxyz
238238
$cLength = strlen($chars);
239239

240240
while (strlen($s) < $length) {
241-
$s .= $chars[mt_rand(0, $cLength-1)];
241+
$s .= $chars[mt_rand(0, $cLength - 1)];
242242
}
243243

244244
return $s;

Core/Authentication/Token/AbstractToken.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ public function setAttribute($name, $value)
231231
public function __toString()
232232
{
233233
$class = get_class($this);
234-
$class = substr($class, strrpos($class, '\\')+1);
234+
$class = substr($class, strrpos($class, '\\') + 1);
235235

236236
$roles = array();
237237
foreach ($this->roles as $role) {
@@ -248,7 +248,7 @@ private function hasUserChanged(UserInterface $user)
248248
}
249249

250250
if ($this->user instanceof EquatableInterface) {
251-
return ! (bool) $this->user->isEqualTo($user);
251+
return !(bool) $this->user->isEqualTo($user);
252252
}
253253

254254
if ($this->user->getPassword() !== $user->getPassword()) {

Core/Tests/Authentication/Token/RememberMeTokenTest.php

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -52,23 +52,6 @@ public function testConstructorKeyCannotBeEmptyString()
5252
);
5353
}
5454

55-
/**
56-
* @expectedException \PHPUnit_Framework_Error
57-
* @dataProvider getUserArguments
58-
*/
59-
public function testConstructorUserCannotBeNull($user)
60-
{
61-
new RememberMeToken($user, 'foo', 'foo');
62-
}
63-
64-
public function getUserArguments()
65-
{
66-
return array(
67-
array(null),
68-
array('foo'),
69-
);
70-
}
71-
7255
protected function getUser($roles = array('ROLE_FOO'))
7356
{
7457
$user = $this->getMock('Symfony\Component\Security\Core\User\UserInterface');

Core/Tests/Util/SecureRandomTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function testPoker($secureRandom)
4949
$f += $c[$i] * $c[$i];
5050
}
5151

52-
$Y = 16/5000 * $f - 5000;
52+
$Y = 16 / 5000 * $f - 5000;
5353

5454
$this->assertTrue($Y > 1.03 && $Y < 57.4, 'Poker test failed, Y = '.$Y);
5555
}

Http/Tests/RememberMe/TokenBasedRememberMeServicesTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function testAutoLoginThrowsExceptionOnNonExistentUser()
4343
$userProvider = $this->getProvider();
4444
$service = $this->getService($userProvider, array('name' => 'foo', 'path' => null, 'domain' => null, 'always_remember_me' => true, 'lifetime' => 3600));
4545
$request = new Request();
46-
$request->cookies->set('foo', $this->getCookie('fooclass', 'foouser', time()+3600, 'foopass'));
46+
$request->cookies->set('foo', $this->getCookie('fooclass', 'foouser', time() + 3600, 'foopass'));
4747

4848
$userProvider
4949
->expects($this->once())
@@ -129,7 +129,7 @@ public function testAutoLogin()
129129

130130
$service = $this->getService($userProvider, array('name' => 'foo', 'always_remember_me' => true, 'lifetime' => 3600));
131131
$request = new Request();
132-
$request->cookies->set('foo', $this->getCookie('fooclass', 'foouser', time()+3600, 'foopass'));
132+
$request->cookies->set('foo', $this->getCookie('fooclass', 'foouser', time() + 3600, 'foopass'));
133133

134134
$returnedToken = $service->autoLogin($request);
135135

0 commit comments

Comments
 (0)