From 3b5a52071d39482deb411919855fbcc139398ddb Mon Sep 17 00:00:00 2001 From: Daniel Ronkainen Date: Sat, 1 Jun 2024 16:10:19 +0200 Subject: [PATCH] Fix data type --- Inp.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Inp.php b/Inp.php index 437217d..f5e0fd3 100755 --- a/Inp.php +++ b/Inp.php @@ -43,15 +43,17 @@ class Inp implements InpInterface /** * Start instance - * @param string $value the input value + * @param mixed $value the input value * @return self */ - public function __construct(string $value) + public function __construct(mixed $value) { $this->value = $value; - $this->length = $this->getLength($value); $this->dateTime = new DateTime("now"); - $this->getStr = new Str($this->value); + if(is_string($value) || is_numeric($value)) { + $this->length = $this->getLength($value); + } + $this->getStr = new Str((string)$this->value); } /** @@ -59,7 +61,7 @@ public function __construct(string $value) * @param string $value the input value * @return self */ - public static function value(string $value): self + public static function value(mixed $value): self { return new self($value); }