Passed
Pull Request — master (#360)
by Valentin
04:12
created
src/Validation/src/AbstractValidator.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -112,30 +112,30 @@
 block discarded – undo
112 112
      */
113 113
     final protected function validate(): void
114 114
     {
115
-        if ($this->errors !== []) {
115
+        if ($this->errors !== []){
116 116
             // already validated
117 117
             return;
118 118
         }
119 119
 
120 120
         $this->errors = [];
121 121
 
122
-        foreach ($this->rules as $field => $rules) {
122
+        foreach ($this->rules as $field => $rules){
123 123
             $hasValue = $this->hasValue($field);
124 124
             $value = $this->getValue($field);
125 125
 
126
-            foreach ($this->provider->getRules($rules) as $rule) {
127
-                if (!$hasValue && $rule->ignoreEmpty($value) && !$rule->hasConditions()) {
126
+            foreach ($this->provider->getRules($rules) as $rule){
127
+                if (!$hasValue && $rule->ignoreEmpty($value) && !$rule->hasConditions()){
128 128
                     continue;
129 129
                 }
130 130
 
131
-                foreach ($rule->getConditions() as $condition) {
132
-                    if (!$condition->isMet($this, $field, $value)) {
131
+                foreach ($rule->getConditions() as $condition){
132
+                    if (!$condition->isMet($this, $field, $value)){
133 133
                         // condition is not met, skipping validation
134 134
                         continue 2;
135 135
                     }
136 136
                 }
137 137
 
138
-                if (!$rule->validate($this, $field, $value)) {
138
+                if (!$rule->validate($this, $field, $value)){
139 139
                     // got error, jump to next field
140 140
                     $this->errors[$field] = $rule->getMessage($field, $value);
141 141
                     break;
Please login to merge, or discard this patch.
src/Validation/src/Validator.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
     {
56 56
         $value = $this->data[$field] ?? $default;
57 57
 
58
-        if (is_object($value) && method_exists($value, 'getValue')) {
58
+        if (is_object($value) && method_exists($value, 'getValue')){
59 59
             return $value->getValue();
60 60
         }
61 61
 
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
      */
68 68
     public function hasValue(string $field): bool
69 69
     {
70
-        if (is_array($this->data)) {
70
+        if (is_array($this->data)){
71 71
             return array_key_exists($field, $this->data);
72 72
         }
73 73
 
Please login to merge, or discard this patch.