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

Commit 729bef8

Browse files
committed
Merge branch '2.5'
* 2.5: added missing use statements added missing use statement added missing use statement fixed CS [Process] fixed some volatile tests [HttpKernel] fixed a volatile test [HttpFoundation] fixed some volatile tests [Tests] PHPUnit Optimizations Use getPathname() instead of string casting to get BinaryFileReponse file path Conflicts: src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Fixtures/php/full.php src/Symfony/Component/Debug/Tests/Exception/FlattenExceptionTest.php src/Symfony/Component/HttpFoundation/Tests/BinaryFileResponseTest.php src/Symfony/Component/Process/Process.php src/Symfony/Component/Stopwatch/Stopwatch.php src/Symfony/Component/Validator/Constraints/AbstractComparisonValidator.php src/Symfony/Component/Validator/Tests/Constraints/GreaterThanOrEqualValidatorTest.php src/Symfony/Component/Yaml/Parser.php src/Symfony/Component/Yaml/Tests/InlineTest.php
2 parents de26fac + 133d64a commit 729bef8

33 files changed

+127
-112
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;
@@ -502,8 +502,8 @@ private function hydrateObjectIdentities(Statement $stmt, array $oidLookup, arra
502502
$acls = $aces = $emptyArray = array();
503503
$oidCache = $oidLookup;
504504
$result = new \SplObjectStorage();
505-
$loadedAces =& $this->loadedAces;
506-
$loadedAcls =& $this->loadedAcls;
505+
$loadedAces = & $this->loadedAces;
506+
$loadedAcls = & $this->loadedAcls;
507507
$permissionGrantingStrategy = $this->permissionGrantingStrategy;
508508

509509
// we need these to set protected properties on hydrated objects
@@ -595,7 +595,7 @@ private function hydrateObjectIdentities(Statement $stmt, array $oidLookup, arra
595595
// It is important to only ever have one ACE instance per actual row since
596596
// some ACEs are shared between ACL instances
597597
if (!isset($loadedAces[$aceId])) {
598-
if (!isset($sids[$key = ($username?'1':'0').$securityIdentifier])) {
598+
if (!isset($sids[$key = ($username ? '1' : '0').$securityIdentifier])) {
599599
if ($username) {
600600
$sids[$key] = new UserSecurityIdentity(
601601
substr($securityIdentifier, 1 + $pos = strpos($securityIdentifier, '-')),

Acl/Dbal/MutableAclProvider.php

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ public function propertyChanged($sender, $propertyName, $oldValue, $newValue)
201201
$propertyChanges['aces'] = new \SplObjectStorage();
202202
}
203203

204-
$acePropertyChanges = $propertyChanges['aces']->contains($ace)? $propertyChanges['aces']->offsetGet($ace) : array();
204+
$acePropertyChanges = $propertyChanges['aces']->contains($ace) ? $propertyChanges['aces']->offsetGet($ace) : array();
205205

206206
if (isset($acePropertyChanges[$propertyName])) {
207207
$oldValue = $acePropertyChanges[$propertyName][0];
@@ -472,8 +472,8 @@ class_id,
472472
$query,
473473
$this->options['entry_table_name'],
474474
$classId,
475-
null === $objectIdentityId? 'NULL' : intval($objectIdentityId),
476-
null === $field? 'NULL' : $this->connection->quote($field),
475+
null === $objectIdentityId ? 'NULL' : intval($objectIdentityId),
476+
null === $field ? 'NULL' : $this->connection->quote($field),
477477
$aceOrder,
478478
$securityIdentityId,
479479
$mask,
@@ -831,7 +831,7 @@ private function updateNewFieldAceProperty($name, array $changes)
831831
$classIds = new \SplObjectStorage();
832832
$currentIds = array();
833833
foreach ($changes[1] as $field => $new) {
834-
for ($i=0,$c=count($new); $i<$c; $i++) {
834+
for ($i = 0,$c = count($new); $i<$c; $i++) {
835835
$ace = $new[$i];
836836

837837
if (null === $ace->getId()) {
@@ -908,7 +908,7 @@ private function updateNewAceProperty($name, array $changes)
908908
$sids = new \SplObjectStorage();
909909
$classIds = new \SplObjectStorage();
910910
$currentIds = array();
911-
for ($i=0,$c=count($new); $i<$c; $i++) {
911+
for ($i = 0,$c = count($new); $i<$c; $i++) {
912912
$ace = $new[$i];
913913

914914
if (null === $ace->getId()) {
@@ -951,7 +951,7 @@ private function updateOldAceProperty($name, array $changes)
951951
list($old, $new) = $changes;
952952
$currentIds = array();
953953

954-
for ($i=0,$c=count($new); $i<$c; $i++) {
954+
for ($i = 0,$c = count($new); $i<$c; $i++) {
955955
$ace = $new[$i];
956956

957957
if (null !== $ace->getId()) {
@@ -989,10 +989,9 @@ private function updateAce(\SplObjectStorage $aces, $ace)
989989
if (isset($propertyChanges['aceOrder'])
990990
&& $propertyChanges['aceOrder'][1] > $propertyChanges['aceOrder'][0]
991991
&& $propertyChanges == $aces->offsetGet($ace)) {
992-
993992
$aces->next();
994993
if ($aces->valid()) {
995-
$this->updateAce($aces, $aces->current());
994+
$this->updateAce($aces, $aces->current());
996995
}
997996
}
998997

Acl/Domain/Acl.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ public function getClassAces()
119119
*/
120120
public function getClassFieldAces($field)
121121
{
122-
return isset($this->classFieldAces[$field])? $this->classFieldAces[$field] : array();
122+
return isset($this->classFieldAces[$field]) ? $this->classFieldAces[$field] : array();
123123
}
124124

125125
/**
@@ -397,7 +397,7 @@ public function updateObjectFieldAuditing($index, $field, $auditSuccess, $auditF
397397
*/
398398
private function deleteAce($property, $index)
399399
{
400-
$aces =& $this->$property;
400+
$aces = & $this->$property;
401401
if (!isset($aces[$index])) {
402402
throw new \OutOfBoundsException(sprintf('The index "%d" does not exist.', $index));
403403
}
@@ -407,7 +407,7 @@ private function deleteAce($property, $index)
407407
$this->$property = array_values($this->$property);
408408
$this->onPropertyChanged($property, $oldValue, $this->$property);
409409

410-
for ($i=$index,$c=count($this->$property); $i<$c; $i++) {
410+
for ($i = $index,$c = count($this->$property); $i<$c; $i++) {
411411
$this->onEntryPropertyChanged($aces[$i], 'aceOrder', $i+1, $i);
412412
}
413413
}
@@ -422,7 +422,7 @@ private function deleteAce($property, $index)
422422
*/
423423
private function deleteFieldAce($property, $index, $field)
424424
{
425-
$aces =& $this->$property;
425+
$aces = & $this->$property;
426426
if (!isset($aces[$field][$index])) {
427427
throw new \OutOfBoundsException(sprintf('The index "%d" does not exist.', $index));
428428
}
@@ -432,7 +432,7 @@ private function deleteFieldAce($property, $index, $field)
432432
$aces[$field] = array_values($aces[$field]);
433433
$this->onPropertyChanged($property, $oldValue, $this->$property);
434434

435-
for ($i=$index,$c=count($aces[$field]); $i<$c; $i++) {
435+
for ($i = $index,$c = count($aces[$field]); $i<$c; $i++) {
436436
$this->onEntryPropertyChanged($aces[$field][$i], 'aceOrder', $i+1, $i);
437437
}
438438
}
@@ -467,7 +467,7 @@ private function insertAce($property, $index, $mask, SecurityIdentityInterface $
467467
}
468468
}
469469

470-
$aces =& $this->$property;
470+
$aces = & $this->$property;
471471
$oldValue = $this->$property;
472472
if (isset($aces[$index])) {
473473
$this->$property = array_merge(
@@ -476,7 +476,7 @@ private function insertAce($property, $index, $mask, SecurityIdentityInterface $
476476
array_slice($this->$property, $index)
477477
);
478478

479-
for ($i=$index,$c=count($this->$property)-1; $i<$c; $i++) {
479+
for ($i = $index,$c = count($this->$property)-1; $i<$c; $i++) {
480480
$this->onEntryPropertyChanged($aces[$i+1], 'aceOrder', $i, $i+1);
481481
}
482482
}
@@ -516,7 +516,7 @@ private function insertFieldAce($property, $index, $field, $mask, SecurityIdenti
516516
}
517517
}
518518

519-
$aces =& $this->$property;
519+
$aces = & $this->$property;
520520
if (!isset($aces[$field])) {
521521
$aces[$field] = array();
522522
}
@@ -533,7 +533,7 @@ private function insertFieldAce($property, $index, $field, $mask, SecurityIdenti
533533
array_slice($aces[$field], $index)
534534
);
535535

536-
for ($i=$index,$c=count($aces[$field])-1; $i<$c; $i++) {
536+
for ($i = $index,$c = count($aces[$field])-1; $i<$c; $i++) {
537537
$this->onEntryPropertyChanged($aces[$field][$i+1], 'aceOrder', $i, $i+1);
538538
}
539539
}
@@ -553,7 +553,7 @@ private function insertFieldAce($property, $index, $field, $mask, SecurityIdenti
553553
*/
554554
private function updateAce($property, $index, $mask, $strategy = null)
555555
{
556-
$aces =& $this->$property;
556+
$aces = & $this->$property;
557557
if (!isset($aces[$index])) {
558558
throw new \OutOfBoundsException(sprintf('The index "%d" does not exist.', $index));
559559
}
@@ -612,7 +612,7 @@ private function updateFieldAce($property, $index, $field, $mask, $strategy = nu
612612
throw new \InvalidArgumentException('$field cannot be empty.');
613613
}
614614

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

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) {
@@ -161,7 +161,7 @@ protected function chooseSid()
161161
$this->insertSidStmt->execute(array(
162162
$id,
163163
$this->getRandomString(rand(5, 30)),
164-
rand(0, 1)
164+
rand(0, 1),
165165
));
166166
$id += 1;
167167

@@ -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 {

Acl/Tests/Dbal/MutableAclProviderTest.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@ public function testDeleteAcl()
8888
try {
8989
$provider->findAcl($oid);
9090
$this->fail('ACL has not been properly deleted.');
91-
} catch (AclNotFoundException $notFound) { }
91+
} catch (AclNotFoundException $notFound) {
92+
}
9293
}
9394

9495
public function testDeleteAclDeletesChildren()
@@ -103,7 +104,8 @@ public function testDeleteAclDeletesChildren()
103104
try {
104105
$provider->findAcl(new ObjectIdentity(1, 'Foo'));
105106
$this->fail('Child-ACLs have not been deleted.');
106-
} catch (AclNotFoundException $notFound) { }
107+
} catch (AclNotFoundException $notFound) {
108+
}
107109
}
108110

109111
public function testFindAclsAddsPropertyListener()
@@ -148,7 +150,7 @@ public function testFindAclsAddsPropertyListenerToParentAcls()
148150
'parent' => array(
149151
'object_identifier' => '1',
150152
'class_type' => 'anotherFoo',
151-
)
153+
),
152154
));
153155

154156
$propertyChanges = $this->getField($provider, 'propertyChanges');
@@ -288,7 +290,8 @@ public function testUpdateAclThrowsExceptionOnConcurrentModificationOfSharedProp
288290
try {
289291
$provider->updateAcl($acl1);
290292
$this->fail('Provider failed to detect a concurrent modification.');
291-
} catch (ConcurrentModificationException $ex) { }
293+
} catch (ConcurrentModificationException $ex) {
294+
}
292295
}
293296

294297
public function testUpdateAcl()

Acl/Tests/Domain/AclTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ public function testInsertAce($property, $method)
128128
$acl = $this->getAcl();
129129

130130
$listener = $this->getListener(array(
131-
$property, 'aceOrder', $property, 'aceOrder', $property
131+
$property, 'aceOrder', $property, 'aceOrder', $property,
132132
));
133133
$acl->addPropertyChangedListener($listener);
134134

@@ -358,7 +358,7 @@ public function testUpdateFieldAce($type)
358358
$acl->{'insert'.$type}('foo', new UserSecurityIdentity('foo', 'Foo'), 1);
359359

360360
$listener = $this->getListener(array(
361-
'mask', 'mask', 'strategy'
361+
'mask', 'mask', 'strategy',
362362
));
363363
$acl->addPropertyChangedListener($listener);
364364

Acl/Tests/Domain/PermissionGrantingStrategyTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,8 @@ public function testIsGrantedStrategies($maskStrategy, $aceMask, $requiredMask,
154154
try {
155155
$strategy->isGranted($acl, array($requiredMask), array($sid));
156156
$this->fail('The ACE is not supposed to match.');
157-
} catch (NoAceFoundException $noAce) { }
157+
} catch (NoAceFoundException $noAce) {
158+
}
158159
} else {
159160
$this->assertTrue($strategy->isGranted($acl, array($requiredMask), array($sid)));
160161
}

Acl/Tests/Domain/SecurityIdentityRetrievalStrategyTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ public function getSecurityIdentityRetrievalTests()
103103
array('guest', array('ROLE_FOO'), 'anonymous', array(
104104
new RoleSecurityIdentity('ROLE_FOO'),
105105
new RoleSecurityIdentity('IS_AUTHENTICATED_ANONYMOUSLY'),
106-
))
106+
)),
107107
);
108108
}
109109

Acl/Voter/AclVoter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public function vote(TokenInterface $token, $object, array $attributes)
6464

6565
if (null === $object) {
6666
if (null !== $this->logger) {
67-
$this->logger->debug(sprintf('Object identity unavailable. Voting to %s', $this->allowIfObjectIdentityUnavailable? 'grant access' : 'abstain'));
67+
$this->logger->debug(sprintf('Object identity unavailable. Voting to %s', $this->allowIfObjectIdentityUnavailable ? 'grant access' : 'abstain'));
6868
}
6969

7070
return $this->allowIfObjectIdentityUnavailable ? self::ACCESS_GRANTED : self::ACCESS_ABSTAIN;
@@ -79,7 +79,7 @@ public function vote(TokenInterface $token, $object, array $attributes)
7979
$oid = $object;
8080
} elseif (null === $oid = $this->objectIdentityRetrievalStrategy->getObjectIdentity($object)) {
8181
if (null !== $this->logger) {
82-
$this->logger->debug(sprintf('Object identity unavailable. Voting to %s', $this->allowIfObjectIdentityUnavailable? 'grant access' : 'abstain'));
82+
$this->logger->debug(sprintf('Object identity unavailable. Voting to %s', $this->allowIfObjectIdentityUnavailable ? 'grant access' : 'abstain'));
8383
}
8484

8585
return $this->allowIfObjectIdentityUnavailable ? self::ACCESS_GRANTED : self::ACCESS_ABSTAIN;

Core/Authentication/Token/AbstractToken.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ public function serialize()
150150
is_object($this->user) ? clone $this->user : $this->user,
151151
$this->authenticated,
152152
$this->roles,
153-
$this->attributes
153+
$this->attributes,
154154
)
155155
);
156156
}

Core/Tests/Authentication/Token/AbstractTokenTest.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@ public function unserialize($serialized)
5252
parent::unserialize($parentStr);
5353
}
5454

55-
public function getCredentials() {}
55+
public function getCredentials()
56+
{
57+
}
5658
}
5759

5860
class AbstractTokenTest extends \PHPUnit_Framework_TestCase
@@ -227,13 +229,13 @@ public function getUserChanges()
227229
'foo', $user,
228230
),
229231
array(
230-
'foo', $advancedUser
232+
'foo', $advancedUser,
231233
),
232234
array(
233-
$user, 'foo'
235+
$user, 'foo',
234236
),
235237
array(
236-
$advancedUser, 'foo'
238+
$advancedUser, 'foo',
237239
),
238240
array(
239241
$user, new TestUser('foo'),
@@ -254,10 +256,10 @@ public function getUserChanges()
254256
new TestUser('foo'), $advancedUser,
255257
),
256258
array(
257-
$user, $advancedUser
259+
$user, $advancedUser,
258260
),
259261
array(
260-
$advancedUser, $user
262+
$advancedUser, $user,
261263
),
262264
);
263265
}

0 commit comments

Comments
 (0)