diff --git a/src/schema/_scalar/ScalarValue.php b/src/schema/_scalar/ScalarValue.php index e5ece81..80a307a 100644 --- a/src/schema/_scalar/ScalarValue.php +++ b/src/schema/_scalar/ScalarValue.php @@ -10,13 +10,13 @@ use nur\sery\schema\types\IType; use nur\sery\schema\Value; class ScalarValue extends Value { - function __construct(ScalarSchema $schema, &$dest=null, $destKey=null, bool $defaultVerifix=true, bool $defaultThrow=true) { + function __construct(ScalarSchema $schema, &$dest=null, $destKey=null, bool $defaultVerifix=true, ?bool $defaultThrow=null) { $this->schema = $schema; $this->defaultVerifix = $defaultVerifix; - $this->defaultThrow = false; + $this->defaultThrow = $defaultThrow !== null? $defaultThrow: false; $this->result = new ScalarResult(); $this->reset($dest, $destKey); - $this->defaultThrow = $defaultThrow; + $this->defaultThrow = $defaultThrow !== null? $defaultThrow: true; } function isScalar(?ScalarValue &$scalar=null): bool { $scalar = $this; return true; }