Test Failed
Pull Request — master (#868)
by butschster
16:38
created
src/Filters/src/Model/Schema/AttributeMapper.php 1 patch
Braces   +30 added lines, -13 removed lines patch added patch discarded remove patch
@@ -36,39 +36,54 @@  discard block
 block discarded – undo
36 36
         $schema = [];
37 37
         $class = new \ReflectionClass($filter);
38 38
 
39
-        foreach ($class->getProperties() as $property) {
40
-            foreach ($this->reader->getPropertyMetadata($property) as $attribute) {
41
-                if ($attribute instanceof AbstractInput) {
39
+        foreach ($class->getProperties() as $property)
40
+        {
41
+            foreach ($this->reader->getPropertyMetadata($property) as $attribute)
42
+            {
43
+                if ($attribute instanceof AbstractInput)
44
+                {
42 45
                     $this->setValue($filter, $property, $attribute->getValue($input, $property));
43 46
                     $schema[$property->getName()] = $attribute->getSchema($property);
44
-                } elseif ($attribute instanceof NestedFilter) {
47
+                }
48
+                elseif ($attribute instanceof NestedFilter)
49
+                {
45 50
                     $prefix = $attribute->prefix ?? $property->name;
46
-                    try {
51
+                    try
52
+                    {
47 53
                         $value = $this->provider->createFilter(
48 54
                             $attribute->class,
49 55
                             $input->withPrefix($prefix)
50 56
                         );
51 57
 
52 58
                         $this->setValue($filter, $property, $value);
53
-                    } catch (ValidationException $e) {
59
+                    }
60
+                    catch (ValidationException $e)
61
+                    {
54 62
                         $errors[$prefix] = $e->errors;
55 63
                     }
56 64
 
57 65
                     $schema[$property->getName()] = $attribute->getSchema($property);
58
-                } elseif ($attribute instanceof NestedArray) {
66
+                }
67
+                elseif ($attribute instanceof NestedArray)
68
+                {
59 69
                     $values = $attribute->getValue($input, $property);
60 70
                     $propertyValues = [];
61 71
 
62 72
                     $prefix = $attribute->input->key ?? $attribute->prefix ?? $property->getName();
63 73
 
64
-                    if (\is_array($values)) {
65
-                        foreach (\array_keys($values) as $key) {
66
-                            try {
74
+                    if (\is_array($values))
75
+                    {
76
+                        foreach (\array_keys($values) as $key)
77
+                        {
78
+                            try
79
+                            {
67 80
                                 $propertyValues[$key] = $this->provider->createFilter(
68 81
                                     $attribute->class,
69 82
                                     $input->withPrefix($prefix . '.' . $key)
70 83
                                 );
71
-                            } catch (ValidationException $e) {
84
+                            }
85
+                            catch (ValidationException $e)
86
+                            {
72 87
                                 $errors[$property->getName()][$key] = $e->errors;
73 88
                             }
74 89
                         }
@@ -87,11 +102,13 @@  discard block
 block discarded – undo
87 102
     {
88 103
         $setter = $this->reader->firstPropertyMetadata($property, Setter::class);
89 104
 
90
-        if ($value === null) {
105
+        if ($value === null)
106
+        {
91 107
             return;
92 108
         }
93 109
 
94
-        if ($setter) {
110
+        if ($setter)
111
+        {
95 112
             $value = $setter->updateValue($value);
96 113
         }
97 114
 
Please login to merge, or discard this patch.
src/Filters/src/Model/Interceptor/ValidateFilterInterceptor.php 1 patch
Braces   +9 added lines, -4 removed lines patch added patch discarded remove patch
@@ -35,7 +35,8 @@  discard block
 block discarded – undo
35 35
         $bag = $parameters['filterBag'];
36 36
         $filter = $core->callAction($controller, $action, $parameters);
37 37
 
38
-        if ($filter instanceof HasFilterDefinition) {
38
+        if ($filter instanceof HasFilterDefinition)
39
+        {
39 40
             $this->validateFilter(
40 41
                 $filter->filterDefinition(),
41 42
                 $bag,
@@ -53,7 +54,8 @@  discard block
 block discarded – undo
53 54
         array $errors,
54 55
         mixed $context
55 56
     ): void {
56
-        if ($definition instanceof ShouldBeValidated) {
57
+        if ($definition instanceof ShouldBeValidated)
58
+        {
57 59
             $errorMapper = new ErrorMapper($bag->schema);
58 60
             $validationProvider = $this->container->get(ValidationProviderInterface::class);
59 61
 
@@ -61,12 +63,15 @@  discard block
 block discarded – undo
61 63
                 ->getValidation($definition::class)
62 64
                 ->validate($bag, $definition->validationRules(), $context);
63 65
 
64
-            if (!$validator->isValid()) {
66
+            if (!$validator->isValid())
67
+            {
65 68
                 throw new ValidationException(
66 69
                     $errorMapper->mapErrors(\array_merge($errors, $validator->getErrors())),
67 70
                     $context
68 71
                 );
69
-            } elseif ($errors !== []) {
72
+            }
73
+            elseif ($errors !== [])
74
+            {
70 75
                 throw new ValidationException($errorMapper->mapErrors($errors), $context);
71 76
             }
72 77
         }
Please login to merge, or discard this patch.