diff --git a/src/core/etl/src/Flow/ETL/PHP/Type/Logical/DateTimeType.php b/src/core/etl/src/Flow/ETL/PHP/Type/Logical/DateTimeType.php
index 585040485..7dd79aed5 100644
--- a/src/core/etl/src/Flow/ETL/PHP/Type/Logical/DateTimeType.php
+++ b/src/core/etl/src/Flow/ETL/PHP/Type/Logical/DateTimeType.php
@@ -26,6 +26,10 @@ public function isEqual(Type $type) : bool
public function isValid(mixed $value) : bool
{
+ if ($this->nullable && $value === null) {
+ return true;
+ }
+
return $value instanceof \DateTimeInterface;
}
diff --git a/src/core/etl/src/Flow/ETL/PHP/Type/Logical/JsonType.php b/src/core/etl/src/Flow/ETL/PHP/Type/Logical/JsonType.php
index 4e8eaa172..c31d66511 100644
--- a/src/core/etl/src/Flow/ETL/PHP/Type/Logical/JsonType.php
+++ b/src/core/etl/src/Flow/ETL/PHP/Type/Logical/JsonType.php
@@ -27,6 +27,10 @@ public function isEqual(Type $type) : bool
public function isValid(mixed $value) : bool
{
+ if ($this->nullable && $value === null) {
+ return true;
+ }
+
if (!\is_string($value)) {
return false;
}
diff --git a/src/core/etl/src/Flow/ETL/PHP/Type/Logical/ListType.php b/src/core/etl/src/Flow/ETL/PHP/Type/Logical/ListType.php
index 16364c056..7a1d76b29 100644
--- a/src/core/etl/src/Flow/ETL/PHP/Type/Logical/ListType.php
+++ b/src/core/etl/src/Flow/ETL/PHP/Type/Logical/ListType.php
@@ -36,6 +36,10 @@ public function isEqual(Type $type) : bool
public function isValid(mixed $value) : bool
{
+ if ($this->nullable && $value === null) {
+ return true;
+ }
+
if (!\is_array($value)) {
return false;
}
diff --git a/src/core/etl/src/Flow/ETL/PHP/Type/Logical/MapType.php b/src/core/etl/src/Flow/ETL/PHP/Type/Logical/MapType.php
index 4e469fb7f..1db25781e 100644
--- a/src/core/etl/src/Flow/ETL/PHP/Type/Logical/MapType.php
+++ b/src/core/etl/src/Flow/ETL/PHP/Type/Logical/MapType.php
@@ -31,6 +31,10 @@ public function isEqual(Type $type) : bool
public function isValid(mixed $value) : bool
{
+ if ($this->nullable && $value === null) {
+ return true;
+ }
+
if (!\is_array($value)) {
return false;
}
diff --git a/src/core/etl/src/Flow/ETL/PHP/Type/Logical/StructureType.php b/src/core/etl/src/Flow/ETL/PHP/Type/Logical/StructureType.php
index ea0d93368..a7303993d 100644
--- a/src/core/etl/src/Flow/ETL/PHP/Type/Logical/StructureType.php
+++ b/src/core/etl/src/Flow/ETL/PHP/Type/Logical/StructureType.php
@@ -77,6 +77,10 @@ public function isEqual(Type $type) : bool
public function isValid(mixed $value) : bool
{
+ if ($this->nullable && $value === null) {
+ return true;
+ }
+
if (!\is_array($value)) {
return false;
}
diff --git a/src/core/etl/src/Flow/ETL/PHP/Type/Logical/UuidType.php b/src/core/etl/src/Flow/ETL/PHP/Type/Logical/UuidType.php
index de53feb75..b2a09098d 100644
--- a/src/core/etl/src/Flow/ETL/PHP/Type/Logical/UuidType.php
+++ b/src/core/etl/src/Flow/ETL/PHP/Type/Logical/UuidType.php
@@ -27,6 +27,10 @@ public function isEqual(Type $type) : bool
public function isValid(mixed $value) : bool
{
+ if ($this->nullable && $value === null) {
+ return true;
+ }
+
if (\is_object($value)) {
foreach ([Uuid::class, \Ramsey\Uuid\UuidInterface::class, \Symfony\Component\Uid\Uuid::class] as $uuidClass) {
if ($value instanceof $uuidClass) {
diff --git a/src/core/etl/src/Flow/ETL/PHP/Type/Logical/XMLNodeType.php b/src/core/etl/src/Flow/ETL/PHP/Type/Logical/XMLNodeType.php
index 0110deb51..11b5ee8bd 100644
--- a/src/core/etl/src/Flow/ETL/PHP/Type/Logical/XMLNodeType.php
+++ b/src/core/etl/src/Flow/ETL/PHP/Type/Logical/XMLNodeType.php
@@ -26,6 +26,10 @@ public function isEqual(Type $type) : bool
public function isValid(mixed $value) : bool
{
+ if ($this->nullable && $value === null) {
+ return true;
+ }
+
if ($value instanceof \DOMNode) {
return true;
}
diff --git a/src/core/etl/src/Flow/ETL/PHP/Type/Logical/XMLType.php b/src/core/etl/src/Flow/ETL/PHP/Type/Logical/XMLType.php
index 149d03607..0fa33d3c3 100644
--- a/src/core/etl/src/Flow/ETL/PHP/Type/Logical/XMLType.php
+++ b/src/core/etl/src/Flow/ETL/PHP/Type/Logical/XMLType.php
@@ -26,6 +26,10 @@ public function isEqual(Type $type) : bool
public function isValid(mixed $value) : bool
{
+ if ($this->nullable && $value === null) {
+ return true;
+ }
+
if ($value instanceof \DOMDocument) {
return true;
}
diff --git a/src/core/etl/src/Flow/ETL/PHP/Type/Native/ArrayType.php b/src/core/etl/src/Flow/ETL/PHP/Type/Native/ArrayType.php
index 3a09e45eb..987917b9f 100644
--- a/src/core/etl/src/Flow/ETL/PHP/Type/Native/ArrayType.php
+++ b/src/core/etl/src/Flow/ETL/PHP/Type/Native/ArrayType.php
@@ -30,6 +30,10 @@ public function isEqual(Type $type) : bool
public function isValid(mixed $value) : bool
{
+ if ($this->nullable && $value === null) {
+ return true;
+ }
+
return \is_array($value);
}
diff --git a/src/core/etl/src/Flow/ETL/PHP/Type/Native/CallableType.php b/src/core/etl/src/Flow/ETL/PHP/Type/Native/CallableType.php
index ec141dfef..72197a728 100644
--- a/src/core/etl/src/Flow/ETL/PHP/Type/Native/CallableType.php
+++ b/src/core/etl/src/Flow/ETL/PHP/Type/Native/CallableType.php
@@ -26,6 +26,10 @@ public function isEqual(Type $type) : bool
public function isValid(mixed $value) : bool
{
+ if ($this->nullable && $value === null) {
+ return true;
+ }
+
return \is_callable($value);
}
diff --git a/src/core/etl/src/Flow/ETL/PHP/Type/Native/EnumType.php b/src/core/etl/src/Flow/ETL/PHP/Type/Native/EnumType.php
index 4b7d2236d..b9265e079 100644
--- a/src/core/etl/src/Flow/ETL/PHP/Type/Native/EnumType.php
+++ b/src/core/etl/src/Flow/ETL/PHP/Type/Native/EnumType.php
@@ -45,6 +45,10 @@ public function isEqual(Type $type) : bool
public function isValid(mixed $value) : bool
{
+ if ($this->nullable && $value === null) {
+ return true;
+ }
+
return \is_a($value, $this->class, true);
}
diff --git a/src/core/etl/src/Flow/ETL/PHP/Type/Native/ObjectType.php b/src/core/etl/src/Flow/ETL/PHP/Type/Native/ObjectType.php
index 44b8a573d..1aefdbe5c 100644
--- a/src/core/etl/src/Flow/ETL/PHP/Type/Native/ObjectType.php
+++ b/src/core/etl/src/Flow/ETL/PHP/Type/Native/ObjectType.php
@@ -37,6 +37,10 @@ public function isEqual(Type $type) : bool
public function isValid(mixed $value) : bool
{
+ if ($this->nullable && $value === null) {
+ return true;
+ }
+
return \is_a($value, $this->class, true);
}
diff --git a/src/core/etl/src/Flow/ETL/PHP/Type/Native/ResourceType.php b/src/core/etl/src/Flow/ETL/PHP/Type/Native/ResourceType.php
index d805d0910..5ef9fc042 100644
--- a/src/core/etl/src/Flow/ETL/PHP/Type/Native/ResourceType.php
+++ b/src/core/etl/src/Flow/ETL/PHP/Type/Native/ResourceType.php
@@ -26,6 +26,10 @@ public function isEqual(Type $type) : bool
public function isValid(mixed $value) : bool
{
+ if ($this->nullable && $value === null) {
+ return true;
+ }
+
return \is_resource($value);
}
diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/PHP/Type/Logical/DateTimeTypeTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/PHP/Type/Logical/DateTimeTypeTest.php
index 24d13fdb4..ff4f75089 100644
--- a/src/core/etl/tests/Flow/ETL/Tests/Unit/PHP/Type/Logical/DateTimeTypeTest.php
+++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/PHP/Type/Logical/DateTimeTypeTest.php
@@ -21,6 +21,7 @@ public function test_equals() : void
public function test_is_valid() : void
{
+ self::assertTrue(type_datetime(true)->isValid(null));
self::assertTrue(type_datetime()->isValid(new \DateTimeImmutable()));
self::assertTrue(type_datetime()->isValid(new \DateTime()));
self::assertFalse(type_datetime()->isValid('2020-01-01'));
diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/PHP/Type/Logical/JsonTypeTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/PHP/Type/Logical/JsonTypeTest.php
index 6435d41e3..7f8a63631 100644
--- a/src/core/etl/tests/Flow/ETL/Tests/Unit/PHP/Type/Logical/JsonTypeTest.php
+++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/PHP/Type/Logical/JsonTypeTest.php
@@ -21,6 +21,7 @@ public function test_equals() : void
public function test_is_valid() : void
{
+ self::assertTrue(type_json(true)->isValid(null));
self::assertTrue(type_json()->isValid('{"foo": "bar"}'));
self::assertFalse(type_json()->isValid('{"foo": "bar"'));
self::assertFalse(type_json()->isValid('2'));
diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/PHP/Type/Logical/ListTypeTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/PHP/Type/Logical/ListTypeTest.php
index c4e50b135..7c044cb14 100644
--- a/src/core/etl/tests/Flow/ETL/Tests/Unit/PHP/Type/Logical/ListTypeTest.php
+++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/PHP/Type/Logical/ListTypeTest.php
@@ -45,6 +45,9 @@ public function test_valid() : void
self::assertTrue(
(new ListType(ListElement::boolean()))->isValid([true, false])
);
+ self::assertTrue(
+ (new ListType(ListElement::boolean(), true))->isValid(null)
+ );
self::assertTrue(
(new ListType(ListElement::string()))->isValid(['one', 'two'])
);
diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/PHP/Type/Logical/MapTypeTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/PHP/Type/Logical/MapTypeTest.php
index a0242c54b..01bab6478 100644
--- a/src/core/etl/tests/Flow/ETL/Tests/Unit/PHP/Type/Logical/MapTypeTest.php
+++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/PHP/Type/Logical/MapTypeTest.php
@@ -45,6 +45,9 @@ public function test_valid() : void
self::assertTrue(
(new MapType(MapKey::string(), MapValue::string()))->isValid(['one' => 'two'])
);
+ self::assertTrue(
+ (new MapType(MapKey::string(), MapValue::string(), true))->isValid(null)
+ );
self::assertTrue(
(new MapType(MapKey::integer(), MapValue::list(new ListType(ListElement::integer()))))->isValid([[1, 2], [3, 4]])
);
diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/PHP/Type/Logical/StructureTypeTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/PHP/Type/Logical/StructureTypeTest.php
index 1b380ef15..271694e9f 100644
--- a/src/core/etl/tests/Flow/ETL/Tests/Unit/PHP/Type/Logical/StructureTypeTest.php
+++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/PHP/Type/Logical/StructureTypeTest.php
@@ -164,6 +164,9 @@ public function test_valid() : void
self::assertTrue(
(struct_type([struct_element('string', type_string())]))->isValid(['one' => 'two'])
);
+ self::assertTrue(
+ (struct_type([struct_element('string', type_string())], true))->isValid(null)
+ );
self::assertTrue(
(
struct_type([
diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/PHP/Type/Logical/UuidTypeTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/PHP/Type/Logical/UuidTypeTest.php
index 8a0ab260c..ad0ed987f 100644
--- a/src/core/etl/tests/Flow/ETL/Tests/Unit/PHP/Type/Logical/UuidTypeTest.php
+++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/PHP/Type/Logical/UuidTypeTest.php
@@ -22,6 +22,7 @@ public function test_equals() : void
public function test_is_valid() : void
{
+ self::assertTrue(type_uuid(true)->isValid(null));
self::assertFalse(type_uuid()->isValid('f6d6e0e8-4b7e-4b0e-8d7a-ff0a0c9c9a5a'));
self::assertFalse(type_uuid()->isValid('f6d6e0e8-4b7e-4b0e-8d7a-ff0a0c9c9a5'));
self::assertFalse(type_uuid()->isValid('2'));
diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/PHP/Type/Logical/XMLNodeTypeTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/PHP/Type/Logical/XMLNodeTypeTest.php
index 3201b1e59..6e802633b 100644
--- a/src/core/etl/tests/Flow/ETL/Tests/Unit/PHP/Type/Logical/XMLNodeTypeTest.php
+++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/PHP/Type/Logical/XMLNodeTypeTest.php
@@ -21,6 +21,7 @@ public function test_equals() : void
public function test_is_valid() : void
{
+ self::assertTrue(type_xml_node(true)->isValid(null));
self::assertTrue(type_xml_node()->isValid(new \DOMDocument()));
self::assertFalse(type_xml_node()->isValid(''));
self::assertFalse(type_xml_node()->isValid('2020-01-01'));
diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/PHP/Type/Logical/XMLTypeTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/PHP/Type/Logical/XMLTypeTest.php
index eccaa6488..399bb3fee 100644
--- a/src/core/etl/tests/Flow/ETL/Tests/Unit/PHP/Type/Logical/XMLTypeTest.php
+++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/PHP/Type/Logical/XMLTypeTest.php
@@ -21,6 +21,7 @@ public function test_equals() : void
public function test_is_valid() : void
{
+ self::assertTrue(type_xml(true)->isValid(null));
self::assertTrue(type_xml()->isValid(new \DOMDocument()));
self::assertFalse(type_xml()->isValid(''));
self::assertFalse(type_xml()->isValid('2020-01-01'));
diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/PHP/Type/Native/ArrayTypeTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/PHP/Type/Native/ArrayTypeTest.php
index fde73bfc1..bda89a913 100644
--- a/src/core/etl/tests/Flow/ETL/Tests/Unit/PHP/Type/Native/ArrayTypeTest.php
+++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/PHP/Type/Native/ArrayTypeTest.php
@@ -54,6 +54,9 @@ public function test_valid() : void
self::assertTrue(
type_array()->isValid([1])
);
+ self::assertTrue(
+ type_array(nullable: true)->isValid(null)
+ );
self::assertFalse(
type_array()->isValid(null)
);
diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/PHP/Type/Native/CallableTypeTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/PHP/Type/Native/CallableTypeTest.php
index c0dcd3765..8807072e7 100644
--- a/src/core/etl/tests/Flow/ETL/Tests/Unit/PHP/Type/Native/CallableTypeTest.php
+++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/PHP/Type/Native/CallableTypeTest.php
@@ -44,6 +44,9 @@ public function test_valid() : void
self::assertTrue(
type_callable(false)->isValid('printf')
);
+ self::assertTrue(
+ type_callable(true)->isValid(null)
+ );
self::assertFalse(
type_callable(false)->isValid('one')
);
diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/PHP/Type/Native/ObjectTypeTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/PHP/Type/Native/ObjectTypeTest.php
new file mode 100644
index 000000000..c75ed14ff
--- /dev/null
+++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/PHP/Type/Native/ObjectTypeTest.php
@@ -0,0 +1,30 @@
+isValid(null)
+ );
+ self::assertFalse(
+ type_object(\stdClass::class)->isValid(null)
+ );
+ self::assertFalse(
+ type_object(\stdClass::class)->isValid('one')
+ );
+ self::assertFalse(
+ type_object(\stdClass::class)->isValid(new \ArrayIterator([]))
+ );
+ self::assertTrue(
+ type_object(\stdClass::class)->isValid(new \stdClass())
+ );
+ }
+}
diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/PHP/Type/Native/ResourceTypeTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/PHP/Type/Native/ResourceTypeTest.php
index 14f3a890e..4b5730822 100644
--- a/src/core/etl/tests/Flow/ETL/Tests/Unit/PHP/Type/Native/ResourceTypeTest.php
+++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/PHP/Type/Native/ResourceTypeTest.php
@@ -46,6 +46,9 @@ public function test_valid() : void
(type_resource(false))->isValid($handle)
);
\fclose($handle);
+ self::assertTrue(
+ type_resource(true)->isValid(null)
+ );
self::assertFalse(
(type_resource(false))->isValid('one')
);