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

Commit 78ebbab

Browse files
committed
Merge branch '2.3' into 2.4
* 2.3: fixed CS [Process] fixed some volatile tests [HttpKernel] fixed a volatile test [HttpFoundation] fixed some volatile tests Use getPathname() instead of string casting to get BinaryFileReponse file path Conflicts: src/Symfony/Bundle/FrameworkBundle/Command/ConfigDumpReferenceCommand.php src/Symfony/Bundle/FrameworkBundle/Command/ContainerDebugCommand.php src/Symfony/Bundle/FrameworkBundle/EventListener/SessionListener.php src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php src/Symfony/Component/ClassLoader/Tests/ApcUniversalClassLoaderTest.php src/Symfony/Component/Config/Definition/ReferenceDumper.php src/Symfony/Component/Config/Tests/Definition/Dumper/YamlReferenceDumperTest.php src/Symfony/Component/Console/Application.php src/Symfony/Component/Console/Tests/ApplicationTest.php src/Symfony/Component/Filesystem/Exception/IOException.php src/Symfony/Component/Form/Extension/Templating/TemplatingExtension.php src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/NumberToLocalizedStringTransformerTest.php src/Symfony/Component/HttpKernel/Debug/TraceableEventDispatcher.php src/Symfony/Component/HttpKernel/Tests/Bundle/BundleTest.php src/Symfony/Component/HttpKernel/Tests/Fragment/RoutableFragmentRendererTest.php src/Symfony/Component/HttpKernel/Tests/Profiler/Mock/RedisMock.php src/Symfony/Component/Intl/NumberFormatter/NumberFormatter.php src/Symfony/Component/PropertyAccess/PropertyAccessor.php src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorCollectionTest.php src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorTest.php src/Symfony/Component/Routing/Matcher/Dumper/ApacheMatcherDumper.php src/Symfony/Component/Routing/Tests/Annotation/RouteTest.php src/Symfony/Component/Routing/Tests/Loader/AnnotationClassLoaderTest.php src/Symfony/Component/Serializer/Encoder/XmlEncoder.php src/Symfony/Component/Validator/Constraints/CollectionValidator.php src/Symfony/Component/Validator/Tests/ExecutionContextTest.php
2 parents 9aefee3 + 2d2a3fa commit 78ebbab

34 files changed

+135
-119
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;
@@ -500,8 +500,8 @@ private function hydrateObjectIdentities(Statement $stmt, array $oidLookup, arra
500500
$acls = $aces = $emptyArray = array();
501501
$oidCache = $oidLookup;
502502
$result = new \SplObjectStorage();
503-
$loadedAces =& $this->loadedAces;
504-
$loadedAcls =& $this->loadedAcls;
503+
$loadedAces = & $this->loadedAces;
504+
$loadedAcls = & $this->loadedAcls;
505505
$permissionGrantingStrategy = $this->permissionGrantingStrategy;
506506

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

Acl/Dbal/MutableAclProvider.php

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ public function propertyChanged($sender, $propertyName, $oldValue, $newValue)
188188
$propertyChanges['aces'] = new \SplObjectStorage();
189189
}
190190

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

