Passed
Push — master ( 8742cf...aa4374 )
by Juan
03:05 queued 49s
created
src/Config/SupportedTypes.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
             'class' => TextType::class,
32 32
             'default_options' => [
33 33
                 'constraints' => [
34
-                    'not_blank' => [],
34
+                    'not_blank' => [ ],
35 35
                 ],
36 36
             ],
37 37
         ],
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
             'class' => TextareaType::class,
40 40
             'default_options' => [
41 41
                 'constraints' => [
42
-                    'not_blank' => [],
42
+                    'not_blank' => [ ],
43 43
                 ],
44 44
             ],
45 45
         ],
@@ -47,8 +47,8 @@  discard block
 block discarded – undo
47 47
             'class' => EmailType::class,
48 48
             'default_options' => [
49 49
                 'constraints' => [
50
-                    'not_blank' => [],
51
-                    'email' => [],
50
+                    'not_blank' => [ ],
51
+                    'email' => [ ],
52 52
                 ],
53 53
             ],
54 54
         ],
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
             'class' => PasswordType::class,
57 57
             'default_options' => [
58 58
                 'constraints' => [
59
-                    'not_blank' => [],
59
+                    'not_blank' => [ ],
60 60
                 ],
61 61
             ],
62 62
         ],
@@ -64,8 +64,8 @@  discard block
 block discarded – undo
64 64
             'class' => UrlType::class,
65 65
             'default_options' => [
66 66
                 'constraints' => [
67
-                    'not_blank' => [],
68
-                    'url' => [],
67
+                    'not_blank' => [ ],
68
+                    'url' => [ ],
69 69
                 ],
70 70
             ],
71 71
         ],
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
             'class' => TelType::class,
74 74
             'default_options' => [
75 75
                 'constraints' => [
76
-                    'not_blank' => [],
76
+                    'not_blank' => [ ],
77 77
                 ],
78 78
             ],
79 79
         ],
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
             'class' => IntegerType::class,
84 84
             'default_options' => [
85 85
                 'constraints' => [
86
-                    'not_blank' => [],
86
+                    'not_blank' => [ ],
87 87
                     'type' => [
88 88
                         'type' => 'integer',
89 89
                     ],
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
             'class' => MoneyType::class,
95 95
             'default_options' => [
96 96
                 'constraints' => [
97
-                    'not_blank' => [],
97
+                    'not_blank' => [ ],
98 98
                     'type' => [
99 99
                         'type' => 'numeric',
100 100
                     ],
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
             'class' => NumberType::class,
106 106
             'default_options' => [
107 107
                 'constraints' => [
108
-                    'not_blank' => [],
108
+                    'not_blank' => [ ],
109 109
                     'type' => [
110 110
                         'type' => 'numeric',
111 111
                     ],
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
             'class' => PercentType::class,
117 117
             'default_options' => [
118 118
                 'constraints' => [
119
-                    'not_blank' => [],
119
+                    'not_blank' => [ ],
120 120
                     'type' => [
121 121
                         'type' => 'numeric',
122 122
                     ],
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
             'class' => ChoiceType::class,
130 130
             'default_options' => [
131 131
                 'constraints' => [
132
-                    'not_blank' => [],
132
+                    'not_blank' => [ ],
133 133
                 ],
134 134
             ],
135 135
         ],
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
             'class' => CountryType::class,
138 138
             'default_options' => [
139 139
                 'constraints' => [
140
-                    'not_blank' => [],
140
+                    'not_blank' => [ ],
141 141
                 ],
142 142
             ],
143 143
         ],
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
             'class' => LanguageType::class,
146 146
             'default_options' => [
147 147
                 'constraints' => [
148
-                    'not_blank' => [],
148
+                    'not_blank' => [ ],
149 149
                 ],
150 150
             ],
151 151
         ],
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
             'class' => LocaleType::class,
154 154
             'default_options' => [
155 155
                 'constraints' => [
156
-                    'not_blank' => [],
156
+                    'not_blank' => [ ],
157 157
                 ],
158 158
             ],
159 159
         ],
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
             'class' => TimezoneType::class,
162 162
             'default_options' => [
163 163
                 'constraints' => [
164
-                    'not_blank' => [],
164
+                    'not_blank' => [ ],
165 165
                 ],
166 166
             ],
167 167
         ],
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
             'class' => CurrencyType::class,
170 170
             'default_options' => [
171 171
                 'constraints' => [
172
-                    'not_blank' => [],
172
+                    'not_blank' => [ ],
173 173
                 ],
174 174
             ],
175 175
         ],
@@ -186,8 +186,8 @@  discard block
 block discarded – undo
186 186
 //                    'placeholder' => 'dd/mm/aaaa',
187 187
 //                ]
188 188
                 'constraints' => [
189
-                    'not_blank' => [],
190
-                    'date' => [],
189
+                    'not_blank' => [ ],
190
+                    'date' => [ ],
191 191
                 ],
192 192
             ],
193 193
         ],
