99use SimpleSAML \XML \Exception \InvalidDOMElementException ;
1010use SimpleSAML \XML \Exception \SchemaViolationException ;
1111use SimpleSAML \XML \ExtendableElementTrait ;
12- use SimpleSAML \XML \SchemaValidatableElementInterface ;
13- use SimpleSAML \XML \SchemaValidatableElementTrait ;
12+ use SimpleSAML \XML \{ SchemaValidatableElementInterface , SchemaValidatableElementTrait } ;
13+ use SimpleSAML \XML \Type \ AnyURIType ;
1414use SimpleSAML \XML \XsNamespace as NS ;
1515use SimpleSAML \XMLSecurity \Constants as C ;
1616use SimpleSAML \XMLSecurity \Exception \InvalidArgumentException ;
@@ -30,14 +30,13 @@ final class DigestMethod extends AbstractDsElement implements SchemaValidatableE
3030 /**
3131 * Initialize a DigestMethod element.
3232 *
33- * @param string $Algorithm
33+ * @param \SimpleSAML\XML\Type\AnyURIValuestring $Algorithm
3434 * @param list<\SimpleSAML\XML\SerializableElementInterface> $elements
3535 */
3636 public function __construct (
37- protected string $ Algorithm ,
37+ protected AnyURIValue $ Algorithm ,
3838 array $ elements = [],
3939 ) {
40- Assert::validURI ($ Algorithm , SchemaViolationException::class);
4140 Assert::oneOf (
4241 $ Algorithm ,
4342 array_keys (C::$ DIGEST_ALGORITHMS ),
@@ -52,9 +51,9 @@ public function __construct(
5251 /**
5352 * Collect the value of the Algorithm-property
5453 *
55- * @return string
54+ * @return \SimpleSAML\XML\Type\AnyURIValue
5655 */
57- public function getAlgorithm (): string
56+ public function getAlgorithm (): AnyURIValue
5857 {
5958 return $ this ->Algorithm ;
6059 }
@@ -74,7 +73,7 @@ public static function fromXML(DOMElement $xml): static
7473 Assert::same ($ xml ->localName , 'DigestMethod ' , InvalidDOMElementException::class);
7574 Assert::same ($ xml ->namespaceURI , DigestMethod::NS , InvalidDOMElementException::class);
7675
77- $ Algorithm = DigestMethod ::getAttribute ($ xml , 'Algorithm ' );
76+ $ Algorithm = self ::getAttribute ($ xml , 'Algorithm ' , AnyURIValue::class );
7877 $ elements = self ::getChildElementsFromXML ($ xml );
7978
8079 return new static ($ Algorithm , $ elements );
@@ -90,7 +89,7 @@ public static function fromXML(DOMElement $xml): static
9089 public function toXML (?DOMElement $ parent = null ): DOMElement
9190 {
9291 $ e = $ this ->instantiateParentElement ($ parent );
93- $ e ->setAttribute ('Algorithm ' , $ this ->getAlgorithm ());
92+ $ e ->setAttribute ('Algorithm ' , strval ( $ this ->getAlgorithm () ));
9493
9594 foreach ($ this ->elements as $ elt ) {
9695 if (!$ elt ->isEmptyElement ()) {
0 commit comments