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

Commit 8c1c6ef

Browse files
Merge branch '2.3' into 2.6
* 2.3: [2.3][Debug] Fix fatal-errors handling on HHVM Standardize the name of the exception variables [2.3] Static Code Analysis for Components Remove duplicated paths Conflicts: src/Symfony/Component/Debug/ErrorHandler.php src/Symfony/Component/HttpFoundation/Session/Storage/MockArraySessionStorage.php src/Symfony/Component/Security/Acl/Dbal/AclProvider.php src/Symfony/Component/Security/Core/Authentication/Provider/UserAuthenticationProvider.php
2 parents 6f969fb + 36cde60 commit 8c1c6ef

22 files changed

+72
-72
lines changed

Acl/Dbal/AclProvider.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,13 +177,13 @@ public function findAcls(array $oids, array $sids = array())
177177
if ($currentBatchesCount > 0 && (self::MAX_BATCH_SIZE === $currentBatchesCount || ($i + 1) === $c)) {
178178
try {
179179
$loadedBatch = $this->lookupObjectIdentities($currentBatch, $sids, $oidLookup);
180-
} catch (AclNotFoundException $aclNotFoundException) {
180+
} catch (AclNotFoundException $e) {
181181
if ($result->count()) {
182182
$partialResultException = new NotAllAclsFoundException('The provider could not find ACLs for all object identities.');
183183
$partialResultException->setPartialResult($result);
184184
throw $partialResultException;
185185
} else {
186-
throw $aclNotFoundException;
186+
throw $e;
187187
}
188188
}
189189
foreach ($loadedBatch as $loadedOid) {

Acl/Dbal/MutableAclProvider.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,10 @@ public function createAcl(ObjectIdentityInterface $oid)
6363
$this->connection->executeQuery($this->getInsertObjectIdentityRelationSql($pk, $pk));
6464

6565
$this->connection->commit();
66-
} catch (\Exception $failed) {
66+
} catch (\Exception $e) {
6767
$this->connection->rollBack();
6868

69-
throw $failed;
69+
throw $e;
7070
}
7171

7272
// re-read the ACL from the database to ensure proper caching, etc.
@@ -91,10 +91,10 @@ public function deleteAcl(ObjectIdentityInterface $oid)
9191
$this->deleteObjectIdentity($oidPK);
9292

9393
$this->connection->commit();
94-
} catch (\Exception $failed) {
94+
} catch (\Exception $e) {
9595
$this->connection->rollBack();
9696

97-
throw $failed;
97+
throw $e;
9898
}
9999

100100
// evict the ACL from the in-memory identity map
@@ -338,10 +338,10 @@ public function updateAcl(MutableAclInterface $acl)
338338
}
339339

340340
$this->connection->commit();
341-
} catch (\Exception $failed) {
341+
} catch (\Exception $e) {
342342
$this->connection->rollBack();
343343

344-
throw $failed;
344+
throw $e;
345345
}
346346

347347
$this->propertyChanges->offsetSet($acl, array());

Acl/Domain/ObjectIdentity.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ public static function fromDomainObject($domainObject)
6868
} elseif (method_exists($domainObject, 'getId')) {
6969
return new self((string) $domainObject->getId(), ClassUtils::getRealClass($domainObject));
7070
}
71-
} catch (\InvalidArgumentException $invalid) {
72-
throw new InvalidDomainObjectException($invalid->getMessage(), 0, $invalid);
71+
} catch (\InvalidArgumentException $e) {
72+
throw new InvalidDomainObjectException($e->getMessage(), 0, $e);
7373
}
7474

7575
throw new InvalidDomainObjectException('$domainObject must either implement the DomainObjectInterface, or have a method named "getId".');

Acl/Domain/ObjectIdentityRetrievalStrategy.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public function getObjectIdentity($domainObject)
2828
{
2929
try {
3030
return ObjectIdentity::fromDomainObject($domainObject);
31-
} catch (InvalidDomainObjectException $failed) {
31+
} catch (InvalidDomainObjectException $e) {
3232
return;
3333
}
3434
}

Acl/Domain/PermissionGrantingStrategy.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,21 +55,21 @@ public function isGranted(AclInterface $acl, array $masks, array $sids, $adminis
5555
}
5656

