Skip to content

Commit

Permalink
Squashed 'src/framework/' changes from b3a45be..f9910dc
Browse files Browse the repository at this point in the history
f9910dc Merge commit 'b4f8d0a17a1c9a99274d0e250f6179d14a8728a8'
036d98b Merge branch 'master' of github.com:swoft-cloud/swoft-component
0d9ccbe Update Aop.php (#222)
cacd775 修复Number验证器最大和最小的template没有生效的问题 (#218)
7ebaf5f 修复Number验证器最大和最小的template没有生效的问题 (#218)
ed18988 fix error on trigger event handler (#196)
bf188ad fix a bug when warnings appear in the high version of swoole (#195)
4ec3be6 自定义组件支持别名配置 (#181)
609dd83 修复restart不能正常使用的BUG (#180)
0bcd9bc 修改连接池配置的timeout字段为float (#177)
0044361 修改自定义组件只能扫描Aop、Command、Bootstrap三个文件的BUG (#169)
99916fc 兼容swoole 4.0.3版本 (#166)
a1d6ace 增加用户自定义组件配置 (#150)
d0f7f88 Upstream travis ci config (#160)
afb115f 修复Json Validator会失效的BUG (#153)
5fdf6c7 修复自定义注解无法使用Aop切面编程的BUG (#139)
3c147d1 Optimize  (#143)
c98825b 修复执行php bin/swoft stop命令时master进程异常未退出的问题,以及停止失败后,pid文件被删除的问题 (#134)
940f76f 修改`ComposerHelper::getDirByNamespace`匹配有误的BUG (#137)
427dcb6 Update PoolHelper.php (#131)
fc38546 Scan bean according to Composer settings (#115)
851f3f0 Add psysh for debug (#109)
e55fae5 Parse namespace to dir path according to composer settings (#103)
290a2f4 fix swoft-cloud/swoft#277 (#96)
0d2dade  fix logWriter (#95)
1f1af6c Uniform log path format (#94)
148daeb [fixed]eval error with void method (#92)
a22481a [fixed] logger->messages init error (#91)
69975cd  add coWrite(); use swoft/swoole-ide-helper (#83)
7f66cef change fix
410b028 fix index err

git-subtree-dir: src/framework
git-subtree-split: f9910dc9266e9f87c158d89286a2f07dc67f2a18
  • Loading branch information
swoft-bot committed Jan 15, 2019
1 parent f398e06 commit 9b5c5f9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/Aop/Aop.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public function doAdvice($target, string $method, array $params, array $advices)
$result = $this->doPoint($advice['around'], $target, $method, $params, $advice, $advices);
} else {
// Before
if ($advice['before'] && ! empty($advice['before'])) {
if (isset($advice['before']) && ! empty($advice['before'])) {
// The result of before point will not effect origin object method
$this->doPoint($advice['before'], $target, $method, $params, $advice, $advices);
}
Expand Down
17 changes: 6 additions & 11 deletions src/Helper/ValidatorHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@

use Swoft\Exception\ValidatorException;

/**
* Class ValidatorHelper
*
* @package Swoft\Helper
*/
class ValidatorHelper
{
/**
Expand Down Expand Up @@ -120,15 +115,15 @@ public static function validateNumber(string $name, $value, $min = null, $max =

$value = (int)$value;
if ($min !== null && $value < $min) {
$template = empty($template) ?: $template;
$template = empty($template) ? sprintf('Parameter %s is too short (minimum is %d)', $name, $min): $template;

return self::validateError(sprintf('Parameter %s is too small (minimum is %d)', $name, $min), $throws);
return self::validateError($template, $throws);
}

if ($max !== null && $value > $max) {
$template = empty($template) ?: $template;
$template = empty($template) ? sprintf('Parameter %s is too large (maximum is %d)', $name, $max) : $template;

return self::validateError(sprintf('Parameter %s is too big (maximum is %d)', $name, $max), $throws);
return self::validateError($template, $throws);
}

return (int)$value;
Expand Down Expand Up @@ -177,13 +172,13 @@ public static function validateFloat(

$value = (float)$value;
if ($min !== null && $value < $min) {
$template = empty($template) ? sprintf('Parameter %s is too small (minimum is %d)', $name, $min) : $template;
$template = empty($template) ? sprintf('Parameter %s is too short (minimum is %d)', $name, $min) : $template;

return self::validateError($template, $throws);
}

if ($max !== null && $value > $max) {
$template = empty($template) ? sprintf('Parameter %s is too big (maximum is %d)', $name, $max) : $template;
$template = empty($template) ? sprintf('Parameter %s is too large (maximum is %d)', $name, $max) : $template;

return self::validateError($template, $throws);
}
Expand Down

0 comments on commit 9b5c5f9

Please sign in to comment.