diff --git a/CHANGELOG.md b/CHANGELOG.md index 39b083b..7e2b257 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,8 @@ All notable changes to this project will be documented in this file. Updates should follow the [Keep a CHANGELOG](http://keepachangelog.com/) principles. ## [Unreleased][unreleased] +### Fixed +- Invalid input type returned when value is empty in InputValidator ## 3.4.2 ### Fixed diff --git a/src/Validation/InputValidator.php b/src/Validation/InputValidator.php index cb326b1..c8d49b4 100644 --- a/src/Validation/InputValidator.php +++ b/src/Validation/InputValidator.php @@ -76,17 +76,17 @@ public function transformType($value, $expectedType = null): mixed } // no break case InputType::INTEGER: - if (is_numeric($value)) { + if (is_numeric($value) || $value === '') { settype($value, 'integer'); } break; case InputType::DOUBLE: - if (is_numeric($value)) { + if (is_numeric($value) || $value === '') { settype($value, 'double'); } break; case InputType::FLOAT: - if (is_numeric($value)) { + if (is_numeric($value) || $value === '') { settype($value, 'float'); } break;