193193
if (isset($acePropertyChanges[$propertyName])) {
194194
$oldValue = $acePropertyChanges[$propertyName][0];
@@ -448,8 +448,8 @@ class_id,
448448
$query,
449449
$this->options['entry_table_name'],
450450
$classId,
451-
null === $objectIdentityId? 'NULL' : intval($objectIdentityId),
452-
null === $field? 'NULL' : $this->connection->quote($field),
451+
null === $objectIdentityId ? 'NULL' : intval($objectIdentityId),
452+
null === $field ? 'NULL' : $this->connection->quote($field),
453453
$aceOrder,
454454
$securityIdentityId,
455455
$mask,
@@ -767,7 +767,7 @@ private function updateNewFieldAceProperty($name, array $changes)
767767
$classIds = new \SplObjectStorage();
768768
$currentIds = array();
769769
foreach ($changes[1] as $field => $new) {
770-
for ($i=0,$c=count($new); $i<$c; $i++) {
770+
for ($i = 0,$c = count($new); $i<$c; $i++) {
771771
$ace = $new[$i];
772772

773773
if (null === $ace->getId()) {
@@ -844,7 +844,7 @@ private function updateNewAceProperty($name, array $changes)
844844
$sids = new \SplObjectStorage();
845845
$classIds = new \SplObjectStorage();
846846
$currentIds = array();
847-
for ($i=0,$c=count($new); $i<$c; $i++) {
847+
for ($i = 0,$c = count($new); $i<$c; $i++) {
848848
$ace = $new[$i];
849849

850850
if (null === $ace->getId()) {
@@ -887,7 +887,7 @@ private function updateOldAceProperty($name, array $changes)
887887
list($old, $new) = $changes;
888888
$currentIds = array();
889889

890-
for ($i=0,$c=count($new); $i<$c; $i++) {
890+
for ($i = 0,$c = count($new); $i<$c; $i++) {
891891
$ace = $new[$i];
892892

893893
if (null !== $ace->getId()) {
@@ -925,11 +925,11 @@ private function updateAce(\SplObjectStorage $aces, $ace)
925925
if (isset($propertyChanges['aceOrder'])
926926
&& $propertyChanges['aceOrder'][1] > $propertyChanges['aceOrder'][0]
927927
&& $propertyChanges == $aces->offsetGet($ace)) {
928-
$aces->next();
929-
if ($aces->valid()) {
930-
$this->updateAce($aces, $aces->current());
931-
}
928+
$aces->next();
929+
if ($aces->valid()) {
930+
$this->updateAce($aces, $aces->current());
932931
}
932+
}
933933

934934
if (isset($propertyChanges['mask'])) {
935935
$sets[] = sprintf('mask = %d', $propertyChanges['mask'][1]);
@@ -949,5 +949,4 @@ private function updateAce(\SplObjectStorage $aces, $ace)
949949

950950
$this->connection->executeQuery($this->getUpdateAccessControlEntrySql($ace->getId(), $sets));
951951
}
952-
953952
}

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
@@ -128,7 +128,7 @@ public function getPattern()
128128
$length = strlen($pattern);
129129
$bitmask = str_pad(decbin($this->mask), $length, '0', STR_PAD_LEFT);
130130

131-
for ($i=$length-1; $i>=0; $i--) {
131+
for ($i = $length-1; $i >= 0; $i--) {
132132
if ('1' === $bitmask[$i]) {
133133
try {
134134
$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/AuditLoggerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public function testLogIfNeeded($granting, $audit)
2828
->will($this->returnValue($audit))
2929
;
3030

31-
$ace
31+
$ace
3232
->expects($this->never())
3333
->method('isAuditFailure')
3434
;

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/Provider/PreAuthenticatedAuthenticationProvider.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,23 +56,23 @@ public function authenticate(TokenInterface $token)
5656
return;
5757
}
5858

59-
if (!$user = $token->getUser()) {
60-
throw new BadCredentialsException('No pre-authenticated principal found in request.');
61-
}
59+
if (!$user = $token->getUser()) {
60+
throw new BadCredentialsException('No pre-authenticated principal found in request.');
61+
}
6262
/*
6363
if (null === $token->getCredentials()) {
6464
throw new BadCredentialsException('No pre-authenticated credentials found in request.');
6565
}
6666
*/
6767
$user = $this->userProvider->loadUserByUsername($user);
6868

69-
$this->userChecker->checkPostAuth($user);
69+
$this->userChecker->checkPostAuth($user);
7070

71-
$authenticatedToken = new PreAuthenticatedToken($user, $token->getCredentials(), $this->providerKey, $user->getRoles());
72-
$authenticatedToken->setAttributes($token->getAttributes());
71+
$authenticatedToken = new PreAuthenticatedToken($user, $token->getCredentials(), $this->providerKey, $user->getRoles());
72+
$authenticatedToken->setAttributes($token->getAttributes());
7373

74-
return $authenticatedToken;
75-
}
74+
return $authenticatedToken;
75+
}
7676

7777
/**
7878
* {@inheritdoc}

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
}

0 commit comments

Comments
 (0)