浏览代码

fixes else -> } else

Lukas Kahwe Smith 14 年之前
父节点
当前提交
ddea635a51

+ 3 - 2
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);

+ 2 - 4
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();
                 }

+ 3 - 7
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();
     }
-}
+}

+ 1 - 2
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;

+ 7 - 11
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());
     }    
-}
+}

+ 3 - 5
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');
     }
-}
+}

+ 2 - 3
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()';
     }
-}
+}

+ 2 - 3
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),
         );
     }
-}
+}

+ 2 - 3
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),
         );
     }
-}
+}