File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -43,23 +43,25 @@ class Inp implements InpInterface
43
43
44
44
/**
45
45
* Start instance
46
- * @param string $value the input value
46
+ * @param mixed $value the input value
47
47
* @return self
48
48
*/
49
- public function __construct (string $ value )
49
+ public function __construct (mixed $ value )
50
50
{
51
51
$ this ->value = $ value ;
52
- $ this ->length = $ this ->getLength ($ value );
53
52
$ 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 );
55
57
}
56
58
57
59
/**
58
60
* Start instance
59
61
* @param string $value the input value
60
62
* @return self
61
63
*/
62
- public static function value (string $ value ): self
64
+ public static function value (mixed $ value ): self
63
65
{
64
66
return new self ($ value );
65
67
}
You can’t perform that action at this time.
0 commit comments