@@ -18,11 +18,6 @@ final class FormHelper extends Helper
1818 private $ formFactory ;
1919 private $ formInteractor ;
2020
21- public function getName (): string
22- {
23- return 'form ' ;
24- }
25-
2621 public function __construct (
2722 ConsoleFormFactory $ formFactory ,
2823 FormInteractor $ formInteractor
@@ -31,6 +26,11 @@ public function __construct(
3126 $ this ->formInteractor = $ formInteractor ;
3227 }
3328
29+ public function getName (): string
30+ {
31+ return 'form ' ;
32+ }
33+
3434 /**
3535 * @param mixed $data
3636 *
@@ -66,7 +66,7 @@ public function interactUsingForm(
6666 $ output ->write (sprintf ('Invalid data provided: %s ' , $ formErrors ));
6767 if ($ this ->noErrorsCanBeFixed ($ formErrors )) {
6868 $ violationPaths = $ this ->constraintViolationPaths ($ formErrors );
69- $ hint = (count ($ violationPaths ) > 0 ? ' (Violations on unused fields: ' . implode (', ' , $ violationPaths ). ') ' : '' );
69+ $ hint = (count ($ violationPaths ) > 0 ? ' (Violations on unused fields: ' . implode (', ' , $ violationPaths ) . ') ' : '' );
7070 throw new RuntimeException (
7171 'Errors out of the form \'s scope - do you have validation constraints on properties not used in the form? '
7272 . $ hint
@@ -94,9 +94,9 @@ protected function noErrorsCanBeFixed(FormErrorIterator $errors): bool
9494 {
9595 // none of the remaining errors is related to a value of a form field
9696 return $ errors ->count () > 0 &&
97- 0 === count (array_filter (iterator_to_array ($ errors ), function ($ error ) {
97+ count (array_filter (iterator_to_array ($ errors ), function ($ error ) {
9898 return $ error instanceof FormErrorIterator;
99- }));
99+ })) === 0 ;
100100 }
101101
102102 protected function constraintViolationPaths (FormErrorIterator $ errors ): array
0 commit comments