From ddea635a51975e2229af3253286cd5b302a7a4f2 Mon Sep 17 00:00:00 2001 From: Lukas Kahwe Smith Date: Tue, 18 Jan 2011 16:41:21 +0100 Subject: [PATCH] fixes else -> } else --- .../DependencyInjection/Dumper/XmlDumper.php | 5 +++-- src/Symfony/Component/Form/PropertyPath.php | 6 ++---- .../Security/Acl/Dbal/AclProvider.php | 10 +++------- src/Symfony/Component/Yaml/Parser.php | 3 +-- .../Acl/Dbal/AclProviderBenchmarkTest.php | 18 +++++++----------- .../Security/Acl/Domain/AuditLoggerTest.php | 8 +++----- .../Security/Acl/Domain/ObjectIdentityTest.php | 5 ++--- .../Acl/Domain/RoleSecurityIdentityTest.php | 5 ++--- .../Acl/Domain/UserSecurityIdentityTest.php | 5 ++--- 9 files changed, 25 insertions(+), 40 deletions(-) diff --git a/src/Symfony/Component/DependencyInjection/Dumper/XmlDumper.php b/src/Symfony/Component/DependencyInjection/Dumper/XmlDumper.php index bf20b3af5d..fd97b9a523 100644 --- a/src/Symfony/Component/DependencyInjection/Dumper/XmlDumper.php +++ b/src/Symfony/Component/DependencyInjection/Dumper/XmlDumper.php @@ -206,10 +206,11 @@ class XmlDumper extends Dumper $element->setAttribute('type', 'service'); $element->setAttribute('id', (string) $value); $behaviour = $value->getInvalidBehavior(); - if ($behaviour == ContainerInterface::NULL_ON_INVALID_REFERENCE) + if ($behaviour == ContainerInterface::NULL_ON_INVALID_REFERENCE) { $element->setAttribute('on-invalid', 'null'); - else if ($behaviour == ContainerInterface::IGNORE_ON_INVALID_REFERENCE) + } else if ($behaviour == ContainerInterface::IGNORE_ON_INVALID_REFERENCE) { $element->setAttribute('on-invalid', 'ignore'); + } } else if (is_object($value) && $value instanceof Definition) { $element->setAttribute('type', 'service'); $this->addService($value, null, $element); diff --git a/src/Symfony/Component/Form/PropertyPath.php b/src/Symfony/Component/Form/PropertyPath.php index 237a22f5e3..b3b03460af 100644 --- a/src/Symfony/Component/Form/PropertyPath.php +++ b/src/Symfony/Component/Form/PropertyPath.php @@ -232,10 +232,9 @@ class PropertyPath implements \IteratorAggregate if (is_object($objectOrArray)) { $value = $this->readProperty($objectOrArray, $currentIndex); - } // arrays need to be treated separately (due to PHP bug?) // http://bugs.php.net/bug.php?id=52133 - else { + } else { if (!array_key_exists($property, $objectOrArray)) { $objectOrArray[$property] = $currentIndex + 1 < $this->length ? array() : null; } @@ -267,10 +266,9 @@ class PropertyPath implements \IteratorAggregate if ($currentIndex + 1 < $this->length) { if (is_object($objectOrArray)) { $nestedObject = $this->readProperty($objectOrArray, $currentIndex); - } // arrays need to be treated separately (due to PHP bug?) // http://bugs.php.net/bug.php?id=52133 - else { + } else { if (!array_key_exists($property, $objectOrArray)) { $objectOrArray[$property] = array(); } diff --git a/src/Symfony/Component/Security/Acl/Dbal/AclProvider.php b/src/Symfony/Component/Security/Acl/Dbal/AclProvider.php index 00bc01dc1a..4a2870fe5e 100644 --- a/src/Symfony/Component/Security/Acl/Dbal/AclProvider.php +++ b/src/Symfony/Component/Security/Acl/Dbal/AclProvider.php @@ -320,11 +320,9 @@ class AclProvider implements AclProviderInterface // has the ACL been hydrated during this hydration cycle? if (isset($acls[$aclId])) { $acl = $acls[$aclId]; - } - // has the ACL been hydrated during any previous cycle, or was possibly loaded // from cache? - else if (isset($loadedAcls[$classType][$objectIdentifier])) { + } else if (isset($loadedAcls[$classType][$objectIdentifier])) { $acl = $loadedAcls[$classType][$objectIdentifier]; // keep reference in local array (saves us some hash calculations) @@ -337,10 +335,8 @@ class AclProvider implements AclProviderInterface $oidCache[$objectIdentifier.$classType] = $acl->getObjectIdentity(); } $result->attach($oidCache[$objectIdentifier.$classType], $acl); - } - // so, this hasn't been hydrated yet - else { + } else { // create object identity if we haven't done so yet $oidLookupKey = $objectIdentifier.$classType; if (!isset($oidCache[$oidLookupKey])) { @@ -632,4 +628,4 @@ QUERY; { return $this->connection->executeQuery($this->getSelectObjectIdentityIdSql($oid))->fetchColumn(); } -} \ No newline at end of file +} diff --git a/src/Symfony/Component/Yaml/Parser.php b/src/Symfony/Component/Yaml/Parser.php index a99b724ba4..11f197fa1f 100644 --- a/src/Symfony/Component/Yaml/Parser.php +++ b/src/Symfony/Component/Yaml/Parser.php @@ -143,9 +143,8 @@ class Parser if ($isProcessed) { // Merge keys $data = $isProcessed; - } // hash - else if (!isset($values['value']) || '' == trim($values['value'], ' ') || 0 === strpos(ltrim($values['value'], ' '), '#')) { + } else if (!isset($values['value']) || '' == trim($values['value'], ' ') || 0 === strpos(ltrim($values['value'], ' '), '#')) { // if next line is less indented or equal, then it means that the current value is null if ($this->isNextLineIndented()) { $data[$key] = null; diff --git a/tests/Symfony/Tests/Component/Security/Acl/Dbal/AclProviderBenchmarkTest.php b/tests/Symfony/Tests/Component/Security/Acl/Dbal/AclProviderBenchmarkTest.php index f0d141e116..bad5448cfc 100644 --- a/tests/Symfony/Tests/Component/Security/Acl/Dbal/AclProviderBenchmarkTest.php +++ b/tests/Symfony/Tests/Component/Security/Acl/Dbal/AclProviderBenchmarkTest.php @@ -121,9 +121,8 @@ class AclProviderBenchmarkTest extends \PHPUnit_Framework_TestCase return $id-1; } - else { - return rand(1000, $id-1); - } + + return rand(1000, $id-1); } protected function generateAcl($classId, $parentId, $ancestors) @@ -163,9 +162,8 @@ class AclProviderBenchmarkTest extends \PHPUnit_Framework_TestCase return $id-1; } - else { - return rand(1000, $id-1); - } + + return rand(1000, $id-1); } protected function generateAces($classId, $objectId) @@ -192,11 +190,9 @@ class AclProviderBenchmarkTest extends \PHPUnit_Framework_TestCase $strategy = rand(0, 2); if ($strategy === 0) { $strategy = PermissionGrantingStrategy::ALL; - } - else if ($strategy === 1) { + } else if ($strategy === 1) { $strategy = PermissionGrantingStrategy::ANY; - } - else { + } else { $strategy = PermissionGrantingStrategy::EQUAL; } @@ -264,4 +260,4 @@ class AclProviderBenchmarkTest extends \PHPUnit_Framework_TestCase { return new AclProvider($this->con, $this->getStrategy(), $this->getOptions()); } -} \ No newline at end of file +} diff --git a/tests/Symfony/Tests/Component/Security/Acl/Domain/AuditLoggerTest.php b/tests/Symfony/Tests/Component/Security/Acl/Domain/AuditLoggerTest.php index fe9f5d19bb..fedeafba5e 100644 --- a/tests/Symfony/Tests/Component/Security/Acl/Domain/AuditLoggerTest.php +++ b/tests/Symfony/Tests/Component/Security/Acl/Domain/AuditLoggerTest.php @@ -32,8 +32,7 @@ class AuditLoggerTest extends \PHPUnit_Framework_TestCase ->expects($this->never()) ->method('isAuditFailure') ; - } - else { + } else { $ace ->expects($this->never()) ->method('isAuditSuccess') @@ -52,8 +51,7 @@ class AuditLoggerTest extends \PHPUnit_Framework_TestCase ->method('doLog') ->with($this->equalTo($granting), $this->equalTo($ace)) ; - } - else { + } else { $logger ->expects($this->never()) ->method('doLog') @@ -82,4 +80,4 @@ class AuditLoggerTest extends \PHPUnit_Framework_TestCase { return $this->getMockForAbstractClass('Symfony\Component\Security\Acl\Domain\AuditLogger'); } -} \ No newline at end of file +} diff --git a/tests/Symfony/Tests/Component/Security/Acl/Domain/ObjectIdentityTest.php b/tests/Symfony/Tests/Component/Security/Acl/Domain/ObjectIdentityTest.php index 7334900381..f87c8e98f8 100644 --- a/tests/Symfony/Tests/Component/Security/Acl/Domain/ObjectIdentityTest.php +++ b/tests/Symfony/Tests/Component/Security/Acl/Domain/ObjectIdentityTest.php @@ -54,8 +54,7 @@ class ObjectIdentityTest extends \PHPUnit_Framework_TestCase { if ($equal) { $this->assertTrue($oid1->equals($oid2)); - } - else { + } else { $this->assertFalse($oid1->equals($oid2)); } } @@ -89,4 +88,4 @@ class TestDomainObject { return 'getId()'; } -} \ No newline at end of file +} diff --git a/tests/Symfony/Tests/Component/Security/Acl/Domain/RoleSecurityIdentityTest.php b/tests/Symfony/Tests/Component/Security/Acl/Domain/RoleSecurityIdentityTest.php index e1b0b96ece..0913b50a77 100644 --- a/tests/Symfony/Tests/Component/Security/Acl/Domain/RoleSecurityIdentityTest.php +++ b/tests/Symfony/Tests/Component/Security/Acl/Domain/RoleSecurityIdentityTest.php @@ -38,8 +38,7 @@ class RoleSecurityIdentityTest extends \PHPUnit_Framework_TestCase { if ($equal) { $this->assertTrue($id1->equals($id2)); - } - else { + } else { $this->assertFalse($id1->equals($id2)); } } @@ -53,4 +52,4 @@ class RoleSecurityIdentityTest extends \PHPUnit_Framework_TestCase array(new RoleSecurityIdentity('ROLE_FOO'), new UserSecurityIdentity('ROLE_FOO', 'Foo'), false), ); } -} \ No newline at end of file +} diff --git a/tests/Symfony/Tests/Component/Security/Acl/Domain/UserSecurityIdentityTest.php b/tests/Symfony/Tests/Component/Security/Acl/Domain/UserSecurityIdentityTest.php index ceb141583c..c2aa1ba08c 100644 --- a/tests/Symfony/Tests/Component/Security/Acl/Domain/UserSecurityIdentityTest.php +++ b/tests/Symfony/Tests/Component/Security/Acl/Domain/UserSecurityIdentityTest.php @@ -31,8 +31,7 @@ class UserSecurityIdentityTest extends \PHPUnit_Framework_TestCase { if ($equal) { $this->assertTrue($id1->equals($id2)); - } - else { + } else { $this->assertFalse($id1->equals($id2)); } } @@ -55,4 +54,4 @@ class UserSecurityIdentityTest extends \PHPUnit_Framework_TestCase array(new UserSecurityIdentity('foo', 'Foo'), new RoleSecurityIdentity('foo'), false), ); } -} \ No newline at end of file +}