8000 Avoid warning in PHP 7.2 because of non-countable data · symfony/symfony@cb81122 · GitHub
[go: up one dir, main page]

Skip to content

Commit cb81122

Browse files
committed
Avoid warning in PHP 7.2 because of non-countable data
1 parent 3113f3f commit cb81122

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/Symfony/Component/Form/Form.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -746,9 +746,12 @@ public function isEmpty()
746746
}
747747
}
748748

749-
return FormUtil::isEmpty($this->modelData) ||
750-
// arrays, countables
751-
0 === count($this->modelData) ||
749+
if (FormUtil::isEmpty($this->modelData)) {
750+
return true;
751+
}
752+
753+
// arrays, countables
754+
return 0 === count($this->modelData) ||
752755
// traversables that are not countable
753756
($this->modelData instanceof \Traversable && 0 === iterator_count($this->modelData));
754757
}

0 commit comments

Comments
 (0)
0