Skip to content

Commit 44ad96b

Browse files
minor #29231 SCA: consolidate non empty array checks across codebase (kalessil)
This PR was squashed before being merged into the 3.4 branch (closes #29231). Discussion ---------- SCA: consolidate non empty array checks across codebase | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | n/a | License | MIT | Doc PR | n/a This PR replaces `is_array(...) && count(...) > 0` with `... && is_array(...)` construct used in the codebase. Commits ------- 2f1fd54dda SCA: consolidate non empty array checks across codebase
2 parents 631ec75 + 6c76813 commit 44ad96b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Extension/Validator/Constraints/FormValidator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public function validate($form, Constraint $constraint)
4848

4949
// Validate the data against its own constraints
5050
if ($form->isRoot() && (\is_object($data) || \is_array($data))) {
51-
if (\is_array($groups) && \count($groups) > 0 || $groups instanceof GroupSequence && \count($groups->groups) > 0) {
51+
if (($groups && \is_array($groups)) || ($groups instanceof GroupSequence && $groups->groups)) {
5252
$validator->atPath('data')->validate($form->getData(), null, $groups);
5353
}
5454
}

0 commit comments

Comments
 (0)