@@ -198,8 +198,8 @@  discard block
 block discarded – undo
198 198
                 'widget' => 'single_text',
199 199
                 'with_seconds' => false,
200 200
                 'constraints' => [
201
-                    'not_blank' => [],
202
-                    'time' => [],
201
+                    'not_blank' => [ ],
202
+                    'time' => [ ],
203 203
                 ],
204 204
             ],
205 205
         ],
@@ -221,10 +221,10 @@  discard block
 block discarded – undo
221 221
 
222 222
     public static function getDefaultTypeConfig(string $inputType): array
223 223
     {
224
-        if (!isset(self::SUPPORTED_TYPES[$inputType])) {
224
+        if (!isset(self::SUPPORTED_TYPES[ $inputType ])) {
225 225
             throw new NotSupportedFormTypeException($inputType);
226 226
         }
227 227
 
228
-        return self::SUPPORTED_TYPES[$inputType];
228
+        return self::SUPPORTED_TYPES[ $inputType ];
229 229
     }
230 230
 }
Please login to merge, or discard this patch.
src/Service/FormGenerator.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
         $this->formFactory = $formFactory;
24 24
     }
25 25
 
26
-    public function createFormFromYaml(string $formConfigYaml, array $formOptions = [], $data = null): ?FormInterface
26
+    public function createFormFromYaml(string $formConfigYaml, array $formOptions = [ ], $data = null): ?FormInterface
27 27
     {
28 28
         $array = Yaml::parse($formConfigYaml);
29 29
         $json = json_encode($array);
@@ -31,14 +31,14 @@  discard block
 block discarded – undo
31 31
         return $this->createFormFromJson($json, $formOptions, $data);
32 32
     }
33 33
 
34
-    public function createFormFromJson(string $formConfigJson, array $formOptions = [], $data = null): ?FormInterface
34
+    public function createFormFromJson(string $formConfigJson, array $formOptions = [ ], $data = null): ?FormInterface
35 35
     {
36 36
         $formConfig = json_decode($formConfigJson, true);
37 37
 
38 38
         return $this->createForm($formConfig, $formOptions, $data);
39 39
     }
40 40
 
