Skip to content

Commit 8e6342a

Browse files
committed
minor #20016 [Form] FormView->isRendered() remove dead code and simplify the flow (taueres)
This PR was merged into the 2.7 branch. Discussion ---------- [Form] FormView->isRendered() remove dead code and simplify the flow | Q | A | ------------- | --- | Branch? | 2.7 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - The method `FormView->isRendered()` can be easily simplified by removing useless conditions and statements. The condition at line 74 is useless because of the composite condition at line 70. Removed dead code statement at line 84. Commits ------- 40af42c [Form] FormView->isRendered() remove dead code and simplify the flow
2 parents bb51ed0 + 40af42c commit 8e6342a

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

src/Symfony/Component/Form/FormView.php

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -65,23 +65,17 @@ public function __construct(FormView $parent = null)
6565
*/
6666
public function isRendered()
6767
{
68-
$hasChildren = 0 < count($this->children);
69-
70-
if (true === $this->rendered || !$hasChildren) {
68+
if (true === $this->rendered || 0 === count($this->children)) {
7169
return $this->rendered;
7270
}
7371

74-
if ($hasChildren) {
75-
foreach ($this->children as $child) {
76-
if (!$child->isRendered()) {
77-
return false;
78-
}
72+
foreach ($this->children as $child) {
73+
if (!$child->isRendered()) {
74+
return false;
7975
}
80-
81-
return $this->rendered = true;
8276
}
8377

84-
return false;
78+
return $this->rendered = true;
8579
}
8680

8781
/**

0 commit comments

Comments
 (0)