Skip to content

Commit a73db7e

Browse files
committed
Ensure the default value is one of the type we're expecting to find
1 parent 94db95a commit a73db7e

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/AbstractElement.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,8 @@ public static function getOptionalAttribute(
101101
string $type = StringValue::class,
102102
?ValueTypeInterface $default = null,
103103
): ?ValueTypeInterface {
104+
Assert::nullOrIsInstanceOf($default, $type);
105+
104106
if (!$xml->hasAttribute($name)) {
105107
return $default;
106108
}

0 commit comments

Comments
 (0)