Skip to content

Commit 0f974fd

Browse files
Merge pull request #1 from MaplePHP/develop
Fix data type
2 parents 5c2f57d + 3b5a520 commit 0f974fd

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

Inp.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,23 +43,25 @@ class Inp implements InpInterface
4343

4444
/**
4545
* Start instance
46-
* @param string $value the input value
46+
* @param mixed $value the input value
4747
* @return self
4848
*/
49-
public function __construct(string $value)
49+
public function __construct(mixed $value)
5050
{
5151
$this->value = $value;
52-
$this->length = $this->getLength($value);
5352
$this->dateTime = new DateTime("now");
54-
$this->getStr = new Str($this->value);
53+
if(is_string($value) || is_numeric($value)) {
54+
$this->length = $this->getLength($value);
55+
}
56+
$this->getStr = new Str((string)$this->value);
5557
}
5658

5759
/**
5860
* Start instance
5961
* @param string $value the input value
6062
* @return self
6163
*/
62-
public static function value(string $value): self
64+
public static function value(mixed $value): self
6365
{
6466
return new self($value);
6567
}

0 commit comments

Comments
 (0)