5757
return $this->hasSufficientPermissions($acl, $aces, $masks, $sids, $administrativeMode);
58-
} catch (NoAceFoundException $noObjectAce) {
58+
} catch (NoAceFoundException $e) {
5959
$aces = $acl->getClassAces();
6060

6161
if (!$aces) {
62-
throw $noObjectAce;
62+
throw $e;
6363
}
6464

6565
return $this->hasSufficientPermissions($acl, $aces, $masks, $sids, $administrativeMode);
6666
}
67-
} catch (NoAceFoundException $noClassAce) {
67+
} catch (NoAceFoundException $e) {
6868
if ($acl->isEntriesInheriting() && null !== $parentAcl = $acl->getParentAcl()) {
6969
return $parentAcl->isGranted($masks, $sids, $administrativeMode);
7070
}
7171

72-
throw $noClassAce;
72+
throw $e;
7373
}
7474
}
7575

@@ -86,20 +86,20 @@ public function isFieldGranted(AclInterface $acl, $field, array $masks, array $s
8686
}
8787

8888
return $this->hasSufficientPermissions($acl, $aces, $masks, $sids, $administrativeMode);
89-
} catch (NoAceFoundException $noObjectAces) {
89+
} catch (NoAceFoundException $e) {
9090
$aces = $acl->getClassFieldAces($field);
9191
if (!$aces) {
92-
throw $noObjectAces;
92+
throw $e;
9393
}
9494

9595
return $this->hasSufficientPermissions($acl, $aces, $masks, $sids, $administrativeMode);
9696
}
97-
} catch (NoAceFoundException $noClassAces) {
97+
} catch (NoAceFoundException $e) {
9898
if ($acl->isEntriesInheriting() && null !== $parentAcl = $acl->getParentAcl()) {
9999
return $parentAcl->isFieldGranted($field, $masks, $sids, $administrativeMode);
100100
}
101101

102-
throw $noClassAces;
102+
throw $e;
103103
}
104104
}
105105

Acl/Domain/SecurityIdentityRetrievalStrategy.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public function getSecurityIdentities(TokenInterface $token)
5151
if (!$token instanceof AnonymousToken) {
5252
try {
5353
$sids[] = UserSecurityIdentity::fromToken($token);
54-
} catch (\InvalidArgumentException $invalid) {
54+
} catch (\InvalidArgumentException $e) {
5555
// ignore, user has no user security identity
5656
}
5757
}

Acl/Permission/MaskBuilder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ public function getPattern()
126126
if ('1' === $bitmask[$i]) {
127127
try {
128128
$pattern[$i] = self::getCode(1 << ($length - $i - 1));
129-
} catch (\Exception $notPredefined) {
129+
} catch (\Exception $e) {
130130
$pattern[$i] = self::ON;
131131
}
132132
}

Acl/Tests/Dbal/AclProviderTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,11 @@ public function testFindAclsThrowsExceptionUnlessAnACLIsFoundForEveryOID()
4545
$this->getProvider()->findAcls($oids);
4646

4747
$this->fail('Provider did not throw an expected exception.');
48-
} catch (\Exception $ex) {
49-
$this->assertInstanceOf('Symfony\Component\Security\Acl\Exception\AclNotFoundException', $ex);
50-
$this->assertInstanceOf('Symfony\Component\Security\Acl\Exception\NotAllAclsFoundException', $ex);
48+
} catch (\Exception $e) {
49+
$this->assertInstanceOf('Symfony\Component\Security\Acl\Exception\AclNotFoundException', $e);
50+
$this->assertInstanceOf('Symfony\Component\Security\Acl\Exception\NotAllAclsFoundException', $e);
5151

52-
$partialResult = $ex->getPartialResult();
52+
$partialResult = $e->getPartialResult();
5353
$this->assertTrue($partialResult->contains($oids[0]));
5454
$this->assertFalse($partialResult->contains($oids[1]));
5555
}

Acl/Tests/Dbal/MutableAclProviderTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ 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 $e) {
9292
}
9393
}
9494

@@ -104,7 +104,7 @@ public function testDeleteAclDeletesChildren()
104104
try {
105105
$provider->findAcl(new ObjectIdentity(1, 'Foo'));
106106
$this->fail('Child-ACLs have not been deleted.');
107-
} catch (AclNotFoundException $notFound) {
107+
} catch (AclNotFoundException $e) {
108108
}
109109
}
110110

@@ -290,7 +290,7 @@ public function testUpdateAclThrowsExceptionOnConcurrentModificationOfSharedProp
290290
try {
291291
$provider->updateAcl($acl1);
292292
$this->fail('Provider failed to detect a concurrent modification.');
293-
} catch (ConcurrentModificationException $ex) {
293+
} catch (ConcurrentModificationException $e) {
294294
}
295295
}
296296

Acl/Tests/Domain/PermissionGrantingStrategyTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ 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 $e) {
158158
}
159159
} else {
160160
$this->assertTrue($strategy->isGranted($acl, array($requiredMask), array($sid)));

0 commit comments

Comments
 (0)