diff --git a/src/AbstractElement.php b/src/AbstractElement.php index cf3acb8..b0576db 100644 --- a/src/AbstractElement.php +++ b/src/AbstractElement.php @@ -101,6 +101,8 @@ public static function getOptionalAttribute( string $type = StringValue::class, ?ValueTypeInterface $default = null, ): ?ValueTypeInterface { + Assert::nullOrIsInstanceOf($default, $type); + if (!$xml->hasAttribute($name)) { return $default; }