فهرست منبع

Core\Validator: Fix addRules() method for array

Visman 1 سال پیش
والد
کامیت
0cf80df852
1فایلهای تغییر یافته به همراه7 افزوده شده و 7 حذف شده
  1. 7 7
      app/Core/Validator.php

+ 7 - 7
app/Core/Validator.php

@@ -172,17 +172,17 @@ class Validator
                     }
                 }
 
-                $rules[$name] = $rule ?? '';
-            }
-
-            if (isset($suffix)) {
                 if (
-                    isset($this->rules[$field]['array'])
-                    && ! \is_array($this->rules[$field]['array'])
+                    'array' === $name
+                    && ! \is_array($rule)
                 ) {
-                    $this->rules[$field]['array'] = [];
+                    $rule = [];
                 }
 
+                $rules[$name] = $rule ?? '';
+            }
+
+            if (isset($suffix)) {
                 $this->rules[$field]['array'][$suffix] = $rules;
             } else {
                 $this->rules[$field] = $rules;