From c0eed294a16a8a71e3513f52431b3d4e689e323d Mon Sep 17 00:00:00 2001 From: Mitch Date: Mon, 21 May 2018 13:02:54 -0600 Subject: [PATCH 1/2] 0 min/max config value should not be treated as null. --- src/DecimalFieldType.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/DecimalFieldType.php b/src/DecimalFieldType.php index 70d3ae0..590725c 100644 --- a/src/DecimalFieldType.php +++ b/src/DecimalFieldType.php @@ -76,11 +76,11 @@ public function getRules() { $rules = parent::getRules(); - if ($min = array_get($this->config, 'min')) { + if (null !== ($min = array_get($this->config, 'min'))) { $rules[] = 'min:' . $min; } - if ($max = array_get($this->config, 'max')) { + if (null !== ($max = array_get($this->config, 'max'))) { $rules[] = 'max:' . $max; } From 7d095187fef966df5f0f40cc47fc648058bd5acc Mon Sep 17 00:00:00 2001 From: Ryan Thompson Date: Mon, 21 May 2018 15:19:43 -0500 Subject: [PATCH 2/2] A little more readable is all --- src/DecimalFieldType.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/DecimalFieldType.php b/src/DecimalFieldType.php index 590725c..a616cfb 100644 --- a/src/DecimalFieldType.php +++ b/src/DecimalFieldType.php @@ -76,11 +76,11 @@ public function getRules() { $rules = parent::getRules(); - if (null !== ($min = array_get($this->config, 'min'))) { + if (!is_null($min = array_get($this->config, 'min'))) { $rules[] = 'min:' . $min; } - if (null !== ($max = array_get($this->config, 'max'))) { + if (!is_null($max = array_get($this->config, 'max'))) { $rules[] = 'max:' . $max; }