44
55namespace SimpleSAML \XML ;
66
7- use DOMElement ;
7+ use Dom ;
88use SimpleSAML \XML \Assert \Assert ;
99use SimpleSAML \XML \DOMDocumentFactory ;
1010use SimpleSAML \XML \SerializableElementTrait ;
@@ -57,10 +57,10 @@ final class Chunk implements
5757 /**
5858 * Create an XML Chunk from a copy of the given \DOMElement.
5959 *
60- * @param \DOMElement $xml The element we should copy.
60+ * @param \Dom\Element $xml The element we should copy.
6161 */
6262 public function __construct (
63- protected DOMElement $ xml ,
63+ protected Dom \ Element $ xml ,
6464 ) {
6565 $ this ->setLocalName ($ xml ->localName );
6666 $ this ->setNamespaceURI ($ xml ->namespaceURI );
@@ -132,9 +132,9 @@ protected function setNamespaceURI(?string $namespaceURI = null): void
132132
133133
134134 /**
135- * Get this \DOMElement .
135+ * Get this \Dom\Element .
136136 */
137- public function getXML (): DOMElement
137+ public function getXML (): Dom \ Element
138138 {
139139 return $ this ->xml ;
140140 }
@@ -180,15 +180,15 @@ public function getQualifiedName(): string
180180 * Get the value of an attribute from a given element.
181181 *
182182 * @template T of \SimpleSAML\XMLSchema\Type\Interface\ValueTypeInterface
183- * @param \DOMElement $xml The element where we should search for the attribute.
183+ * @param \Dom\Element $xml The element where we should search for the attribute.
184184 * @param string $name The name of the attribute.
185185 * @param class-string<T> $type The type of the attribute value.
186186 * @return T
187187 *
188188 * @throws \SimpleSAML\XMLSchema\Exception\MissingAttributeException if the attribute is missing from the element
189189 */
190190 public static function getAttribute (
191- DOMElement $ xml ,
191+ Dom \ Element $ xml ,
192192 string $ name ,
193193 string $ type = StringValue::class,
194194 ): ValueTypeInterface {
@@ -209,15 +209,15 @@ public static function getAttribute(
209209 * Get the value of an attribute from a given element.
210210 *
211211 * @template T of \SimpleSAML\XMLSchema\Type\Interface\ValueTypeInterface
212- * @param \DOMElement $xml The element where we should search for the attribute.
212+ * @param \Dom\Element $xml The element where we should search for the attribute.
213213 * @param string $name The name of the attribute.
214214 * @param class-string<T> $type The type of the attribute value.
215215 * @param \SimpleSAML\XMLSchema\Type\Interface\ValueTypeInterface|null $default
216216 * The default to return in case the attribute does not exist and it is optional.
217217 * @return ($default is \SimpleSAML\XMLSchema\Type\Interface\ValueTypeInterface ? T : T|null)
218218 */
219219 public static function getOptionalAttribute (
220- DOMElement $ xml ,
220+ Dom \ Element $ xml ,
221221 string $ name ,
222222 string $ type = StringValue::class,
223223 ?ValueTypeInterface $ default = null ,
@@ -235,16 +235,16 @@ public static function getOptionalAttribute(
235235 */
236236 public function isEmptyElement (): bool
237237 {
238- /** @var \DOMElement $xml */
238+ /** @var \Dom\Element $xml */
239239 $ xml = $ this ->getXML ();
240240 return ($ xml ->childNodes ->length === 0 ) && ($ xml ->attributes ->count () === 0 );
241241 }
242242
243243
244244 /**
245- * @param \DOMElement $xml
245+ * @param \Dom\Element $xml
246246 */
247- public static function fromXML (DOMElement $ xml ): static
247+ public static function fromXML (Dom \ Element $ xml ): static
248248 {
249249 return new static ($ xml );
250250 }
@@ -253,10 +253,10 @@ public static function fromXML(DOMElement $xml): static
253253 /**
254254 * Append this XML element to a different XML element.
255255 *
256- * @param \DOMElement |null $parent The element we should append this element to.
257- * @return \DOMElement The new element.
256+ * @param \Dom\Element |null $parent The element we should append this element to.
257+ * @return \Dom\Element The new element.
258258 */
259- public function toXML (?DOMElement $ parent = null ): DOMElement
259+ public function toXML (?Dom \ Element $ parent = null ): Dom \ Element
260260 {
261261 if ($ parent === null ) {
262262 $ doc = DOMDocumentFactory::create ();
0 commit comments