浏览代码

Merge remote branch 'Infranology/minor-code-simplification'

* Infranology/minor-code-simplification:
  [Form] minor code simplification
Fabien Potencier 14 年之前
父节点
当前提交
44816ebca0
共有 1 个文件被更改,包括 6 次插入4 次删除
  1. 6 4
      src/Symfony/Component/Form/FormView.php

+ 6 - 4
src/Symfony/Component/Form/FormView.php

@@ -110,11 +110,13 @@ class FormView implements \ArrayAccess, \IteratorAggregate, \Countable
      */
     public function isRendered()
     {
-        if (true === $this->rendered || 0 == count($this->children)) {
+        $hasChildren = 0 < count($this->children);
+
+        if (true === $this->rendered || !$hasChildren) {
             return $this->rendered;
         }
 
-        if (count($this->children) > 0) {
+        if ($hasChildren) {
             foreach ($this->children as $child) {
                 if (!$child->isRendered()) {
                     return false;
@@ -122,9 +124,9 @@ class FormView implements \ArrayAccess, \IteratorAggregate, \Countable
             }
 
             return $this->rendered = true;
-        } else {
-            return false;
         }
+
+        return false;
     }
 
     /**