@@ -8,7 +8,7 @@ discard block |
||
| 8 | 8 | // +---------------------------------------------------------------------- |
| 9 | 9 | // | Author: liu21st <[email protected]> |
| 10 | 10 | // +---------------------------------------------------------------------- |
| 11 | -declare (strict_types = 1); |
|
| 11 | +declare(strict_types=1); |
|
| 12 | 12 | |
| 13 | 13 | namespace think; |
| 14 | 14 | |
@@ -367,7 +367,7 @@ discard block |
||
| 367 | 367 | */ |
| 368 | 368 | public function hasScene(string $name): bool |
| 369 | 369 | { |
| 370 | - return isset($this->scene[$name]) || method_exists($this, 'scene' . $name); |
|
| 370 | + return isset($this->scene[$name]) || method_exists($this, 'scene'.$name); |
|
| 371 | 371 | } |
| 372 | 372 | |
| 373 | 373 | /** |
@@ -715,7 +715,7 @@ discard block |
||
| 715 | 715 | if (strpos($field, '_confirm')) { |
| 716 | 716 | $rule = strstr($field, '_confirm', true); |
| 717 | 717 | } else { |
| 718 | - $rule = $field . '_confirm'; |
|
| 718 | + $rule = $field.'_confirm'; |
|
| 719 | 719 | } |
| 720 | 720 | } |
| 721 | 721 | |
@@ -866,9 +866,9 @@ discard block |
||
| 866 | 866 | if (isset($this->type[$rule])) { |
| 867 | 867 | // 注册的验证规则 |
| 868 | 868 | $result = call_user_func_array($this->type[$rule], [$value]); |
| 869 | - } elseif (function_exists('ctype_' . $rule)) { |
|
| 869 | + } elseif (function_exists('ctype_'.$rule)) { |
|
| 870 | 870 | // ctype验证规则 |
| 871 | - $ctypeFun = 'ctype_' . $rule; |
|
| 871 | + $ctypeFun = 'ctype_'.$rule; |
|
| 872 | 872 | $result = $ctypeFun($value); |
| 873 | 873 | } elseif (isset($this->filter[$rule])) { |
| 874 | 874 | // Filter_var验证规则 |
@@ -1142,7 +1142,7 @@ discard block |
||
| 1142 | 1142 | } |
| 1143 | 1143 | } else if (strpos($key, '=')) { |
| 1144 | 1144 | // 支持复杂验证条件 |
| 1145 | - parse_str($key,$map); |
|
| 1145 | + parse_str($key, $map); |
|
| 1146 | 1146 | } elseif (isset($data[$field])) { |
| 1147 | 1147 | $map[] = [$key, '=', $data[$field]]; |
| 1148 | 1148 | } else { |
@@ -1509,7 +1509,7 @@ discard block |
||
| 1509 | 1509 | |
| 1510 | 1510 | if (is_string($rule) && 0 !== strpos($rule, '/') && !preg_match('/\/[imsU]{0,4}$/', $rule)) { |
| 1511 | 1511 | // 不是正则表达式则两端补上/ |
| 1512 | - $rule = '/^' . $rule . '$/'; |
|
| 1512 | + $rule = '/^'.$rule.'$/'; |
|
| 1513 | 1513 | } |
| 1514 | 1514 | |
| 1515 | 1515 | return is_scalar($value) && 1 === preg_match($rule, (string) $value); |
@@ -1562,8 +1562,8 @@ discard block |
||
| 1562 | 1562 | */ |
| 1563 | 1563 | protected function getRuleMsg(string $attribute, string $title, string $type, $rule) |
| 1564 | 1564 | { |
| 1565 | - if (isset($this->message[$attribute . '.' . $type])) { |
|
| 1566 | - $msg = $this->message[$attribute . '.' . $type]; |
|
| 1565 | + if (isset($this->message[$attribute.'.'.$type])) { |
|
| 1566 | + $msg = $this->message[$attribute.'.'.$type]; |
|
| 1567 | 1567 | } elseif (isset($this->message[$attribute][$type])) { |
| 1568 | 1568 | $msg = $this->message[$attribute][$type]; |
| 1569 | 1569 | } elseif (isset($this->message[$attribute])) { |
@@ -1573,7 +1573,7 @@ discard block |
||
| 1573 | 1573 | } elseif (0 === strpos($type, 'require')) { |
| 1574 | 1574 | $msg = $this->typeMsg['require']; |
| 1575 | 1575 | } else { |
| 1576 | - $msg = $title . $this->lang->get('not conform to the rules'); |
|
| 1576 | + $msg = $title.$this->lang->get('not conform to the rules'); |
|
| 1577 | 1577 | } |
| 1578 | 1578 | |
| 1579 | 1579 | if (is_array($msg)) { |
@@ -1652,8 +1652,8 @@ discard block |
||
| 1652 | 1652 | { |
| 1653 | 1653 | $this->only = $this->append = $this->remove = []; |
| 1654 | 1654 | |
| 1655 | - if (method_exists($this, 'scene' . $scene)) { |
|
| 1656 | - call_user_func([$this, 'scene' . $scene]); |
|
| 1655 | + if (method_exists($this, 'scene'.$scene)) { |
|
| 1656 | + call_user_func([$this, 'scene'.$scene]); |
|
| 1657 | 1657 | } elseif (isset($this->scene[$scene])) { |
| 1658 | 1658 | // 如果设置了验证适用场景 |
| 1659 | 1659 | $this->only = $this->scene[$scene]; |