Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 83bb723

Browse files
committed
minor #18400 Lower complexity of Form:isValid() (krzysiekpiasecki)
This PR was squashed before being merged into the 2.7 branch (closes #18400). Discussion ---------- Lower complexity of Form:isValid() | Q | A | ------------- | --- | Branch? | 2.7 | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | n/a | License | MIT | Doc PR | n/a Replace #18391 - use Yoda condition, - merge into 2.7 branch Why? - lower LOC - less return expressions - lower complexity - more readable comparison Commits ------- d583ec3 Lower complexity of Form:isValid()
2 parents c5b792c + d583ec3 commit 83bb723

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

src/Symfony/Component/Form/Form.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -766,11 +766,7 @@ public function isValid()
766766
return true;
767767
}
768768

769-
if (count($this->getErrors(true)) > 0) {
770-
return false;
771-
}
772-
773-
return true;
769+
return 0 === count($this->getErrors(true));
774770
}
775771

776772
/**

0 commit comments

Comments
 (0)