41
-    public function createForm(array $formConfig, array $formOptions = [], $data = null): ?FormInterface
41
+    public function createForm(array $formConfig, array $formOptions = [ ], $data = null): ?FormInterface
42 42
     {
43 43
         if (empty($formConfig)) {
44 44
             return null;
@@ -47,31 +47,31 @@  discard block
 block discarded – undo
47 47
         $form = $this->formFactory->create(FormType::class, $data, $formOptions);
48 48
 
49 49
         foreach ($formConfig as $inputName => $inputConfig) {
50
-            $inputType = isset($inputConfig['type']) ? $inputConfig['type'] : 'text';
50
+            $inputType = isset($inputConfig[ 'type' ]) ? $inputConfig[ 'type' ] : 'text';
51 51
 
52 52
             // Se obtiene la configuración predeterminada
53 53
             if (class_exists($inputType)) {
54 54
                 $inputDefaultConfig = [
55 55
                     'class' => $inputType,
56
-                    'default_options' => [],
56
+                    'default_options' => [ ],
57 57
                 ];
58 58
             } else {
59 59
                 $inputDefaultConfig = SupportedTypes::getDefaultTypeConfig($inputType);
60 60
             }
61 61
 
62 62
             // se obtienen las opciones definidas para este input
63
-            $inputOptions = isset($inputConfig['options']) ? $inputConfig['options'] : [];
63
+            $inputOptions = isset($inputConfig[ 'options' ]) ? $inputConfig[ 'options' ] : [ ];
64 64
 
65
-            $inputOptions['constraints'] = $this->getConstraints($inputType, $inputDefaultConfig['default_options'], $inputOptions);
65
+            $inputOptions[ 'constraints' ] = $this->getConstraints($inputType, $inputDefaultConfig[ 'default_options' ], $inputOptions);
66 66
 
67 67
             // Se compilan las opciones default con las definidas
68 68
             $inputOptions = array_merge(
69
-                $inputDefaultConfig['default_options'],
69
+                $inputDefaultConfig[ 'default_options' ],
70 70
                 $inputOptions
71 71
             );
72 72
 
73 73
             // Se crea el input de formulario
74
-            $form->add($inputName, $inputDefaultConfig['class'], $inputOptions);
74
+            $form->add($inputName, $inputDefaultConfig[ 'class' ], $inputOptions);
75 75
         }
76 76
 
77 77
         return $form;
@@ -79,31 +79,31 @@  discard block
 block discarded – undo
79 79
 
80 80
     private function getConstraints(string $inputType, array $inputDefaultOptions, array $inputOptions)
81 81
     {
82
-        $ret = [];
82
+        $ret = [ ];
83 83
 
84
-        $validations = isset($inputDefaultOptions['constraints']) ? $inputDefaultOptions['constraints'] : [];
85
-        $validations = array_merge($validations, isset($inputOptions['constraints']) ? $inputOptions['constraints'] : []);
84
+        $validations = isset($inputDefaultOptions[ 'constraints' ]) ? $inputDefaultOptions[ 'constraints' ] : [ ];
85
+        $validations = array_merge($validations, isset($inputOptions[ 'constraints' ]) ? $inputOptions[ 'constraints' ] : [ ]);
86 86
 
87 87
         foreach ($validations as $validation => $validationOptions) {
88 88
             switch ($validation) {
89 89
                 case 'not_blank':
90
-                    if (isset($inputOptions['required']) && false === $inputOptions['required']) {
90
+                    if (isset($inputOptions[ 'required' ]) && false === $inputOptions[ 'required' ]) {
91 91
                         // no se setea la validación
92 92
                     } else {
93
-                        $ret[] = new NotBlank($validationOptions);
93
+                        $ret[ ] = new NotBlank($validationOptions);
94 94
                     }
95 95
                     break;
96 96
                 case 'email':
97
-                    $ret[] = new Email($validationOptions);
97
+                    $ret[ ] = new Email($validationOptions);
98 98
                     break;
99 99
                 case 'url':
100
-                    $ret[] = new Url($validationOptions);
100
+                    $ret[ ] = new Url($validationOptions);
101 101
                     break;
102 102
                 case 'length':
103
-                    $ret[] = new Length($validationOptions);
103
+                    $ret[ ] = new Length($validationOptions);
104 104
                     break;
105 105
                 case 'date':
106
-                    $ret[] = new Date($validationOptions);
106
+                    $ret[ ] = new Date($validationOptions);
107 107
                     break;
108 108
             }
109 109
         }
Please login to merge, or discard this patch.