diff --git a/composer.json b/composer.json index d48454b..4a115f9 100644 --- a/composer.json +++ b/composer.json @@ -18,8 +18,8 @@ "psr/clock": "~1.0", "psr/log": "~3.0", "simplesamlphp/assert": "~2.0", - "simplesamlphp/xml-common": "~2.8", - "simplesamlphp/xml-security": "~2.3" + "simplesamlphp/xml-common": "dev-feature/dom-migration-php84", + "simplesamlphp/xml-security": "dev-feature/dom-migration-php84" }, "require-dev": { "beste/clock": "~3.0", diff --git a/src/SAML11/Utils/XPath.php b/src/SAML11/Utils/XPath.php index cb1e61e..b74ed7a 100644 --- a/src/SAML11/Utils/XPath.php +++ b/src/SAML11/Utils/XPath.php @@ -4,8 +4,7 @@ namespace SimpleSAML\SAML11\Utils; -use DOMNode; -use DOMXPath; +use Dom; use SimpleSAML\SAML11\Constants as C; /** @@ -16,15 +15,15 @@ class XPath extends \SimpleSAML\XMLSecurity\Utils\XPath { /** - * Get a DOMXPath object that can be used to search for SAML elements. + * Get a Dom\XPath object that can be used to search for SAML elements. * - * @param \DOMNode $node The document to associate to the DOMXPath object. + * @param \Dom\Node $node The document to associate to the Dom\XPath object. * @param bool $autoregister Whether to auto-register all namespaces used in the document * - * @return \DOMXPath A DOMXPath object ready to use in the given document, with several + * @return \Dom\XPath A Dom\XPath object ready to use in the given document, with several * saml-related namespaces already registered. */ - public static function getXPath(DOMNode $node, bool $autoregister = false): DOMXPath + public static function getXPath(Dom\Node $node, bool $autoregister = false): Dom\XPath { $xp = parent::getXPath($node, $autoregister); diff --git a/src/SAML11/XML/CanonicalizableElementTrait.php b/src/SAML11/XML/CanonicalizableElementTrait.php index 88b53e7..7e440f2 100644 --- a/src/SAML11/XML/CanonicalizableElementTrait.php +++ b/src/SAML11/XML/CanonicalizableElementTrait.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML11\XML; -use DOMElement; +use Dom; use SimpleSAML\SAML11\Assert\Assert; use SimpleSAML\XMLSecurity\Constants as C; use SimpleSAML\XMLSecurity\Exception\CanonicalizationFailedException; @@ -26,7 +26,7 @@ trait CanonicalizableElementTrait * Process all transforms specified by a given Reference element. * * @param \SimpleSAML\XMLSecurity\XML\ds\Transforms $transforms The transforms to apply. - * @param \DOMElement $data The data referenced. + * @param \Dom\Element $data The data referenced. * * @return string The canonicalized data after applying all transforms specified by $ref. * @@ -34,7 +34,7 @@ trait CanonicalizableElementTrait */ public function processTransforms( Transforms $transforms, - DOMElement $data, + Dom\Element $data, ): string { Assert::maxCount( $transforms->getTransform(), diff --git a/src/SAML11/XML/SignableElementTrait.php b/src/SAML11/XML/SignableElementTrait.php index c3b59ae..4aaa9b2 100644 --- a/src/SAML11/XML/SignableElementTrait.php +++ b/src/SAML11/XML/SignableElementTrait.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML11\XML; -use DOMElement; +use Dom; use SimpleSAML\Assert\Assert; use SimpleSAML\SAML11\Compat\ContainerSingleton; use SimpleSAML\XML\DOMDocumentFactory; @@ -72,9 +72,9 @@ public function sign( /** * Do the actual signing of the document. * - * Note that this method does not insert the signature in the returned \DOMElement. The signature will be available + * Note that this method does not insert the signature in the returned \Dom\Element. The signature will be available * in $this->signature as a \SimpleSAML\XMLSecurity\XML\ds\Signature object, which can then be converted to XML - * calling toXML() on it, passing the \DOMElement value returned here as a parameter. The resulting \DOMElement + * calling toXML() on it, passing the \Dom\Element value returned here as a parameter. The resulting \Dom\Element * can then be inserted in the position desired. * * E.g.: @@ -82,10 +82,10 @@ public function sign( * $signedXML = $this->doSign($xml); * $signedXML->appendChild($this->signature->toXML($signedXML)); * - * @param \DOMElement $xml The element to sign. - * @return \DOMElement The signed element, without the signature attached to it just yet. + * @param \Dom\Element $xml The element to sign. + * @return \Dom\Element The signed element, without the signature attached to it just yet. */ - protected function doSign(DOMElement $xml): DOMElement + protected function doSign(Dom\Element $xml): Dom\Element { Assert::notNull( $this->signer, diff --git a/src/SAML11/XML/saml/AbstractActionType.php b/src/SAML11/XML/saml/AbstractActionType.php index 4ff24d1..d4cbad8 100644 --- a/src/SAML11/XML/saml/AbstractActionType.php +++ b/src/SAML11/XML/saml/AbstractActionType.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML11\XML\saml; -use DOMElement; +use Dom; use SimpleSAML\Assert\Assert; use SimpleSAML\SAML11\Type\SAMLAnyURIValue; use SimpleSAML\SAML11\Type\SAMLStringValue; @@ -60,7 +60,7 @@ public function getNamespace(): ?SAMLAnyURIValue * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ - public static function fromXML(DOMElement $xml): static + public static function fromXML(Dom\Element $xml): static { Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class); Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class); @@ -75,7 +75,7 @@ public static function fromXML(DOMElement $xml): static /** * Convert this ActionType to XML. */ - public function toXML(?DOMElement $parent = null): DOMElement + public function toXML(?Dom\Element $parent = null): Dom\Element { $e = $this->instantiateParentElement($parent); $e->textContent = strval($this->getValue()); diff --git a/src/SAML11/XML/saml/AbstractAdviceType.php b/src/SAML11/XML/saml/AbstractAdviceType.php index de0e3ea..e97eb06 100644 --- a/src/SAML11/XML/saml/AbstractAdviceType.php +++ b/src/SAML11/XML/saml/AbstractAdviceType.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML11\XML\saml; -use DOMElement; +use Dom; use SimpleSAML\Assert\Assert; use SimpleSAML\SAML11\Constants as C; use SimpleSAML\XML\Chunk; @@ -87,7 +87,7 @@ public function isEmptyElement(): bool * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ - public static function fromXML(DOMElement $xml): static + public static function fromXML(Dom\Element $xml): static { Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class); Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class); @@ -96,7 +96,7 @@ public static function fromXML(DOMElement $xml): static foreach ($xml->childNodes as $element) { if ($element->namespaceURI === C::NS_SAML) { continue; - } elseif (!($element instanceof DOMElement)) { + } elseif (!($element instanceof Dom\Element)) { continue; } @@ -114,7 +114,7 @@ public static function fromXML(DOMElement $xml): static /** * Convert this EvidenceType to XML. */ - public function toXML(?DOMElement $parent = null): DOMElement + public function toXML(?Dom\Element $parent = null): Dom\Element { $e = $this->instantiateParentElement($parent); diff --git a/src/SAML11/XML/saml/AbstractAssertionType.php b/src/SAML11/XML/saml/AbstractAssertionType.php index d4aa909..b39a9a5 100644 --- a/src/SAML11/XML/saml/AbstractAssertionType.php +++ b/src/SAML11/XML/saml/AbstractAssertionType.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML11\XML\saml; -use DOMElement; +use Dom; use SimpleSAML\SAML11\Assert\Assert; use SimpleSAML\SAML11\Compat\ContainerSingleton; use SimpleSAML\SAML11\Constants as C; @@ -50,7 +50,7 @@ abstract class AbstractAssertionType extends AbstractSamlElement implements /** * The original signed XML */ - protected DOMElement $xml; + protected Dom\Element $xml; /** @@ -231,7 +231,7 @@ public function getAttributeStatements(): array /** * Set the XML element. */ - private function setOriginalXML(DOMElement $xml): void + private function setOriginalXML(Dom\Element $xml): void { $this->xml = $xml; } @@ -239,7 +239,7 @@ private function setOriginalXML(DOMElement $xml): void /** */ - protected function getOriginalXML(): DOMElement + protected function getOriginalXML(): Dom\Element { return $this->xml ?? $this->toUnsignedXML(); } @@ -258,7 +258,7 @@ public function getBlacklistedAlgorithms(): ?array * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ - public static function fromXML(DOMElement $xml): static + public static function fromXML(Dom\Element $xml): static { Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class); Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class); @@ -312,7 +312,7 @@ public static function fromXML(DOMElement $xml): static * Convert this assertion to an unsigned XML document. * This method does not sign the resulting XML document. */ - protected function toUnsignedXML(?DOMElement $parent = null): DOMElement + protected function toUnsignedXML(?Dom\Element $parent = null): Dom\Element { $e = $this->instantiateParentElement($parent); @@ -338,7 +338,7 @@ protected function toUnsignedXML(?DOMElement $parent = null): DOMElement * * @throws \Exception */ - public function toXML(?DOMElement $parent = null): DOMElement + public function toXML(?Dom\Element $parent = null): Dom\Element { if ($this->isSigned() === true && $this->signer === null) { // We already have a signed document and no signer was set to re-sign it diff --git a/src/SAML11/XML/saml/AbstractAttributeDesignatorType.php b/src/SAML11/XML/saml/AbstractAttributeDesignatorType.php index 6c726a3..e3bf830 100644 --- a/src/SAML11/XML/saml/AbstractAttributeDesignatorType.php +++ b/src/SAML11/XML/saml/AbstractAttributeDesignatorType.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML11\XML\saml; -use DOMElement; +use Dom; use SimpleSAML\SAML11\Type\SAMLAnyURIValue; use SimpleSAML\SAML11\Type\SAMLStringValue; @@ -55,7 +55,7 @@ public function getAttributeNamespace(): SAMLAnyURIValue /** * Convert this AttributeDesignatorType to XML. */ - public function toXML(?DOMElement $parent = null): DOMElement + public function toXML(?Dom\Element $parent = null): Dom\Element { $e = $this->instantiateParentElement($parent); diff --git a/src/SAML11/XML/saml/AbstractAttributeStatementType.php b/src/SAML11/XML/saml/AbstractAttributeStatementType.php index 46820cb..cc089e8 100644 --- a/src/SAML11/XML/saml/AbstractAttributeStatementType.php +++ b/src/SAML11/XML/saml/AbstractAttributeStatementType.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML11\XML\saml; -use DOMElement; +use Dom; use SimpleSAML\Assert\Assert; use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; use SimpleSAML\XMLSchema\Exception\MissingElementException; @@ -51,7 +51,7 @@ public function getAttributes(): array * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ - public static function fromXML(DOMElement $xml): static + public static function fromXML(Dom\Element $xml): static { Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class); Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class); @@ -70,7 +70,7 @@ public static function fromXML(DOMElement $xml): static /** * Convert this AttributeStatementType to XML. */ - public function toXML(?DOMElement $parent = null): DOMElement + public function toXML(?Dom\Element $parent = null): Dom\Element { $e = parent::toXML($parent); diff --git a/src/SAML11/XML/saml/AbstractAttributeType.php b/src/SAML11/XML/saml/AbstractAttributeType.php index 12211a2..5d206eb 100644 --- a/src/SAML11/XML/saml/AbstractAttributeType.php +++ b/src/SAML11/XML/saml/AbstractAttributeType.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML11\XML\saml; -use DOMElement; +use Dom; use SimpleSAML\Assert\Assert; use SimpleSAML\SAML11\Type\SAMLAnyURIValue; use SimpleSAML\SAML11\Type\SAMLStringValue; @@ -53,7 +53,7 @@ public function getAttributeValue(): array * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ - public static function fromXML(DOMElement $xml): static + public static function fromXML(Dom\Element $xml): static { Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class); Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class); @@ -69,7 +69,7 @@ public static function fromXML(DOMElement $xml): static /** * Convert this AttributeType to XML. */ - public function toXML(?DOMElement $parent = null): DOMElement + public function toXML(?Dom\Element $parent = null): Dom\Element { $e = parent::toXML($parent); diff --git a/src/SAML11/XML/saml/AbstractAudienceRestrictionConditionType.php b/src/SAML11/XML/saml/AbstractAudienceRestrictionConditionType.php index b6391f5..8da05ac 100644 --- a/src/SAML11/XML/saml/AbstractAudienceRestrictionConditionType.php +++ b/src/SAML11/XML/saml/AbstractAudienceRestrictionConditionType.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML11\XML\saml; -use DOMElement; +use Dom; use SimpleSAML\Assert\Assert; use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; use SimpleSAML\XMLSchema\Exception\MissingElementException; @@ -44,7 +44,7 @@ public function getAudience(): array * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ - public static function fromXML(DOMElement $xml): static + public static function fromXML(Dom\Element $xml): static { Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class); Assert::same($xml->namespaceURI, static::getNamespaceURI(), InvalidDOMElementException::class); @@ -61,7 +61,7 @@ public static function fromXML(DOMElement $xml): static /** * Convert this AudienceRestrictionCondition to XML. */ - public function toXML(?DOMElement $parent = null): DOMElement + public function toXML(?Dom\Element $parent = null): Dom\Element { $e = $this->instantiateParentElement($parent); diff --git a/src/SAML11/XML/saml/AbstractAuthenticationStatementType.php b/src/SAML11/XML/saml/AbstractAuthenticationStatementType.php index 9ca4d14..e67760c 100644 --- a/src/SAML11/XML/saml/AbstractAuthenticationStatementType.php +++ b/src/SAML11/XML/saml/AbstractAuthenticationStatementType.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML11\XML\saml; -use DOMElement; +use Dom; use SimpleSAML\Assert\Assert; use SimpleSAML\SAML11\Type\SAMLAnyURIValue; use SimpleSAML\SAML11\Type\SAMLDateTimeValue; @@ -92,7 +92,7 @@ public function getAuthenticationInstant(): SAMLDateTimeValue * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ - public static function fromXML(DOMElement $xml): static + public static function fromXML(Dom\Element $xml): static { Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class); Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class); @@ -118,7 +118,7 @@ public static function fromXML(DOMElement $xml): static /** * Convert this AuthenticationStatementType to XML. */ - public function toXML(?DOMElement $parent = null): DOMElement + public function toXML(?Dom\Element $parent = null): Dom\Element { $e = parent::toXML($parent); diff --git a/src/SAML11/XML/saml/AbstractAuthorityBindingType.php b/src/SAML11/XML/saml/AbstractAuthorityBindingType.php index 4586940..3ced255 100644 --- a/src/SAML11/XML/saml/AbstractAuthorityBindingType.php +++ b/src/SAML11/XML/saml/AbstractAuthorityBindingType.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML11\XML\saml; -use DOMElement; +use Dom; use SimpleSAML\SAML11\Assert\Assert; use SimpleSAML\SAML11\Type\SAMLAnyURIValue; use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; @@ -73,7 +73,7 @@ public function getBinding(): SAMLAnyURIValue * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ - public static function fromXML(DOMElement $xml): static + public static function fromXML(Dom\Element $xml): static { Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class); Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class); @@ -89,7 +89,7 @@ public static function fromXML(DOMElement $xml): static /** * Convert this AuthorityBindingType to XML. */ - public function toXML(?DOMElement $parent = null): DOMElement + public function toXML(?Dom\Element $parent = null): Dom\Element { $e = $this->instantiateParentElement($parent); diff --git a/src/SAML11/XML/saml/AbstractAuthorizationDecisionStatementType.php b/src/SAML11/XML/saml/AbstractAuthorizationDecisionStatementType.php index ff89a65..fb1edcb 100644 --- a/src/SAML11/XML/saml/AbstractAuthorizationDecisionStatementType.php +++ b/src/SAML11/XML/saml/AbstractAuthorizationDecisionStatementType.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML11\XML\saml; -use DOMElement; +use Dom; use SimpleSAML\Assert\Assert; use SimpleSAML\SAML11\Type\DecisionTypeValue; use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; @@ -96,7 +96,7 @@ public function getAction(): array * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ - public static function fromXML(DOMElement $xml): static + public static function fromXML(Dom\Element $xml): static { Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class); Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class); @@ -121,7 +121,7 @@ public static function fromXML(DOMElement $xml): static /** * Convert this AuthorizationDecisionStatementType to XML. */ - public function toXML(?DOMElement $parent = null): DOMElement + public function toXML(?Dom\Element $parent = null): Dom\Element { $e = parent::toXML($parent); diff --git a/src/SAML11/XML/saml/AbstractCondition.php b/src/SAML11/XML/saml/AbstractCondition.php index 9ee64ee..e347e28 100644 --- a/src/SAML11/XML/saml/AbstractCondition.php +++ b/src/SAML11/XML/saml/AbstractCondition.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML11\XML\saml; -use DOMElement; +use Dom; use SimpleSAML\SAML11\Assert\Assert; use SimpleSAML\SAML11\Constants as C; use SimpleSAML\SAML11\Utils; @@ -63,7 +63,7 @@ public function getXsiType(): QNameValue * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ - public static function fromXML(DOMElement $xml): static + public static function fromXML(Dom\Element $xml): static { Assert::same($xml->localName, 'Condition', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, C::NS_SAML, InvalidDOMElementException::class); @@ -94,7 +94,7 @@ public static function fromXML(DOMElement $xml): static /** * Convert this Condition to XML. */ - public function toXML(?DOMElement $parent = null): DOMElement + public function toXML(?Dom\Element $parent = null): Dom\Element { $e = $this->instantiateParentElement($parent); if (!$e->lookupPrefix($this->getXsiType()->getNamespaceURI()->getValue())) { diff --git a/src/SAML11/XML/saml/AbstractConditionsType.php b/src/SAML11/XML/saml/AbstractConditionsType.php index cd8e6d7..8c6b728 100644 --- a/src/SAML11/XML/saml/AbstractConditionsType.php +++ b/src/SAML11/XML/saml/AbstractConditionsType.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML11\XML\saml; -use DOMElement; +use Dom; use SimpleSAML\Assert\Assert; use SimpleSAML\SAML11\Type\SAMLDateTimeValue; use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; @@ -114,7 +114,7 @@ public function isEmptyElement(): bool * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ - public static function fromXML(DOMElement $xml): static + public static function fromXML(Dom\Element $xml): static { Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class); Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class); @@ -132,7 +132,7 @@ public static function fromXML(DOMElement $xml): static /** * Convert this ConditionsType to XML. */ - public function toXML(?DOMElement $parent = null): DOMElement + public function toXML(?Dom\Element $parent = null): Dom\Element { $e = $this->instantiateParentElement($parent); diff --git a/src/SAML11/XML/saml/AbstractDoNotCacheConditionType.php b/src/SAML11/XML/saml/AbstractDoNotCacheConditionType.php index 2f0b36c..182a72d 100644 --- a/src/SAML11/XML/saml/AbstractDoNotCacheConditionType.php +++ b/src/SAML11/XML/saml/AbstractDoNotCacheConditionType.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML11\XML\saml; -use DOMElement; +use Dom; use SimpleSAML\Assert\Assert; use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; @@ -29,7 +29,7 @@ final public function __construct() * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ - public static function fromXML(DOMElement $xml): static + public static function fromXML(Dom\Element $xml): static { Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class); Assert::same($xml->namespaceURI, static::getNamespaceURI(), InvalidDOMElementException::class); @@ -41,7 +41,7 @@ public static function fromXML(DOMElement $xml): static /** * Convert this DoNotCacheCondition to XML. */ - public function toXML(?DOMElement $parent = null): DOMElement + public function toXML(?Dom\Element $parent = null): Dom\Element { return $this->instantiateParentElement($parent); } diff --git a/src/SAML11/XML/saml/AbstractEvidenceType.php b/src/SAML11/XML/saml/AbstractEvidenceType.php index 6eae7e6..ce4c438 100644 --- a/src/SAML11/XML/saml/AbstractEvidenceType.php +++ b/src/SAML11/XML/saml/AbstractEvidenceType.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML11\XML\saml; -use DOMElement; +use Dom; use SimpleSAML\Assert\Assert; use SimpleSAML\SAML11\Constants as C; use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; @@ -72,7 +72,7 @@ public function isEmptyElement(): bool * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ - public static function fromXML(DOMElement $xml): static + public static function fromXML(Dom\Element $xml): static { Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class); Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class); @@ -87,7 +87,7 @@ public static function fromXML(DOMElement $xml): static /** * Convert this EvidenceType to XML. */ - public function toXML(?DOMElement $parent = null): DOMElement + public function toXML(?Dom\Element $parent = null): Dom\Element { $e = $this->instantiateParentElement($parent); diff --git a/src/SAML11/XML/saml/AbstractNameIdentifierType.php b/src/SAML11/XML/saml/AbstractNameIdentifierType.php index e95e95d..bdf8a0f 100644 --- a/src/SAML11/XML/saml/AbstractNameIdentifierType.php +++ b/src/SAML11/XML/saml/AbstractNameIdentifierType.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML11\XML\saml; -use DOMElement; +use Dom; use SimpleSAML\Assert\Assert; use SimpleSAML\SAML11\Type\SAMLAnyURIValue; use SimpleSAML\SAML11\Type\SAMLStringValue; @@ -73,7 +73,7 @@ public function getNameQualifier(): ?SAMLStringValue * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ - public static function fromXML(DOMElement $xml): static + public static function fromXML(Dom\Element $xml): static { Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class); Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class); @@ -89,7 +89,7 @@ public static function fromXML(DOMElement $xml): static /** * Convert this NameIdentifierType to XML. */ - public function toXML(?DOMElement $parent = null): DOMElement + public function toXML(?Dom\Element $parent = null): Dom\Element { $e = $this->instantiateParentElement($parent); $e->textContent = strval($this->getValue()); diff --git a/src/SAML11/XML/saml/AbstractStatement.php b/src/SAML11/XML/saml/AbstractStatement.php index e3dfe99..5a19471 100644 --- a/src/SAML11/XML/saml/AbstractStatement.php +++ b/src/SAML11/XML/saml/AbstractStatement.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML11\XML\saml; -use DOMElement; +use Dom; use SimpleSAML\SAML11\Assert\Assert; use SimpleSAML\SAML11\Constants as C; use SimpleSAML\SAML11\Utils; @@ -63,7 +63,7 @@ public function getXsiType(): QNameValue * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ - public static function fromXML(DOMElement $xml): static + public static function fromXML(Dom\Element $xml): static { Assert::same($xml->localName, 'Statement', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, C::NS_SAML, InvalidDOMElementException::class); @@ -94,7 +94,7 @@ public static function fromXML(DOMElement $xml): static /** * Convert this Statement to XML. */ - public function toXML(?DOMElement $parent = null): DOMElement + public function toXML(?Dom\Element $parent = null): Dom\Element { $e = $this->instantiateParentElement($parent); diff --git a/src/SAML11/XML/saml/AbstractSubjectConfirmationType.php b/src/SAML11/XML/saml/AbstractSubjectConfirmationType.php index 98f7046..4eef468 100644 --- a/src/SAML11/XML/saml/AbstractSubjectConfirmationType.php +++ b/src/SAML11/XML/saml/AbstractSubjectConfirmationType.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML11\XML\saml; -use DOMElement; +use Dom; use SimpleSAML\Assert\Assert; use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; use SimpleSAML\XMLSchema\Exception\MissingElementException; @@ -75,7 +75,7 @@ public function getKeyInfo(): ?KeyInfo * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ - public static function fromXML(DOMElement $xml): static + public static function fromXML(Dom\Element $xml): static { Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class); Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class); @@ -97,7 +97,7 @@ public static function fromXML(DOMElement $xml): static /** * Convert this SubjectConfirmationType to XML. */ - public function toXML(?DOMElement $parent = null): DOMElement + public function toXML(?Dom\Element $parent = null): Dom\Element { $e = $this->instantiateParentElement($parent); diff --git a/src/SAML11/XML/saml/AbstractSubjectLocalityType.php b/src/SAML11/XML/saml/AbstractSubjectLocalityType.php index bf5a7ac..4410dd8 100644 --- a/src/SAML11/XML/saml/AbstractSubjectLocalityType.php +++ b/src/SAML11/XML/saml/AbstractSubjectLocalityType.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML11\XML\saml; -use DOMElement; +use Dom; use SimpleSAML\Assert\Assert; use SimpleSAML\SAML11\Type\SAMLStringValue; use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; @@ -69,7 +69,7 @@ public function isEmptyElement(): bool * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ - public static function fromXML(DOMElement $xml): static + public static function fromXML(Dom\Element $xml): static { Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class); Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class); @@ -84,7 +84,7 @@ public static function fromXML(DOMElement $xml): static /** * Convert this SubjectLocalityType to XML. */ - public function toXML(?DOMElement $parent = null): DOMElement + public function toXML(?Dom\Element $parent = null): Dom\Element { $e = $this->instantiateParentElement($parent); diff --git a/src/SAML11/XML/saml/AbstractSubjectStatement.php b/src/SAML11/XML/saml/AbstractSubjectStatement.php index 1038b22..e444385 100644 --- a/src/SAML11/XML/saml/AbstractSubjectStatement.php +++ b/src/SAML11/XML/saml/AbstractSubjectStatement.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML11\XML\saml; -use DOMElement; +use Dom; use SimpleSAML\SAML11\Assert\Assert; use SimpleSAML\SAML11\Constants as C; use SimpleSAML\SAML11\Utils; @@ -60,7 +60,7 @@ public function getXsiType(): QNameValue * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ - public static function fromXML(DOMElement $xml): static + public static function fromXML(Dom\Element $xml): static { Assert::same($xml->localName, 'SubjectStatement', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, C::NS_SAML, InvalidDOMElementException::class); @@ -95,7 +95,7 @@ public static function fromXML(DOMElement $xml): static /** * Convert this SubjectStatement to XML. */ - public function toXML(?DOMElement $parent = null): DOMElement + public function toXML(?Dom\Element $parent = null): Dom\Element { $e = parent::toXML($parent); diff --git a/src/SAML11/XML/saml/AbstractSubjectStatementType.php b/src/SAML11/XML/saml/AbstractSubjectStatementType.php index c57e4e8..38fb57e 100644 --- a/src/SAML11/XML/saml/AbstractSubjectStatementType.php +++ b/src/SAML11/XML/saml/AbstractSubjectStatementType.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML11\XML\saml; -use DOMElement; +use Dom; /** * @package simplesamlphp\saml11 @@ -36,7 +36,7 @@ public function getSubject(): Subject /** * Convert this SubjectStatement to XML. */ - public function toXML(?DOMElement $parent = null): DOMElement + public function toXML(?Dom\Element $parent = null): Dom\Element { $e = $this->instantiateParentElement($parent); diff --git a/src/SAML11/XML/saml/AbstractSubjectType.php b/src/SAML11/XML/saml/AbstractSubjectType.php index a99d4b1..12eb8cf 100644 --- a/src/SAML11/XML/saml/AbstractSubjectType.php +++ b/src/SAML11/XML/saml/AbstractSubjectType.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML11\XML\saml; -use DOMElement; +use Dom; use SimpleSAML\Assert\Assert; use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; use SimpleSAML\XMLSchema\Exception\MissingElementException; @@ -61,7 +61,7 @@ public function getNameIdentifier(): ?NameIdentifier * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ - public static function fromXML(DOMElement $xml): static + public static function fromXML(Dom\Element $xml): static { Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class); Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class); @@ -82,7 +82,7 @@ public static function fromXML(DOMElement $xml): static /** * Convert this SubjectType to XML. */ - public function toXML(?DOMElement $parent = null): DOMElement + public function toXML(?Dom\Element $parent = null): Dom\Element { $e = $this->instantiateParentElement($parent); diff --git a/src/SAML11/XML/saml/AttributeDesignator.php b/src/SAML11/XML/saml/AttributeDesignator.php index 069a6af..9275cd2 100644 --- a/src/SAML11/XML/saml/AttributeDesignator.php +++ b/src/SAML11/XML/saml/AttributeDesignator.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML11\XML\saml; -use DOMElement; +use Dom; use SimpleSAML\Assert\Assert; use SimpleSAML\SAML11\Type\SAMLAnyURIValue; use SimpleSAML\SAML11\Type\SAMLStringValue; @@ -28,7 +28,7 @@ final class AttributeDesignator extends AbstractAttributeDesignatorType implemen * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ - public static function fromXML(DOMElement $xml): static + public static function fromXML(Dom\Element $xml): static { Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class); Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class); diff --git a/src/SAML11/XML/saml/AttributeValue.php b/src/SAML11/XML/saml/AttributeValue.php index fe948cd..3a70f40 100644 --- a/src/SAML11/XML/saml/AttributeValue.php +++ b/src/SAML11/XML/saml/AttributeValue.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML11\XML\saml; -use DOMElement; +use Dom; use SimpleSAML\SAML11\Assert\Assert; use SimpleSAML\SAML11\Type\SAMLDateTimeValue; use SimpleSAML\SAML11\Type\SAMLStringValue; @@ -37,7 +37,7 @@ class AttributeValue extends AbstractSamlElement implements SchemaValidatableEle * Create an AttributeValue. * * @param \SimpleSAML\XMLSchema\Type\Interface\ValueTypeInterface|\SimpleSAML\XML\AbstractElement $value - * @throws \SimpleSAML\Assert\AssertionFailedException if the supplied value is neither a string or a DOMElement + * @throws \SimpleSAML\Assert\AssertionFailedException if the supplied value is neither a string or a Dom\Element */ final public function __construct( protected SAMLStringValue|IntegerValue|SAMLDateTimeValue|AbstractElement $value, @@ -89,7 +89,7 @@ public function getValue() * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ - public static function fromXML(DOMElement $xml): static + public static function fromXML(Dom\Element $xml): static { Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class); Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class); @@ -139,7 +139,7 @@ public static function fromXML(DOMElement $xml): static /** * Append this attribute value to an element. */ - public function toXML(?DOMElement $parent = null): DOMElement + public function toXML(?Dom\Element $parent = null): Dom\Element { $e = parent::instantiateParentElement($parent); diff --git a/src/SAML11/XML/saml/SubjectConfirmationData.php b/src/SAML11/XML/saml/SubjectConfirmationData.php index 90e2df9..a10892a 100644 --- a/src/SAML11/XML/saml/SubjectConfirmationData.php +++ b/src/SAML11/XML/saml/SubjectConfirmationData.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML11\XML\saml; -use DOMElement; +use Dom; use SimpleSAML\Assert\Assert; use SimpleSAML\SAML11\Type\SAMLStringValue; use SimpleSAML\XML\AbstractElement; @@ -41,7 +41,7 @@ class SubjectConfirmationData extends AbstractSamlElement implements SchemaValid * - null * - \SimpleSAML\XML\AbstractElement * - * @throws \SimpleSAML\Assert\AssertionFailedException if the supplied value is neither a string or a DOMElement + * @throws \SimpleSAML\Assert\AssertionFailedException if the supplied value is neither a string or a Dom\Element */ final public function __construct( protected SAMLStringValue|IntegerValue|null|AbstractElement $value, @@ -92,7 +92,7 @@ public function getValue(): SAMLStringValue|IntegerValue|AbstractElement|null * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ - public static function fromXML(DOMElement $xml): static + public static function fromXML(Dom\Element $xml): static { Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class); Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class); @@ -136,7 +136,7 @@ public static function fromXML(DOMElement $xml): static /** * Append this attribute value to an element. */ - public function toXML(?DOMElement $parent = null): DOMElement + public function toXML(?Dom\Element $parent = null): Dom\Element { $e = parent::instantiateParentElement($parent); diff --git a/src/SAML11/XML/saml/UnknownCondition.php b/src/SAML11/XML/saml/UnknownCondition.php index 1a02db0..106cbc8 100644 --- a/src/SAML11/XML/saml/UnknownCondition.php +++ b/src/SAML11/XML/saml/UnknownCondition.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML11\XML\saml; -use DOMElement; +use Dom; use SimpleSAML\XML\Chunk; use SimpleSAML\XMLSchema\Type\QNameValue; @@ -41,7 +41,7 @@ public function getRawCondition(): Chunk /** * Convert this unknown condition to XML. */ - public function toXML(?DOMElement $parent = null): DOMElement + public function toXML(?Dom\Element $parent = null): Dom\Element { return $this->getRawCondition()->toXML($parent); } diff --git a/src/SAML11/XML/saml/UnknownStatement.php b/src/SAML11/XML/saml/UnknownStatement.php index aa64f44..3024491 100644 --- a/src/SAML11/XML/saml/UnknownStatement.php +++ b/src/SAML11/XML/saml/UnknownStatement.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML11\XML\saml; -use DOMElement; +use Dom; use SimpleSAML\XML\Chunk; use SimpleSAML\XMLSchema\Type\QNameValue; @@ -41,7 +41,7 @@ public function getRawStatement(): Chunk /** * Convert this unknown statement to XML. */ - public function toXML(?DOMElement $parent = null): DOMElement + public function toXML(?Dom\Element $parent = null): Dom\Element { return $this->getRawStatement()->toXML($parent); } diff --git a/src/SAML11/XML/saml/UnknownSubjectStatement.php b/src/SAML11/XML/saml/UnknownSubjectStatement.php index 679c1d2..e5b33cc 100644 --- a/src/SAML11/XML/saml/UnknownSubjectStatement.php +++ b/src/SAML11/XML/saml/UnknownSubjectStatement.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML11\XML\saml; -use DOMElement; +use Dom; use SimpleSAML\XML\Chunk; use SimpleSAML\XMLSchema\Type\QNameValue; @@ -42,7 +42,7 @@ public function getRawSubjectStatement(): Chunk /** * Convert this unknown SubjectStatement to XML. */ - public function toXML(?DOMElement $parent = null): DOMElement + public function toXML(?Dom\Element $parent = null): Dom\Element { return $this->getRawSubjectStatement()->toXML($parent); } diff --git a/src/SAML11/XML/samlp/AbstractAttributeQueryType.php b/src/SAML11/XML/samlp/AbstractAttributeQueryType.php index f90aaa7..2c6b538 100644 --- a/src/SAML11/XML/samlp/AbstractAttributeQueryType.php +++ b/src/SAML11/XML/samlp/AbstractAttributeQueryType.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML11\XML\samlp; -use DOMElement; +use Dom; use SimpleSAML\Assert\Assert; use SimpleSAML\SAML11\XML\saml\AttributeDesignator; use SimpleSAML\SAML11\XML\saml\Subject; @@ -59,7 +59,7 @@ public function getAttributeDesignator(): array /** * Convert this AttributeQuery to XML. */ - public function toXML(?DOMElement $parent = null): DOMElement + public function toXML(?Dom\Element $parent = null): Dom\Element { $e = parent::toXML($parent); diff --git a/src/SAML11/XML/samlp/AbstractAuthenticationQueryType.php b/src/SAML11/XML/samlp/AbstractAuthenticationQueryType.php index 77c21b5..2178857 100644 --- a/src/SAML11/XML/samlp/AbstractAuthenticationQueryType.php +++ b/src/SAML11/XML/samlp/AbstractAuthenticationQueryType.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML11\XML\samlp; -use DOMElement; +use Dom; use SimpleSAML\SAML11\Type\SAMLAnyURIValue; use SimpleSAML\SAML11\XML\saml\Subject; @@ -43,7 +43,7 @@ public function getAuthenticationMethod(): SAMLAnyURIValue /** * Convert this AuthenticationQuery to XML. */ - public function toXML(?DOMElement $parent = null): DOMElement + public function toXML(?Dom\Element $parent = null): Dom\Element { $e = parent::toXML($parent); $e->setAttribute('AuthenticationMethod', strval($this->getAuthenticationMethod())); diff --git a/src/SAML11/XML/samlp/AbstractAuthorizationDecisionQueryType.php b/src/SAML11/XML/samlp/AbstractAuthorizationDecisionQueryType.php index f099f99..2a956af 100644 --- a/src/SAML11/XML/samlp/AbstractAuthorizationDecisionQueryType.php +++ b/src/SAML11/XML/samlp/AbstractAuthorizationDecisionQueryType.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML11\XML\samlp; -use DOMElement; +use Dom; use SimpleSAML\Assert\Assert; use SimpleSAML\SAML11\Type\SAMLAnyURIValue; use SimpleSAML\SAML11\XML\saml\Action; @@ -73,7 +73,7 @@ public function getAction(): array /** * Convert this AttributeQuery to XML. */ - public function toXML(?DOMElement $parent = null): DOMElement + public function toXML(?Dom\Element $parent = null): Dom\Element { $e = parent::toXML($parent); $e->setAttribute('Resource', strval($this->getResource())); diff --git a/src/SAML11/XML/samlp/AbstractMessage.php b/src/SAML11/XML/samlp/AbstractMessage.php index dfabbb2..af4af0d 100644 --- a/src/SAML11/XML/samlp/AbstractMessage.php +++ b/src/SAML11/XML/samlp/AbstractMessage.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML11\XML\samlp; -use DOMElement; +use Dom; use SimpleSAML\SAML11\Type\SAMLDateTimeValue; use SimpleSAML\SAML11\XML\CanonicalizableElementTrait; use SimpleSAML\SAML11\XML\SignableElementTrait; @@ -41,7 +41,7 @@ abstract class AbstractMessage extends AbstractSamlpElement implements /** * The original signed XML */ - protected DOMElement $xml; + protected Dom\Element $xml; /** @@ -106,7 +106,7 @@ public function isMessageConstructedWithSignature(): bool /** * Get the XML element. */ - public function getXML(): DOMElement + public function getXML(): Dom\Element { return $this->xml; } @@ -115,7 +115,7 @@ public function getXML(): DOMElement /** * Set the XML element. */ - protected function setXML(DOMElement $xml): void + protected function setXML(Dom\Element $xml): void { $this->xml = $xml; } @@ -123,7 +123,7 @@ protected function setXML(DOMElement $xml): void /** */ - protected function getOriginalXML(): DOMElement + protected function getOriginalXML(): Dom\Element { return $this->xml ?? $this->toUnsignedXML(); } @@ -133,7 +133,7 @@ protected function getOriginalXML(): DOMElement * Convert this message to an unsigned XML document. * This method does not sign the resulting XML document. */ - protected function toUnsignedXML(?DOMElement $parent = null): DOMElement + protected function toUnsignedXML(?Dom\Element $parent = null): Dom\Element { $e = $this->instantiateParentElement($parent); diff --git a/src/SAML11/XML/samlp/AbstractQuery.php b/src/SAML11/XML/samlp/AbstractQuery.php index 87f9084..8328b9b 100644 --- a/src/SAML11/XML/samlp/AbstractQuery.php +++ b/src/SAML11/XML/samlp/AbstractQuery.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML11\XML\samlp; -use DOMElement; +use Dom; use SimpleSAML\SAML11\Assert\Assert; use SimpleSAML\SAML11\Constants as C; use SimpleSAML\SAML11\Utils; @@ -52,7 +52,7 @@ protected function __construct( * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ - public static function fromXML(DOMElement $xml): static + public static function fromXML(Dom\Element $xml): static { Assert::same($xml->localName, 'Query', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, C::NS_SAMLP, InvalidDOMElementException::class); @@ -83,7 +83,7 @@ public static function fromXML(DOMElement $xml): static /** * Convert this Query to XML. */ - public function toXML(?DOMElement $parent = null): DOMElement + public function toXML(?Dom\Element $parent = null): Dom\Element { $e = $this->instantiateParentElement($parent); diff --git a/src/SAML11/XML/samlp/AbstractRequestAbstractType.php b/src/SAML11/XML/samlp/AbstractRequestAbstractType.php index cd7b0d5..4b40e6b 100644 --- a/src/SAML11/XML/samlp/AbstractRequestAbstractType.php +++ b/src/SAML11/XML/samlp/AbstractRequestAbstractType.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML11\XML\samlp; -use DOMElement; +use Dom; use SimpleSAML\SAML11\Assert\Assert; use SimpleSAML\SAML11\Type\SAMLDateTimeValue; use SimpleSAML\SAML11\Utils\XPath; @@ -70,7 +70,7 @@ public function getRespondWith(): array * Convert this message to an unsigned XML document. * This method does not sign the resulting XML document. */ - protected function toUnsignedXML(?DOMElement $parent = null): DOMElement + protected function toUnsignedXML(?Dom\Element $parent = null): Dom\Element { $e = parent::toUnsignedXML($parent); $e->setAttribute('RequestID', strval($this->getID())); @@ -86,7 +86,7 @@ protected function toUnsignedXML(?DOMElement $parent = null): DOMElement /** * Create XML from this class */ - public function toXML(?DOMElement $parent = null): DOMElement + public function toXML(?Dom\Element $parent = null): Dom\Element { if ($this->isSigned() === true && $this->signer === null) { // We already have a signed document and no signer was set to re-sign it diff --git a/src/SAML11/XML/samlp/AbstractRequestType.php b/src/SAML11/XML/samlp/AbstractRequestType.php index f979133..291c005 100644 --- a/src/SAML11/XML/samlp/AbstractRequestType.php +++ b/src/SAML11/XML/samlp/AbstractRequestType.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML11\XML\samlp; -use DOMElement; +use Dom; use SimpleSAML\Assert\Assert; use SimpleSAML\SAML11\Type\SAMLDateTimeValue; use SimpleSAML\SAML11\XML\saml\AssertionIDReference; @@ -82,7 +82,7 @@ public function getRequest(): AbstractQueryAbstractType|array * Convert this message to an unsigned XML document. * This method does not sign the resulting XML document. */ - protected function toUnsignedXML(?DOMElement $parent = null): DOMElement + protected function toUnsignedXML(?Dom\Element $parent = null): Dom\Element { $e = parent::toUnsignedXML($parent); diff --git a/src/SAML11/XML/samlp/AbstractResponseAbstractType.php b/src/SAML11/XML/samlp/AbstractResponseAbstractType.php index c67f6c5..881d552 100644 --- a/src/SAML11/XML/samlp/AbstractResponseAbstractType.php +++ b/src/SAML11/XML/samlp/AbstractResponseAbstractType.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML11\XML\samlp; -use DOMElement; +use Dom; use SimpleSAML\SAML11\Type\SAMLDateTimeValue; use SimpleSAML\XMLSchema\Type\IDValue; use SimpleSAML\XMLSchema\Type\NonNegativeIntegerValue; @@ -56,7 +56,7 @@ public function getID(): IDValue * Convert this message to an unsigned XML document. * This method does not sign the resulting XML document. */ - protected function toUnsignedXML(?DOMElement $parent = null): DOMElement + protected function toUnsignedXML(?Dom\Element $parent = null): Dom\Element { $e = parent::toUnsignedXML($parent); $e->setAttribute('ResponseID', strval($this->getId())); @@ -68,7 +68,7 @@ protected function toUnsignedXML(?DOMElement $parent = null): DOMElement /** * Create XML from this class */ - public function toXML(?DOMElement $parent = null): DOMElement + public function toXML(?Dom\Element $parent = null): Dom\Element { if ($this->isSigned() === true && $this->signer === null) { // We already have a signed document and no signer was set to re-sign it diff --git a/src/SAML11/XML/samlp/AbstractResponseType.php b/src/SAML11/XML/samlp/AbstractResponseType.php index ea2e7f0..b504d88 100644 --- a/src/SAML11/XML/samlp/AbstractResponseType.php +++ b/src/SAML11/XML/samlp/AbstractResponseType.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML11\XML\samlp; -use DOMElement; +use Dom; use SimpleSAML\SAML11\Assert\Assert; use SimpleSAML\SAML11\Type\SAMLAnyURIValue; use SimpleSAML\SAML11\Type\SAMLDateTimeValue; @@ -102,7 +102,7 @@ public function getStatus(): Status * Convert this message to an unsigned XML document. * This method does not sign the resulting XML document. */ - protected function toUnsignedXML(?DOMElement $parent = null): DOMElement + protected function toUnsignedXML(?Dom\Element $parent = null): Dom\Element { $e = parent::toUnsignedXML($parent); diff --git a/src/SAML11/XML/samlp/AbstractStatusCodeType.php b/src/SAML11/XML/samlp/AbstractStatusCodeType.php index 1994075..bd76338 100644 --- a/src/SAML11/XML/samlp/AbstractStatusCodeType.php +++ b/src/SAML11/XML/samlp/AbstractStatusCodeType.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML11\XML\samlp; -use DOMElement; +use Dom; use SimpleSAML\SAML11\Assert\Assert; use SimpleSAML\SAML11\Constants as C; use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; @@ -65,7 +65,7 @@ public function getSubCodes(): array * @throws \SimpleSAML\XML\Exception\MissingAttributeException * if the supplied element is missing one of the mandatory attributes */ - public static function fromXML(DOMElement $xml): static + public static function fromXML(Dom\Element $xml): static { Assert::same($xml->localName, 'StatusCode', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, StatusCode::NS, InvalidDOMElementException::class); @@ -83,7 +83,7 @@ public static function fromXML(DOMElement $xml): static /** * Convert this StatusCode to XML. */ - public function toXML(?DOMElement $parent = null): DOMElement + public function toXML(?Dom\Element $parent = null): Dom\Element { $e = $this->instantiateParentElement($parent); $e->setAttribute('Value', strval($this->getValue())); diff --git a/src/SAML11/XML/samlp/AbstractStatusDetailType.php b/src/SAML11/XML/samlp/AbstractStatusDetailType.php index 9740715..299196d 100644 --- a/src/SAML11/XML/samlp/AbstractStatusDetailType.php +++ b/src/SAML11/XML/samlp/AbstractStatusDetailType.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML11\XML\samlp; -use DOMElement; +use Dom; use SimpleSAML\Assert\Assert; use SimpleSAML\XML\Chunk; use SimpleSAML\XML\ExtendableElementTrait; @@ -51,14 +51,14 @@ public function isEmptyElement(): bool * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ - public static function fromXML(DOMElement $xml): static + public static function fromXML(Dom\Element $xml): static { Assert::same($xml->localName, 'StatusDetail', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, StatusDetail::NS, InvalidDOMElementException::class); $details = []; foreach ($xml->childNodes as $detail) { - if (!($detail instanceof DOMElement)) { + if (!($detail instanceof Dom\Element)) { continue; } @@ -72,7 +72,7 @@ public static function fromXML(DOMElement $xml): static /** * Convert this StatusDetail to XML. */ - public function toXML(?DOMElement $parent = null): DOMElement + public function toXML(?Dom\Element $parent = null): Dom\Element { $e = $this->instantiateParentElement($parent); diff --git a/src/SAML11/XML/samlp/AbstractStatusType.php b/src/SAML11/XML/samlp/AbstractStatusType.php index 66f88d2..c548a27 100644 --- a/src/SAML11/XML/samlp/AbstractStatusType.php +++ b/src/SAML11/XML/samlp/AbstractStatusType.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML11\XML\samlp; -use DOMElement; +use Dom; use SimpleSAML\Assert\Assert; use SimpleSAML\SAML11\Constants as C; use SimpleSAML\SAML11\Exception\ProtocolViolationException; @@ -85,7 +85,7 @@ public function getStatusDetail(): ?StatusDetail * @throws \SimpleSAML\XML\Exception\MissingElementException * if one of the mandatory child-elements is missing */ - public static function fromXML(DOMElement $xml): static + public static function fromXML(Dom\Element $xml): static { Assert::same($xml->localName, 'Status', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, Status::NS, InvalidDOMElementException::class); @@ -110,7 +110,7 @@ public static function fromXML(DOMElement $xml): static /** * Convert this Status to XML. */ - public function toXML(?DOMElement $parent = null): DOMElement + public function toXML(?Dom\Element $parent = null): Dom\Element { $e = $this->instantiateParentElement($parent); diff --git a/src/SAML11/XML/samlp/AbstractSubjectQuery.php b/src/SAML11/XML/samlp/AbstractSubjectQuery.php index 6d668b5..4a4f020 100644 --- a/src/SAML11/XML/samlp/AbstractSubjectQuery.php +++ b/src/SAML11/XML/samlp/AbstractSubjectQuery.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML11\XML\samlp; -use DOMElement; +use Dom; use SimpleSAML\SAML11\Assert\Assert; use SimpleSAML\SAML11\Constants as C; use SimpleSAML\SAML11\Utils; @@ -58,7 +58,7 @@ protected function __construct( * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ - public static function fromXML(DOMElement $xml): static + public static function fromXML(Dom\Element $xml): static { Assert::same($xml->localName, 'SubjectQuery', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, C::NS_SAMLP, InvalidDOMElementException::class); diff --git a/src/SAML11/XML/samlp/AbstractSubjectQueryAbstractType.php b/src/SAML11/XML/samlp/AbstractSubjectQueryAbstractType.php index 8add9cf..79a8fa2 100644 --- a/src/SAML11/XML/samlp/AbstractSubjectQueryAbstractType.php +++ b/src/SAML11/XML/samlp/AbstractSubjectQueryAbstractType.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML11\XML\samlp; -use DOMElement; +use Dom; use SimpleSAML\SAML11\XML\saml\Subject; /** @@ -37,7 +37,7 @@ public function getSubject(): Subject /** * Convert this SubjectQuery to XML. */ - public function toXML(?DOMElement $parent = null): DOMElement + public function toXML(?Dom\Element $parent = null): Dom\Element { $e = $this->instantiateParentElement($parent); diff --git a/src/SAML11/XML/samlp/AttributeQuery.php b/src/SAML11/XML/samlp/AttributeQuery.php index 2240557..ade0432 100644 --- a/src/SAML11/XML/samlp/AttributeQuery.php +++ b/src/SAML11/XML/samlp/AttributeQuery.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML11\XML\samlp; -use DOMElement; +use Dom; use SimpleSAML\Assert\Assert; use SimpleSAML\SAML11\Type\SAMLAnyURIValue; use SimpleSAML\SAML11\XML\saml\AttributeDesignator; @@ -33,7 +33,7 @@ final class AttributeQuery extends AbstractAttributeQueryType implements SchemaV * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ - public static function fromXML(DOMElement $xml): static + public static function fromXML(Dom\Element $xml): static { Assert::same($xml->localName, 'AttributeQuery', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, AttributeQuery::NS, InvalidDOMElementException::class); diff --git a/src/SAML11/XML/samlp/AuthenticationQuery.php b/src/SAML11/XML/samlp/AuthenticationQuery.php index 9d9f28a..ef5d5f4 100644 --- a/src/SAML11/XML/samlp/AuthenticationQuery.php +++ b/src/SAML11/XML/samlp/AuthenticationQuery.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML11\XML\samlp; -use DOMElement; +use Dom; use SimpleSAML\Assert\Assert; use SimpleSAML\SAML11\Type\SAMLAnyURIValue; use SimpleSAML\SAML11\XML\saml\Subject; @@ -32,7 +32,7 @@ final class AuthenticationQuery extends AbstractAuthenticationQueryType implemen * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ - public static function fromXML(DOMElement $xml): static + public static function fromXML(Dom\Element $xml): static { Assert::same($xml->localName, 'AuthenticationQuery', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, AuthenticationQuery::NS, InvalidDOMElementException::class); diff --git a/src/SAML11/XML/samlp/AuthorizationDecisionQuery.php b/src/SAML11/XML/samlp/AuthorizationDecisionQuery.php index 1d59e17..8ce980b 100644 --- a/src/SAML11/XML/samlp/AuthorizationDecisionQuery.php +++ b/src/SAML11/XML/samlp/AuthorizationDecisionQuery.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML11\XML\samlp; -use DOMElement; +use Dom; use SimpleSAML\Assert\Assert; use SimpleSAML\SAML11\Type\SAMLAnyURIValue; use SimpleSAML\SAML11\XML\saml\Action; @@ -35,7 +35,7 @@ final class AuthorizationDecisionQuery extends AbstractAuthorizationDecisionQuer * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ - public static function fromXML(DOMElement $xml): static + public static function fromXML(Dom\Element $xml): static { Assert::same($xml->localName, 'AuthorizationDecisionQuery', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, AuthorizationDecisionQuery::NS, InvalidDOMElementException::class); diff --git a/src/SAML11/XML/samlp/Request.php b/src/SAML11/XML/samlp/Request.php index aa516f4..4283cb4 100644 --- a/src/SAML11/XML/samlp/Request.php +++ b/src/SAML11/XML/samlp/Request.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML11\XML\samlp; -use DOMElement; +use Dom; use SimpleSAML\Assert\Assert; use SimpleSAML\SAML11\Exception\VersionMismatchException; use SimpleSAML\SAML11\Type\SAMLDateTimeValue; @@ -35,7 +35,7 @@ final class Request extends AbstractRequestType * @throws \SimpleSAML\XML\Exception\MissingElementException * if one of the mandatory child-elements is missing */ - public static function fromXML(DOMElement $xml): static + public static function fromXML(Dom\Element $xml): static { Assert::same($xml->localName, 'Request', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, Request::NS, InvalidDOMElementException::class); diff --git a/src/SAML11/XML/samlp/Response.php b/src/SAML11/XML/samlp/Response.php index fcbc95d..740274b 100644 --- a/src/SAML11/XML/samlp/Response.php +++ b/src/SAML11/XML/samlp/Response.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML11\XML\samlp; -use DOMElement; +use Dom; use SimpleSAML\SAML11\Assert\Assert; use SimpleSAML\SAML11\Exception\VersionMismatchException; use SimpleSAML\SAML11\Type\SAMLAnyURIValue; @@ -42,7 +42,7 @@ final class Response extends AbstractResponseType implements SchemaValidatableEl * @throws \SimpleSAML\XML\Exception\MissingElementException * if one of the mandatory child-elements is missing */ - public static function fromXML(DOMElement $xml): static + public static function fromXML(Dom\Element $xml): static { Assert::same($xml->localName, 'Response', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, Response::NS, InvalidDOMElementException::class); diff --git a/src/SAML11/XML/samlp/UnknownQuery.php b/src/SAML11/XML/samlp/UnknownQuery.php index b3436d0..3e43ac1 100644 --- a/src/SAML11/XML/samlp/UnknownQuery.php +++ b/src/SAML11/XML/samlp/UnknownQuery.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML11\XML\samlp; -use DOMElement; +use Dom; use SimpleSAML\XML\Chunk; use SimpleSAML\XMLSchema\Type\QNameValue; @@ -41,7 +41,7 @@ public function getRawQuery(): Chunk /** * Convert this unknown query to XML. */ - public function toXML(?DOMElement $parent = null): DOMElement + public function toXML(?Dom\Element $parent = null): Dom\Element { return $this->getRawQuery()->toXML($parent); } diff --git a/src/SAML11/XML/samlp/UnknownSubjectQuery.php b/src/SAML11/XML/samlp/UnknownSubjectQuery.php index b9611d6..c33e61c 100644 --- a/src/SAML11/XML/samlp/UnknownSubjectQuery.php +++ b/src/SAML11/XML/samlp/UnknownSubjectQuery.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML11\XML\samlp; -use DOMElement; +use Dom; use SimpleSAML\SAML11\XML\saml\Subject; use SimpleSAML\XML\Chunk; use SimpleSAML\XMLSchema\Type\QNameValue; @@ -43,7 +43,7 @@ public function getRawSubjectQuery(): Chunk /** * Convert this unknown subject query to XML. */ - public function toXML(?DOMElement $parent = null): DOMElement + public function toXML(?Dom\Element $parent = null): Dom\Element { return $this->getRawSubjectQuery()->toXML($parent); } diff --git a/tests/bin/signedassertion.php b/tests/bin/signedassertion.php index 3677c22..bb48bbd 100644 --- a/tests/bin/signedassertion.php +++ b/tests/bin/signedassertion.php @@ -21,4 +21,8 @@ $unsignedAssertion = Assertion::fromXML($document->documentElement); $unsignedAssertion->sign($signer); -echo $unsignedAssertion->toXML()->ownerDocument->saveXML(); + +/** @var \Dom\XMLDocument $ownerDocument */ +$ownerDocument = $unsignedAssertion->toXML()->ownerDocument; + +echo $ownerDocument->saveXML(); diff --git a/tests/resources/xml/saml_Evidence.xml b/tests/resources/xml/saml_Evidence.xml index 84740a8..8094a9d 100644 --- a/tests/resources/xml/saml_Evidence.xml +++ b/tests/resources/xml/saml_Evidence.xml @@ -1,4 +1,4 @@ - + _Test @@ -13,13 +13,13 @@ urn:some:audience - + TheNameIDValue _Test1 _Test2 - 2 + 2 testkey @@ -38,7 +38,7 @@ _Test1 _Test2 - 2 + 2 testkey @@ -58,7 +58,7 @@ _Test1 _Test2 - 2 + 2 testkey diff --git a/tests/resources/xml/saml_Statement.xml b/tests/resources/xml/saml_Statement.xml index 84f9724..e2ec3da 100644 --- a/tests/resources/xml/saml_Statement.xml +++ b/tests/resources/xml/saml_Statement.xml @@ -1,3 +1,3 @@ - + urn:some:audience diff --git a/tests/resources/xml/saml_Subject.xml b/tests/resources/xml/saml_Subject.xml index 735f58d..c2f5a9c 100644 --- a/tests/resources/xml/saml_Subject.xml +++ b/tests/resources/xml/saml_Subject.xml @@ -1,9 +1,9 @@ - + TheNameIDValue _Test1 _Test2 - 2 + 2 testkey diff --git a/tests/resources/xml/saml_SubjectConfirmation.xml b/tests/resources/xml/saml_SubjectConfirmation.xml index 9977140..552e6f5 100644 --- a/tests/resources/xml/saml_SubjectConfirmation.xml +++ b/tests/resources/xml/saml_SubjectConfirmation.xml @@ -1,7 +1,7 @@ - + _Test1 _Test2 - 2 + 2 testkey diff --git a/tests/resources/xml/saml_SubjectConfirmationData.xml b/tests/resources/xml/saml_SubjectConfirmationData.xml index 98262f0..31d4f30 100644 --- a/tests/resources/xml/saml_SubjectConfirmationData.xml +++ b/tests/resources/xml/saml_SubjectConfirmationData.xml @@ -1 +1 @@ -2 +2 diff --git a/tests/resources/xml/saml_SubjectStatement.xml b/tests/resources/xml/saml_SubjectStatement.xml index 36b755a..da58a3b 100644 --- a/tests/resources/xml/saml_SubjectStatement.xml +++ b/tests/resources/xml/saml_SubjectStatement.xml @@ -1,10 +1,10 @@ - + TheNameIDValue _Test1 _Test2 - 2 + 2 testkey diff --git a/tests/resources/xml/samlp_AuthorizationDecisionQuery.xml b/tests/resources/xml/samlp_AuthorizationDecisionQuery.xml index 867bd70..5b880b3 100644 --- a/tests/resources/xml/samlp_AuthorizationDecisionQuery.xml +++ b/tests/resources/xml/samlp_AuthorizationDecisionQuery.xml @@ -1,4 +1,4 @@ - + TheNameIDValue @@ -31,7 +31,7 @@ _Test1 _Test2 - 2 + 2 testkey @@ -51,7 +51,7 @@ _Test1 _Test2 - 2 + 2 testkey diff --git a/tests/resources/xml/samlp_Query.xml b/tests/resources/xml/samlp_Query.xml index 9572d6b..8fb3d1c 100644 --- a/tests/resources/xml/samlp_Query.xml +++ b/tests/resources/xml/samlp_Query.xml @@ -1,3 +1,3 @@ - + urn:some:audience diff --git a/tests/resources/xml/samlp_Response.xml b/tests/resources/xml/samlp_Response.xml index 638a0d1..43d7e92 100644 --- a/tests/resources/xml/samlp_Response.xml +++ b/tests/resources/xml/samlp_Response.xml @@ -1,4 +1,4 @@ - + @@ -18,7 +18,7 @@ _Test1 _Test2 - 2 + 2 testkey diff --git a/tests/src/SAML11/CustomCondition.php b/tests/src/SAML11/CustomCondition.php index 76f1f40..1a42447 100644 --- a/tests/src/SAML11/CustomCondition.php +++ b/tests/src/SAML11/CustomCondition.php @@ -4,7 +4,7 @@ namespace SimpleSAML\Test\SAML11; -use DOMElement; +use Dom; use SimpleSAML\Assert\Assert; use SimpleSAML\SAML11\XML\saml\AbstractCondition; use SimpleSAML\SAML11\XML\saml\Audience; @@ -61,7 +61,7 @@ public function getAudience(): array * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ - public static function fromXML(DOMElement $xml): static + public static function fromXML(Dom\Element $xml): static { Assert::same($xml->localName, 'Condition', InvalidDOMElementException::class); Assert::notNull($xml->namespaceURI, InvalidDOMElementException::class); @@ -84,7 +84,7 @@ public static function fromXML(DOMElement $xml): static /** * Convert this Condition to XML. */ - public function toXML(?DOMElement $parent = null): DOMElement + public function toXML(?Dom\Element $parent = null): Dom\Element { $e = parent::toXML($parent); diff --git a/tests/src/SAML11/CustomQuery.php b/tests/src/SAML11/CustomQuery.php index e6fb4d1..8cdcab0 100644 --- a/tests/src/SAML11/CustomQuery.php +++ b/tests/src/SAML11/CustomQuery.php @@ -4,7 +4,7 @@ namespace SimpleSAML\Test\SAML11; -use DOMElement; +use Dom; use SimpleSAML\Assert\Assert; use SimpleSAML\SAML11\XML\samlp\AbstractQuery; use SimpleSAML\SAML11\XML\samlp\StatusMessage; @@ -61,7 +61,7 @@ public function getStatusMessage(): array * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ - public static function fromXML(DOMElement $xml): static + public static function fromXML(Dom\Element $xml): static { Assert::same($xml->localName, 'Query', InvalidDOMElementException::class); Assert::notNull($xml->namespaceURI, InvalidDOMElementException::class); @@ -84,7 +84,7 @@ public static function fromXML(DOMElement $xml): static /** * Convert this Query to XML. */ - public function toXML(?DOMElement $parent = null): DOMElement + public function toXML(?Dom\Element $parent = null): Dom\Element { $e = parent::toXML($parent); diff --git a/tests/src/SAML11/CustomStatement.php b/tests/src/SAML11/CustomStatement.php index d54bc5f..6ebf8dd 100644 --- a/tests/src/SAML11/CustomStatement.php +++ b/tests/src/SAML11/CustomStatement.php @@ -4,7 +4,7 @@ namespace SimpleSAML\Test\SAML11; -use DOMElement; +use Dom; use SimpleSAML\Assert\Assert; use SimpleSAML\SAML11\XML\saml\AbstractStatement; use SimpleSAML\SAML11\XML\saml\Audience; @@ -61,7 +61,7 @@ public function getAudience(): array * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ - public static function fromXML(DOMElement $xml): static + public static function fromXML(Dom\Element $xml): static { Assert::same($xml->localName, 'Statement', InvalidDOMElementException::class); Assert::notNull($xml->namespaceURI, InvalidDOMElementException::class); @@ -84,7 +84,7 @@ public static function fromXML(DOMElement $xml): static /** * Convert this Statement to XML. */ - public function toXML(?DOMElement $parent = null): DOMElement + public function toXML(?Dom\Element $parent = null): Dom\Element { $e = parent::toXML($parent); diff --git a/tests/src/SAML11/CustomSubjectQuery.php b/tests/src/SAML11/CustomSubjectQuery.php index 35dfdfe..0d40099 100644 --- a/tests/src/SAML11/CustomSubjectQuery.php +++ b/tests/src/SAML11/CustomSubjectQuery.php @@ -4,7 +4,7 @@ namespace SimpleSAML\Test\SAML11; -use DOMElement; +use Dom; use SimpleSAML\Assert\Assert; use SimpleSAML\SAML11\XML\saml\Subject; use SimpleSAML\SAML11\XML\samlp\AbstractSubjectQuery; @@ -69,7 +69,7 @@ public function getStatusMessage(): array * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ - public static function fromXML(DOMElement $xml): static + public static function fromXML(Dom\Element $xml): static { Assert::same($xml->localName, 'SubjectQuery', InvalidDOMElementException::class); Assert::notNull($xml->namespaceURI, InvalidDOMElementException::class); @@ -96,7 +96,7 @@ public static function fromXML(DOMElement $xml): static /** * Convert this SubjectQuery to XML. */ - public function toXML(?DOMElement $parent = null): DOMElement + public function toXML(?Dom\Element $parent = null): Dom\Element { $e = $this->instantiateParentElement($parent); diff --git a/tests/src/SAML11/CustomSubjectStatement.php b/tests/src/SAML11/CustomSubjectStatement.php index 12b5e50..86445b2 100644 --- a/tests/src/SAML11/CustomSubjectStatement.php +++ b/tests/src/SAML11/CustomSubjectStatement.php @@ -4,7 +4,7 @@ namespace SimpleSAML\Test\SAML11; -use DOMElement; +use Dom; use SimpleSAML\Assert\Assert; use SimpleSAML\SAML11\XML\saml\AbstractSubjectStatement; use SimpleSAML\SAML11\XML\saml\Audience; @@ -67,7 +67,7 @@ public function getAudience(): array * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ - public static function fromXML(DOMElement $xml): static + public static function fromXML(Dom\Element $xml): static { Assert::same($xml->localName, 'SubjectStatement', InvalidDOMElementException::class); Assert::notNull($xml->namespaceURI, InvalidDOMElementException::class); @@ -94,7 +94,7 @@ public static function fromXML(DOMElement $xml): static /** * Convert this SubjectStatement to XML. */ - public function toXML(?DOMElement $parent = null): DOMElement + public function toXML(?Dom\Element $parent = null): Dom\Element { $e = parent::toXML($parent); diff --git a/tests/src/SAML11/XML/saml/ActionTest.php b/tests/src/SAML11/XML/saml/ActionTest.php index 7b16e13..e3bd089 100644 --- a/tests/src/SAML11/XML/saml/ActionTest.php +++ b/tests/src/SAML11/XML/saml/ActionTest.php @@ -59,9 +59,10 @@ public function testMarshalling(): void SAMLAnyURIValue::fromString('urn:x-simplesamlphp:namespace'), ); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($action), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($action); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } } diff --git a/tests/src/SAML11/XML/saml/AdviceTest.php b/tests/src/SAML11/XML/saml/AdviceTest.php index f3488d8..f5a51ef 100644 --- a/tests/src/SAML11/XML/saml/AdviceTest.php +++ b/tests/src/SAML11/XML/saml/AdviceTest.php @@ -4,7 +4,7 @@ namespace SimpleSAML\Test\SAML11\XML\saml; -use DOMDocument; +use Dom; use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; @@ -83,23 +83,23 @@ final class AdviceTest extends TestCase /** @var \SimpleSAML\XML\Chunk $chunk */ private static Chunk $chunk; - /** @var \DOMDocument $conditions */ - private static DOMDocument $conditions; + /** @var \Dom\XMLDocument $conditions */ + private static Dom\XMLDocument $conditions; - /** @var \DOMDocument $statement */ - private static DOMDocument $statement; + /** @var \Dom\XMLDocument $statement */ + private static Dom\XMLDocument $statement; - /** @var \DOMDocument $subjectStatement */ - private static DOMDocument $subjectStatement; + /** @var \Dom\XMLDocument $subjectStatement */ + private static Dom\XMLDocument $subjectStatement; - /** @var \DOMDocument $authnStatement */ - private static DOMDocument $authnStatement; + /** @var \Dom\XMLDocument $authnStatement */ + private static Dom\XMLDocument $authnStatement; - /** @var \DOMDocument $authzDecisionStatement */ -// private static DOMDocument $authzDecisionStatement; + /** @var \Dom\XMLDocument $authzDecisionStatement */ +// private static Dom\XMLDocument $authzDecisionStatement; - /** @var \DOMDocument $attributeStatement */ - private static DOMDocument $attributeStatement; + /** @var \Dom\XMLDocument $attributeStatement */ + private static Dom\XMLDocument $attributeStatement; /** @@ -370,10 +370,11 @@ public function testMarshalling(): void [self::$chunk], ); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($advice), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($advice); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } diff --git a/tests/src/SAML11/XML/saml/AssertionIDReferenceTest.php b/tests/src/SAML11/XML/saml/AssertionIDReferenceTest.php index 4e0b6ae..9f29a03 100644 --- a/tests/src/SAML11/XML/saml/AssertionIDReferenceTest.php +++ b/tests/src/SAML11/XML/saml/AssertionIDReferenceTest.php @@ -48,9 +48,10 @@ public function testMarshalling(): void { $assertionIDReference = AssertionIDReference::fromString('_Test'); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($assertionIDReference), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($assertionIDReference); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } } diff --git a/tests/src/SAML11/XML/saml/AssertionTest.php b/tests/src/SAML11/XML/saml/AssertionTest.php index bb0c375..23bfa7d 100644 --- a/tests/src/SAML11/XML/saml/AssertionTest.php +++ b/tests/src/SAML11/XML/saml/AssertionTest.php @@ -4,7 +4,7 @@ namespace SimpleSAML\Test\SAML11\XML\saml; -use DOMDocument; +use Dom; use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; @@ -83,26 +83,26 @@ final class AssertionTest extends TestCase /** @var \SimpleSAML\SAML11\Compat\AbstractContainer */ private static AbstractContainer $containerBackup; - /** @var \DOMDocument $conditions */ - private static DOMDocument $conditions; + /** @var \Dom\XMLDocument $conditions */ + private static Dom\XMLDocument $conditions; - /** @var \DOMDocument $action */ - //private static DOMDocument $action; + /** @var \Dom\XMLDocument $action */ + //private static Dom\XMLDocument $action; - /** @var \DOMDocument $statement */ - private static DOMDocument $statement; + /** @var \Dom\XMLDocument $statement */ + private static Dom\XMLDocument $statement; - /** @var \DOMDocument $subjectStatement */ - private static DOMDocument $subjectStatement; + /** @var \Dom\XMLDocument $subjectStatement */ + private static Dom\XMLDocument $subjectStatement; - /** @var \DOMDocument $authnStatement */ - private static DOMDocument $authnStatement; + /** @var \Dom\XMLDocument $authnStatement */ + private static Dom\XMLDocument $authnStatement; - /** @var \DOMDocument $authzDecisionStatement */ - private static DOMDocument $authzDecisionStatement; + /** @var \Dom\XMLDocument $authzDecisionStatement */ + private static Dom\XMLDocument $authzDecisionStatement; - /** @var \DOMDocument $attributeStatement */ - private static DOMDocument $attributeStatement; + /** @var \Dom\XMLDocument $attributeStatement */ + private static Dom\XMLDocument $attributeStatement; /** @@ -280,10 +280,11 @@ public function testMarshalling(): void ], ); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($assertion), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($assertion); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } diff --git a/tests/src/SAML11/XML/saml/AttributeDesignatorTest.php b/tests/src/SAML11/XML/saml/AttributeDesignatorTest.php index f0256a5..c3ad1a2 100644 --- a/tests/src/SAML11/XML/saml/AttributeDesignatorTest.php +++ b/tests/src/SAML11/XML/saml/AttributeDesignatorTest.php @@ -58,9 +58,10 @@ public function testMarshalling(): void SAMLAnyURIValue::fromString('https://example.org/'), ); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($attributeDesignator), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($attributeDesignator); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } } diff --git a/tests/src/SAML11/XML/saml/AttributeStatementTest.php b/tests/src/SAML11/XML/saml/AttributeStatementTest.php index 320d80f..d57e192 100644 --- a/tests/src/SAML11/XML/saml/AttributeStatementTest.php +++ b/tests/src/SAML11/XML/saml/AttributeStatementTest.php @@ -157,10 +157,11 @@ public function testMarshalling(): void [$attribute], ); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($attributeStatement), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($attributeStatement); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } diff --git a/tests/src/SAML11/XML/saml/AttributeTest.php b/tests/src/SAML11/XML/saml/AttributeTest.php index 33de2ef..7b2f90e 100644 --- a/tests/src/SAML11/XML/saml/AttributeTest.php +++ b/tests/src/SAML11/XML/saml/AttributeTest.php @@ -78,9 +78,10 @@ public function testMarshalling(): void ], ); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($attribute), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($attribute); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } } diff --git a/tests/src/SAML11/XML/saml/AttributeValueTest.php b/tests/src/SAML11/XML/saml/AttributeValueTest.php index e2635e2..995b460 100644 --- a/tests/src/SAML11/XML/saml/AttributeValueTest.php +++ b/tests/src/SAML11/XML/saml/AttributeValueTest.php @@ -64,10 +64,11 @@ public function testMarshalling(): void $this->assertEquals('2', $av->getValue()); $this->assertEquals('xs:integer', $av->getXsiType()); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($av), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($av); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } @@ -127,7 +128,7 @@ public function testMarshallingDateTime(): void $nsxs = C_XSI::NS_XS; $nsxsi = C_XSI::NS_XSI; $xml = <<2024-04-04T04:44:44Z +2024-04-04T04:44:44Z XML; $this->assertEquals( $xml, @@ -167,12 +168,15 @@ public function testUnmarshallingNameID(): void $this->assertEquals('abcd-some-value-xyz', $value->getValue()); $this->assertEquals('urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified', $value->getFormat()); - $this->assertXmlStringEqualsXmlString($document->saveXML(), $av->toXML()->ownerDocument?->saveXML()); + + /** @var \Dom\XMLDocument $ownerDocument */ + $ownerDocument = $av->toXML()->ownerDocument; + $this->assertXmlStringEqualsXmlString($document->saveXML(), $ownerDocument->saveXML()); } /** - * Verifies that we cannot create an AttributeValue that is nullable, like SAML2 allows, but SAML1.1 does not. + * Verifies that we cannot create an AttributeValue that is nullable, like SAML 2.0 allows, but SAML1.1 does not. * * @return void */ diff --git a/tests/src/SAML11/XML/saml/AudienceRestrictionConditionTest.php b/tests/src/SAML11/XML/saml/AudienceRestrictionConditionTest.php index 5f45833..b18c8ca 100644 --- a/tests/src/SAML11/XML/saml/AudienceRestrictionConditionTest.php +++ b/tests/src/SAML11/XML/saml/AudienceRestrictionConditionTest.php @@ -56,9 +56,10 @@ public function testMarshalling(): void $audience = Audience::fromString('urn:x-simplesamlphp:audience'); $audienceRestrictionCondition = new AudienceRestrictionCondition([$audience]); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($audienceRestrictionCondition), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($audienceRestrictionCondition); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } } diff --git a/tests/src/SAML11/XML/saml/AudienceTest.php b/tests/src/SAML11/XML/saml/AudienceTest.php index 01d2c4a..052bd13 100644 --- a/tests/src/SAML11/XML/saml/AudienceTest.php +++ b/tests/src/SAML11/XML/saml/AudienceTest.php @@ -52,9 +52,10 @@ public function testMarshalling(): void { $audience = Audience::fromString('urn:x-simplesamlphp:audience'); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($audience), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($audience); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } } diff --git a/tests/src/SAML11/XML/saml/AuthenticationStatementTest.php b/tests/src/SAML11/XML/saml/AuthenticationStatementTest.php index a1d5224..c0809fd 100644 --- a/tests/src/SAML11/XML/saml/AuthenticationStatementTest.php +++ b/tests/src/SAML11/XML/saml/AuthenticationStatementTest.php @@ -161,10 +161,11 @@ public function testMarshalling(): void [$authorityBinding], ); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($authenticationStatement), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($authenticationStatement); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } diff --git a/tests/src/SAML11/XML/saml/AuthorityBindingTest.php b/tests/src/SAML11/XML/saml/AuthorityBindingTest.php index abdbb85..f37851a 100644 --- a/tests/src/SAML11/XML/saml/AuthorityBindingTest.php +++ b/tests/src/SAML11/XML/saml/AuthorityBindingTest.php @@ -66,9 +66,10 @@ public function testMarshalling(): void SAMLAnyURIValue::fromString('urn:x-simplesamlphp:binding'), ); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($ab), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($ab); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } } diff --git a/tests/src/SAML11/XML/saml/AuthorizationDecisionStatementTest.php b/tests/src/SAML11/XML/saml/AuthorizationDecisionStatementTest.php index 89fcad8..1d3973b 100644 --- a/tests/src/SAML11/XML/saml/AuthorizationDecisionStatementTest.php +++ b/tests/src/SAML11/XML/saml/AuthorizationDecisionStatementTest.php @@ -4,7 +4,7 @@ namespace SimpleSAML\Test\SAML11\XML\saml; -use DOMDocument; +use Dom; use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; @@ -47,17 +47,17 @@ final class AuthorizationDecisionStatementTest extends TestCase /** @var \SimpleSAML\SAML11\Compat\AbstractContainer */ private static AbstractContainer $containerBackup; - /** @var \DOMDocument $action */ - private static DOMDocument $action; + /** @var \Dom\XMLDocument $action */ + private static Dom\XMLDocument $action; - /** @var \DOMDocument $advice */ -// private static DOMDocument $advice; + /** @var \Dom\XMLDocument $advice */ +// private static Dom\XMLDocument $advice; - /** @var \DOMDocument $evidence */ - private static DOMDocument $evidence; + /** @var \Dom\XMLDocument $evidence */ + private static Dom\XMLDocument $evidence; - /** @var \DOMDocument $subject */ - private static DOMDocument $subject; + /** @var \Dom\XMLDocument $subject */ + private static Dom\XMLDocument $subject; /** @@ -126,9 +126,10 @@ public function testMarshalling(): void $evidence, ); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($authzDecisionStatement), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($authzDecisionStatement); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } } diff --git a/tests/src/SAML11/XML/saml/ConditionTest.php b/tests/src/SAML11/XML/saml/ConditionTest.php index d574690..18467ae 100644 --- a/tests/src/SAML11/XML/saml/ConditionTest.php +++ b/tests/src/SAML11/XML/saml/ConditionTest.php @@ -85,10 +85,11 @@ public function testMarshalling(): void ], ); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($condition), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($condition); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } @@ -115,6 +116,8 @@ public function testUnmarshallingUnregistered(): void $this->assertEquals('Condition', $chunk->getLocalName()); $this->assertEquals(C::NS_SAML, $chunk->getNamespaceURI()); - $this->assertEquals($element->ownerDocument?->saveXML($element), strval($condition)); + /** @var \Dom\XMLDocument $ownerDocument */ + $ownerDocument = $element->ownerDocument; + $this->assertEquals($ownerDocument->saveXML($element), strval($condition)); } } diff --git a/tests/src/SAML11/XML/saml/ConditionsTest.php b/tests/src/SAML11/XML/saml/ConditionsTest.php index cab7703..9ed4567 100644 --- a/tests/src/SAML11/XML/saml/ConditionsTest.php +++ b/tests/src/SAML11/XML/saml/ConditionsTest.php @@ -82,10 +82,11 @@ public function testMarshalling(): void SAMLDateTimeValue::fromString('2023-01-24T09:47:26Z'), ); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($conditions), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($conditions); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } diff --git a/tests/src/SAML11/XML/saml/ConfirmationMethodTest.php b/tests/src/SAML11/XML/saml/ConfirmationMethodTest.php index 0c11ed9..683ce4b 100644 --- a/tests/src/SAML11/XML/saml/ConfirmationMethodTest.php +++ b/tests/src/SAML11/XML/saml/ConfirmationMethodTest.php @@ -51,9 +51,10 @@ public function testMarshalling(): void SAMLAnyURIValue::fromString('_Test'), ); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($confirmationMethod), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($confirmationMethod); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } } diff --git a/tests/src/SAML11/XML/saml/DoNotCacheConditionTest.php b/tests/src/SAML11/XML/saml/DoNotCacheConditionTest.php index 9372333..4bc548f 100644 --- a/tests/src/SAML11/XML/saml/DoNotCacheConditionTest.php +++ b/tests/src/SAML11/XML/saml/DoNotCacheConditionTest.php @@ -52,11 +52,12 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $DoNotCacheCondition = new DoNotCacheCondition(); + $doNotCacheCondition = new DoNotCacheCondition(); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($DoNotCacheCondition), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($doNotCacheCondition); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } } diff --git a/tests/src/SAML11/XML/saml/EvidenceTest.php b/tests/src/SAML11/XML/saml/EvidenceTest.php index 701d4aa..6434f40 100644 --- a/tests/src/SAML11/XML/saml/EvidenceTest.php +++ b/tests/src/SAML11/XML/saml/EvidenceTest.php @@ -4,7 +4,7 @@ namespace SimpleSAML\Test\SAML11\XML\saml; -use DOMDocument; +use Dom; use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; @@ -80,17 +80,17 @@ final class EvidenceTest extends TestCase /** @var \SimpleSAML\SAML11\Compat\AbstractContainer */ private static AbstractContainer $containerBackup; - /** @var \DOMDocument $conditions */ - private static DOMDocument $conditions; + /** @var \Dom\Document $conditions */ + private static Dom\Document $conditions; - /** @var \DOMDocument $advice */ - //private static DOMDocument $advice; + /** @var \Dom\Document $advice */ + //private static Dom\Document $advice; - /** @var \DOMDocument $authzDecisionStatement */ - //private static DOMDocument $authzDecisionStatement; + /** @var \Dom\Document $authzDecisionStatement */ + //private static Dom\Document $authzDecisionStatement; - /** @var \DOMDocument $statement */ - private static DOMDocument $statement; + /** @var \Dom\Document $statement */ + private static Dom\Document $statement; /** @@ -201,10 +201,11 @@ public function testMarshalling(): void $evidence = new Evidence([$assertionIDReference], [$assertion]); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($evidence), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($evidence); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } diff --git a/tests/src/SAML11/XML/saml/NameIdentifierTest.php b/tests/src/SAML11/XML/saml/NameIdentifierTest.php index 47d4f54..de50cd6 100644 --- a/tests/src/SAML11/XML/saml/NameIdentifierTest.php +++ b/tests/src/SAML11/XML/saml/NameIdentifierTest.php @@ -59,9 +59,10 @@ public function testMarshalling(): void SAMLAnyURIValue::fromString('urn:the:format'), ); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($nameIdentifier), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($nameIdentifier); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } } diff --git a/tests/src/SAML11/XML/saml/StatementTest.php b/tests/src/SAML11/XML/saml/StatementTest.php index 41676a5..ea7a5c9 100644 --- a/tests/src/SAML11/XML/saml/StatementTest.php +++ b/tests/src/SAML11/XML/saml/StatementTest.php @@ -107,10 +107,11 @@ public function testUnmarshalling(): void $this->assertCount(1, $audience); $this->assertEquals('urn:some:audience', $audience[0]->getContent()); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($statement), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($statement); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } @@ -134,6 +135,8 @@ public function testUnmarshallingUnregistered(): void $this->assertEquals('Statement', $chunk->getLocalName()); $this->assertEquals(C::NS_SAML, $chunk->getNamespaceURI()); - $this->assertEquals($element->ownerDocument?->saveXML($element), strval($statement)); + /** @var \Dom\XMLDocument $ownerDocument */ + $ownerDocument = $element->ownerDocument; + $this->assertEquals($ownerDocument->saveXML($element), strval($statement)); } } diff --git a/tests/src/SAML11/XML/saml/SubjectConfirmationDataTest.php b/tests/src/SAML11/XML/saml/SubjectConfirmationDataTest.php index 85c1044..3bd7481 100644 --- a/tests/src/SAML11/XML/saml/SubjectConfirmationDataTest.php +++ b/tests/src/SAML11/XML/saml/SubjectConfirmationDataTest.php @@ -63,10 +63,11 @@ public function testMarshalling(): void $this->assertEquals('2', strval($scd->getValue())); $this->assertEquals('xs:integer', $scd->getXsiType()); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($scd), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($scd); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } @@ -95,7 +96,7 @@ public function testMarshallingNull(): void $nssaml = C::NS_SAML; $nsxsi = C_XSI::NS_XSI; $xml = << + XML; $this->assertEquals( $xml, @@ -125,6 +126,9 @@ public function testUnmarshallingNameID(): void $this->assertEquals('abcd-some-value-xyz', $value->getValue()); $this->assertEquals('urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified', $value->getFormat()); - $this->assertXmlStringEqualsXmlString($document->saveXML(), $scd->toXML()->ownerDocument?->saveXML()); + + /** @var \Dom\XMLDocument $ownerDocument */ + $ownerDocument = $scd->toXML()->ownerDocument; + $this->assertXmlStringEqualsXmlString($document->saveXML($document), $ownerDocument->saveXML($ownerDocument)); } } diff --git a/tests/src/SAML11/XML/saml/SubjectConfirmationTest.php b/tests/src/SAML11/XML/saml/SubjectConfirmationTest.php index c5b9df5..a0b7128 100644 --- a/tests/src/SAML11/XML/saml/SubjectConfirmationTest.php +++ b/tests/src/SAML11/XML/saml/SubjectConfirmationTest.php @@ -123,9 +123,10 @@ public function testMarshalling(): void $keyInfo, ); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($sc), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($sc); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } } diff --git a/tests/src/SAML11/XML/saml/SubjectLocalityTest.php b/tests/src/SAML11/XML/saml/SubjectLocalityTest.php index dbbf602..552f09e 100644 --- a/tests/src/SAML11/XML/saml/SubjectLocalityTest.php +++ b/tests/src/SAML11/XML/saml/SubjectLocalityTest.php @@ -58,10 +58,11 @@ public function testMarshalling(): void SAMLStringValue::fromString('simplesamlphp.org'), ); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($sl), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($sl); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } diff --git a/tests/src/SAML11/XML/saml/SubjectStatementTest.php b/tests/src/SAML11/XML/saml/SubjectStatementTest.php index 474d6f5..bf58bb0 100644 --- a/tests/src/SAML11/XML/saml/SubjectStatementTest.php +++ b/tests/src/SAML11/XML/saml/SubjectStatementTest.php @@ -181,10 +181,11 @@ public function testUnmarshalling(): void $this->assertCount(1, $audience); $this->assertEquals('urn:x-simplesamlphp:audience', $audience[0]->getContent()); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($subjectStatement), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($subjectStatement); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } @@ -208,6 +209,8 @@ public function testUnmarshallingUnregistered(): void $this->assertEquals('SubjectStatement', $chunk->getLocalName()); $this->assertEquals(C::NS_SAML, $chunk->getNamespaceURI()); - $this->assertEquals($element->ownerDocument?->saveXML($element), strval($subjectStatement)); + /** @var \Dom\XMLDocument $ownerDocument */ + $ownerDocument = $element->ownerDocument; + $this->assertEquals($ownerDocument->saveXML($element), strval($subjectStatement)); } } diff --git a/tests/src/SAML11/XML/saml/SubjectTest.php b/tests/src/SAML11/XML/saml/SubjectTest.php index 18856c5..fb938d4 100644 --- a/tests/src/SAML11/XML/saml/SubjectTest.php +++ b/tests/src/SAML11/XML/saml/SubjectTest.php @@ -135,9 +135,10 @@ public function testMarshalling(): void $subject = new Subject($sc, $nameIdentifier); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($subject), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($subject); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } } diff --git a/tests/src/SAML11/XML/samlp/AssertionArtifactTest.php b/tests/src/SAML11/XML/samlp/AssertionArtifactTest.php index cd4795a..df02134 100644 --- a/tests/src/SAML11/XML/samlp/AssertionArtifactTest.php +++ b/tests/src/SAML11/XML/samlp/AssertionArtifactTest.php @@ -52,9 +52,10 @@ public function testMarshalling(): void { $assertionArtifact = AssertionArtifact::fromString('AAEbuqrPjR1XORIHk5YAV8I4sM0nKP2CLV+h1CMiWbnkaWvvlJ0g4Ess'); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($assertionArtifact), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($assertionArtifact); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } } diff --git a/tests/src/SAML11/XML/samlp/AttributeQueryTest.php b/tests/src/SAML11/XML/samlp/AttributeQueryTest.php index b601756..88a7d5a 100644 --- a/tests/src/SAML11/XML/samlp/AttributeQueryTest.php +++ b/tests/src/SAML11/XML/samlp/AttributeQueryTest.php @@ -154,9 +154,10 @@ public function testMarshalling(): void ], ); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($attributeQuery), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($attributeQuery); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } } diff --git a/tests/src/SAML11/XML/samlp/AuthenticationQueryTest.php b/tests/src/SAML11/XML/samlp/AuthenticationQueryTest.php index 0191d74..715f5ca 100644 --- a/tests/src/SAML11/XML/samlp/AuthenticationQueryTest.php +++ b/tests/src/SAML11/XML/samlp/AuthenticationQueryTest.php @@ -144,9 +144,10 @@ public function testMarshalling(): void SAMLAnyURIValue::fromString(C::AC_PASSWORD), ); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($authnQuery), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($authnQuery); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } } diff --git a/tests/src/SAML11/XML/samlp/AuthorizationDecisionQueryTest.php b/tests/src/SAML11/XML/samlp/AuthorizationDecisionQueryTest.php index 09dfa0a..ba99973 100644 --- a/tests/src/SAML11/XML/samlp/AuthorizationDecisionQueryTest.php +++ b/tests/src/SAML11/XML/samlp/AuthorizationDecisionQueryTest.php @@ -4,7 +4,7 @@ namespace SimpleSAML\Test\SAML11\XML\samlp; -use DOMDocument; +use Dom; use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; @@ -70,23 +70,23 @@ final class AuthorizationDecisionQueryTest extends TestCase /** @var string[] */ private static array $certData; - /** @var \DOMDocument $advice */ - //private static DOMDocument $advice; + /** @var \Dom\XMLDocument $advice */ + //private static Dom\XMLDocument $advice; - /** @var \DOMDocument $statement */ - //private static DOMDocument $statement; + /** @var \Dom\XMLDocument $statement */ + //private static Dom\XMLDocument $statement; - /** @var \DOMDocument $subjectStatement */ - //private static DOMDocument $subjectStatement; + /** @var \Dom\XMLDocument $subjectStatement */ + //private static Dom\XMLDocument $subjectStatement; - /** @var \DOMDocument $authnStatement */ - private static DOMDocument $authnStatement; + /** @var \Dom\XMLDocument $authnStatement */ + private static Dom\XMLDocument $authnStatement; - /** @var \DOMDocument $authzDecisionStatement */ - //private static DOMDocument $authzDecisionStatement; + /** @var \Dom\XMLDocument $authzDecisionStatement */ + //private static \Dom\XMLDocument $authzDecisionStatement; - /** @var \DOMDocument $attributeStatement */ - private static DOMDocument $attributeStatement; + /** @var \Dom\XMLDocument $attributeStatement */ + private static Dom\XMLDocument $attributeStatement; /** @@ -237,9 +237,10 @@ public function testMarshalling(): void ], ); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($authorizationDecisionQuery), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($authorizationDecisionQuery); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } } diff --git a/tests/src/SAML11/XML/samlp/QueryTest.php b/tests/src/SAML11/XML/samlp/QueryTest.php index a9bbc97..782ecd5 100644 --- a/tests/src/SAML11/XML/samlp/QueryTest.php +++ b/tests/src/SAML11/XML/samlp/QueryTest.php @@ -85,10 +85,11 @@ public function testMarshalling(): void ], ); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($query), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($query); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } @@ -115,6 +116,8 @@ public function testUnmarshallingUnregistered(): void $this->assertEquals('Query', $chunk->getLocalName()); $this->assertEquals(C::NS_SAMLP, $chunk->getNamespaceURI()); - $this->assertEquals($element->ownerDocument?->saveXML($element), strval($query)); + /** @var \Dom\XMLDocument $ownerDocument */ + $ownerDocument = $element->ownerDocument; + $this->assertEquals($ownerDocument->saveXml($element), strval($query)); } } diff --git a/tests/src/SAML11/XML/samlp/RespondWithTest.php b/tests/src/SAML11/XML/samlp/RespondWithTest.php index 06b2e8f..52b8a23 100644 --- a/tests/src/SAML11/XML/samlp/RespondWithTest.php +++ b/tests/src/SAML11/XML/samlp/RespondWithTest.php @@ -55,9 +55,10 @@ public function testMarshalling(): void ), ); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($respondWith), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($respondWith); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } } diff --git a/tests/src/SAML11/XML/samlp/ResponseTest.php b/tests/src/SAML11/XML/samlp/ResponseTest.php index 86e4983..fd2a0c8 100644 --- a/tests/src/SAML11/XML/samlp/ResponseTest.php +++ b/tests/src/SAML11/XML/samlp/ResponseTest.php @@ -4,7 +4,7 @@ namespace SimpleSAML\Test\SAML11\XML\samlp; -use DOMDocument; +use Dom; use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; @@ -50,8 +50,8 @@ final class ResponseTest extends TestCase use SerializableElementTestTrait; - /** @var \DOMDocument $authnStatement */ - private static DOMDocument $authnStatement; + /** @var \Dom\XMLDocument $authnStatement */ + private static Dom\XMLDocument $authnStatement; /** @@ -125,9 +125,10 @@ public function testMarshalling(): void [$assertion], ); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($response), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($response); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } } diff --git a/tests/src/SAML11/XML/samlp/StatusCodeTest.php b/tests/src/SAML11/XML/samlp/StatusCodeTest.php index 5e82d3d..0512d03 100644 --- a/tests/src/SAML11/XML/samlp/StatusCodeTest.php +++ b/tests/src/SAML11/XML/samlp/StatusCodeTest.php @@ -58,9 +58,10 @@ public function testMarshalling(): void ], ); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($statusCode), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($statusCode); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } } diff --git a/tests/src/SAML11/XML/samlp/StatusDetailTest.php b/tests/src/SAML11/XML/samlp/StatusDetailTest.php index 1ea228d..9cc2ae0 100644 --- a/tests/src/SAML11/XML/samlp/StatusDetailTest.php +++ b/tests/src/SAML11/XML/samlp/StatusDetailTest.php @@ -56,10 +56,11 @@ public function testMarshalling(): void $statusDetail = new StatusDetail([new Chunk($document->documentElement)]); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($statusDetail), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($statusDetail); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } diff --git a/tests/src/SAML11/XML/samlp/StatusMessageTest.php b/tests/src/SAML11/XML/samlp/StatusMessageTest.php index 0e493fa..1c33be8 100644 --- a/tests/src/SAML11/XML/samlp/StatusMessageTest.php +++ b/tests/src/SAML11/XML/samlp/StatusMessageTest.php @@ -48,9 +48,10 @@ public function testMarshalling(): void { $statusMessage = StatusMessage::fromString('Something went wrong'); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($statusMessage), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($statusMessage); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } } diff --git a/tests/src/SAML11/XML/samlp/StatusTest.php b/tests/src/SAML11/XML/samlp/StatusTest.php index 9396637..58a04b6 100644 --- a/tests/src/SAML11/XML/samlp/StatusTest.php +++ b/tests/src/SAML11/XML/samlp/StatusTest.php @@ -4,7 +4,7 @@ namespace SimpleSAML\Test\SAML11\XML\samlp; -use DOMDocument; +use Dom; use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; @@ -38,8 +38,8 @@ final class StatusTest extends TestCase use SerializableElementTestTrait; - /** @var \DOMDocument $detail */ - private static DOMDocument $detail; + /** @var \Dom\XMLDocument $detail */ + private static Dom\XMLDocument $detail; /** @@ -79,10 +79,11 @@ public function testMarshalling(): void ), ); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($status), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($status); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } @@ -111,7 +112,7 @@ public function testMarshallingElementOrdering(): void $this->assertCount(1, $statusElements); // Test ordering of Status contents - /** @var \DOMElement[] $statusElements */ + /** @var \Dom\Element[] $statusElements */ $statusElements = XPath::xpQuery($statusElement, './saml_protocol:StatusCode/following-sibling::*', $xpCache); $this->assertCount(2, $statusElements); $this->assertEquals('samlp:StatusMessage', $statusElements[0]->tagName); diff --git a/tests/src/SAML11/XML/samlp/SubjectQueryTest.php b/tests/src/SAML11/XML/samlp/SubjectQueryTest.php index 1fa9e0a..3a7dc0d 100644 --- a/tests/src/SAML11/XML/samlp/SubjectQueryTest.php +++ b/tests/src/SAML11/XML/samlp/SubjectQueryTest.php @@ -167,10 +167,11 @@ public function testMarshalling(): void ], ); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($subjectQuery), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($subjectQuery); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } @@ -187,7 +188,7 @@ public function testUnmarshallingUnregistered(): void // Normalize the DOMElement by importing it into a clean empty document $newDoc = DOMDocumentFactory::create(); - /** @var \DOMElement $element */ + /** @var \Dom\Element $element */ $element = $newDoc->appendChild($newDoc->importNode($element, true)); $subjectQuery = AbstractSubjectQuery::fromXML($element);