Visman před 4 roky
rodič
revize
897700a15e
2 změnil soubory, kde provedl 5 přidání a 5 odebrání
  1. 4 4
      app/Core/Validator.php
  2. 1 1
      app/functions.php

+ 4 - 4
app/Core/Validator.php

@@ -176,7 +176,7 @@ class Validator
 
 
                 if (empty($this->validators[$vs[0]])) {
                 if (empty($this->validators[$vs[0]])) {
                     try {
                     try {
-                        $validator = $this->c->{'VL' . $vs[0]};
+                        $validator = $this->c->{"VL{$vs[0]}"};
                     } catch (Exception $e) {
                     } catch (Exception $e) {
                         $validator = null;
                         $validator = null;
                     }
                     }
@@ -184,7 +184,7 @@ class Validator
                     if ($validator instanceof RulesValidator) {
                     if ($validator instanceof RulesValidator) {
                         $this->validators[$vs[0]] = [$validator, $vs[0]];
                         $this->validators[$vs[0]] = [$validator, $vs[0]];
                     } else {
                     } else {
-                        throw new RuntimeException($vs[0] . ' validator not found');
+                        throw new RuntimeException("{$vs[0]} validator not found");
                     }
                     }
                 }
                 }
 
 
@@ -602,7 +602,7 @@ class Validator
 
 
         $result = [];
         $result = [];
         foreach ($attr as $name => $rules) {
         foreach ($attr as $name => $rules) {
-            $this->recArray($value, $result, $name, $rules, $vars['field'] . '.' . $name);
+            $this->recArray($value, $result, $name, $rules, "{$vars['field']}.{$name}");
         }
         }
 
 
         return $result;
         return $result;
@@ -894,7 +894,7 @@ class Validator
             return null;
             return null;
         } elseif (
         } elseif (
             ! \is_string($value)
             ! \is_string($value)
-            || false === \strtotime($value . ' UTC')
+            || false === \strtotime("{$value} UTC")
         ) {
         ) {
             $v->addError('The :alias does not contain a date');
             $v->addError('The :alias does not contain a date');
 
 

+ 1 - 1
app/functions.php

@@ -35,7 +35,7 @@ function __(/* string|arrray */ $arg): string
             $c = \reset($arg);
             $c = \reset($arg);
 
 
             if (! $c instanceof Container) {
             if (! $c instanceof Container) {
-                throw new InvalidArgumentException('Container expected ');
+                throw new InvalidArgumentException('Container expected');
             }
             }
 
 
             return '';
             return '';