diff --git a/composer.json b/composer.json index 2b9f44c97..49793d213 100644 --- a/composer.json +++ b/composer.json @@ -31,9 +31,9 @@ "psr/http-message": "~2.0", "psr/log": "~3.0", "simplesamlphp/assert": "~2.0", - "simplesamlphp/xml-common": "~2.8", - "simplesamlphp/xml-security": "~2.3", - "simplesamlphp/xml-soap": "~2.3" + "simplesamlphp/xml-common": "dev-feature/dom-migration-php84", + "simplesamlphp/xml-security": "dev-feature/dom-migration-php84", + "simplesamlphp/xml-soap": "dev-feature/dom-migration-php84" }, "require-dev": { "ext-intl": "*", diff --git a/phpstan-baseline-dev.neon b/phpstan-baseline-dev.neon index 68d430697..6dbf8eecf 100644 --- a/phpstan-baseline-dev.neon +++ b/phpstan-baseline-dev.neon @@ -30,12 +30,6 @@ parameters: count: 1 path: tests/SAML2/Assertion/Validation/AssertionValidatorTest.php - - - message: '#^Parameter \#1 \$xml of static method SimpleSAML\\SAML2\\XML\\saml\\Assertion\:\:fromXML\(\) expects DOMElement, DOMNode\|null given\.$#' - identifier: argument.type - count: 2 - path: tests/SAML2/Assertion/Validation/AssertionValidatorTest.php - - message: '#^Result of method SimpleSAML\\SAML2\\Assertion\\Processor\:\:validateAssertion\(\) \(void\) is used\.$#' identifier: method.void diff --git a/src/Binding/HTTPArtifact.php b/src/Binding/HTTPArtifact.php index 9fd84dedd..1ace55f37 100644 --- a/src/Binding/HTTPArtifact.php +++ b/src/Binding/HTTPArtifact.php @@ -78,7 +78,9 @@ public function getRedirectURL(AbstractMessage $message): string } $artifact = base64_encode("\x00\x04\x00\x00" . sha1($issuer->getContent(), true) . $generatedId); $artifactData = $message->toXML(); - $artifactDataString = $artifactData->ownerDocument?->saveXML($artifactData); + /** @var \Dom\XMLDocument $ownerDocument */ + $ownerDocument = $artifactData->ownerDocument; + $artifactDataString = $ownerDocument->saveXML($artifactData); $clock = Utils::getContainer()->getClock(); $store->set('artifact', $artifact, $artifactDataString, $clock->now()->add(new DateInterval('PT15M'))); diff --git a/src/Binding/HTTPPost.php b/src/Binding/HTTPPost.php index 51281d7ca..be12dc3ed 100644 --- a/src/Binding/HTTPPost.php +++ b/src/Binding/HTTPPost.php @@ -53,7 +53,9 @@ public function send(AbstractMessage $message): ResponseInterface $msgStr = $message->toXML(); Utils::getContainer()->debugMessage($msgStr, 'out'); - $msgStr = $msgStr->ownerDocument?->saveXML($msgStr); + /** @var \Dom\XMLDocument $ownerDocument */ + $ownerDocument = $msgStr->ownerDocument; + $msgStr = $ownerDocument?->saveXML($msgStr); $msgStr = base64_encode($msgStr); diff --git a/src/Binding/HTTPRedirect.php b/src/Binding/HTTPRedirect.php index 0cf966582..a07cb3621 100644 --- a/src/Binding/HTTPRedirect.php +++ b/src/Binding/HTTPRedirect.php @@ -66,7 +66,9 @@ public function getRedirectURL(AbstractMessage $message): string $msgStr = $message->toXML(); Utils::getContainer()->debugMessage($msgStr, 'out'); - $msgStr = $msgStr->ownerDocument?->saveXML($msgStr); + /** @var \Dom\XMLDocument $ownerDocument */ + $ownerDocument = $msgStr->ownerDocument; + $msgStr = $ownerDocument->saveXML($msgStr); $msgStr = gzdeflate($msgStr); $msgStr = base64_encode($msgStr); diff --git a/src/Binding/SOAP.php b/src/Binding/SOAP.php index 1afd02c71..ab2e7b36b 100644 --- a/src/Binding/SOAP.php +++ b/src/Binding/SOAP.php @@ -63,7 +63,9 @@ public function getOutputToSend(AbstractMessage $message): string|false new Body([$message]), $header, ); - return $env->toXML()->ownerDocument?->saveXML(); + /** @var \Dom\XMLDocument $ownerDocument */ + $ownerDocument = $env->toXML()->ownerDocument; + return $ownerDocument->saveXML(); } @@ -99,12 +101,12 @@ public function receive(/** @scrutinizer ignore-unused */ServerRequestInterface } $document = DOMDocumentFactory::fromString($postText); - /** @var \DOMNode $xml */ + /** @var \Dom\Node $xml */ $xml = $document->firstChild; Utils::getContainer()->debugMessage($document->documentElement, 'in'); $xpCache = XPath::getXPath($document->documentElement); - /** @var \DOMElement[] $results */ + /** @var \Dom\Element[] $results */ $results = XPath::xpQuery($xml, '/SOAP-ENV:Envelope/SOAP-ENV:Body/*[1]', $xpCache); return MessageFactory::fromXML($results[0]); diff --git a/src/Compat/AbstractContainer.php b/src/Compat/AbstractContainer.php index 931c65f80..14a3d0fc4 100644 --- a/src/Compat/AbstractContainer.php +++ b/src/Compat/AbstractContainer.php @@ -142,7 +142,7 @@ abstract public function getLogger(): LoggerInterface; * - **encrypt** XML that is about to be encrypted * - **decrypt** XML that was just decrypted * - * @param \DOMElement|string $message + * @param \Dom\Element|string $message */ abstract public function debugMessage($message, string $type): void; diff --git a/src/Compat/MockContainer.php b/src/Compat/MockContainer.php index 788c7a878..3bf2cc9d6 100644 --- a/src/Compat/MockContainer.php +++ b/src/Compat/MockContainer.php @@ -45,7 +45,7 @@ public function getLogger(): LoggerInterface * - **encrypt** XML that is about to be encrypted * - **decrypt** XML that was just decrypted * - * @param \DOMElement|string $message + * @param \Dom\Element|string $message */ public function debugMessage($message, string $type): void { diff --git a/src/SOAPClient.php b/src/SOAPClient.php index 6174c05ec..79da5a5a1 100644 --- a/src/SOAPClient.php +++ b/src/SOAPClient.php @@ -142,7 +142,9 @@ public function send( // Add soap-envelopes $env = (new Envelope(new Body([new Chunk($msg->toXML())])))->toXML(); - $request = $env->ownerDocument?->saveXML(); + /** @var \Dom\XMLDocument $ownerDocument */ + $ownerDocument = $env->ownerDocument; + $request = $ownerDocument->saveXML(); $container->debugMessage($request, 'out'); @@ -158,7 +160,9 @@ public function send( $dom = DOMDocumentFactory::fromString($soapresponsexml); $env = Envelope::fromXML($dom->documentElement); - $container->debugMessage($env->toXML()->ownerDocument?->saveXML(), 'in'); + /** @var \Dom\XMLDocument $ownerDocument */ + $ownerDocument = $env->toXML()->ownerDocument; + $container->debugMessage($ownerDocument->saveXML(), 'in'); $soapfault = $this->getSOAPFault($dom); if ($soapfault !== null) { diff --git a/src/Utils/XPath.php b/src/Utils/XPath.php index c3603d2a7..ca838d24d 100644 --- a/src/Utils/XPath.php +++ b/src/Utils/XPath.php @@ -4,8 +4,7 @@ namespace SimpleSAML\SAML2\Utils; -use DOMNode; -use DOMXPath; +use Dom; use SimpleSAML\SAML2\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/XML/CanonicalizableElementTrait.php b/src/XML/CanonicalizableElementTrait.php index c1779d132..0a8b3d729 100644 --- a/src/XML/CanonicalizableElementTrait.php +++ b/src/XML/CanonicalizableElementTrait.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\XML; -use DOMElement; +use Dom; use SimpleSAML\XMLSecurity\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/XML/EncryptableElementTrait.php b/src/XML/EncryptableElementTrait.php index 961337ac3..d79147fc5 100644 --- a/src/XML/EncryptableElementTrait.php +++ b/src/XML/EncryptableElementTrait.php @@ -65,13 +65,15 @@ public function encrypt(EncryptionAlgorithmInterface $encryptor): EncryptedData } $xmlRepresentation = $this->toXML(); + /** @var \Dom\XMLDocument $ownerDocument */ + $ownerDocument = $xmlRepresentation->ownerDocument; return new EncryptedData( new CipherData( new CipherValue( Base64BinaryValue::fromString( base64_encode($encryptor->encrypt( - $xmlRepresentation->ownerDocument->saveXML($xmlRepresentation), + $ownerDocument->saveXML($xmlRepresentation), )), ), ), diff --git a/src/XML/EncryptedElementTrait.php b/src/XML/EncryptedElementTrait.php index 43f61e61f..45ba38e8f 100644 --- a/src/XML/EncryptedElementTrait.php +++ b/src/XML/EncryptedElementTrait.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\XML; -use DOMElement; +use Dom; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Compat\ContainerSingleton; use SimpleSAML\SAML2\Exception\ProtocolViolationException; @@ -92,7 +92,7 @@ public function getDecryptionKeys(): 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, @@ -120,7 +120,7 @@ public static function fromXML(DOMElement $xml): static /** * @inheritDoc */ - public function toXML(?DOMElement $parent = null): DOMElement + public function toXML(?Dom\Element $parent = null): Dom\Element { $e = $this->instantiateParentElement($parent); diff --git a/src/XML/ExtensionsTrait.php b/src/XML/ExtensionsTrait.php index 61c58e2df..07f9259f6 100644 --- a/src/XML/ExtensionsTrait.php +++ b/src/XML/ExtensionsTrait.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\XML; -use DOMElement; +use Dom; use SimpleSAML\XML\ExtendableElementTrait; /** @@ -49,10 +49,10 @@ public function isEmptyElement(): bool /** * Convert this object into its md:Extensions XML representation. * - * @param \DOMElement|null $parent The element we should add this Extensions element to. - * @return \DOMElement The new md:Extensions XML element. + * @param \Dom\Element|null $parent The element we should add this Extensions element to. + * @return \Dom\Element The new md:Extensions XML element. */ - public function toXML(?DOMElement $parent = null): DOMElement + public function toXML(?Dom\Element $parent = null): Dom\Element { $e = $this->instantiateParentElement($parent); @@ -70,5 +70,5 @@ public function toXML(?DOMElement $parent = null): DOMElement /** */ - abstract public function instantiateParentElement(?DOMElement $parent = null): DOMElement; + abstract public function instantiateParentElement(?Dom\Element $parent = null): Dom\Element; } diff --git a/src/XML/IdentifierTrait.php b/src/XML/IdentifierTrait.php index 40a0a28ab..ec3b32efc 100644 --- a/src/XML/IdentifierTrait.php +++ b/src/XML/IdentifierTrait.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\XML; -use DOMElement; +use Dom; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\XML\saml\AbstractBaseID; use SimpleSAML\SAML2\XML\saml\EncryptedID; @@ -58,7 +58,7 @@ protected function setIdentifier(?IdentifierInterface $identifier): void * @throws \SimpleSAML\XMLSchema\Exception\TooManyElementsException * if too many child-elements of a type are specified */ - protected static function getIdentifierFromXML(DOMElement $xml): ?IdentifierInterface + protected static function getIdentifierFromXML(Dom\Element $xml): ?IdentifierInterface { $class = static::NS_PREFIX . ':' . self::getClassName(static::class); diff --git a/src/XML/SignableElementTrait.php b/src/XML/SignableElementTrait.php index d85ddac4f..c43f610b8 100644 --- a/src/XML/SignableElementTrait.php +++ b/src/XML/SignableElementTrait.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\XML; -use DOMElement; +use Dom; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Compat\ContainerSingleton; use SimpleSAML\XML\DOMDocumentFactory; @@ -75,9 +75,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.: @@ -85,10 +85,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/XML/alg/DigestMethod.php b/src/XML/alg/DigestMethod.php index 7f78b85b5..29ef1f347 100644 --- a/src/XML/alg/DigestMethod.php +++ b/src/XML/alg/DigestMethod.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\XML\alg; -use DOMElement; +use Dom; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Type\SAMLAnyURIValue; use SimpleSAML\XML\ExtendableElementTrait; @@ -58,14 +58,14 @@ public function getAlgorithm(): SAMLAnyURIValue /** * Convert XML into a DigestMethod * - * @param \DOMElement $xml The XML element we should load + * @param \Dom\Element $xml The XML element we should load * * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong * @throws \SimpleSAML\XMLSchema\Exception\MissingAttributeException * if the mandatory Algorithm-attribute is missing */ - public static function fromXML(DOMElement $xml): static + public static function fromXML(Dom\Element $xml): static { Assert::same($xml->localName, 'DigestMethod', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, DigestMethod::NS, InvalidDOMElementException::class); @@ -80,9 +80,9 @@ public static function fromXML(DOMElement $xml): static /** * Convert this element to XML. * - * @param \DOMElement|null $parent The element we should append to. + * @param \Dom\Element|null $parent The element we should append to. */ - public function toXML(?DOMElement $parent = null): DOMElement + public function toXML(?Dom\Element $parent = null): Dom\Element { $e = $this->instantiateParentElement($parent); $e->setAttribute('Algorithm', $this->getAlgorithm()->getValue()); diff --git a/src/XML/alg/SigningMethod.php b/src/XML/alg/SigningMethod.php index c1c806362..f16e319a4 100644 --- a/src/XML/alg/SigningMethod.php +++ b/src/XML/alg/SigningMethod.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\XML\alg; -use DOMElement; +use Dom; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Type\SAMLAnyURIValue; use SimpleSAML\XML\ExtendableElementTrait; @@ -84,14 +84,14 @@ public function getMaxKeySize(): ?PositiveIntegerValue /** * Convert XML into a SigningMethod * - * @param \DOMElement $xml The XML element we should load + * @param \Dom\Element $xml The XML element we should load * * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong * @throws \SimpleSAML\XMLSchema\Exception\MissingAttributeException * if the supplied argument is missing the Algorithm attribute */ - public static function fromXML(DOMElement $xml): static + public static function fromXML(Dom\Element $xml): static { Assert::same($xml->localName, 'SigningMethod', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, SigningMethod::NS, InvalidDOMElementException::class); @@ -108,9 +108,9 @@ public static function fromXML(DOMElement $xml): static /** * Convert this element to XML. * - * @param \DOMElement|null $parent The element we should append to. + * @param \Dom\Element|null $parent The element we should append to. */ - public function toXML(?DOMElement $parent = null): DOMElement + public function toXML(?Dom\Element $parent = null): Dom\Element { $e = $this->instantiateParentElement($parent); diff --git a/src/XML/ecp/RelayState.php b/src/XML/ecp/RelayState.php index ac17f8317..ef75f0aec 100644 --- a/src/XML/ecp/RelayState.php +++ b/src/XML/ecp/RelayState.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\XML\ecp; -use DOMElement; +use Dom; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Exception\ProtocolViolationException; use SimpleSAML\SAML2\Type\SAMLStringValue; @@ -33,14 +33,14 @@ final class RelayState extends AbstractEcpElement implements SchemaValidatableEl /** * Convert XML into a RelayState * - * @param \DOMElement $xml The XML element we should load + * @param \Dom\Element $xml The XML element we should load * * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong * @throws \SimpleSAML\XMLSchema\Exception\MissingAttributeException * if the supplied element is missing any of the mandatory attributes */ - public static function fromXML(DOMElement $xml): static + public static function fromXML(Dom\Element $xml): static { Assert::same($xml->localName, 'RelayState', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, RelayState::NS, InvalidDOMElementException::class); @@ -75,9 +75,9 @@ public static function fromXML(DOMElement $xml): static /** * Convert this ECP RelayState to XML. * - * @param \DOMElement|null $parent The element we should append this element to. + * @param \Dom\Element|null $parent The element we should append this element to. */ - public function toXML(?DOMElement $parent = null): DOMElement + public function toXML(?Dom\Element $parent = null): Dom\Element { $e = $this->instantiateParentElement($parent); diff --git a/src/XML/ecp/Request.php b/src/XML/ecp/Request.php index 5bb4daea6..5f3e85c98 100644 --- a/src/XML/ecp/Request.php +++ b/src/XML/ecp/Request.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\XML\ecp; -use DOMElement; +use Dom; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Exception\ProtocolViolationException; use SimpleSAML\SAML2\Type\SAMLStringValue; @@ -97,14 +97,14 @@ public function getIDPList(): ?IDPList /** * Convert XML into a Request * - * @param \DOMElement $xml The XML element we should load + * @param \Dom\Element $xml The XML element we should load * * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong * @throws \SimpleSAML\XMLSchema\Exception\MissingAttributeException * if the supplied element is missing any of the mandatory attributes */ - 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); @@ -152,9 +152,9 @@ public static function fromXML(DOMElement $xml): static /** * Convert this ECP SubjectConfirmation to XML. * - * @param \DOMElement|null $parent The element we should append this element to. + * @param \Dom\Element|null $parent The element we should append this element to. */ - public function toXML(?DOMElement $parent = null): DOMElement + public function toXML(?Dom\Element $parent = null): Dom\Element { $e = $this->instantiateParentElement($parent); $e->setAttributeNS(C::NS_SOAP_ENV, 'SOAP-ENV:mustUnderstand', '1'); diff --git a/src/XML/ecp/RequestAuthenticated.php b/src/XML/ecp/RequestAuthenticated.php index 9d10889f6..b8dafb7d1 100644 --- a/src/XML/ecp/RequestAuthenticated.php +++ b/src/XML/ecp/RequestAuthenticated.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\XML\ecp; -use DOMElement; +use Dom; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Exception\ProtocolViolationException; use SimpleSAML\SOAP11\Constants as C; @@ -49,14 +49,14 @@ public function getMustUnderstand(): ?MustUnderstandValue /** * Convert XML into a RequestAuthenticated * - * @param \DOMElement $xml The XML element we should load + * @param \Dom\Element $xml The XML element we should load * * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong * @throws \SimpleSAML\XMLSchema\Exception\MissingAttributeException * if the supplied element is missing any of the mandatory attributes */ - public static function fromXML(DOMElement $xml): static + public static function fromXML(Dom\Element $xml): static { Assert::same($xml->localName, 'RequestAuthenticated', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, RequestAuthenticated::NS, InvalidDOMElementException::class); @@ -87,9 +87,9 @@ public static function fromXML(DOMElement $xml): static /** * Convert this ECP RequestAuthentication to XML. * - * @param \DOMElement|null $parent The element we should append this element to. + * @param \Dom\Element|null $parent The element we should append this element to. */ - public function toXML(?DOMElement $parent = null): DOMElement + public function toXML(?Dom\Element $parent = null): Dom\Element { $e = $this->instantiateParentElement($parent); diff --git a/src/XML/ecp/Response.php b/src/XML/ecp/Response.php index 5d96484de..300a9cb74 100644 --- a/src/XML/ecp/Response.php +++ b/src/XML/ecp/Response.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\XML\ecp; -use DOMElement; +use Dom; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Exception\ProtocolViolationException; use SimpleSAML\SAML2\Type\SAMLAnyURIValue; @@ -50,14 +50,14 @@ public function getAssertionConsumerServiceURL(): SAMLAnyURIValue /** * Convert XML into a Response * - * @param \DOMElement $xml The XML element we should load + * @param \Dom\Element $xml The XML element we should load * * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong * @throws \SimpleSAML\XMLSchema\Exception\MissingAttributeException * if the supplied element is missing any of the mandatory attributes */ - 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); @@ -95,9 +95,9 @@ public static function fromXML(DOMElement $xml): static /** * Convert this ECP Response to XML. * - * @param \DOMElement|null $parent The element we should append this element to. + * @param \Dom\Element|null $parent The element we should append this element to. */ - public function toXML(?DOMElement $parent = null): DOMElement + public function toXML(?Dom\Element $parent = null): Dom\Element { $response = $this->instantiateParentElement($parent); diff --git a/src/XML/ecp/SubjectConfirmation.php b/src/XML/ecp/SubjectConfirmation.php index c13a11861..c7990cf8e 100644 --- a/src/XML/ecp/SubjectConfirmation.php +++ b/src/XML/ecp/SubjectConfirmation.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\XML\ecp; -use DOMElement; +use Dom; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Exception\ProtocolViolationException; use SimpleSAML\SAML2\Type\SAMLAnyURIValue; @@ -67,14 +67,14 @@ public function getSubjectConfirmationData(): ?SubjectConfirmationData /** * Convert XML into a SubjectConfirmation * - * @param \DOMElement $xml The XML element we should load + * @param \Dom\Element $xml The XML element we should load * * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong * @throws \SimpleSAML\XMLSchema\Exception\MissingAttributeException * if the supplied element is missing any of the mandatory attributes */ - public static function fromXML(DOMElement $xml): static + public static function fromXML(Dom\Element $xml): static { Assert::same($xml->localName, 'SubjectConfirmation', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, SubjectConfirmation::NS, InvalidDOMElementException::class); @@ -123,9 +123,9 @@ public static function fromXML(DOMElement $xml): static /** * Convert this ECP SubjectConfirmation to XML. * - * @param \DOMElement|null $parent The element we should append this element to. + * @param \Dom\Element|null $parent The element we should append this element to. */ - public function toXML(?DOMElement $parent = null): DOMElement + public function toXML(?Dom\Element $parent = null): Dom\Element { $e = $this->instantiateParentElement($parent); $e->setAttributeNS(C::NS_SOAP_ENV, 'SOAP-ENV:mustUnderstand', '1'); diff --git a/src/XML/emd/RepublishRequest.php b/src/XML/emd/RepublishRequest.php index ff260b873..95f80500d 100644 --- a/src/XML/emd/RepublishRequest.php +++ b/src/XML/emd/RepublishRequest.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\XML\emd; -use DOMElement; +use Dom; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Exception\ArrayValidationException; use SimpleSAML\SAML2\Type\SAMLAnyURIValue; @@ -51,14 +51,14 @@ public function getRepublishTarget(): RepublishTarget /** * Convert XML into a RepublishRequest * - * @param \DOMElement $xml The XML element we should load + * @param \Dom\Element $xml The XML element we should load * * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong * @throws \SimpleSAML\XMLSchema\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, 'RepublishRequest', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, RepublishRequest::NS, InvalidDOMElementException::class); @@ -78,9 +78,9 @@ public static function fromXML(DOMElement $xml): static /** * Convert this element to XML. * - * @param \DOMElement|null $parent The element we should append to. + * @param \Dom\Element|null $parent The element we should append to. */ - public function toXML(?DOMElement $parent = null): DOMElement + public function toXML(?Dom\Element $parent = null): Dom\Element { $e = $this->instantiateParentElement($parent); diff --git a/src/XML/init/RequestInitiator.php b/src/XML/init/RequestInitiator.php index 60caf9d70..3ad691a29 100644 --- a/src/XML/init/RequestInitiator.php +++ b/src/XML/init/RequestInitiator.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\XML\init; -use DOMElement; +use Dom; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Exception\ProtocolViolationException; use SimpleSAML\SAML2\Type\SAMLAnyURIValue; @@ -63,11 +63,11 @@ public function __construct( * * Note: this method cannot be used when extending this class, if the constructor has a different signature. * - * @param \DOMElement $xml The XML element we should load. + * @param \Dom\Element $xml The XML element we should load. * * @throws \InvalidArgumentException 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 { $qualifiedName = static::getClassName(static::class); Assert::eq( diff --git a/src/XML/md/AbstractEndpointType.php b/src/XML/md/AbstractEndpointType.php index ad2f98533..dfb49ea60 100644 --- a/src/XML/md/AbstractEndpointType.php +++ b/src/XML/md/AbstractEndpointType.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\XML\md; -use DOMElement; +use Dom; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Exception\ArrayValidationException; use SimpleSAML\SAML2\Type\SAMLAnyURIValue; @@ -110,14 +110,14 @@ public function getResponseLocation(): ?SAMLAnyURIValue * * Note: this method cannot be used when extending this class, if the constructor has a different signature. * - * @param \DOMElement $xml The XML element we should load. + * @param \Dom\Element $xml The XML element we should load. * * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong * @throws \SimpleSAML\XMLSchema\Exception\MissingAttributeException * if the supplied element is missing any of the mandatory attributes */ - public static function fromXML(DOMElement $xml): static + public static function fromXML(Dom\Element $xml): static { $qualifiedName = static::getClassName(static::class); Assert::eq( @@ -140,9 +140,9 @@ public static function fromXML(DOMElement $xml): static /** * Add this endpoint to an XML element. * - * @param \DOMElement $parent The element we should append this endpoint to. + * @param \Dom\Element $parent The element we should append this endpoint to. */ - public function toXML(?DOMElement $parent = null): DOMElement + public function toXML(?Dom\Element $parent = null): Dom\Element { $e = parent::instantiateParentElement($parent); diff --git a/src/XML/md/AbstractIndexedEndpointType.php b/src/XML/md/AbstractIndexedEndpointType.php index 6d54e7339..63f6c0821 100644 --- a/src/XML/md/AbstractIndexedEndpointType.php +++ b/src/XML/md/AbstractIndexedEndpointType.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\XML\md; -use DOMElement; +use Dom; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Exception\ArrayValidationException; use SimpleSAML\SAML2\Type\SAMLAnyURIValue; @@ -34,7 +34,7 @@ abstract class AbstractIndexedEndpointType extends AbstractEndpointType implemen * * Note: if you extend this class, the constructor must retain its signature. You cannot extend this class and * modify the signature of the constructor, unless you implement fromXML() yourself. This class provides - * static methods to get its properties from a given \DOMElement for your convenience. Look at the implementation + * static methods to get its properties from a given \Dom\Element for your convenience. Look at the implementation * of fromXML() to know how to use them. * * @param \SimpleSAML\XMLSchema\Type\UnsignedShortValue $index @@ -64,7 +64,7 @@ public function __construct( /** * Initialize an IndexedEndpointType. * - * @param \DOMElement $xml The XML element we should load. + * @param \Dom\Element $xml The XML element we should load. * @return static * * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException @@ -72,7 +72,7 @@ public function __construct( * @throws \SimpleSAML\XMLSchema\Exception\MissingAttributeException * if the supplied element is missing any of the mandatory attributes */ - public static function fromXML(DOMElement $xml): static + public static function fromXML(Dom\Element $xml): static { $qualifiedName = static::getClassName(static::class); Assert::eq( @@ -97,9 +97,9 @@ public static function fromXML(DOMElement $xml): static /** * Add this endpoint to an XML element. * - * @param \DOMElement $parent The element we should append this endpoint to. + * @param \Dom\Element $parent The element we should append this endpoint to. */ - public function toXML(?DOMElement $parent = null): DOMElement + public function toXML(?Dom\Element $parent = null): Dom\Element { $e = parent::instantiateParentElement($parent); $e->setAttribute('Binding', $this->getBinding()->getValue()); diff --git a/src/XML/md/AbstractLocalizedName.php b/src/XML/md/AbstractLocalizedName.php index ac3e22557..061222763 100644 --- a/src/XML/md/AbstractLocalizedName.php +++ b/src/XML/md/AbstractLocalizedName.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\XML\md; -use DOMElement; +use Dom; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Exception\ArrayValidationException; use SimpleSAML\SAML2\Type\SAMLStringValue; @@ -61,7 +61,7 @@ public function getLanguage(): LangValue * @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, static::getLocalName(), InvalidDOMElementException::class); Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class); @@ -80,7 +80,7 @@ public static function fromXML(DOMElement $xml): static /** */ - final public function toXML(?DOMElement $parent = null): DOMElement + final public function toXML(?Dom\Element $parent = null): Dom\Element { $e = $this->instantiateParentElement($parent); $e->setAttributeNS(C::NS_XML, 'xml:lang', $this->getLanguage()->getValue()); diff --git a/src/XML/md/AbstractLocalizedURI.php b/src/XML/md/AbstractLocalizedURI.php index 14cdae538..041431e20 100644 --- a/src/XML/md/AbstractLocalizedURI.php +++ b/src/XML/md/AbstractLocalizedURI.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\XML\md; -use DOMElement; +use Dom; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Constants as C; use SimpleSAML\SAML2\Type\SAMLAnyURIValue; @@ -47,7 +47,7 @@ final public function __construct( * @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, static::getLocalName(), InvalidDOMElementException::class); Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class); diff --git a/src/XML/md/AbstractMetadataDocument.php b/src/XML/md/AbstractMetadataDocument.php index e7bba485e..3b8fa53c9 100644 --- a/src/XML/md/AbstractMetadataDocument.php +++ b/src/XML/md/AbstractMetadataDocument.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\XML\md; -use DOMElement; +use Dom; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Exception\ProtocolViolationException; use SimpleSAML\SAML2\Type\SAMLDateTimeValue; @@ -127,7 +127,7 @@ public function getCacheDuration(): ?DurationValue /** */ - protected function getOriginalXML(): DOMElement + protected function getOriginalXML(): Dom\Element { return $this->isSigned() ? $this->getXML() : $this->toUnsignedXML(); } @@ -135,7 +135,7 @@ protected function getOriginalXML(): DOMElement /** */ - public function toUnsignedXML(?DOMElement $parent = null): DOMElement + public function toUnsignedXML(?Dom\Element $parent = null): Dom\Element { $e = $this->instantiateParentElement($parent); diff --git a/src/XML/md/AbstractRoleDescriptor.php b/src/XML/md/AbstractRoleDescriptor.php index 1c3c0a602..5fccce60d 100644 --- a/src/XML/md/AbstractRoleDescriptor.php +++ b/src/XML/md/AbstractRoleDescriptor.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\XML\md; -use DOMElement; +use Dom; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Constants as C; use SimpleSAML\SAML2\Type\SAMLAnyURIListValue; @@ -109,7 +109,7 @@ public function getXsiType(): QNameValue * @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, 'RoleDescriptor', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, C::NS_MD, InvalidDOMElementException::class); diff --git a/src/XML/md/AbstractRoleDescriptorType.php b/src/XML/md/AbstractRoleDescriptorType.php index 5d3d78710..57af83239 100644 --- a/src/XML/md/AbstractRoleDescriptorType.php +++ b/src/XML/md/AbstractRoleDescriptorType.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\XML\md; -use DOMElement; +use Dom; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Constants as C; use SimpleSAML\SAML2\Type\SAMLAnyURIListValue; @@ -139,7 +139,7 @@ public function getKeyDescriptor(): array /** * Add this RoleDescriptor to an EntityDescriptor. */ - public function toUnsignedXML(?DOMElement $parent = null): DOMElement + public function toUnsignedXML(?Dom\Element $parent = null): Dom\Element { $e = parent::toUnsignedXML($parent); $e->setAttribute('protocolSupportEnumeration', $this->getProtocolSupportEnumeration()->getValue()); diff --git a/src/XML/md/AbstractSSODescriptor.php b/src/XML/md/AbstractSSODescriptor.php index d922efc50..abd97ac67 100644 --- a/src/XML/md/AbstractSSODescriptor.php +++ b/src/XML/md/AbstractSSODescriptor.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\XML\md; -use DOMElement; +use Dom; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Exception\ProtocolViolationException; use SimpleSAML\SAML2\Type\SAMLAnyURIListValue; @@ -146,7 +146,7 @@ public function getNameIDFormat(): array /** * Add this SSODescriptorType to an EntityDescriptor. */ - public function toUnsignedXML(?DOMElement $parent = null): DOMElement + public function toUnsignedXML(?Dom\Element $parent = null): Dom\Element { $e = parent::toUnsignedXML($parent); diff --git a/src/XML/md/AbstractSignedMdElement.php b/src/XML/md/AbstractSignedMdElement.php index 5811492a7..94f89c8e9 100644 --- a/src/XML/md/AbstractSignedMdElement.php +++ b/src/XML/md/AbstractSignedMdElement.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\XML\md; -use DOMElement; +use Dom; use SimpleSAML\SAML2\XML\CanonicalizableElementTrait; use SimpleSAML\SAML2\XML\SignableElementTrait; use SimpleSAML\SAML2\XML\SignedElementTrait; @@ -34,13 +34,13 @@ abstract class AbstractSignedMdElement extends AbstractMdElement implements /** * The original signed XML */ - protected DOMElement $xml; + protected Dom\Element $xml; /** * Get the XML element. */ - public function getXML(): DOMElement + public function getXML(): Dom\Element { return $this->xml; } @@ -49,7 +49,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; } @@ -58,7 +58,7 @@ protected function setXML(DOMElement $xml): void /** * @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 @@ -96,5 +96,5 @@ public function toXML(?DOMElement $parent = null): DOMElement /** */ - abstract public function toUnsignedXML(?DOMElement $parent = null): DOMElement; + abstract public function toUnsignedXML(?Dom\Element $parent = null): Dom\Element; } diff --git a/src/XML/md/AdditionalMetadataLocation.php b/src/XML/md/AdditionalMetadataLocation.php index e2a10ca7b..101824f78 100644 --- a/src/XML/md/AdditionalMetadataLocation.php +++ b/src/XML/md/AdditionalMetadataLocation.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\XML\md; -use DOMElement; +use Dom; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Type\SAMLAnyURIValue; use SimpleSAML\XML\SchemaValidatableElementInterface; @@ -64,7 +64,7 @@ public function getLocation(): SAMLAnyURIValue * @throws \SimpleSAML\XMLSchema\Exception\MissingAttributeException * if the supplied element is missing any of the mandatory attributes */ - public static function fromXML(DOMElement $xml): static + public static function fromXML(Dom\Element $xml): static { Assert::same($xml->localName, 'AdditionalMetadataLocation', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, AdditionalMetadataLocation::NS, InvalidDOMElementException::class); @@ -79,7 +79,7 @@ public static function fromXML(DOMElement $xml): static /** * Convert this AdditionalMetadataLocation to XML. */ - public function toXML(?DOMElement $parent = null): DOMElement + public function toXML(?Dom\Element $parent = null): Dom\Element { $e = $this->instantiateParentElement($parent); $e->textContent = $this->getLocation()->getValue(); diff --git a/src/XML/md/AffiliationDescriptor.php b/src/XML/md/AffiliationDescriptor.php index 9bbd29ae1..9a03174b4 100644 --- a/src/XML/md/AffiliationDescriptor.php +++ b/src/XML/md/AffiliationDescriptor.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\XML\md; -use DOMElement; +use Dom; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Constants as C; use SimpleSAML\SAML2\Type\EntityIDValue; @@ -115,7 +115,7 @@ public function getKeyDescriptor(): array * @throws \SimpleSAML\XMLSchema\Exception\TooManyElementsException * if too many child-elements of a type are specified */ - public static function fromXML(DOMElement $xml): static + public static function fromXML(Dom\Element $xml): static { Assert::same($xml->localName, 'AffiliationDescriptor', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, AffiliationDescriptor::NS, InvalidDOMElementException::class); @@ -172,7 +172,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. */ - public function toUnsignedXML(?DOMElement $parent = null): DOMElement + public function toUnsignedXML(?Dom\Element $parent = null): Dom\Element { $e = parent::toUnsignedXML($parent); $e->setAttribute('affiliationOwnerID', $this->getAffiliationOwnerId()->getValue()); diff --git a/src/XML/md/AttributeAuthorityDescriptor.php b/src/XML/md/AttributeAuthorityDescriptor.php index b9c5dd5a5..bb6e37504 100644 --- a/src/XML/md/AttributeAuthorityDescriptor.php +++ b/src/XML/md/AttributeAuthorityDescriptor.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\XML\md; -use DOMElement; +use Dom; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Type\SAMLAnyURIListValue; use SimpleSAML\SAML2\Type\SAMLAnyURIValue; @@ -171,7 +171,7 @@ public function getAttributes(): array * @throws \SimpleSAML\XMLSchema\Exception\TooManyElementsException * if too many child-elements of a type are specified */ - public static function fromXML(DOMElement $xml): static + public static function fromXML(Dom\Element $xml): static { Assert::same($xml->localName, 'AttributeAuthorityDescriptor', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, AttributeAuthorityDescriptor::NS, InvalidDOMElementException::class); @@ -242,7 +242,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. */ - public function toUnsignedXML(?DOMElement $parent = null): DOMElement + public function toUnsignedXML(?Dom\Element $parent = null): Dom\Element { $e = parent::toUnsignedXML($parent); diff --git a/src/XML/md/AttributeConsumingService.php b/src/XML/md/AttributeConsumingService.php index a3ed4860d..c02726ca0 100644 --- a/src/XML/md/AttributeConsumingService.php +++ b/src/XML/md/AttributeConsumingService.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\XML\md; -use DOMElement; +use Dom; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\XML\Constants as C; use SimpleSAML\XML\SchemaValidatableElementInterface; @@ -120,7 +120,7 @@ public function getRequestedAttribute(): array * @throws \SimpleSAML\XMLSchema\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, 'AttributeConsumingService', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, AttributeConsumingService::NS, InvalidDOMElementException::class); @@ -150,7 +150,7 @@ public static function fromXML(DOMElement $xml): static /** * Convert to \DOMElement. */ - public function toXML(?DOMElement $parent = null): DOMElement + public function toXML(?Dom\Element $parent = null): Dom\Element { $e = $this->instantiateParentElement($parent); $e->setAttribute('index', $this->getIndex()->getValue()); diff --git a/src/XML/md/AuthnAuthorityDescriptor.php b/src/XML/md/AuthnAuthorityDescriptor.php index f78877aa2..3774418a2 100644 --- a/src/XML/md/AuthnAuthorityDescriptor.php +++ b/src/XML/md/AuthnAuthorityDescriptor.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\XML\md; -use DOMElement; +use Dom; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Type\SAMLAnyURIListValue; use SimpleSAML\SAML2\Type\SAMLAnyURIValue; @@ -134,7 +134,7 @@ public function getNameIDFormat(): array * @throws \SimpleSAML\XMLSchema\Exception\TooManyElementsException * if too many child-elements of a type are specified */ - public static function fromXML(DOMElement $xml): static + public static function fromXML(Dom\Element $xml): static { Assert::same($xml->localName, 'AuthnAuthorityDescriptor', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, AuthnAuthorityDescriptor::NS, InvalidDOMElementException::class); @@ -197,7 +197,7 @@ public static function fromXML(DOMElement $xml): static * * @throws \Exception */ - public function toUnsignedXML(?DOMElement $parent = null): DOMElement + public function toUnsignedXML(?Dom\Element $parent = null): Dom\Element { $e = parent::toUnsignedXML($parent); diff --git a/src/XML/md/ContactPerson.php b/src/XML/md/ContactPerson.php index 0a0742ae6..36740c034 100644 --- a/src/XML/md/ContactPerson.php +++ b/src/XML/md/ContactPerson.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\XML\md; -use DOMElement; +use Dom; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Exception\ArrayValidationException; use SimpleSAML\SAML2\Type\SAMLStringValue; @@ -167,7 +167,7 @@ public function getTelephoneNumber(): array * @throws \SimpleSAML\XMLSchema\Exception\TooManyElementsException * if too many child-elements of a type are specified */ - public static function fromXML(DOMElement $xml): static + public static function fromXML(Dom\Element $xml): static { Assert::same($xml->localName, 'ContactPerson', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, ContactPerson::NS, InvalidDOMElementException::class); @@ -205,7 +205,7 @@ public static function fromXML(DOMElement $xml): static /** * Convert this ContactPerson 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/XML/md/EntitiesDescriptor.php b/src/XML/md/EntitiesDescriptor.php index 1fedfd91f..a1b2232cb 100644 --- a/src/XML/md/EntitiesDescriptor.php +++ b/src/XML/md/EntitiesDescriptor.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\XML\md; -use DOMElement; +use Dom; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Exception\ProtocolViolationException; use SimpleSAML\SAML2\Type\SAMLDateTimeValue; @@ -211,7 +211,7 @@ public function getName(): ?SAMLStringValue * @throws \SimpleSAML\XMLSchema\Exception\TooManyElementsException * if too many child-elements of a type are specified */ - public static function fromXML(DOMElement $xml): static + public static function fromXML(Dom\Element $xml): static { Assert::same($xml->localName, 'EntitiesDescriptor', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, EntitiesDescriptor::NS, InvalidDOMElementException::class); @@ -263,7 +263,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. */ - public function toUnsignedXML(?DOMElement $parent = null): DOMElement + public function toUnsignedXML(?Dom\Element $parent = null): Dom\Element { $e = parent::toUnsignedXML($parent); diff --git a/src/XML/md/EntityDescriptor.php b/src/XML/md/EntityDescriptor.php index c5dd2a97a..7a7c6aedc 100644 --- a/src/XML/md/EntityDescriptor.php +++ b/src/XML/md/EntityDescriptor.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\XML\md; -use DOMElement; +use Dom; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Constants as C; use SimpleSAML\SAML2\Exception\ProtocolViolationException; @@ -111,7 +111,7 @@ public function __construct( * @throws \SimpleSAML\XMLSchema\Exception\TooManyElementsException * if too many child-elements of a type are specified */ - public static function fromXML(DOMElement $xml): static + public static function fromXML(Dom\Element $xml): static { Assert::same($xml->localName, 'EntityDescriptor', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, EntityDescriptor::NS, InvalidDOMElementException::class); @@ -129,7 +129,7 @@ public static function fromXML(DOMElement $xml): static $additionalMetadataLocation = []; foreach ($xml->childNodes as $node) { if ( - !($node instanceof DOMElement) + !($node instanceof Dom\Element) || ($node->namespaceURI !== C::NS_MD) ) { continue; @@ -280,7 +280,7 @@ public function getAdditionalMetadataLocation(): array * Convert this assertion to an unsigned XML document. * This method does not sign the resulting XML document. */ - public function toUnsignedXML(?DOMElement $parent = null): DOMElement + public function toUnsignedXML(?Dom\Element $parent = null): Dom\Element { $e = parent::toUnsignedXML($parent); $e->setAttribute('entityID', $this->getEntityId()->getValue()); diff --git a/src/XML/md/Extensions.php b/src/XML/md/Extensions.php index ea297bad3..a07353aa9 100644 --- a/src/XML/md/Extensions.php +++ b/src/XML/md/Extensions.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\XML\md; -use DOMElement; +use Dom; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Utils\XPath; use SimpleSAML\SAML2\XML\alg\AbstractAlgElement as ALG; @@ -66,7 +66,7 @@ final class Extensions extends AbstractMdElement implements SchemaValidatableEle * @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::eq( $xml->namespaceURI, @@ -112,7 +112,7 @@ public static function fromXML(DOMElement $xml): static ], ]; - /** @var \DOMElement $node */ + /** @var \Dom\Element $node */ foreach (XPath::xpQuery($xml, './*', XPath::getXPath($xml)) as $node) { if ( array_key_exists($node->namespaceURI, $supported) diff --git a/src/XML/md/IDPSSODescriptor.php b/src/XML/md/IDPSSODescriptor.php index f6819784f..47dd0618f 100644 --- a/src/XML/md/IDPSSODescriptor.php +++ b/src/XML/md/IDPSSODescriptor.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\XML\md; -use DOMElement; +use Dom; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Type\SAMLAnyURIListValue; use SimpleSAML\SAML2\Type\SAMLAnyURIValue; @@ -198,7 +198,7 @@ public function getSupportedAttribute(): array * @throws \SimpleSAML\XMLSchema\Exception\TooManyElementsException * if too many child-elements of a type are specified */ - public static function fromXML(DOMElement $xml): static + public static function fromXML(Dom\Element $xml): static { Assert::same($xml->localName, 'IDPSSODescriptor', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, IDPSSODescriptor::NS, InvalidDOMElementException::class); @@ -261,7 +261,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. */ - public function toUnsignedXML(?DOMElement $parent = null): DOMElement + public function toUnsignedXML(?Dom\Element $parent = null): Dom\Element { $e = parent::toUnsignedXML($parent); diff --git a/src/XML/md/KeyDescriptor.php b/src/XML/md/KeyDescriptor.php index 4f2910ae3..893fcf734 100644 --- a/src/XML/md/KeyDescriptor.php +++ b/src/XML/md/KeyDescriptor.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\XML\md; -use DOMElement; +use Dom; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Type\KeyTypesValue; use SimpleSAML\XML\Constants as C; @@ -87,7 +87,7 @@ public function getEncryptionMethod(): array * @throws \SimpleSAML\XMLSchema\Exception\TooManyElementsException * if too many child-elements of a type are specified */ - public static function fromXML(DOMElement $xml): static + public static function fromXML(Dom\Element $xml): static { Assert::same($xml->localName, 'KeyDescriptor', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, KeyDescriptor::NS, InvalidDOMElementException::class); @@ -107,7 +107,7 @@ public static function fromXML(DOMElement $xml): static /** * Convert this KeyDescriptor 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/XML/md/Organization.php b/src/XML/md/Organization.php index 96a6bc2c8..d1ece94e9 100644 --- a/src/XML/md/Organization.php +++ b/src/XML/md/Organization.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\XML\md; -use DOMElement; +use Dom; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Exception\ArrayValidationException; use SimpleSAML\SAML2\Exception\ProtocolViolationException; @@ -119,7 +119,7 @@ public function getOrganizationURL(): array * @throws \SimpleSAML\XMLSchema\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, 'Organization', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, Organization::NS, InvalidDOMElementException::class); @@ -159,7 +159,7 @@ public static function fromXML(DOMElement $xml): static /** * Convert this Organization 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/XML/md/PDPDescriptor.php b/src/XML/md/PDPDescriptor.php index 1d1199b90..37ed5a117 100644 --- a/src/XML/md/PDPDescriptor.php +++ b/src/XML/md/PDPDescriptor.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\XML\md; -use DOMElement; +use Dom; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Type\SAMLAnyURIListValue; use SimpleSAML\SAML2\Type\SAMLAnyURIValue; @@ -134,7 +134,7 @@ public function getNameIDFormat(): array * @throws \SimpleSAML\XMLSchema\Exception\TooManyElementsException * if too many child-elements of a type are specified */ - public static function fromXML(DOMElement $xml): static + public static function fromXML(Dom\Element $xml): static { Assert::same($xml->localName, 'PDPDescriptor', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, PDPDescriptor::NS, InvalidDOMElementException::class); @@ -188,7 +188,7 @@ public static function fromXML(DOMElement $xml): static * * @throws \Exception */ - public function toUnsignedXML(?DOMElement $parent = null): DOMElement + public function toUnsignedXML(?Dom\Element $parent = null): Dom\Element { $e = parent::toUnsignedXML($parent); diff --git a/src/XML/md/RequestedAttribute.php b/src/XML/md/RequestedAttribute.php index 590ebf6d5..56fd7bc0e 100644 --- a/src/XML/md/RequestedAttribute.php +++ b/src/XML/md/RequestedAttribute.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\XML\md; -use DOMElement; +use Dom; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Type\SAMLAnyURIValue; use SimpleSAML\SAML2\Type\SAMLStringValue; @@ -66,7 +66,7 @@ public function getIsRequired(): ?BooleanValue * @throws \SimpleSAML\XMLSchema\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, 'RequestedAttribute', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, RequestedAttribute::NS, InvalidDOMElementException::class); @@ -84,7 +84,7 @@ public static function fromXML(DOMElement $xml): static /** * Convert this RequestedAttribute 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/XML/md/SPSSODescriptor.php b/src/XML/md/SPSSODescriptor.php index edb3ea244..d809ccf9d 100644 --- a/src/XML/md/SPSSODescriptor.php +++ b/src/XML/md/SPSSODescriptor.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\XML\md; -use DOMElement; +use Dom; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Type\SAMLAnyURIListValue; use SimpleSAML\SAML2\Type\SAMLAnyURIValue; @@ -172,7 +172,7 @@ public function getAttributeConsumingService(): array * @throws \SimpleSAML\XMLSchema\Exception\TooManyElementsException * if too many child-elements of a type are specified */ - public static function fromXML(DOMElement $xml): static + public static function fromXML(Dom\Element $xml): static { Assert::same($xml->localName, 'SPSSODescriptor', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, SPSSODescriptor::NS, InvalidDOMElementException::class); @@ -234,7 +234,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. */ - public function toUnsignedXML(?DOMElement $parent = null): DOMElement + public function toUnsignedXML(?Dom\Element $parent = null): Dom\Element { $e = parent::toUnsignedXML($parent); diff --git a/src/XML/md/UnknownRoleDescriptor.php b/src/XML/md/UnknownRoleDescriptor.php index d2d3fe6e8..dd6ba3e94 100644 --- a/src/XML/md/UnknownRoleDescriptor.php +++ b/src/XML/md/UnknownRoleDescriptor.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\XML\md; -use DOMElement; +use Dom; use SimpleSAML\SAML2\Type\SAMLAnyURIListValue; use SimpleSAML\SAML2\Type\SAMLAnyURIValue; use SimpleSAML\SAML2\Type\SAMLDateTimeValue; @@ -87,7 +87,7 @@ public function getRawRoleDescriptor(): Chunk /** * Convert this RoleDescriptor to XML. */ - public function toXML(?DOMElement $parent = null): DOMElement + public function toXML(?Dom\Element $parent = null): Dom\Element { return $this->getRawRoleDescriptor()->toXML($parent); } diff --git a/src/XML/mdattr/EntityAttributes.php b/src/XML/mdattr/EntityAttributes.php index ed8ecf4c1..94dc5c293 100644 --- a/src/XML/mdattr/EntityAttributes.php +++ b/src/XML/mdattr/EntityAttributes.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\XML\mdattr; -use DOMElement; +use Dom; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Constants as C; use SimpleSAML\SAML2\Exception\ProtocolViolationException; @@ -134,14 +134,14 @@ public function addChild($child): void * @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, 'EntityAttributes', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, EntityAttributes::NS, InvalidDOMElementException::class); $children = []; foreach ($xml->childNodes as $node) { - if ($node instanceof DOMElement && $node->namespaceURI === C::NS_SAML) { + if ($node instanceof Dom\Element && $node->namespaceURI === C::NS_SAML) { switch ($node->localName) { case 'Assertion': $children[] = Assertion::fromXML($node); @@ -162,7 +162,7 @@ public static function fromXML(DOMElement $xml): static /** * Convert this EntityAttributes 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/XML/mdrpi/Publication.php b/src/XML/mdrpi/Publication.php index 2a0cfef4b..c7fc4d96d 100644 --- a/src/XML/mdrpi/Publication.php +++ b/src/XML/mdrpi/Publication.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\XML\mdrpi; -use DOMElement; +use Dom; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Exception\ArrayValidationException; use SimpleSAML\SAML2\Type\SAMLDateTimeValue; @@ -83,7 +83,7 @@ public function getPublicationId(): ?SAMLStringValue * @throws \SimpleSAML\XMLSchema\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, 'Publication', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, Publication::NS, InvalidDOMElementException::class); @@ -99,7 +99,7 @@ public static function fromXML(DOMElement $xml): static /** * Convert this element to XML. */ - public function toXML(?DOMElement $parent = null): DOMElement + public function toXML(?Dom\Element $parent = null): Dom\Element { $e = $this->instantiateParentElement($parent); $e->setAttribute('publisher', $this->getPublisher()->getValue()); diff --git a/src/XML/mdrpi/PublicationInfo.php b/src/XML/mdrpi/PublicationInfo.php index 8038ed958..f6b9bc6c1 100644 --- a/src/XML/mdrpi/PublicationInfo.php +++ b/src/XML/mdrpi/PublicationInfo.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\XML\mdrpi; -use DOMElement; +use Dom; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Constants as C; use SimpleSAML\SAML2\Exception\ArrayValidationException; @@ -120,7 +120,7 @@ public function getUsagePolicy(): array * @throws \SimpleSAML\XMLSchema\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, 'PublicationInfo', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, PublicationInfo::NS, InvalidDOMElementException::class); @@ -137,7 +137,7 @@ public static function fromXML(DOMElement $xml): static /** * Convert this element to XML. */ - public function toXML(?DOMElement $parent = null): DOMElement + public function toXML(?Dom\Element $parent = null): Dom\Element { $e = $this->instantiateParentElement($parent); $e->setAttribute('publisher', $this->getPublisher()->getValue()); diff --git a/src/XML/mdrpi/PublicationPath.php b/src/XML/mdrpi/PublicationPath.php index 9b0070d69..62483ff1e 100644 --- a/src/XML/mdrpi/PublicationPath.php +++ b/src/XML/mdrpi/PublicationPath.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\XML\mdrpi; -use DOMElement; +use Dom; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Exception\ArrayValidationException; use SimpleSAML\XML\ArrayizableElementInterface; @@ -63,7 +63,7 @@ public function isEmptyElement(): bool /** * Convert XML into a PublicationPath * - * @param \DOMElement $xml The XML element we should load + * @param \Dom\Element $xml The XML element we should load * @return static * * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException @@ -71,7 +71,7 @@ public function isEmptyElement(): bool * @throws \SimpleSAML\XMLSchema\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, 'PublicationPath', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, PublicationPath::NS, InvalidDOMElementException::class); @@ -85,7 +85,7 @@ public static function fromXML(DOMElement $xml): static /** * Convert this element 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/XML/mdrpi/RegistrationInfo.php b/src/XML/mdrpi/RegistrationInfo.php index 9c1a0a06b..2d19b0621 100644 --- a/src/XML/mdrpi/RegistrationInfo.php +++ b/src/XML/mdrpi/RegistrationInfo.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\XML\mdrpi; -use DOMElement; +use Dom; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Constants as C; use SimpleSAML\SAML2\Exception\ArrayValidationException; @@ -105,7 +105,7 @@ public function getRegistrationPolicy(): array * @throws \SimpleSAML\XMLSchema\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, 'RegistrationInfo', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, RegistrationInfo::NS, InvalidDOMElementException::class); @@ -121,7 +121,7 @@ public static function fromXML(DOMElement $xml): static /** * Convert this element to XML. */ - public function toXML(?DOMElement $parent = null): DOMElement + public function toXML(?Dom\Element $parent = null): Dom\Element { $e = $this->instantiateParentElement($parent); $e->setAttribute('registrationAuthority', $this->getRegistrationAuthority()->getValue()); diff --git a/src/XML/mdui/DiscoHints.php b/src/XML/mdui/DiscoHints.php index 20deac33e..b1f36e1bf 100644 --- a/src/XML/mdui/DiscoHints.php +++ b/src/XML/mdui/DiscoHints.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\XML\mdui; -use DOMElement; +use Dom; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Exception\ArrayValidationException; use SimpleSAML\SAML2\Type\CIDRValue; @@ -129,7 +129,7 @@ public function isEmptyElement(): bool * @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, 'DiscoHints', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, DiscoHints::NS, InvalidDOMElementException::class); @@ -146,7 +146,7 @@ public static function fromXML(DOMElement $xml): static /** * Convert this DiscoHints 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/XML/mdui/Keywords.php b/src/XML/mdui/Keywords.php index 133274f23..ca8ecef28 100644 --- a/src/XML/mdui/Keywords.php +++ b/src/XML/mdui/Keywords.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\XML\mdui; -use DOMElement; +use Dom; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Exception\ArrayValidationException; use SimpleSAML\SAML2\Exception\ProtocolViolationException; @@ -68,7 +68,7 @@ public function getLanguage(): LangValue * @throws \SimpleSAML\XMLSchema\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, 'Keywords', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, Keywords::NS, InvalidDOMElementException::class); @@ -86,7 +86,7 @@ public static function fromXML(DOMElement $xml): static * * @throws \Exception */ - public function toXML(?DOMElement $parent = null): DOMElement + public function toXML(?Dom\Element $parent = null): Dom\Element { $e = $this->instantiateParentElement($parent); $e->setAttribute('xml:lang', $this->getLanguage()->getValue()); diff --git a/src/XML/mdui/Logo.php b/src/XML/mdui/Logo.php index 4166107c3..a4b064456 100644 --- a/src/XML/mdui/Logo.php +++ b/src/XML/mdui/Logo.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\XML\mdui; -use DOMElement; +use Dom; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Exception\ArrayValidationException; use SimpleSAML\SAML2\Exception\ProtocolViolationException; @@ -111,7 +111,7 @@ public function getWidth(): PositiveIntegerValue * @throws \SimpleSAML\XMLSchema\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, 'Logo', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, Logo::NS, InvalidDOMElementException::class); @@ -129,7 +129,7 @@ public static function fromXML(DOMElement $xml): static /** * Convert this Logo to XML. */ - public function toXML(?DOMElement $parent = null): DOMElement + public function toXML(?Dom\Element $parent = null): Dom\Element { $e = $this->instantiateParentElement($parent); $e->textContent = $this->getContent()->getValue(); diff --git a/src/XML/mdui/UIInfo.php b/src/XML/mdui/UIInfo.php index 4043eb7b0..17ab0ce46 100644 --- a/src/XML/mdui/UIInfo.php +++ b/src/XML/mdui/UIInfo.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\XML\mdui; -use DOMElement; +use Dom; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Exception\ArrayValidationException; use SimpleSAML\SAML2\Exception\ProtocolViolationException; @@ -268,7 +268,7 @@ function ($elt) { * @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, 'UIInfo', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, UIInfo::NS, InvalidDOMElementException::class); @@ -296,7 +296,7 @@ public static function fromXML(DOMElement $xml): static /** * Convert this UIInfo 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/XML/saml/AbstractBaseID.php b/src/XML/saml/AbstractBaseID.php index 4399b3037..92ccb4b65 100644 --- a/src/XML/saml/AbstractBaseID.php +++ b/src/XML/saml/AbstractBaseID.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\XML\saml; -use DOMElement; +use Dom; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Constants as C; use SimpleSAML\SAML2\Type\SAMLStringValue; @@ -72,7 +72,7 @@ public function getXsiType(): QNameValue * @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, 'BaseID', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, C::NS_SAML, InvalidDOMElementException::class); @@ -108,7 +108,7 @@ public static function fromXML(DOMElement $xml): static /** * Convert this BaseID to XML. */ - public function toXML(?DOMElement $parent = null): DOMElement + public function toXML(?Dom\Element $parent = null): Dom\Element { $e = parent::toXML($parent); $e->setAttributeNS( diff --git a/src/XML/saml/AbstractBaseIDType.php b/src/XML/saml/AbstractBaseIDType.php index 41930ef2f..d7afc43fa 100644 --- a/src/XML/saml/AbstractBaseIDType.php +++ b/src/XML/saml/AbstractBaseIDType.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\XML\saml; -use DOMElement; +use Dom; use SimpleSAML\SAML2\Type\SAMLStringValue; /** @@ -37,7 +37,7 @@ protected function __construct( /** * Convert this BaseID 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/XML/saml/AbstractCondition.php b/src/XML/saml/AbstractCondition.php index 49c9e35a0..9f61255c9 100644 --- a/src/XML/saml/AbstractCondition.php +++ b/src/XML/saml/AbstractCondition.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\XML\saml; -use DOMElement; +use Dom; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Constants as C; use SimpleSAML\SAML2\Utils; @@ -61,7 +61,7 @@ public function getXsiType(): QNameValue * @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::same($xml->namespaceURI, C::NS_SAML, InvalidDOMElementException::class); @@ -92,7 +92,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); $e->setAttributeNS( diff --git a/src/XML/saml/AbstractStatement.php b/src/XML/saml/AbstractStatement.php index 5fb6c194b..e2a1fcecf 100644 --- a/src/XML/saml/AbstractStatement.php +++ b/src/XML/saml/AbstractStatement.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\XML\saml; -use DOMElement; +use Dom; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Constants as C; use SimpleSAML\SAML2\Utils; @@ -61,7 +61,7 @@ public function getXsiType(): QNameValue * @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::same($xml->namespaceURI, C::NS_SAML, InvalidDOMElementException::class); @@ -92,7 +92,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); $e->setAttributeNS( diff --git a/src/XML/saml/AbstractSubjectConfirmationData.php b/src/XML/saml/AbstractSubjectConfirmationData.php index 5b84cb3e3..218bfea1f 100644 --- a/src/XML/saml/AbstractSubjectConfirmationData.php +++ b/src/XML/saml/AbstractSubjectConfirmationData.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\XML\saml; -use DOMElement; +use Dom; use SimpleSAML\Assert\AssertionFailedException; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Constants as C; @@ -172,7 +172,7 @@ public function isEmptyElement(): bool /** * Convert this element 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/XML/saml/Action.php b/src/XML/saml/Action.php index 093f9cb7e..3a1ae8939 100644 --- a/src/XML/saml/Action.php +++ b/src/XML/saml/Action.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\XML\saml; -use DOMElement; +use Dom; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Constants as C; use SimpleSAML\SAML2\Exception\ProtocolViolationException; @@ -88,7 +88,7 @@ public function getNamespace(): SAMLAnyURIValue * @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, static::getLocalName(), InvalidDOMElementException::class); Assert::same($xml->namespaceURI, Action::NS, InvalidDOMElementException::class); @@ -103,7 +103,7 @@ public static function fromXML(DOMElement $xml): static /** * Convert this Action 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/XML/saml/Advice.php b/src/XML/saml/Advice.php index 14e9e3b8f..bb077ae26 100644 --- a/src/XML/saml/Advice.php +++ b/src/XML/saml/Advice.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\XML\saml; -use DOMElement; +use Dom; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Constants as C; use SimpleSAML\XML\ExtendableElementTrait; @@ -111,7 +111,7 @@ public function getEncryptedAssertion(): 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 { $qualifiedName = static::getClassName(static::class); Assert::eq( @@ -139,7 +139,7 @@ public static function fromXML(DOMElement $xml): static /** * Convert this Advince 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/XML/saml/Assertion.php b/src/XML/saml/Assertion.php index 0d9224936..c1a9d37d8 100644 --- a/src/XML/saml/Assertion.php +++ b/src/XML/saml/Assertion.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\XML\saml; -use DOMElement; +use Dom; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Constants as C; use SimpleSAML\SAML2\Exception\Protocol\RequestVersionTooHighException; @@ -64,7 +64,7 @@ final class Assertion extends AbstractSamlElement implements /** * The original signed XML */ - protected DOMElement $xml; + protected Dom\Element $xml; /** @@ -230,7 +230,7 @@ public function wasSignedAtConstruction(): bool /** * Get the XML element. */ - public function getXML(): DOMElement + public function getXML(): Dom\Element { return $this->xml; } @@ -239,7 +239,7 @@ public function getXML(): DOMElement /** * Set the XML element. */ - private function setXML(DOMElement $xml): void + private function setXML(Dom\Element $xml): void { $this->xml = $xml; } @@ -247,7 +247,7 @@ private function setXML(DOMElement $xml): void /** */ - protected function getOriginalXML(): DOMElement + protected function getOriginalXML(): Dom\Element { return $this->xml ?? $this->toUnsignedXML(); } @@ -278,7 +278,7 @@ public function getEncryptionBackend(): ?EncryptionBackend * if too many child-elements of a type are specified * @throws \Exception */ - public static function fromXML(DOMElement $xml): static + public static function fromXML(Dom\Element $xml): static { Assert::same($xml->localName, 'Assertion', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, Assertion::NS, InvalidDOMElementException::class); @@ -337,7 +337,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); @@ -362,7 +362,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/XML/saml/Attribute.php b/src/XML/saml/Attribute.php index b3efdd50b..519bb89b7 100644 --- a/src/XML/saml/Attribute.php +++ b/src/XML/saml/Attribute.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\XML\saml; -use DOMElement; +use Dom; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Constants as C; use SimpleSAML\SAML2\Exception\ProtocolViolationException; @@ -169,7 +169,7 @@ public function getEncryptionBackend(): ?EncryptionBackend * @throws \SimpleSAML\XMLSchema\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, 'Attribute', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, Attribute::NS, InvalidDOMElementException::class); @@ -187,7 +187,7 @@ public static function fromXML(DOMElement $xml): static /** * Convert this Attribute to XML. */ - public function toXML(?DOMElement $parent = null): DOMElement + public function toXML(?Dom\Element $parent = null): Dom\Element { $e = $this->instantiateParentElement($parent); $e->setAttribute('Name', strval($this->getName())); diff --git a/src/XML/saml/AttributeStatement.php b/src/XML/saml/AttributeStatement.php index 4c194adea..a283a3742 100644 --- a/src/XML/saml/AttributeStatement.php +++ b/src/XML/saml/AttributeStatement.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\XML\saml; -use DOMElement; +use Dom; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\XML\Constants as C; use SimpleSAML\XML\SchemaValidatableElementInterface; @@ -69,7 +69,7 @@ public function hasEncryptedAttributes(): bool * @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, 'AttributeStatement', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, AttributeStatement::NS, InvalidDOMElementException::class); @@ -84,7 +84,7 @@ public static function fromXML(DOMElement $xml): static /** * Convert this Attribute 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/XML/saml/AttributeValue.php b/src/XML/saml/AttributeValue.php index 79f658f49..0937483a7 100644 --- a/src/XML/saml/AttributeValue.php +++ b/src/XML/saml/AttributeValue.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\XML\saml; -use DOMElement; +use Dom; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Exception\RuntimeException; use SimpleSAML\XML\AbstractElement; @@ -89,7 +89,7 @@ public function getValue(): ValueTypeInterface|AbstractElement|null * @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, static::getLocalName(), InvalidDOMElementException::class); Assert::same($xml->namespaceURI, AttributeValue::NS, InvalidDOMElementException::class); @@ -134,7 +134,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/XML/saml/AudienceRestriction.php b/src/XML/saml/AudienceRestriction.php index f5d1d11fd..4721acfa3 100644 --- a/src/XML/saml/AudienceRestriction.php +++ b/src/XML/saml/AudienceRestriction.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\XML\saml; -use DOMElement; +use Dom; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\XML\Constants as C; use SimpleSAML\XML\SchemaValidatableElementInterface; @@ -53,7 +53,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, 'AudienceRestriction', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, AudienceRestriction::NS, InvalidDOMElementException::class); @@ -67,7 +67,7 @@ public static function fromXML(DOMElement $xml): static /** * Convert this Audience 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/XML/saml/AuthnContext.php b/src/XML/saml/AuthnContext.php index adf30750e..8fb678add 100644 --- a/src/XML/saml/AuthnContext.php +++ b/src/XML/saml/AuthnContext.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\XML\saml; -use DOMElement; +use Dom; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\XML\saml\AuthnContextClassRef; use SimpleSAML\SAML2\XML\saml\AuthnContextDecl; @@ -110,7 +110,7 @@ public function getAuthenticatingAuthorities(): 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, 'AuthnContext', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, AuthnContext::NS, InvalidDOMElementException::class); @@ -153,7 +153,7 @@ public static function fromXML(DOMElement $xml): static /** * Convert this AuthContextDeclRef 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/XML/saml/AuthnContextDecl.php b/src/XML/saml/AuthnContextDecl.php index 459a312bb..679215726 100644 --- a/src/XML/saml/AuthnContextDecl.php +++ b/src/XML/saml/AuthnContextDecl.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\XML\saml; -use DOMElement; +use Dom; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\XML\ExtendableAttributesTrait; use SimpleSAML\XML\ExtendableElementTrait; @@ -61,7 +61,7 @@ public function isEmptyElement(): bool * @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, 'AuthnContextDecl', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, AuthnContextDecl::NS, InvalidDOMElementException::class); @@ -76,7 +76,7 @@ public static function fromXML(DOMElement $xml): static /** * Convert this AuthContextDecl 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/XML/saml/AuthnStatement.php b/src/XML/saml/AuthnStatement.php index bcb56e567..15694ff17 100644 --- a/src/XML/saml/AuthnStatement.php +++ b/src/XML/saml/AuthnStatement.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\XML\saml; -use DOMElement; +use Dom; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Type\SAMLDateTimeValue; use SimpleSAML\SAML2\Type\SAMLStringValue; @@ -109,7 +109,7 @@ public function getSubjectLocality(): ?SubjectLocality * if one of the mandatory child-elements is missing * @throws \Exception if the authentication instant is not a valid timestamp. */ - public static function fromXML(DOMElement $xml): static + public static function fromXML(Dom\Element $xml): static { Assert::same($xml->localName, 'AuthnStatement', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, AuthnStatement::NS, InvalidDOMElementException::class); @@ -143,7 +143,7 @@ public static function fromXML(DOMElement $xml): static /** * Convert this AuthnStatement 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/XML/saml/AuthzDecisionStatement.php b/src/XML/saml/AuthzDecisionStatement.php index deb866ed9..8a75d2072 100644 --- a/src/XML/saml/AuthzDecisionStatement.php +++ b/src/XML/saml/AuthzDecisionStatement.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\XML\saml; -use DOMElement; +use Dom; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Constants as C; use SimpleSAML\SAML2\Type\DecisionTypeValue; @@ -102,7 +102,7 @@ public function getEvidence(): ?Evidence * if one of the mandatory child-elements is missing * @throws \Exception if the authentication instant is not a valid timestamp. */ - public static function fromXML(DOMElement $xml): static + public static function fromXML(Dom\Element $xml): static { Assert::same($xml->localName, 'AuthzDecisionStatement', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, AuthzDecisionStatement::NS, InvalidDOMElementException::class); @@ -136,7 +136,7 @@ public static function fromXML(DOMElement $xml): static /** * Convert this AuthzDecisionStatement 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/XML/saml/Conditions.php b/src/XML/saml/Conditions.php index fc6926253..be78fa37f 100644 --- a/src/XML/saml/Conditions.php +++ b/src/XML/saml/Conditions.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\XML\saml; -use DOMElement; +use Dom; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Constants as C; use SimpleSAML\SAML2\Exception\ProtocolViolationException; @@ -145,7 +145,7 @@ public function isEmptyElement(): bool * @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, 'Conditions', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, Conditions::NS, InvalidDOMElementException::class); @@ -182,7 +182,7 @@ public static function fromXML(DOMElement $xml): static /** * Convert this element 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/XML/saml/Evidence.php b/src/XML/saml/Evidence.php index 0abaf24bd..90c24f374 100644 --- a/src/XML/saml/Evidence.php +++ b/src/XML/saml/Evidence.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\XML\saml; -use DOMElement; +use Dom; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\XML\Constants as C; use SimpleSAML\XML\SchemaValidatableElementInterface; @@ -99,7 +99,7 @@ public function getEncryptedAssertion(): 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 { $qualifiedName = static::getClassName(static::class); Assert::eq( @@ -126,7 +126,7 @@ public static function fromXML(DOMElement $xml): static /** * Convert this Evidence 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/XML/saml/NameIDType.php b/src/XML/saml/NameIDType.php index a2f586567..6f363301c 100644 --- a/src/XML/saml/NameIDType.php +++ b/src/XML/saml/NameIDType.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\XML\saml; -use DOMElement; +use Dom; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Type\SAMLAnyURIValue; use SimpleSAML\SAML2\Type\SAMLStringValue; @@ -76,7 +76,7 @@ public function getSPProvidedID(): ?SAMLStringValue * @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, static::getLocalName(), InvalidDOMElementException::class); Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class); @@ -94,7 +94,7 @@ public static function fromXML(DOMElement $xml): static /** * Convert this NameIDType 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->getContent()); diff --git a/src/XML/saml/OneTimeUse.php b/src/XML/saml/OneTimeUse.php index f4a8e5ecc..cd491cfd0 100644 --- a/src/XML/saml/OneTimeUse.php +++ b/src/XML/saml/OneTimeUse.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\XML\saml; -use DOMElement; +use Dom; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\XML\SchemaValidatableElementInterface; use SimpleSAML\XML\SchemaValidatableElementTrait; @@ -26,7 +26,7 @@ final class OneTimeUse extends AbstractConditionType implements SchemaValidatabl * @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, 'OneTimeUse', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, OneTimeUse::NS, InvalidDOMElementException::class); @@ -38,7 +38,7 @@ public static function fromXML(DOMElement $xml): static /** * Convert this OneTimeUse 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/XML/saml/ProxyRestriction.php b/src/XML/saml/ProxyRestriction.php index 20909ed20..5d6f413c2 100644 --- a/src/XML/saml/ProxyRestriction.php +++ b/src/XML/saml/ProxyRestriction.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\XML\saml; -use DOMElement; +use Dom; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\XML\Constants as C; use SimpleSAML\XML\SchemaValidatableElementInterface; @@ -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, 'ProxyRestriction', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, ProxyRestriction::NS, InvalidDOMElementException::class); @@ -76,7 +76,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); diff --git a/src/XML/saml/Subject.php b/src/XML/saml/Subject.php index 45e0183a7..a5269583e 100644 --- a/src/XML/saml/Subject.php +++ b/src/XML/saml/Subject.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\XML\saml; -use DOMElement; +use Dom; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\XML\IdentifierTrait; use SimpleSAML\XML\Constants as C; @@ -65,7 +65,7 @@ public function getSubjectConfirmation(): 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, 'Subject', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, Subject::NS, InvalidDOMElementException::class); @@ -92,7 +92,7 @@ public static function fromXML(DOMElement $xml): static /** * Convert this element 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/XML/saml/SubjectConfirmation.php b/src/XML/saml/SubjectConfirmation.php index 4f283cbf9..f05f41406 100644 --- a/src/XML/saml/SubjectConfirmation.php +++ b/src/XML/saml/SubjectConfirmation.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\XML\saml; -use DOMElement; +use Dom; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Type\SAMLAnyURIValue; use SimpleSAML\SAML2\XML\IdentifierTrait; @@ -74,7 +74,7 @@ public function getSubjectConfirmationData(): ?SubjectConfirmationData * @throws \SimpleSAML\XMLSchema\Exception\TooManyElementsException * if too many child-elements of a type are specified */ - public static function fromXML(DOMElement $xml): static + public static function fromXML(Dom\Element $xml): static { Assert::same($xml->localName, 'SubjectConfirmation', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, SubjectConfirmation::NS, InvalidDOMElementException::class); @@ -98,7 +98,7 @@ public static function fromXML(DOMElement $xml): static /** * Convert this element to XML. */ - public function toXML(?DOMElement $parent = null): DOMElement + public function toXML(?Dom\Element $parent = null): Dom\Element { $e = $this->instantiateParentElement($parent); $e->setAttribute('Method', $this->getMethod()->getValue()); diff --git a/src/XML/saml/SubjectConfirmationData.php b/src/XML/saml/SubjectConfirmationData.php index 9cc6a3824..e21811d15 100644 --- a/src/XML/saml/SubjectConfirmationData.php +++ b/src/XML/saml/SubjectConfirmationData.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\XML\saml; -use DOMElement; +use Dom; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Type\EntityIDValue; use SimpleSAML\SAML2\Type\SAMLDateTimeValue; @@ -34,7 +34,7 @@ final class SubjectConfirmationData extends AbstractSubjectConfirmationData impl * @throws \SimpleSAML\Assert\AssertionFailedException * if NotBefore or NotOnOrAfter contain an invalid date. */ - public static function fromXML(DOMElement $xml): static + public static function fromXML(Dom\Element $xml): static { Assert::same($xml->localName, 'SubjectConfirmationData', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, SubjectConfirmationData::NS, InvalidDOMElementException::class); diff --git a/src/XML/saml/SubjectLocality.php b/src/XML/saml/SubjectLocality.php index 6d2a3de1d..45e892b10 100644 --- a/src/XML/saml/SubjectLocality.php +++ b/src/XML/saml/SubjectLocality.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\XML\saml; -use DOMElement; +use Dom; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Type\DomainValue; use SimpleSAML\SAML2\Type\SAMLStringValue; @@ -74,7 +74,7 @@ public function isEmptyElement(): bool * @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, 'SubjectLocality', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, SubjectLocality::NS, InvalidDOMElementException::class); @@ -89,7 +89,7 @@ public static function fromXML(DOMElement $xml): static /** * Convert this SubjectLocality 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/XML/saml/UnknownCondition.php b/src/XML/saml/UnknownCondition.php index f2e119ad5..c8de1727c 100644 --- a/src/XML/saml/UnknownCondition.php +++ b/src/XML/saml/UnknownCondition.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\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/XML/saml/UnknownID.php b/src/XML/saml/UnknownID.php index 9f6124279..754c5dc4c 100644 --- a/src/XML/saml/UnknownID.php +++ b/src/XML/saml/UnknownID.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\XML\saml; -use DOMElement; +use Dom; use SimpleSAML\SAML2\Type\SAMLStringValue; use SimpleSAML\XML\Chunk; use SimpleSAML\XMLSchema\Type\QNameValue; @@ -46,7 +46,7 @@ public function getRawIdentifier(): Chunk /** * Convert this unknown ID to XML. */ - public function toXML(?DOMElement $parent = null): DOMElement + public function toXML(?Dom\Element $parent = null): Dom\Element { return $this->getRawIdentifier()->toXML($parent); } diff --git a/src/XML/saml/UnknownStatement.php b/src/XML/saml/UnknownStatement.php index 8720d90ed..7b852126b 100644 --- a/src/XML/saml/UnknownStatement.php +++ b/src/XML/saml/UnknownStatement.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\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/XML/samlp/AbstractManageNameIDRequest.php b/src/XML/samlp/AbstractManageNameIDRequest.php index 2151349e9..e0db8fbcc 100644 --- a/src/XML/samlp/AbstractManageNameIDRequest.php +++ b/src/XML/samlp/AbstractManageNameIDRequest.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\XML\samlp; -use DOMElement; +use Dom; use SimpleSAML\SAML2\Type\SAMLAnyURIValue; use SimpleSAML\SAML2\Type\SAMLDateTimeValue; use SimpleSAML\SAML2\XML\IdentifierTrait; @@ -76,7 +76,7 @@ public function getNewIdentifier(): NewID|NewEncryptedID|Terminate /** * Convert this ManageNameIDRequest to XML */ - public function toUnsignedXML(?DOMElement $parent = null): DOMElement + public function toUnsignedXML(?Dom\Element $parent = null): Dom\Element { $e = parent::toUnsignedXML($parent); diff --git a/src/XML/samlp/AbstractMessage.php b/src/XML/samlp/AbstractMessage.php index a7a20920f..b588fd3c2 100644 --- a/src/XML/samlp/AbstractMessage.php +++ b/src/XML/samlp/AbstractMessage.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\XML\samlp; -use DOMElement; +use Dom; use SimpleSAML\SAML2\Type\SAMLAnyURIValue; use SimpleSAML\SAML2\Type\SAMLDateTimeValue; use SimpleSAML\SAML2\Utils\XPath; @@ -46,7 +46,7 @@ abstract class AbstractMessage extends AbstractSamlpElement implements /** * The original signed XML */ - protected DOMElement $xml; + protected Dom\Element $xml; /** @@ -143,7 +143,7 @@ public function isMessageConstructedWithSignature(): bool /** * Get the XML element. */ - public function getXML(): DOMElement + public function getXML(): Dom\Element { return $this->xml; } @@ -152,7 +152,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; } @@ -160,7 +160,7 @@ protected function setXML(DOMElement $xml): void /** */ - protected function getOriginalXML(): DOMElement + protected function getOriginalXML(): Dom\Element { return $this->xml ?? $this->toUnsignedXML(); } @@ -170,7 +170,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 { $root = $this->instantiateParentElement($parent); @@ -200,7 +200,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/XML/samlp/AbstractNameIDMappingRequest.php b/src/XML/samlp/AbstractNameIDMappingRequest.php index 9f9715225..e9905b582 100644 --- a/src/XML/samlp/AbstractNameIDMappingRequest.php +++ b/src/XML/samlp/AbstractNameIDMappingRequest.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\XML\samlp; -use DOMElement; +use Dom; use SimpleSAML\SAML2\Type\SAMLAnyURIValue; use SimpleSAML\SAML2\Type\SAMLDateTimeValue; use SimpleSAML\SAML2\XML\IdentifierTrait; @@ -65,7 +65,7 @@ public function getNameIDPolicy(): NameIDPolicy /** * Convert this NameIDMappingRequest to XML */ - public function toUnsignedXML(?DOMElement $parent = null): DOMElement + public function toUnsignedXML(?Dom\Element $parent = null): Dom\Element { $e = parent::toUnsignedXML($parent); diff --git a/src/XML/samlp/AbstractStatusResponse.php b/src/XML/samlp/AbstractStatusResponse.php index f0ede126e..b9a8bdc4a 100644 --- a/src/XML/samlp/AbstractStatusResponse.php +++ b/src/XML/samlp/AbstractStatusResponse.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\XML\samlp; -use DOMElement; +use Dom; use SimpleSAML\SAML2\Constants as C; use SimpleSAML\SAML2\Type\SAMLAnyURIValue; use SimpleSAML\SAML2\Type\SAMLDateTimeValue; @@ -89,7 +89,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/XML/samlp/AbstractSubjectQuery.php b/src/XML/samlp/AbstractSubjectQuery.php index 49f41af49..c81544a02 100644 --- a/src/XML/samlp/AbstractSubjectQuery.php +++ b/src/XML/samlp/AbstractSubjectQuery.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\XML\samlp; -use DOMElement; +use Dom; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Type\SAMLAnyURIValue; use SimpleSAML\SAML2\Type\SAMLDateTimeValue; @@ -64,7 +64,7 @@ public function getSubject(): Subject * 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 { Assert::notEmpty($this->subject, 'Cannot convert SubjectQuery to XML without a Subject set.'); diff --git a/src/XML/samlp/ArtifactResolve.php b/src/XML/samlp/ArtifactResolve.php index a8d8f1152..93e34642c 100644 --- a/src/XML/samlp/ArtifactResolve.php +++ b/src/XML/samlp/ArtifactResolve.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\XML\samlp; -use DOMElement; +use Dom; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Exception\Protocol\RequestVersionTooHighException; use SimpleSAML\SAML2\Exception\Protocol\RequestVersionTooLowException; @@ -79,7 +79,7 @@ public function getArtifact(): Artifact * @throws \SimpleSAML\XMLSchema\Exception\TooManyElementsException * if too many child-elements of a type are specified */ - public static function fromXML(DOMElement $xml): static + public static function fromXML(Dom\Element $xml): static { Assert::same($xml->localName, 'ArtifactResolve', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, ArtifactResolve::NS, InvalidDOMElementException::class); @@ -129,7 +129,7 @@ public static function fromXML(DOMElement $xml): static * 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 { Assert::notEmpty($this->artifact, 'Cannot convert ArtifactResolve to XML without an Artifact set.'); diff --git a/src/XML/samlp/ArtifactResponse.php b/src/XML/samlp/ArtifactResponse.php index 3f3a03f8a..c34fb49b5 100644 --- a/src/XML/samlp/ArtifactResponse.php +++ b/src/XML/samlp/ArtifactResponse.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\XML\samlp; -use DOMElement; +use Dom; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Exception\Protocol\RequestVersionTooHighException; use SimpleSAML\SAML2\Exception\Protocol\RequestVersionTooLowException; @@ -91,7 +91,7 @@ public function getMessage(): ?AbstractMessage * @throws \SimpleSAML\XMLSchema\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, 'ArtifactResponse', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, ArtifactResponse::NS, InvalidDOMElementException::class); @@ -109,7 +109,7 @@ public static function fromXML(DOMElement $xml): static $message = null; for ($child = $status->nextSibling; $child !== null; $child = $child->nextSibling) { - if ($child instanceof DOMElement) { + if ($child instanceof Dom\Element) { $message = MessageFactory::fromXML($child); break; } @@ -160,7 +160,7 @@ public static function fromXML(DOMElement $xml): static * 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/XML/samlp/AssertionIDRequest.php b/src/XML/samlp/AssertionIDRequest.php index 0dd0843af..dfc412c96 100644 --- a/src/XML/samlp/AssertionIDRequest.php +++ b/src/XML/samlp/AssertionIDRequest.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\XML\samlp; -use DOMElement; +use Dom; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Exception\Protocol\RequestVersionTooHighException; use SimpleSAML\SAML2\Exception\Protocol\RequestVersionTooLowException; @@ -83,7 +83,7 @@ public function getAssertionIDRef(): 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, 'AssertionIDRequest', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, AssertionIDRequest::NS, InvalidDOMElementException::class); @@ -142,7 +142,7 @@ public static function fromXML(DOMElement $xml): static /** * Convert this AssertionIDRequest element to XML. */ - public function toUnsignedXML(?DOMElement $parent = null): DOMElement + public function toUnsignedXML(?Dom\Element $parent = null): Dom\Element { $e = parent::toUnsignedXML($parent); diff --git a/src/XML/samlp/AttributeQuery.php b/src/XML/samlp/AttributeQuery.php index 2eb3dd900..005303ab0 100644 --- a/src/XML/samlp/AttributeQuery.php +++ b/src/XML/samlp/AttributeQuery.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\XML\samlp; -use DOMElement; +use Dom; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Constants as C; use SimpleSAML\SAML2\Exception\Protocol\RequestVersionTooHighException; @@ -115,7 +115,7 @@ public function getAttributes(): array * @throws \SimpleSAML\XMLSchema\Exception\TooManyElementsException * if too many child-elements of a type are specified */ - 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); @@ -171,7 +171,7 @@ public static function fromXML(DOMElement $xml): static * 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/XML/samlp/AuthnQuery.php b/src/XML/samlp/AuthnQuery.php index 3943c0bdc..1f9cb6f42 100644 --- a/src/XML/samlp/AuthnQuery.php +++ b/src/XML/samlp/AuthnQuery.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\XML\samlp; -use DOMElement; +use Dom; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Exception\Protocol\RequestVersionTooHighException; use SimpleSAML\SAML2\Exception\Protocol\RequestVersionTooLowException; @@ -97,7 +97,7 @@ public function getSessionIndex(): ?SAMLStringValue * @throws \SimpleSAML\XMLSchema\Exception\TooManyElementsException * if too many child-elements of a type are specified */ - public static function fromXML(DOMElement $xml): static + public static function fromXML(Dom\Element $xml): static { Assert::same($xml->localName, 'AuthnQuery', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, AuthnQuery::NS, InvalidDOMElementException::class); @@ -156,7 +156,7 @@ public static function fromXML(DOMElement $xml): static * 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/XML/samlp/AuthnRequest.php b/src/XML/samlp/AuthnRequest.php index 2093bf747..bb73a9a72 100644 --- a/src/XML/samlp/AuthnRequest.php +++ b/src/XML/samlp/AuthnRequest.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\XML\samlp; -use DOMElement; +use Dom; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Exception\Protocol\RequestVersionTooHighException; use SimpleSAML\SAML2\Exception\Protocol\RequestVersionTooLowException; @@ -236,7 +236,7 @@ public function getRequestedAuthnContext(): ?RequestedAuthnContext * @throws \SimpleSAML\XMLSchema\Exception\TooManyElementsException * if too many child-elements of a type are specified */ - public static function fromXML(DOMElement $xml): static + public static function fromXML(Dom\Element $xml): static { Assert::same($xml->localName, 'AuthnRequest', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, AuthnRequest::NS, InvalidDOMElementException::class); @@ -329,7 +329,7 @@ public static function fromXML(DOMElement $xml): static * 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/XML/samlp/AuthzDecisionQuery.php b/src/XML/samlp/AuthzDecisionQuery.php index 12703317a..074969def 100644 --- a/src/XML/samlp/AuthzDecisionQuery.php +++ b/src/XML/samlp/AuthzDecisionQuery.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\XML\samlp; -use DOMElement; +use Dom; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Constants as C; use SimpleSAML\SAML2\Exception\Protocol\RequestVersionTooHighException; @@ -112,7 +112,7 @@ public function getEvidence(): ?Evidence * if one of the mandatory child-elements is missing * @throws \Exception if the authentication instant is not a valid timestamp. */ - public static function fromXML(DOMElement $xml): static + public static function fromXML(Dom\Element $xml): static { Assert::same($xml->localName, 'AuthzDecisionQuery', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, AuthzDecisionQuery::NS, InvalidDOMElementException::class); @@ -186,7 +186,7 @@ public static function fromXML(DOMElement $xml): static * 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('Resource', $this->getResource()->getValue()); diff --git a/src/XML/samlp/Extensions.php b/src/XML/samlp/Extensions.php index 7d07c97c0..5f7884e5d 100644 --- a/src/XML/samlp/Extensions.php +++ b/src/XML/samlp/Extensions.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\XML\samlp; -use DOMElement; +use Dom; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Utils\XPath; use SimpleSAML\SAML2\XML\ExtensionsTrait; @@ -49,7 +49,7 @@ final class Extensions extends AbstractSamlpElement implements SchemaValidatable * @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::eq( $xml->namespaceURI, @@ -65,7 +65,7 @@ public static function fromXML(DOMElement $xml): static ); $ret = []; - /** @var \DOMElement $node */ + /** @var \Dom\Element $node */ foreach (XPath::xpQuery($xml, './*', XPath::getXPath($xml)) as $node) { $ret[] = new Chunk($node); } diff --git a/src/XML/samlp/IDPEntry.php b/src/XML/samlp/IDPEntry.php index 29c3a0290..9eef815e9 100644 --- a/src/XML/samlp/IDPEntry.php +++ b/src/XML/samlp/IDPEntry.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\XML\samlp; -use DOMElement; +use Dom; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Exception\ArrayValidationException; use SimpleSAML\SAML2\Type\EntityIDValue; @@ -79,7 +79,7 @@ public function getLoc(): ?SAMLAnyURIValue * @throws \SimpleSAML\XMLSchema\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, 'IDPEntry', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, IDPEntry::NS, InvalidDOMElementException::class); @@ -95,7 +95,7 @@ public static function fromXML(DOMElement $xml): static /** * Convert this IDPEntry to XML. */ - public function toXML(?DOMElement $parent = null): DOMElement + public function toXML(?Dom\Element $parent = null): Dom\Element { $e = $this->instantiateParentElement($parent); $e->setAttribute('ProviderID', $this->getProviderId()->getValue()); diff --git a/src/XML/samlp/IDPList.php b/src/XML/samlp/IDPList.php index eea4d1147..5259e12d6 100644 --- a/src/XML/samlp/IDPList.php +++ b/src/XML/samlp/IDPList.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\XML\samlp; -use DOMElement; +use Dom; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Exception\ArrayValidationException; use SimpleSAML\XML\Constants as C; @@ -74,7 +74,7 @@ public function getGetComplete(): ?GetComplete * @throws \SimpleSAML\XMLSchema\Exception\TooManyElementsException * if too many child-elements of a type are specified */ - public static function fromXML(DOMElement $xml): static + public static function fromXML(Dom\Element $xml): static { Assert::same($xml->localName, 'IDPList', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, IDPList::NS, InvalidDOMElementException::class); @@ -105,7 +105,7 @@ public static function fromXML(DOMElement $xml): static /** * Convert this IDPList 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/XML/samlp/LogoutRequest.php b/src/XML/samlp/LogoutRequest.php index 21e801126..dd4d102ee 100644 --- a/src/XML/samlp/LogoutRequest.php +++ b/src/XML/samlp/LogoutRequest.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\XML\samlp; -use DOMElement; +use Dom; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Constants as C; use SimpleSAML\SAML2\Exception\Protocol\RequestVersionTooHighException; @@ -122,7 +122,7 @@ public function getSessionIndexes(): array * @throws \SimpleSAML\XMLSchema\Exception\TooManyElementsException * if too many child-elements of a type are specified */ - public static function fromXML(DOMElement $xml): static + public static function fromXML(Dom\Element $xml): static { Assert::same($xml->localName, 'LogoutRequest', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, LogoutRequest::NS, InvalidDOMElementException::class); @@ -187,7 +187,7 @@ public static function fromXML(DOMElement $xml): static * 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/XML/samlp/LogoutResponse.php b/src/XML/samlp/LogoutResponse.php index 054838a65..7ab76941d 100644 --- a/src/XML/samlp/LogoutResponse.php +++ b/src/XML/samlp/LogoutResponse.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\XML\samlp; -use DOMElement; +use Dom; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Exception\Protocol\RequestVersionTooHighException; use SimpleSAML\SAML2\Exception\Protocol\RequestVersionTooLowException; @@ -77,7 +77,7 @@ public function __construct( * @throws \SimpleSAML\XMLSchema\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, 'LogoutResponse', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, LogoutResponse::NS, InvalidDOMElementException::class); diff --git a/src/XML/samlp/ManageNameIDRequest.php b/src/XML/samlp/ManageNameIDRequest.php index 0e68b72b4..15520de4a 100644 --- a/src/XML/samlp/ManageNameIDRequest.php +++ b/src/XML/samlp/ManageNameIDRequest.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\XML\samlp; -use DOMElement; +use Dom; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Exception\Protocol\RequestVersionTooHighException; use SimpleSAML\SAML2\Exception\Protocol\RequestVersionTooLowException; @@ -44,7 +44,7 @@ final class ManageNameIDRequest extends AbstractManageNameIDRequest implements * @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, static::getLocalName(), InvalidDOMElementException::class); Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class); diff --git a/src/XML/samlp/ManageNameIDResponse.php b/src/XML/samlp/ManageNameIDResponse.php index 5aeb65f2e..97afaf88e 100644 --- a/src/XML/samlp/ManageNameIDResponse.php +++ b/src/XML/samlp/ManageNameIDResponse.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\XML\samlp; -use DOMElement; +use Dom; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Exception\Protocol\RequestVersionTooHighException; use SimpleSAML\SAML2\Exception\Protocol\RequestVersionTooLowException; @@ -79,7 +79,7 @@ final public function __construct( * @throws \SimpleSAML\XMLSchema\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, static::getLocalName(), InvalidDOMElementException::class); Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class); diff --git a/src/XML/samlp/MessageFactory.php b/src/XML/samlp/MessageFactory.php index 0b0ed0df3..96b3675e5 100644 --- a/src/XML/samlp/MessageFactory.php +++ b/src/XML/samlp/MessageFactory.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\XML\samlp; -use DOMElement; +use Dom; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Constants as C; use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; @@ -24,7 +24,7 @@ abstract class MessageFactory * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ - public static function fromXML(DOMElement $xml): AbstractMessage + public static function fromXML(Dom\Element $xml): AbstractMessage { Assert::same( $xml->namespaceURI, diff --git a/src/XML/samlp/NameIDMappingRequest.php b/src/XML/samlp/NameIDMappingRequest.php index 774fc6d29..250d15718 100644 --- a/src/XML/samlp/NameIDMappingRequest.php +++ b/src/XML/samlp/NameIDMappingRequest.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\XML\samlp; -use DOMElement; +use Dom; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Exception\Protocol\RequestVersionTooHighException; use SimpleSAML\SAML2\Exception\Protocol\RequestVersionTooLowException; @@ -40,7 +40,7 @@ final class NameIDMappingRequest extends AbstractNameIDMappingRequest implements * @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, static::getLocalName(), InvalidDOMElementException::class); Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class); diff --git a/src/XML/samlp/NameIDMappingResponse.php b/src/XML/samlp/NameIDMappingResponse.php index c6bef7fde..e68e0f06e 100644 --- a/src/XML/samlp/NameIDMappingResponse.php +++ b/src/XML/samlp/NameIDMappingResponse.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\XML\samlp; -use DOMElement; +use Dom; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Exception\Protocol\RequestVersionTooHighException; use SimpleSAML\SAML2\Exception\Protocol\RequestVersionTooLowException; @@ -87,7 +87,7 @@ final public function __construct( * @throws \SimpleSAML\XMLSchema\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, static::getLocalName(), InvalidDOMElementException::class); Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class); @@ -139,7 +139,7 @@ public static function fromXML(DOMElement $xml): static /** * Convert the response message to an XML element. */ - protected function toUnsignedXML(?DOMElement $parent = null): DOMElement + protected function toUnsignedXML(?Dom\Element $parent = null): Dom\Element { $e = parent::toUnsignedXML($parent); diff --git a/src/XML/samlp/NameIDPolicy.php b/src/XML/samlp/NameIDPolicy.php index ad4124889..785531526 100644 --- a/src/XML/samlp/NameIDPolicy.php +++ b/src/XML/samlp/NameIDPolicy.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\XML\samlp; -use DOMElement; +use Dom; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Constants as C; use SimpleSAML\SAML2\Exception\ArrayValidationException; @@ -109,7 +109,7 @@ public function isEmptyElement(): bool * @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, 'NameIDPolicy', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, NameIDPolicy::NS, InvalidDOMElementException::class); @@ -129,7 +129,7 @@ public static function fromXML(DOMElement $xml): static /** * Convert this NameIDPolicy 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/XML/samlp/RequestedAuthnContext.php b/src/XML/samlp/RequestedAuthnContext.php index 10c1eb189..50df7ee69 100644 --- a/src/XML/samlp/RequestedAuthnContext.php +++ b/src/XML/samlp/RequestedAuthnContext.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\XML\samlp; -use DOMElement; +use Dom; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Exception\ProtocolViolationException; use SimpleSAML\SAML2\Type\AuthnContextComparisonTypeValue; @@ -96,7 +96,7 @@ public function getComparison(): ?AuthnContextComparisonTypeValue * @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, 'RequestedAuthnContext', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, RequestedAuthnContext::NS, InvalidDOMElementException::class); @@ -114,10 +114,10 @@ public static function fromXML(DOMElement $xml): static /** * Convert this RequestedAuthnContext to XML. * - * @param \DOMElement|null $parent The element we should append this RequestedAuthnContext to. - * @return \DOMElement + * @param \Dom\Element|null $parent The element we should append this RequestedAuthnContext to. + * @return \Dom\Element */ - public function toXML(?DOMElement $parent = null): DOMElement + public function toXML(?Dom\Element $parent = null): Dom\Element { $e = $this->instantiateParentElement($parent); diff --git a/src/XML/samlp/Response.php b/src/XML/samlp/Response.php index 5c702919a..1e68d3d5a 100644 --- a/src/XML/samlp/Response.php +++ b/src/XML/samlp/Response.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\XML\samlp; -use DOMElement; +use Dom; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Constants as C; use SimpleSAML\SAML2\Exception\Protocol\RequestVersionTooHighException; @@ -102,7 +102,7 @@ public function getAssertions(): array * @throws \SimpleSAML\XMLSchema\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); @@ -154,7 +154,7 @@ public static function fromXML(DOMElement $xml): static /** * Convert the response message to an XML element. */ - protected function toUnsignedXML(?DOMElement $parent = null): DOMElement + protected function toUnsignedXML(?Dom\Element $parent = null): Dom\Element { $e = parent::toUnsignedXML($parent); diff --git a/src/XML/samlp/Scoping.php b/src/XML/samlp/Scoping.php index 020314197..8012aeae9 100644 --- a/src/XML/samlp/Scoping.php +++ b/src/XML/samlp/Scoping.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\XML\samlp; -use DOMElement; +use Dom; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\XML\Constants as C; use SimpleSAML\XML\SchemaValidatableElementInterface; @@ -86,7 +86,7 @@ public function isEmptyElement(): bool * @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, 'Scoping', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, Scoping::NS, InvalidDOMElementException::class); @@ -105,7 +105,7 @@ public static function fromXML(DOMElement $xml): static /** * Convert this Scoping 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/XML/samlp/Status.php b/src/XML/samlp/Status.php index 5a6615c76..d761a5916 100644 --- a/src/XML/samlp/Status.php +++ b/src/XML/samlp/Status.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\XML\samlp; -use DOMElement; +use Dom; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Constants as C; use SimpleSAML\SAML2\Exception\ProtocolViolationException; @@ -98,7 +98,7 @@ public function getStatusDetails(): array * @throws \SimpleSAML\XMLSchema\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); @@ -123,7 +123,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/XML/samlp/StatusCode.php b/src/XML/samlp/StatusCode.php index e00487f76..5a6c21147 100644 --- a/src/XML/samlp/StatusCode.php +++ b/src/XML/samlp/StatusCode.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\XML\samlp; -use DOMElement; +use Dom; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Constants as C; use SimpleSAML\SAML2\Type\SAMLAnyURIValue; @@ -69,7 +69,7 @@ public function getSubCodes(): array * @throws \SimpleSAML\XMLSchema\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); @@ -84,7 +84,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/XML/samlp/StatusDetail.php b/src/XML/samlp/StatusDetail.php index 47d9b759c..56c325fb0 100644 --- a/src/XML/samlp/StatusDetail.php +++ b/src/XML/samlp/StatusDetail.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\XML\samlp; -use DOMElement; +use Dom; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\XML\ExtendableElementTrait; use SimpleSAML\XML\SchemaValidatableElementInterface; @@ -53,7 +53,7 @@ public function isEmptyElement(): bool * @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, 'StatusDetail', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, StatusDetail::NS, InvalidDOMElementException::class); @@ -67,7 +67,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/XML/samlp/Terminate.php b/src/XML/samlp/Terminate.php index eb528281a..ebe8787ad 100644 --- a/src/XML/samlp/Terminate.php +++ b/src/XML/samlp/Terminate.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\XML\samlp; -use DOMElement; +use Dom; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\XML\SchemaValidatableElementInterface; use SimpleSAML\XML\SchemaValidatableElementTrait; @@ -26,7 +26,7 @@ final class Terminate extends AbstractSamlpElement implements SchemaValidatableE * @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, 'Terminate', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, Terminate::NS, InvalidDOMElementException::class); @@ -38,7 +38,7 @@ public static function fromXML(DOMElement $xml): static /** * Convert this Terminate 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/XML/shibmd/KeyAuthority.php b/src/XML/shibmd/KeyAuthority.php index ae841d546..72eae8b7e 100644 --- a/src/XML/shibmd/KeyAuthority.php +++ b/src/XML/shibmd/KeyAuthority.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\XML\shibmd; -use DOMElement; +use Dom; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\XML\Constants as C; use SimpleSAML\XML\ExtendableAttributesTrait; @@ -79,7 +79,7 @@ public function getKeys(): 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, 'KeyAuthority', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, KeyAuthority::NS, InvalidDOMElementException::class); @@ -96,7 +96,7 @@ public static function fromXML(DOMElement $xml): static /** * Convert this KeyAuthority 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/XML/shibmd/Scope.php b/src/XML/shibmd/Scope.php index 9fffa9e4b..1f10f1f3a 100644 --- a/src/XML/shibmd/Scope.php +++ b/src/XML/shibmd/Scope.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\XML\shibmd; -use DOMElement; +use Dom; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Exception\ArrayValidationException; use SimpleSAML\SAML2\Type\SAMLStringValue; @@ -67,7 +67,7 @@ public function isRegexpScope(): ?BooleanValue * @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, 'Scope', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, Scope::NS, InvalidDOMElementException::class); @@ -82,7 +82,7 @@ public static function fromXML(DOMElement $xml): static /** * Convert this Scope 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->getContent()); diff --git a/tests/InterOperability/EntitiesDescriptorTest.php b/tests/InterOperability/EntitiesDescriptorTest.php index 1f3929b73..1e0726511 100644 --- a/tests/InterOperability/EntitiesDescriptorTest.php +++ b/tests/InterOperability/EntitiesDescriptorTest.php @@ -4,7 +4,7 @@ namespace SimpleSAML\Test\SAML2; -use DOMElement; +use Dom; use Exception; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; @@ -26,10 +26,10 @@ final class EntitiesDescriptorTest extends TestCase /** - * @param \DOMElement $metadata; + * @param \Dom\Element $metadata; */ #[DataProvider('provideMetadata')] - public function testUnmarshalling(DOMElement $metadata): void + public function testUnmarshalling(Dom\Element $metadata): void { $this->failures = 0; @@ -40,9 +40,8 @@ public function testUnmarshalling(DOMElement $metadata): void /** - * */ - private function parseMetadata(DOMElement $metadata): void + private function parseMetadata(Dom\Element $metadata): void { $xpCache = XPath::getXPath($metadata); if ($metadata->localName === 'EntitiesDescriptor') { @@ -52,11 +51,11 @@ private function parseMetadata(DOMElement $metadata): void $descriptors = array_merge($entityDescriptorElements, $entitiesDescriptorElements); foreach ($descriptors as $descriptor) { - /** @var \DOMElement $descriptor */ + /** @var \Dom\Element $descriptor */ $this->parseMetadata($descriptor); } } elseif ($metadata->localName === 'EntityDescriptor') { - /** @var \DOMAttr[] $entityID */ + /** @var \Dom\Attr[] $entityID */ $entityID = XPath::xpQuery($metadata, './@entityID', $xpCache); try { diff --git a/tests/InterOperability/EntityDescriptorTest.php b/tests/InterOperability/EntityDescriptorTest.php index 9c60ef8d8..422e72594 100644 --- a/tests/InterOperability/EntityDescriptorTest.php +++ b/tests/InterOperability/EntityDescriptorTest.php @@ -4,7 +4,7 @@ namespace SimpleSAML\Test\SAML2; -use DOMElement; +use Dom; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use SimpleSAML\Assert\AssertionFailedException; @@ -20,10 +20,10 @@ final class EntityDescriptorTest extends TestCase { /** * @param boolean $shouldPass - * @param \DOMElement $metadata; + * @param \Dom\Element $metadata; */ #[DataProvider('provideMetadata')] - public function testUnmarshalling(bool $shouldPass, DOMElement $metadata): void + public function testUnmarshalling(bool $shouldPass, Dom\Element $metadata): void { try { EntityDescriptor::fromXML($metadata); diff --git a/tests/SAML2/Assertion/Transformer/NameIdDecryptionTransformerTest.php b/tests/SAML2/Assertion/Transformer/NameIdDecryptionTransformerTest.php index 651c6c1b0..154313617 100644 --- a/tests/SAML2/Assertion/Transformer/NameIdDecryptionTransformerTest.php +++ b/tests/SAML2/Assertion/Transformer/NameIdDecryptionTransformerTest.php @@ -4,7 +4,7 @@ namespace SimpleSAML\Test\SAML2\Assertion\Transformer; -use DOMDocument; +use Dom; use PHPUnit\Framework\Attributes\PreserveGlobalState; use PHPUnit\Framework\Attributes\RunInSeparateProcess; use PHPUnit\Framework\TestCase; @@ -52,8 +52,8 @@ final class NameIdDecryptionTransformerTest extends TestCase /** @var \Psr\Clock\ClockInterface */ protected static ClockInterface $clock; - /** @var \DOMDocument */ - protected static DOMDocument $document; + /** @var \Dom\Document */ + protected static Dom\Document $document; /** @var \SimpleSAML\SAML2\Assertion\Processor */ protected static Processor $assertionProcessor; diff --git a/tests/SAML2/Assertion/Validation/AssertionValidatorTest.php b/tests/SAML2/Assertion/Validation/AssertionValidatorTest.php index 08ded53c2..0ce1e627e 100644 --- a/tests/SAML2/Assertion/Validation/AssertionValidatorTest.php +++ b/tests/SAML2/Assertion/Validation/AssertionValidatorTest.php @@ -4,7 +4,7 @@ namespace SimpleSAML\Test\SAML2\Assertion\Validation; -use DOMDocument; +use Dom; use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DoesNotPerformAssertions; use PHPUnit\Framework\Attributes\PreserveGlobalState; @@ -43,8 +43,8 @@ final class AssertionValidatorTest extends TestCase /** @var \Psr\Clock\ClockInterface */ protected static ClockInterface $clock; - /** @var \DOMDocument */ - protected static DOMDocument $document; + /** @var \Dom\XMLDocument */ + protected static Dom\XMLDocument $document; /** @var \SimpleSAML\SAML2\Assertion\Processor */ protected static Processor $assertionProcessor; @@ -143,7 +143,9 @@ public static function setUpBeforeClass(): void #[RunInSeparateProcess] public function testBasicValidation(): void { - $assertion = Assertion::fromXML(self::$document->firstChild); + /** @var \Dom\Element $firstChild */ + $firstChild = self::$document->firstChild; + $assertion = Assertion::fromXML($firstChild); self::$assertionProcessor->validateAssertion($assertion); } @@ -186,7 +188,9 @@ public function testAssertionNonValidation(): void , ); - $assertion = Assertion::fromXML($document->firstChild); + /** @var \Dom\Element $firstChild */ + $firstChild = $document->firstChild; + $assertion = Assertion::fromXML($firstChild); $this->expectException(InvalidAssertionException::class); $this->expectExceptionMessage( diff --git a/tests/SAML2/Assertion/Validation/SubjectConfirmationValidatorTest.php b/tests/SAML2/Assertion/Validation/SubjectConfirmationValidatorTest.php index 60e2b1b7e..f22ad0311 100644 --- a/tests/SAML2/Assertion/Validation/SubjectConfirmationValidatorTest.php +++ b/tests/SAML2/Assertion/Validation/SubjectConfirmationValidatorTest.php @@ -4,7 +4,7 @@ namespace SimpleSAML\Test\SAML2\XML\saml; -use DOMDocument; +use Dom; use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DoesNotPerformAssertions; use PHPUnit\Framework\TestCase; @@ -42,8 +42,8 @@ final class SubjectConfirmationValidatorTest extends TestCase /** @var \Psr\Clock\ClockInterface */ private static ClockInterface $clock; - /** @var \DOMDocument */ - private static DOMDocument $document; + /** @var \Dom\XMLDocument */ + private static Dom\Document $document; /** @var \SimpleSAML\SAML2\Assertion\Processor */ private static Processor $assertionProcessor; diff --git a/tests/SAML2/Binding/SOAPTest.php b/tests/SAML2/Binding/SOAPTest.php index 521178f75..4fd9fc34f 100644 --- a/tests/SAML2/Binding/SOAPTest.php +++ b/tests/SAML2/Binding/SOAPTest.php @@ -89,7 +89,7 @@ public function testSendArtifactResponse(): void SOAP); - /** @var \DOMElement $body */ + /** @var \Dom\Element $body */ $body = $doc->getElementsByTagNameNS(C::NS_SOAP_ENV, 'Body')->item(0); $message->toXML($body); @@ -121,12 +121,12 @@ public function testSendResponse(): void ); - /** @var \DOMElement $header */ + /** @var \Dom\Element $header */ $header = $doc->getElementsByTagNameNS(C::NS_SOAP_ENV, 'Header')->item(0); $requestAuthenticated->toXML($header); $ecpResponse->toXML($header); - /** @var \DOMElement $body */ + /** @var \Dom\Element $body */ $body = $doc->getElementsByTagNameNS(C::NS_SOAP_ENV, 'Body')->item(0); $message->toXML($body); diff --git a/tests/SAML2/CustomBaseID.php b/tests/SAML2/CustomBaseID.php index 25bf79635..79fa7ee90 100644 --- a/tests/SAML2/CustomBaseID.php +++ b/tests/SAML2/CustomBaseID.php @@ -4,7 +4,7 @@ namespace SimpleSAML\Test\SAML2; -use DOMElement; +use Dom; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Type\SAMLStringValue; use SimpleSAML\SAML2\XML\saml\AbstractBaseID; @@ -67,7 +67,7 @@ public function getAudience(): array /** * @inheritDoc */ - public static function fromXML(DOMElement $xml): static + public static function fromXML(Dom\Element $xml): static { Assert::same($xml->localName, 'BaseID', InvalidDOMElementException::class); Assert::notNull($xml->namespaceURI, InvalidDOMElementException::class); @@ -92,7 +92,7 @@ public static function fromXML(DOMElement $xml): static /** * Convert this BaseID 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/SAML2/CustomCondition.php b/tests/SAML2/CustomCondition.php index f5fbeca47..e70ae8db2 100644 --- a/tests/SAML2/CustomCondition.php +++ b/tests/SAML2/CustomCondition.php @@ -4,7 +4,7 @@ namespace SimpleSAML\Test\SAML2; -use DOMElement; +use Dom; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\XML\saml\AbstractCondition; use SimpleSAML\SAML2\XML\saml\Audience; @@ -62,7 +62,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); @@ -85,7 +85,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/SAML2/CustomRoleDescriptor.php b/tests/SAML2/CustomRoleDescriptor.php index 4713df233..65a45ee58 100644 --- a/tests/SAML2/CustomRoleDescriptor.php +++ b/tests/SAML2/CustomRoleDescriptor.php @@ -4,7 +4,7 @@ namespace SimpleSAML\Test\SAML2; -use DOMElement; +use Dom; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Type\SAMLAnyURIListValue; use SimpleSAML\SAML2\Type\SAMLAnyURIValue; @@ -120,7 +120,7 @@ public function getChunk(): 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, 'RoleDescriptor', InvalidDOMElementException::class); Assert::notNull($xml->namespaceURI, InvalidDOMElementException::class); @@ -169,7 +169,7 @@ public static function fromXML(DOMElement $xml): static /** * Convert this RoleDescriptor to XML. */ - public function toUnsignedXML(?DOMElement $parent = null): DOMElement + public function toUnsignedXML(?Dom\Element $parent = null): Dom\Element { $e = parent::toUnsignedXML($parent); diff --git a/tests/SAML2/CustomStatement.php b/tests/SAML2/CustomStatement.php index 2a6313e92..89ae0d181 100644 --- a/tests/SAML2/CustomStatement.php +++ b/tests/SAML2/CustomStatement.php @@ -4,7 +4,7 @@ namespace SimpleSAML\Test\SAML2; -use DOMElement; +use Dom; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\XML\saml\AbstractStatement; use SimpleSAML\SAML2\XML\saml\Audience; @@ -62,7 +62,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); @@ -85,7 +85,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/SAML2/XML/alg/DigestMethodTest.php b/tests/SAML2/XML/alg/DigestMethodTest.php index 5640374ce..5b8f812dc 100644 --- a/tests/SAML2/XML/alg/DigestMethodTest.php +++ b/tests/SAML2/XML/alg/DigestMethodTest.php @@ -59,10 +59,11 @@ public function testMarshalling(): void ], ); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($digestMethod), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($digestMethod); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } diff --git a/tests/SAML2/XML/alg/SigningMethodTest.php b/tests/SAML2/XML/alg/SigningMethodTest.php index 6e9c1de42..d41de7523 100644 --- a/tests/SAML2/XML/alg/SigningMethodTest.php +++ b/tests/SAML2/XML/alg/SigningMethodTest.php @@ -62,10 +62,11 @@ public function testMarshalling(): void ], ); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($signingMethod), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($signingMethod); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } diff --git a/tests/SAML2/XML/ecp/RelayStateTest.php b/tests/SAML2/XML/ecp/RelayStateTest.php index ff37bb56d..3253e285e 100644 --- a/tests/SAML2/XML/ecp/RelayStateTest.php +++ b/tests/SAML2/XML/ecp/RelayStateTest.php @@ -48,10 +48,11 @@ public function testMarshalling(): void { $relayState = RelayState::fromString('AGDY854379dskssda'); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($relayState), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($relayState); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } diff --git a/tests/SAML2/XML/ecp/RequestAuthenticatedTest.php b/tests/SAML2/XML/ecp/RequestAuthenticatedTest.php index 3bc5c1477..a58db1d9e 100644 --- a/tests/SAML2/XML/ecp/RequestAuthenticatedTest.php +++ b/tests/SAML2/XML/ecp/RequestAuthenticatedTest.php @@ -51,10 +51,11 @@ public function testMarshalling(): void MustUnderstandValue::fromBoolean(true), ); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($ra), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($ra); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } diff --git a/tests/SAML2/XML/ecp/RequestTest.php b/tests/SAML2/XML/ecp/RequestTest.php index e7be39028..99ac29fa2 100644 --- a/tests/SAML2/XML/ecp/RequestTest.php +++ b/tests/SAML2/XML/ecp/RequestTest.php @@ -81,10 +81,11 @@ public function testMarshalling(): void BooleanValue::fromBoolean(true), ); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($request), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($request); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } diff --git a/tests/SAML2/XML/ecp/ResponseTest.php b/tests/SAML2/XML/ecp/ResponseTest.php index d02db909d..5d985658e 100644 --- a/tests/SAML2/XML/ecp/ResponseTest.php +++ b/tests/SAML2/XML/ecp/ResponseTest.php @@ -4,7 +4,6 @@ namespace SimpleSAML\Test\SAML2\XML\ecp; -use DOMDocument; use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; @@ -53,10 +52,11 @@ public function testMarshalling(): void SAMLAnyURIValue::fromString('https://example.com/ACS'), ); - $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); } @@ -64,7 +64,7 @@ public function testMarshalling(): void */ public function testToXMLResponseAppended(): void { - $doc = new DOMDocument('1.0', 'UTF-8'); + $doc = DOMDocumentFactory::create(); $element = $doc->createElement('Foobar'); $response = new Response( diff --git a/tests/SAML2/XML/ecp/SubjectConfirmationTest.php b/tests/SAML2/XML/ecp/SubjectConfirmationTest.php index 7b6fd9fd1..d57594858 100644 --- a/tests/SAML2/XML/ecp/SubjectConfirmationTest.php +++ b/tests/SAML2/XML/ecp/SubjectConfirmationTest.php @@ -93,10 +93,11 @@ public function testMarshalling(): void $subjectConfirmationData, ); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($subjectConfirmation), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($subjectConfirmation); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } diff --git a/tests/SAML2/XML/emd/RepublishRequestTest.php b/tests/SAML2/XML/emd/RepublishRequestTest.php index 50fb8d976..db2b933c3 100644 --- a/tests/SAML2/XML/emd/RepublishRequestTest.php +++ b/tests/SAML2/XML/emd/RepublishRequestTest.php @@ -58,9 +58,10 @@ public function testMarshalling(): void RepublishTarget::fromString('http://edugain.org/'), ); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($republishRequest), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($republishRequest); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } } diff --git a/tests/SAML2/XML/emd/RepublishTargetTest.php b/tests/SAML2/XML/emd/RepublishTargetTest.php index 6e2a332a8..7a853b400 100644 --- a/tests/SAML2/XML/emd/RepublishTargetTest.php +++ b/tests/SAML2/XML/emd/RepublishTargetTest.php @@ -48,10 +48,11 @@ public function testMarshalling(): void { $republishTarget = RepublishTarget::fromString('http://edugain.org/'); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($republishTarget), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($republishTarget); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } diff --git a/tests/SAML2/XML/idpdisc/DiscoveryResponseTest.php b/tests/SAML2/XML/idpdisc/DiscoveryResponseTest.php index 8ca9bdd69..2fdd82953 100644 --- a/tests/SAML2/XML/idpdisc/DiscoveryResponseTest.php +++ b/tests/SAML2/XML/idpdisc/DiscoveryResponseTest.php @@ -100,10 +100,11 @@ public function testMarshalling(): void [self::$attr], ); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($discoResponse), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($discoResponse); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } diff --git a/tests/SAML2/XML/init/RequestInitiatorTest.php b/tests/SAML2/XML/init/RequestInitiatorTest.php index 94985f8d7..c0302b4bf 100644 --- a/tests/SAML2/XML/init/RequestInitiatorTest.php +++ b/tests/SAML2/XML/init/RequestInitiatorTest.php @@ -72,10 +72,11 @@ public function testMarshalling(): void [$attr], ); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($requestInitiator), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($requestInitiator); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } diff --git a/tests/SAML2/XML/md/AbstractLocalizedNameTest.php b/tests/SAML2/XML/md/AbstractLocalizedNameTest.php index 31b452f37..241a98c47 100644 --- a/tests/SAML2/XML/md/AbstractLocalizedNameTest.php +++ b/tests/SAML2/XML/md/AbstractLocalizedNameTest.php @@ -4,7 +4,7 @@ namespace SimpleSAML\Test\SAML2\XML\md; -use DOMDocument; +use Dom; use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; @@ -27,8 +27,8 @@ #[CoversClass(AbstractMdElement::class)] final class AbstractLocalizedNameTest extends TestCase { - /** @var \DOMDocument */ - private static DOMDocument $xmlRepresentation; + /** @var \Dom\XMLDocument $xmlRepresentation */ + private static Dom\XMLDocument $xmlRepresentation; /** diff --git a/tests/SAML2/XML/md/AdditionalMetadataLocationTest.php b/tests/SAML2/XML/md/AdditionalMetadataLocationTest.php index 0fa4cf06c..39c1f1a55 100644 --- a/tests/SAML2/XML/md/AdditionalMetadataLocationTest.php +++ b/tests/SAML2/XML/md/AdditionalMetadataLocationTest.php @@ -58,10 +58,11 @@ public function testMarshalling(): void SAMLAnyURIValue::fromString(C::LOCATION_A), ); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($additionalMetadataLocation), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($additionalMetadataLocation); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } diff --git a/tests/SAML2/XML/md/AffiliateMemberTest.php b/tests/SAML2/XML/md/AffiliateMemberTest.php index 14fa5860e..fe093720d 100644 --- a/tests/SAML2/XML/md/AffiliateMemberTest.php +++ b/tests/SAML2/XML/md/AffiliateMemberTest.php @@ -52,9 +52,10 @@ public function testMarshalling(): void { $affiliateMember = AffiliateMember::fromString('https://some.entity.org/id'); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($affiliateMember), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($affiliateMember); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } } diff --git a/tests/SAML2/XML/md/AffiliationDescriptorTest.php b/tests/SAML2/XML/md/AffiliationDescriptorTest.php index 5c32125ea..0bf4249b1 100644 --- a/tests/SAML2/XML/md/AffiliationDescriptorTest.php +++ b/tests/SAML2/XML/md/AffiliationDescriptorTest.php @@ -95,10 +95,11 @@ public function testMarshalling(): void ], ); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($affiliationDescriptor), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($affiliationDescriptor); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } diff --git a/tests/SAML2/XML/md/ArtifactResolutionServiceTest.php b/tests/SAML2/XML/md/ArtifactResolutionServiceTest.php index e0d5e2038..8944e6070 100644 --- a/tests/SAML2/XML/md/ArtifactResolutionServiceTest.php +++ b/tests/SAML2/XML/md/ArtifactResolutionServiceTest.php @@ -100,10 +100,11 @@ public function testMarshalling(): void [self::$attr], ); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($ars), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($ars); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } diff --git a/tests/SAML2/XML/md/AssertionConsumerServiceTest.php b/tests/SAML2/XML/md/AssertionConsumerServiceTest.php index 271350de0..9d51215a6 100644 --- a/tests/SAML2/XML/md/AssertionConsumerServiceTest.php +++ b/tests/SAML2/XML/md/AssertionConsumerServiceTest.php @@ -99,9 +99,10 @@ public function testMarshalling(): void [self::$attr], ); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($idxep), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($idxep); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } } diff --git a/tests/SAML2/XML/md/AttributeAuthorityDescriptorTest.php b/tests/SAML2/XML/md/AttributeAuthorityDescriptorTest.php index 4177994f7..8c27f74d9 100644 --- a/tests/SAML2/XML/md/AttributeAuthorityDescriptorTest.php +++ b/tests/SAML2/XML/md/AttributeAuthorityDescriptorTest.php @@ -126,10 +126,11 @@ public function testMarshalling(): void IDValue::fromString('phpunit'), ); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($aad), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($aad); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } diff --git a/tests/SAML2/XML/md/AttributeConsumingServiceTest.php b/tests/SAML2/XML/md/AttributeConsumingServiceTest.php index 87163cf26..b6d51007a 100644 --- a/tests/SAML2/XML/md/AttributeConsumingServiceTest.php +++ b/tests/SAML2/XML/md/AttributeConsumingServiceTest.php @@ -94,10 +94,11 @@ public function testMarshalling(): void ], ); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($acs), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($acs); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } @@ -124,16 +125,18 @@ public function testMarshallingWithoutDescription(): void 'ServiceDescription', ); - /** @var \DOMElement $space */ + /** @var \Dom\Element $space */ $space = $descr->item(0)->previousSibling; $xmlRepresentation->documentElement->removeChild($descr->item(0)); $xmlRepresentation->documentElement->removeChild($space); $xmlRepresentation->documentElement->setAttribute('isDefault', 'false'); - $this->assertEquals( - $xmlRepresentation->saveXML($xmlRepresentation->documentElement), - strval($acs), - ); + + $expectedXml = $xmlRepresentation->saveXml($xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($acs); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } @@ -160,10 +163,10 @@ public function testMarshallingWithoutIsDefault(): void ); $xmlRepresentation = clone self::$xmlRepresentation; $xmlRepresentation->documentElement->removeAttribute('isDefault'); - $this->assertEquals( - $xmlRepresentation->saveXML($xmlRepresentation->documentElement), - strval($acs), - ); + + $expectedXml = $xmlRepresentation->saveXml($xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($acs); } diff --git a/tests/SAML2/XML/md/AttributeProfileTest.php b/tests/SAML2/XML/md/AttributeProfileTest.php index d1a8ed088..d09a2a4a8 100644 --- a/tests/SAML2/XML/md/AttributeProfileTest.php +++ b/tests/SAML2/XML/md/AttributeProfileTest.php @@ -52,9 +52,10 @@ public function testMarshalling(): void { $attributeProfile = AttributeProfile::fromString(C::PROFILE_1); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($attributeProfile), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($attributeProfile); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } } diff --git a/tests/SAML2/XML/md/AuthnAuthorityDescriptorTest.php b/tests/SAML2/XML/md/AuthnAuthorityDescriptorTest.php index c57160135..8467449c1 100644 --- a/tests/SAML2/XML/md/AuthnAuthorityDescriptorTest.php +++ b/tests/SAML2/XML/md/AuthnAuthorityDescriptorTest.php @@ -96,10 +96,11 @@ public function testMarshalling(): void IDValue::fromString('phpunit'), ); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($aad), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($aad); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } diff --git a/tests/SAML2/XML/md/CompanyTest.php b/tests/SAML2/XML/md/CompanyTest.php index c6bdcb7ee..7b99079ec 100644 --- a/tests/SAML2/XML/md/CompanyTest.php +++ b/tests/SAML2/XML/md/CompanyTest.php @@ -50,11 +50,12 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $name = Company::fromString('Company'); + $company = Company::fromString('Company'); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($name), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($company); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } } diff --git a/tests/SAML2/XML/md/ContactPersonTest.php b/tests/SAML2/XML/md/ContactPersonTest.php index 990b13591..1b30c1bc8 100644 --- a/tests/SAML2/XML/md/ContactPersonTest.php +++ b/tests/SAML2/XML/md/ContactPersonTest.php @@ -4,7 +4,7 @@ namespace SimpleSAML\Test\SAML2\XML\md; -use DOMDocument; +use Dom; use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; @@ -46,7 +46,7 @@ final class ContactPersonTest extends TestCase use SerializableElementTestTrait; - private static DOMDocument $ext; + private static Dom\XMLDocument $ext; /** @@ -114,10 +114,11 @@ public function testMarshalling(): void [$attr1, $attr2], ); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($contactPerson), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($contactPerson); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } @@ -177,7 +178,8 @@ public function testUnmarshallingMultipleCompanies(): void { $xmlRepresentation = clone self::$xmlRepresentation; $company = $xmlRepresentation->getElementsByTagNameNS(C::NS_MD, 'Company'); - $newCompany = $xmlRepresentation->createElementNS(C::NS_MD, 'Company', 'Alt. Co.'); + $newCompany = $xmlRepresentation->createElementNS(C::NS_MD, 'Company'); + $newCompany->textContent = 'Alt. Co.'; $xmlRepresentation->documentElement->insertBefore($newCompany, $company->item(0)->nextSibling); $this->expectException(AssertionFailedException::class); @@ -194,7 +196,8 @@ public function testUnmarshallingMultipleGivenNames(): void { $xmlRepresentation = clone self::$xmlRepresentation; $givenName = $xmlRepresentation->getElementsByTagNameNS(C::NS_MD, 'GivenName'); - $newName = $xmlRepresentation->createElementNS(C::NS_MD, 'GivenName', 'New Name'); + $newName = $xmlRepresentation->createElementNS(C::NS_MD, 'GivenName'); + $newName->textContent = 'New Name'; $xmlRepresentation->documentElement->insertBefore($newName, $givenName->item(0)->nextSibling); $this->expectException(AssertionFailedException::class); @@ -211,7 +214,8 @@ public function testUnmarshallingMultipleSurNames(): void { $xmlRepresentation = clone self::$xmlRepresentation; $surName = $xmlRepresentation->getElementsByTagNameNS(C::NS_MD, 'SurName'); - $newName = $xmlRepresentation->createElementNS(C::NS_MD, 'SurName', 'New Name'); + $newName = $xmlRepresentation->createElementNS(C::NS_MD, 'SurName'); + $newName->textContent = 'New Name'; $xmlRepresentation->documentElement->insertBefore($newName, $surName->item(0)->nextSibling); $this->expectException(AssertionFailedException::class); diff --git a/tests/SAML2/XML/md/EmailAddressTest.php b/tests/SAML2/XML/md/EmailAddressTest.php index 503cb0121..a113181fe 100644 --- a/tests/SAML2/XML/md/EmailAddressTest.php +++ b/tests/SAML2/XML/md/EmailAddressTest.php @@ -54,10 +54,11 @@ public function testMarshalling(): void { $email = EmailAddress::fromString('john.doe@example.org'); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($email), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($email); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } diff --git a/tests/SAML2/XML/md/EncryptionMethodTest.php b/tests/SAML2/XML/md/EncryptionMethodTest.php index f13a1bb71..e461f1caa 100644 --- a/tests/SAML2/XML/md/EncryptionMethodTest.php +++ b/tests/SAML2/XML/md/EncryptionMethodTest.php @@ -71,10 +71,11 @@ public function testMarshalling(): void [$chunk], ); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($encryptionMethod), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($encryptionMethod); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } @@ -115,7 +116,7 @@ public function testMarshallingElementOrdering(): void [$chunk], ); - // Marshall it to a \DOMElement + // Marshall it to a \Dom\Element $emElement = $em->toXML(); // Test for a KeySize @@ -125,7 +126,7 @@ public function testMarshallingElementOrdering(): void $this->assertEquals('10', $keySizeElements[0]->textContent); // Test ordering of EncryptionMethod contents - /** @var \DOMElement[] $emElements */ + /** @var \Dom\Element[] $emElements */ $emElements = XPath::xpQuery($emElement, './xenc:KeySize/following-sibling::*', $xpCache); $this->assertCount(2, $emElements); diff --git a/tests/SAML2/XML/md/EndpointTypeTest.php b/tests/SAML2/XML/md/EndpointTypeTest.php index 7ca3cc973..fd49758c0 100644 --- a/tests/SAML2/XML/md/EndpointTypeTest.php +++ b/tests/SAML2/XML/md/EndpointTypeTest.php @@ -4,7 +4,7 @@ namespace SimpleSAML\Test\SAML2\XML\md; -use DOMDocument; +use Dom; use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; @@ -43,7 +43,7 @@ final class EndpointTypeTest extends TestCase use SerializableElementTestTrait; - private static DOMDocument $ext; + private static Dom\XMLDocument $ext; /** @@ -95,10 +95,11 @@ public function testMarshalling(): void [$attr], ); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($endpointType), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($endpointType); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } diff --git a/tests/SAML2/XML/md/EntitiesDescriptorTest.php b/tests/SAML2/XML/md/EntitiesDescriptorTest.php index a9bb186ff..f73ac5788 100644 --- a/tests/SAML2/XML/md/EntitiesDescriptorTest.php +++ b/tests/SAML2/XML/md/EntitiesDescriptorTest.php @@ -100,10 +100,11 @@ public function testMarshalling(): void ID: IDValue::fromString('phpunit'), ); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($entitiesd), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($entitiesd); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } diff --git a/tests/SAML2/XML/md/EntityDescriptorTest.php b/tests/SAML2/XML/md/EntityDescriptorTest.php index b988a0371..6e871358b 100644 --- a/tests/SAML2/XML/md/EntityDescriptorTest.php +++ b/tests/SAML2/XML/md/EntityDescriptorTest.php @@ -4,7 +4,6 @@ namespace SimpleSAML\Test\SAML2\XML\md; -use DOMText; use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; @@ -216,10 +215,11 @@ public function testMarshalling(): void namespacedAttribute: [$attr1], ); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($ed), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($ed); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } @@ -423,7 +423,7 @@ public function testUnmarshalling(): void $type = new XMLAttribute(C_XSI::NS_XSI, 'xsi', 'type', StringValue::fromString('ssp:UnknownRoleDescriptor')); $type->toXML($customd); - $newline = new DOMText("\n "); + $newline = $pdpd->ownerDocument->createTextNode("\n "); $pdpd->parentNode->insertBefore($customd, $pdpd->nextSibling); $pdpd->parentNode->insertBefore($newline, $customd); $entityDescriptor = EntityDescriptor::fromXML($xmlRepresentation->documentElement); diff --git a/tests/SAML2/XML/md/ExtensionsTest.php b/tests/SAML2/XML/md/ExtensionsTest.php index b5c050d15..d3dd98544 100644 --- a/tests/SAML2/XML/md/ExtensionsTest.php +++ b/tests/SAML2/XML/md/ExtensionsTest.php @@ -133,10 +133,11 @@ public function testMarshalling(): void $republishRequest, ]); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($extensions), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($extensions); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } diff --git a/tests/SAML2/XML/md/GivenNameTest.php b/tests/SAML2/XML/md/GivenNameTest.php index ec2ac8950..ce07bb9f3 100644 --- a/tests/SAML2/XML/md/GivenNameTest.php +++ b/tests/SAML2/XML/md/GivenNameTest.php @@ -50,11 +50,12 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $name = GivenName::fromString('John'); + $givenName = GivenName::fromString('John'); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($name), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($givenName); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } } diff --git a/tests/SAML2/XML/md/IDPSSODescriptorTest.php b/tests/SAML2/XML/md/IDPSSODescriptorTest.php index 9dc9de254..b71ab511b 100644 --- a/tests/SAML2/XML/md/IDPSSODescriptorTest.php +++ b/tests/SAML2/XML/md/IDPSSODescriptorTest.php @@ -182,10 +182,11 @@ public function testMarshalling(): void ], ); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($idpssod), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($idpssod); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } diff --git a/tests/SAML2/XML/md/KeyDescriptorTest.php b/tests/SAML2/XML/md/KeyDescriptorTest.php index 02ba844e8..22e8f3561 100644 --- a/tests/SAML2/XML/md/KeyDescriptorTest.php +++ b/tests/SAML2/XML/md/KeyDescriptorTest.php @@ -69,10 +69,11 @@ public function testMarshalling(): void ], ); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($kd), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($kd); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } diff --git a/tests/SAML2/XML/md/NameIDFormatTest.php b/tests/SAML2/XML/md/NameIDFormatTest.php index 00719535c..61fbdf9ca 100644 --- a/tests/SAML2/XML/md/NameIDFormatTest.php +++ b/tests/SAML2/XML/md/NameIDFormatTest.php @@ -52,9 +52,10 @@ public function testMarshalling(): void { $nameIdFormat = NameIDFormat::fromString(C::NAMEID_PERSISTENT); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($nameIdFormat), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($nameIdFormat); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } } diff --git a/tests/SAML2/XML/md/NameIDMappingServiceTest.php b/tests/SAML2/XML/md/NameIDMappingServiceTest.php index ea1ecce2d..385f6272c 100644 --- a/tests/SAML2/XML/md/NameIDMappingServiceTest.php +++ b/tests/SAML2/XML/md/NameIDMappingServiceTest.php @@ -58,10 +58,11 @@ public function testMarshalling(): void SAMLAnyURIValue::fromString(C::LOCATION_A), ); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($nidmsep), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($nidmsep); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } diff --git a/tests/SAML2/XML/md/OrganizationDisplayNameTest.php b/tests/SAML2/XML/md/OrganizationDisplayNameTest.php index d1b50aa3f..195e2072e 100644 --- a/tests/SAML2/XML/md/OrganizationDisplayNameTest.php +++ b/tests/SAML2/XML/md/OrganizationDisplayNameTest.php @@ -63,9 +63,10 @@ public function testMarshalling(): void SAMLStringValue::fromString('Identity Providers R US, a Division of Lerxst Corp.'), ); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($name), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($name); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } } diff --git a/tests/SAML2/XML/md/OrganizationNameTest.php b/tests/SAML2/XML/md/OrganizationNameTest.php index 2d2551946..478a46e57 100644 --- a/tests/SAML2/XML/md/OrganizationNameTest.php +++ b/tests/SAML2/XML/md/OrganizationNameTest.php @@ -63,9 +63,10 @@ public function testMarshalling(): void SAMLStringValue::fromString('Identity Providers R US'), ); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($name), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($name); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } } diff --git a/tests/SAML2/XML/md/OrganizationTest.php b/tests/SAML2/XML/md/OrganizationTest.php index 5e4713e14..f8eea2c2f 100644 --- a/tests/SAML2/XML/md/OrganizationTest.php +++ b/tests/SAML2/XML/md/OrganizationTest.php @@ -4,7 +4,7 @@ namespace SimpleSAML\Test\SAML2\XML\md; -use DOMDocument; +use Dom; use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; @@ -44,8 +44,8 @@ final class OrganizationTest extends TestCase use SerializableElementTestTrait; - /** @var \DOMDocument */ - private static DOMDocument $ext; + /** @var \Dom\XMLDocument $ext */ + private static Dom\XMLDocument $ext; /** @@ -114,9 +114,10 @@ public function testMarshalling(): void [new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1'))], ); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($org), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($org); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } } diff --git a/tests/SAML2/XML/md/OrganizationURLTest.php b/tests/SAML2/XML/md/OrganizationURLTest.php index 2c70a9670..cabeeb656 100644 --- a/tests/SAML2/XML/md/OrganizationURLTest.php +++ b/tests/SAML2/XML/md/OrganizationURLTest.php @@ -65,9 +65,10 @@ public function testMarshalling(): void SAMLAnyURIValue::fromString('https://IdentityProvider.com'), ); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($name), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($name); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } } diff --git a/tests/SAML2/XML/md/PDPDescriptorTest.php b/tests/SAML2/XML/md/PDPDescriptorTest.php index a2172388c..726f522b8 100644 --- a/tests/SAML2/XML/md/PDPDescriptorTest.php +++ b/tests/SAML2/XML/md/PDPDescriptorTest.php @@ -97,10 +97,11 @@ public function testMarshalling(): void IDValue::fromString('phpunit'), ); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($pdpd), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($pdpd); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } diff --git a/tests/SAML2/XML/md/RequestedAttributeTest.php b/tests/SAML2/XML/md/RequestedAttributeTest.php index a6e055f78..95225489b 100644 --- a/tests/SAML2/XML/md/RequestedAttributeTest.php +++ b/tests/SAML2/XML/md/RequestedAttributeTest.php @@ -66,10 +66,11 @@ public function testMarshalling(): void ], ); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($ra), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($ra); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } diff --git a/tests/SAML2/XML/md/RoleDescriptorTest.php b/tests/SAML2/XML/md/RoleDescriptorTest.php index a81db527f..fe8e54807 100644 --- a/tests/SAML2/XML/md/RoleDescriptorTest.php +++ b/tests/SAML2/XML/md/RoleDescriptorTest.php @@ -198,10 +198,11 @@ public function testMarshalling(): void [$attr_3], ); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($roleDescriptor), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($roleDescriptor); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } @@ -296,7 +297,9 @@ public function testUnmarshallingUnregistered(): void $this->assertEquals('urn:x-simplesamlphp:namespace', $extensions[0]->getNamespaceURI()); $this->assertEquals('Chunk', $extensions[0]->getLocalName()); - $this->assertEquals($element->ownerDocument?->saveXML($element), strval($descriptor)); + /** @var \Dom\XMLDocument $ownerDocument */ + $ownerDocument = $element->ownerDocument; + $this->assertEquals($ownerDocument->saveXML($element), strval($descriptor)); } diff --git a/tests/SAML2/XML/md/SPSSODescriptorTest.php b/tests/SAML2/XML/md/SPSSODescriptorTest.php index 786d648ee..b522ff647 100644 --- a/tests/SAML2/XML/md/SPSSODescriptorTest.php +++ b/tests/SAML2/XML/md/SPSSODescriptorTest.php @@ -223,10 +223,11 @@ public function testMarshalling(): void ], ); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($spssod), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($spssod); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } diff --git a/tests/SAML2/XML/md/ServiceDescriptionTest.php b/tests/SAML2/XML/md/ServiceDescriptionTest.php index 3695a2556..85ef44951 100644 --- a/tests/SAML2/XML/md/ServiceDescriptionTest.php +++ b/tests/SAML2/XML/md/ServiceDescriptionTest.php @@ -58,14 +58,15 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $name = new ServiceDescription( + $sd = new ServiceDescription( LangValue::fromString('en'), SAMLStringValue::fromString('Academic Journals R US and only us'), ); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($name), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($sd); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } } diff --git a/tests/SAML2/XML/md/ServiceNameTest.php b/tests/SAML2/XML/md/ServiceNameTest.php index 31ac13f6b..2a0e9f7c3 100644 --- a/tests/SAML2/XML/md/ServiceNameTest.php +++ b/tests/SAML2/XML/md/ServiceNameTest.php @@ -60,15 +60,16 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $name = new ServiceName( + $serviceName = new ServiceName( LangValue::fromString('en'), SAMLStringValue::fromString('Academic Journals R US'), ); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($name), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($serviceName); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } diff --git a/tests/SAML2/XML/md/SingleSignOnServiceTest.php b/tests/SAML2/XML/md/SingleSignOnServiceTest.php index 9be2f2d66..7c7e8a78f 100644 --- a/tests/SAML2/XML/md/SingleSignOnServiceTest.php +++ b/tests/SAML2/XML/md/SingleSignOnServiceTest.php @@ -58,10 +58,11 @@ public function testMarshalling(): void SAMLAnyURIValue::fromString(C::LOCATION_A), ); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($ssoep), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($ssoep); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } diff --git a/tests/SAML2/XML/md/SurNameTest.php b/tests/SAML2/XML/md/SurNameTest.php index 79348ca3a..b95573f68 100644 --- a/tests/SAML2/XML/md/SurNameTest.php +++ b/tests/SAML2/XML/md/SurNameTest.php @@ -52,9 +52,10 @@ public function testMarshalling(): void { $name = SurName::fromString('Doe'); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($name), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($name); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } } diff --git a/tests/SAML2/XML/md/TelephoneNumberTest.php b/tests/SAML2/XML/md/TelephoneNumberTest.php index c9c202dfc..3aedda383 100644 --- a/tests/SAML2/XML/md/TelephoneNumberTest.php +++ b/tests/SAML2/XML/md/TelephoneNumberTest.php @@ -51,11 +51,12 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $name = TelephoneNumber::fromString('+1234567890'); + $telephoneNumber = TelephoneNumber::fromString('+1234567890'); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($name), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($telephoneNumber); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } } diff --git a/tests/SAML2/XML/mdattr/EntityAttributesTest.php b/tests/SAML2/XML/mdattr/EntityAttributesTest.php index 5aabec628..c5c998099 100644 --- a/tests/SAML2/XML/mdattr/EntityAttributesTest.php +++ b/tests/SAML2/XML/mdattr/EntityAttributesTest.php @@ -168,9 +168,10 @@ public function testMarshalling(): void $entityAttributes->addChild($signedAssertion); $entityAttributes->addChild($attribute2); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($entityAttributes), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($entityAttributes); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } } diff --git a/tests/SAML2/XML/mdrpi/PublicationInfoTest.php b/tests/SAML2/XML/mdrpi/PublicationInfoTest.php index 88ee2335b..477ebacc6 100644 --- a/tests/SAML2/XML/mdrpi/PublicationInfoTest.php +++ b/tests/SAML2/XML/mdrpi/PublicationInfoTest.php @@ -4,7 +4,7 @@ namespace SimpleSAML\Test\SAML2\XML\mdrpi; -use DOMDocument; +use Dom; use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; @@ -45,8 +45,8 @@ final class PublicationInfoTest extends TestCase use SerializableElementTestTrait; - /** @var \DOMDocument */ - private static DOMDocument $affiliationDescriptor; + /** @var \Dom\XMLDocument $affiliationDescriptor */ + private static Dom\XMLDocument $affiliationDescriptor; /** @@ -92,10 +92,11 @@ public function testMarshalling(): void ], ); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($publicationInfo), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($publicationInfo); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } diff --git a/tests/SAML2/XML/mdrpi/PublicationPathTest.php b/tests/SAML2/XML/mdrpi/PublicationPathTest.php index 5fc34bd66..75a7bdc67 100644 --- a/tests/SAML2/XML/mdrpi/PublicationPathTest.php +++ b/tests/SAML2/XML/mdrpi/PublicationPathTest.php @@ -77,10 +77,11 @@ public function testMarshalling(): void ), ]); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($publicationPath), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($publicationPath); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } diff --git a/tests/SAML2/XML/mdrpi/PublicationTest.php b/tests/SAML2/XML/mdrpi/PublicationTest.php index a0d07fb9f..c2541d913 100644 --- a/tests/SAML2/XML/mdrpi/PublicationTest.php +++ b/tests/SAML2/XML/mdrpi/PublicationTest.php @@ -64,10 +64,11 @@ public function testMarshalling(): void SAMLStringValue::fromString('SomePublicationId'), ); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($publication), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($publication); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } diff --git a/tests/SAML2/XML/mdrpi/RegistrationInfoTest.php b/tests/SAML2/XML/mdrpi/RegistrationInfoTest.php index a3cd3777b..a6afed9d5 100644 --- a/tests/SAML2/XML/mdrpi/RegistrationInfoTest.php +++ b/tests/SAML2/XML/mdrpi/RegistrationInfoTest.php @@ -4,7 +4,7 @@ namespace SimpleSAML\Test\SAML2\XML\mdrpi; -use DOMDocument; +use Dom; use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; @@ -45,8 +45,8 @@ final class RegistrationInfoTest extends TestCase use SerializableElementTestTrait; - /** @var \DOMDocument */ - private static DOMDocument $affiliationDescriptor; + /** @var \Dom\XMLDocument $affiliationDescriptor */ + private static Dom\XMLDocument $affiliationDescriptor; /** @@ -93,10 +93,11 @@ public function testMarshalling(): void ], ); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($registrationInfo), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($registrationInfo); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } diff --git a/tests/SAML2/XML/mdrpi/RegistrationPolicyTest.php b/tests/SAML2/XML/mdrpi/RegistrationPolicyTest.php index d56e64e62..1a726a45b 100644 --- a/tests/SAML2/XML/mdrpi/RegistrationPolicyTest.php +++ b/tests/SAML2/XML/mdrpi/RegistrationPolicyTest.php @@ -58,14 +58,15 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $name = new RegistrationPolicy( + $rp = new RegistrationPolicy( LangValue::fromString('en'), SAMLAnyURIValue::fromString('http://www.example.edu/en/'), ); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($name), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($rp); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } } diff --git a/tests/SAML2/XML/mdrpi/UsagePolicyTest.php b/tests/SAML2/XML/mdrpi/UsagePolicyTest.php index 6cbc157c6..cc88a7b06 100644 --- a/tests/SAML2/XML/mdrpi/UsagePolicyTest.php +++ b/tests/SAML2/XML/mdrpi/UsagePolicyTest.php @@ -58,14 +58,15 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $name = new UsagePolicy( + $up = new UsagePolicy( LangValue::fromString('en'), SAMLAnyURIValue::fromString('http://www.example.edu/en/'), ); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($name), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($up); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } } diff --git a/tests/SAML2/XML/mdui/DescriptionTest.php b/tests/SAML2/XML/mdui/DescriptionTest.php index 8bdc8b469..e81c4e8f0 100644 --- a/tests/SAML2/XML/mdui/DescriptionTest.php +++ b/tests/SAML2/XML/mdui/DescriptionTest.php @@ -56,14 +56,15 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $name = new Description( + $description = new Description( LangValue::fromString('en'), SAMLStringValue::fromString('Just an example'), ); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($name), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($description); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } } diff --git a/tests/SAML2/XML/mdui/DiscoHintsTest.php b/tests/SAML2/XML/mdui/DiscoHintsTest.php index f0b1246d2..274c052d0 100644 --- a/tests/SAML2/XML/mdui/DiscoHintsTest.php +++ b/tests/SAML2/XML/mdui/DiscoHintsTest.php @@ -78,10 +78,11 @@ public function testMarshalling(): void ], ); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($discoHints), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($discoHints); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } @@ -116,7 +117,7 @@ public function testMarshallingChildren(): void $document = DOMDocumentFactory::fromString(''); $xml = $discoHints->toXML($document->documentElement); - /** @var \DOMElement[] $discoElements */ + /** @var \Dom\Element[] $discoElements */ $discoElements = XPath::xpQuery( $xml, '/root/*[local-name()=\'DiscoHints\' and namespace-uri()=\'urn:oasis:names:tc:SAML:metadata:ui\']', diff --git a/tests/SAML2/XML/mdui/DisplayNameTest.php b/tests/SAML2/XML/mdui/DisplayNameTest.php index 51c9b0aa1..e77b8734a 100644 --- a/tests/SAML2/XML/mdui/DisplayNameTest.php +++ b/tests/SAML2/XML/mdui/DisplayNameTest.php @@ -61,9 +61,10 @@ public function testMarshalling(): void SAMLStringValue::fromString('University of Examples'), ); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($name), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($name); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } } diff --git a/tests/SAML2/XML/mdui/DomainHintTest.php b/tests/SAML2/XML/mdui/DomainHintTest.php index 8c2ad8c6a..7032dbe3a 100644 --- a/tests/SAML2/XML/mdui/DomainHintTest.php +++ b/tests/SAML2/XML/mdui/DomainHintTest.php @@ -58,9 +58,10 @@ public function testMarshalling(): void { $hint = DomainHint::fromString('www.example.com'); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($hint), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($hint); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } } diff --git a/tests/SAML2/XML/mdui/GeolocationHintTest.php b/tests/SAML2/XML/mdui/GeolocationHintTest.php index bd710f5e2..0eef3f1ac 100644 --- a/tests/SAML2/XML/mdui/GeolocationHintTest.php +++ b/tests/SAML2/XML/mdui/GeolocationHintTest.php @@ -58,9 +58,10 @@ public function testMarshalling(): void { $hint = GeolocationHint::fromString('geo:47.37328,8.531126'); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($hint), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($hint); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } } diff --git a/tests/SAML2/XML/mdui/IPHintTest.php b/tests/SAML2/XML/mdui/IPHintTest.php index f58cf06bd..7be627f5e 100644 --- a/tests/SAML2/XML/mdui/IPHintTest.php +++ b/tests/SAML2/XML/mdui/IPHintTest.php @@ -58,9 +58,10 @@ public function testMarshalling(): void { $hint = IPHint::fromString('130.59.0.0/16'); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($hint), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($hint); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } } diff --git a/tests/SAML2/XML/mdui/InformationURLTest.php b/tests/SAML2/XML/mdui/InformationURLTest.php index 677962b67..178a20211 100644 --- a/tests/SAML2/XML/mdui/InformationURLTest.php +++ b/tests/SAML2/XML/mdui/InformationURLTest.php @@ -58,14 +58,15 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $name = new InformationURL( + $url = new InformationURL( LangValue::fromString('en'), SAMLAnyURIValue::fromString('http://www.example.edu/en/'), ); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($name), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($url); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } } diff --git a/tests/SAML2/XML/mdui/KeywordsTest.php b/tests/SAML2/XML/mdui/KeywordsTest.php index 2ce74acbc..3a11e444f 100644 --- a/tests/SAML2/XML/mdui/KeywordsTest.php +++ b/tests/SAML2/XML/mdui/KeywordsTest.php @@ -61,10 +61,11 @@ public function testMarshalling(): void ListOfStringsValue::fromString("KLM koninklijke+luchtvaart+maatschappij"), ); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($keywords), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($keywords); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } diff --git a/tests/SAML2/XML/mdui/LogoTest.php b/tests/SAML2/XML/mdui/LogoTest.php index ac3f1c274..e300d1a83 100644 --- a/tests/SAML2/XML/mdui/LogoTest.php +++ b/tests/SAML2/XML/mdui/LogoTest.php @@ -76,10 +76,11 @@ public function testMarshalling(): void LangValue::fromString('nl'), ); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($logo), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($logo); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } diff --git a/tests/SAML2/XML/mdui/PrivacyStatementURLTest.php b/tests/SAML2/XML/mdui/PrivacyStatementURLTest.php index e7f973750..db104639d 100644 --- a/tests/SAML2/XML/mdui/PrivacyStatementURLTest.php +++ b/tests/SAML2/XML/mdui/PrivacyStatementURLTest.php @@ -58,14 +58,15 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $name = new PrivacyStatementURL( + $url = new PrivacyStatementURL( LangValue::fromString('en'), SAMLAnyURIValue::fromString('https://example.org/privacy'), ); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($name), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($url); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } } diff --git a/tests/SAML2/XML/mdui/UIInfoTest.php b/tests/SAML2/XML/mdui/UIInfoTest.php index 82a530b4f..09246866b 100644 --- a/tests/SAML2/XML/mdui/UIInfoTest.php +++ b/tests/SAML2/XML/mdui/UIInfoTest.php @@ -140,10 +140,11 @@ public function testMarshalling(): void $uiinfo->addLogo($logo); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($uiinfo), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($uiinfo); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } @@ -210,7 +211,7 @@ public function testMarshallingChildren(): void $this->assertEquals("https://example.edu/logo.png", $logoElements[0]->textContent); $xpCache = XPath::getXPath($infoElement); - /** @var \DOMElement[] $keywordElements */ + /** @var \Dom\Element[] $keywordElements */ $keywordElements = XPath::xpQuery( $infoElement, './*[local-name()=\'Keywords\' and namespace-uri()=\'urn:oasis:names:tc:SAML:metadata:ui\']', diff --git a/tests/SAML2/XML/saml/ActionTest.php b/tests/SAML2/XML/saml/ActionTest.php index 96486a3fc..d0bc83d64 100644 --- a/tests/SAML2/XML/saml/ActionTest.php +++ b/tests/SAML2/XML/saml/ActionTest.php @@ -55,9 +55,10 @@ public function testMarshalling(): void SAMLStringValue::fromString('SomeAction'), ); - $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/SAML2/XML/saml/AdviceTest.php b/tests/SAML2/XML/saml/AdviceTest.php index 1bbc35098..6fc56c62c 100644 --- a/tests/SAML2/XML/saml/AdviceTest.php +++ b/tests/SAML2/XML/saml/AdviceTest.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\Test\SAML2\XML\saml; -use DOMDocument; +use Dom; use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; @@ -35,14 +35,14 @@ final class AdviceTest extends TestCase use SerializableElementTestTrait; - /** @var \DOMDocument $assertionIDRef */ - private static DOMDocument $assertionIDRef; + /** @var \Dom\XMLDocument $assertionIDRef */ + private static Dom\XMLDocument $assertionIDRef; - /** @var \DOMDocument $assertionURIRef */ - private static DOMDocument $assertionURIRef; + /** @var \Dom\XMLDocument $assertionURIRef */ + private static Dom\XMLDocument $assertionURIRef; - /** @var \DOMDocument $assertion */ - private static DOMDocument $assertion; + /** @var \Dom\XMLDocument $assertion */ + private static Dom\XMLDocument $assertion; /** @@ -88,10 +88,11 @@ public function testMarshalling(): void $this->assertFalse($advice->isEmptyElement()); - $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/SAML2/XML/saml/AssertionIDRefTest.php b/tests/SAML2/XML/saml/AssertionIDRefTest.php index a5e1fa836..291e828da 100644 --- a/tests/SAML2/XML/saml/AssertionIDRefTest.php +++ b/tests/SAML2/XML/saml/AssertionIDRefTest.php @@ -48,9 +48,10 @@ public function testMarshalling(): void { $assertionIDRef = AssertionIDRef::fromString('_Test'); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($assertionIDRef), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($assertionIDRef); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } } diff --git a/tests/SAML2/XML/saml/AssertionTest.php b/tests/SAML2/XML/saml/AssertionTest.php index 97b09cbfa..cab30c70e 100644 --- a/tests/SAML2/XML/saml/AssertionTest.php +++ b/tests/SAML2/XML/saml/AssertionTest.php @@ -202,10 +202,11 @@ public function testMarshalling(): void [$authnStatement, $attrStatement], ); - $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); } @@ -316,7 +317,9 @@ public function testMarshallingUnmarshallingChristmas(): void statements: $statements, ); - $assertionElement = $assertion->toXML()->ownerDocument?->saveXML(); + /** @var \Dom\XMLDocument $ownerDocument */ + $ownerDocument = $assertion->toXML()->ownerDocument; + $assertionElement = $ownerDocument->saveXML(); $assertionToVerify = Assertion::fromXML(DOMDocumentFactory::fromString($assertionElement)->documentElement); $conditions = $assertionToVerify->getConditions(); @@ -589,7 +592,10 @@ public function testEptiAttributeValuesAreParsedCorrectly(): void $this->assertEquals('abcd-some-value-xyz', $oValue->getContent()); $this->assertEquals('urn:oasis:names:tc:SAML:2.0:nameid-format:persistent', $mValue->getFormat()); $this->assertEquals('urn:oasis:names:tc:SAML:2.0:nameid-format:persistent', $oValue->getFormat()); - $this->assertXmlStringEqualsXmlString($xml, $assertion->toXML()->ownerDocument?->saveXML()); + + /** @var \Dom\XMLDocument $ownerDocument */ + $ownerDocument = $assertion->toXML()->ownerDocument; + $this->assertXmlStringEqualsXmlString($xml, $ownerDocument->saveXML()); } @@ -692,7 +698,9 @@ public function testEptiAttributeParsingSupportsMultipleValues(): void $this->assertEquals('urn:oasis:names:tc:SAML:2.0:nameid-format:persistent', $firstValue->getFormat()); $this->assertEquals('urn:oasis:names:tc:SAML:2.0:nameid-format:persistent', $secondValue->getFormat()); - $this->assertXmlStringEqualsXmlString($xml, $assertion->toXML()->ownerDocument?->saveXML()); + /** @var \Dom\XMLDocument $ownerDocument */ + $ownerDocument = $assertion->toXML()->ownerDocument; + $this->assertXmlStringEqualsXmlString($xml, $ownerDocument->saveXML()); } @@ -1152,8 +1160,10 @@ public function testNameIdEncryption(): void statements: [$authnStatement], ); - // Marshall it to a \DOMElement - $assertionElement = $assertion->toXML()->ownerDocument?->saveXML(); + // Marshall it to a \Dom\Element + /** @var \Dom\XMLDocument $ownerDocument */ + $ownerDocument = $assertion->toXML()->ownerDocument; + $assertionElement = $ownerDocument->saveXML(); $assertionToVerify = Assertion::fromXML(DOMDocumentFactory::fromString($assertionElement)->documentElement); @@ -1245,7 +1255,7 @@ public function testMarshallingElementOrdering(): void PEMCertificatesMock::getPrivateKey(PEMCertificatesMock::PRIVATE_KEY), ); - // Marshall it to a \DOMElement + // Marshall it to a \Dom\Element $assertion->sign($signer); $assertionElement = $assertion->toXML(); @@ -1256,7 +1266,7 @@ public function testMarshallingElementOrdering(): void $this->assertEquals('urn:x-simplesamlphp:issuer', $issuerElements[0]->textContent); // Test ordering of Assertion contents - /** @var \DOMElement[] $assertionElements */ + /** @var \Dom\Element[] $assertionElements */ $assertionElements = XPath::xpQuery( $assertionElement, './saml_assertion:Issuer/following-sibling::*', diff --git a/tests/SAML2/XML/saml/AssertionURIRefTest.php b/tests/SAML2/XML/saml/AssertionURIRefTest.php index 4778eff9c..07cfcc181 100644 --- a/tests/SAML2/XML/saml/AssertionURIRefTest.php +++ b/tests/SAML2/XML/saml/AssertionURIRefTest.php @@ -48,9 +48,10 @@ public function testMarshalling(): void { $assertionURIRef = AssertionURIRef::fromString('urn:x-simplesamlphp:reference'); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($assertionURIRef), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($assertionURIRef); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } } diff --git a/tests/SAML2/XML/saml/AttributeStatementTest.php b/tests/SAML2/XML/saml/AttributeStatementTest.php index 6fd4fa7cd..c39e332f4 100644 --- a/tests/SAML2/XML/saml/AttributeStatementTest.php +++ b/tests/SAML2/XML/saml/AttributeStatementTest.php @@ -77,10 +77,11 @@ public function testMarshalling(): void ], ); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($attrStatement), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($attrStatement); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } diff --git a/tests/SAML2/XML/saml/AttributeTest.php b/tests/SAML2/XML/saml/AttributeTest.php index b3bc863fc..36256c7e9 100644 --- a/tests/SAML2/XML/saml/AttributeTest.php +++ b/tests/SAML2/XML/saml/AttributeTest.php @@ -95,10 +95,11 @@ public function testMarshalling(): void [$attr1, $attr2], ); - $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/SAML2/XML/saml/AttributeValueTest.php b/tests/SAML2/XML/saml/AttributeValueTest.php index 4898edbc5..3d002896c 100644 --- a/tests/SAML2/XML/saml/AttributeValueTest.php +++ b/tests/SAML2/XML/saml/AttributeValueTest.php @@ -61,10 +61,11 @@ public function testMarshalling(): void $this->assertEquals(2, $av->getValue()->toInteger()); $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); } @@ -166,7 +167,7 @@ public function testEmptyStringAttribute(): void /** - * Verifies that we can create an AttributeValue containing a NameID from a DOMElement. + * Verifies that we can create an AttributeValue containing a NameID from a Dom\Element. * * @return void */ @@ -188,7 +189,9 @@ public function testUnmarshallingNameID(): void $this->assertEquals('abcd-some-value-xyz', $value->getContent()); $this->assertEquals('urn:oasis:names:tc:SAML:2.0:nameid-format:persistent', $value->getFormat()); - $this->assertXmlStringEqualsXmlString($document->saveXML(), $av->toXML()->ownerDocument?->saveXML()); + /** @var \Dom\XMLDocument $ownerDocument */ + $ownerDocument = $av->toXML()->ownerDocument; + $this->assertXmlStringEqualsXmlString($document->saveXML(), $ownerDocument->saveXML()); } diff --git a/tests/SAML2/XML/saml/AudienceRestrictionTest.php b/tests/SAML2/XML/saml/AudienceRestrictionTest.php index 081b67c65..d82d4acb3 100644 --- a/tests/SAML2/XML/saml/AudienceRestrictionTest.php +++ b/tests/SAML2/XML/saml/AudienceRestrictionTest.php @@ -57,9 +57,10 @@ 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); } } diff --git a/tests/SAML2/XML/saml/AudienceTest.php b/tests/SAML2/XML/saml/AudienceTest.php index 297015f90..8b824f036 100644 --- a/tests/SAML2/XML/saml/AudienceTest.php +++ b/tests/SAML2/XML/saml/AudienceTest.php @@ -50,9 +50,10 @@ public function testMarshalling(): void { $audience = Audience::fromString('urn:test:audience1'); - $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/SAML2/XML/saml/AuthenticatingAuthorityTest.php b/tests/SAML2/XML/saml/AuthenticatingAuthorityTest.php index c3eaaa963..823728f20 100644 --- a/tests/SAML2/XML/saml/AuthenticatingAuthorityTest.php +++ b/tests/SAML2/XML/saml/AuthenticatingAuthorityTest.php @@ -48,9 +48,10 @@ public function testMarshalling(): void { $authenticatingAuthority = AuthenticatingAuthority::fromString('https://idp.example.com/SAML2'); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($authenticatingAuthority), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($authenticatingAuthority); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } } diff --git a/tests/SAML2/XML/saml/AuthnContextClassRefTest.php b/tests/SAML2/XML/saml/AuthnContextClassRefTest.php index ccf2753c4..8fbd57a79 100644 --- a/tests/SAML2/XML/saml/AuthnContextClassRefTest.php +++ b/tests/SAML2/XML/saml/AuthnContextClassRefTest.php @@ -50,9 +50,10 @@ public function testMarshalling(): void { $authnContextClassRef = AuthnContextClassRef::fromString(C::AC_PASSWORD_PROTECTED_TRANSPORT); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($authnContextClassRef), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($authnContextClassRef); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } } diff --git a/tests/SAML2/XML/saml/AuthnContextDeclRefTest.php b/tests/SAML2/XML/saml/AuthnContextDeclRefTest.php index 305702758..492e30fac 100644 --- a/tests/SAML2/XML/saml/AuthnContextDeclRefTest.php +++ b/tests/SAML2/XML/saml/AuthnContextDeclRefTest.php @@ -51,9 +51,10 @@ public function testMarshalling(): void { $authnContextDeclRef = AuthnContextDeclRef::fromString('https://example.org/relative/path/to/document.xml'); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($authnContextDeclRef), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($authnContextDeclRef); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } } diff --git a/tests/SAML2/XML/saml/AuthnContextDeclTest.php b/tests/SAML2/XML/saml/AuthnContextDeclTest.php index abc63245e..cdf02dc97 100644 --- a/tests/SAML2/XML/saml/AuthnContextDeclTest.php +++ b/tests/SAML2/XML/saml/AuthnContextDeclTest.php @@ -72,9 +72,10 @@ public function testMarshalling(): void ], ); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($authnContextDecl), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($authnContextDecl); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } } diff --git a/tests/SAML2/XML/saml/AuthnContextTest.php b/tests/SAML2/XML/saml/AuthnContextTest.php index d7f53b663..b227914fb 100644 --- a/tests/SAML2/XML/saml/AuthnContextTest.php +++ b/tests/SAML2/XML/saml/AuthnContextTest.php @@ -4,7 +4,7 @@ namespace SimpleSAML\Test\SAML2\XML\saml; -use DOMDocument; +use Dom; use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; @@ -31,8 +31,8 @@ #[CoversClass(AbstractSamlElement::class)] final class AuthnContextTest extends TestCase { - /** @var \DOMDocument */ - private static DOMDocument $decl; + /** @var \Dom\XMLDocument $decl */ + private static Dom\XMLDocument $decl; /** diff --git a/tests/SAML2/XML/saml/AuthnContextWithClassRefAndDeclRefTest.php b/tests/SAML2/XML/saml/AuthnContextWithClassRefAndDeclRefTest.php index ac756b89c..f0f758195 100644 --- a/tests/SAML2/XML/saml/AuthnContextWithClassRefAndDeclRefTest.php +++ b/tests/SAML2/XML/saml/AuthnContextWithClassRefAndDeclRefTest.php @@ -60,9 +60,10 @@ public function testMarshalling(): void ], ); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($authnContext), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($authnContext); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } } diff --git a/tests/SAML2/XML/saml/AuthnContextWithClassRefAndDeclTest.php b/tests/SAML2/XML/saml/AuthnContextWithClassRefAndDeclTest.php index b7c90dd2a..fca4942f2 100644 --- a/tests/SAML2/XML/saml/AuthnContextWithClassRefAndDeclTest.php +++ b/tests/SAML2/XML/saml/AuthnContextWithClassRefAndDeclTest.php @@ -81,9 +81,10 @@ public function testMarshalling(): void ], ); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($authnContext), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($authnContext); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } } diff --git a/tests/SAML2/XML/saml/AuthnContextWithClassRefTest.php b/tests/SAML2/XML/saml/AuthnContextWithClassRefTest.php index 20f96193e..ee59bf05f 100644 --- a/tests/SAML2/XML/saml/AuthnContextWithClassRefTest.php +++ b/tests/SAML2/XML/saml/AuthnContextWithClassRefTest.php @@ -59,9 +59,10 @@ public function testMarshalling(): void ], ); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($authnContext), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($authnContext); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } } diff --git a/tests/SAML2/XML/saml/AuthnContextWithDeclRefTest.php b/tests/SAML2/XML/saml/AuthnContextWithDeclRefTest.php index 73018c765..83419250b 100644 --- a/tests/SAML2/XML/saml/AuthnContextWithDeclRefTest.php +++ b/tests/SAML2/XML/saml/AuthnContextWithDeclRefTest.php @@ -58,9 +58,10 @@ public function testMarshalling(): void ], ); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($authnContext), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($authnContext); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } } diff --git a/tests/SAML2/XML/saml/AuthnContextWithDeclTest.php b/tests/SAML2/XML/saml/AuthnContextWithDeclTest.php index babd7f972..d268792a7 100644 --- a/tests/SAML2/XML/saml/AuthnContextWithDeclTest.php +++ b/tests/SAML2/XML/saml/AuthnContextWithDeclTest.php @@ -79,9 +79,10 @@ public function testMarshalling(): void ], ); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($authnContext), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($authnContext); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } } diff --git a/tests/SAML2/XML/saml/AuthnStatementTest.php b/tests/SAML2/XML/saml/AuthnStatementTest.php index 45a7990a2..2684f4861 100644 --- a/tests/SAML2/XML/saml/AuthnStatementTest.php +++ b/tests/SAML2/XML/saml/AuthnStatementTest.php @@ -79,10 +79,11 @@ public function testMarshalling(): void ), ); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($authnStatement), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($authnStatement); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } @@ -108,7 +109,7 @@ public function testMarshallingElementOrdering(): void ), ); - // Marshall it to a \DOMElement + // Marshall it to a \Dom\Element $authnStatementElement = $authnStatement->toXML(); // Test for a SubjectLocality @@ -117,7 +118,7 @@ public function testMarshallingElementOrdering(): void $this->assertCount(1, $authnStatementElements); // Test ordering of AuthnStatement contents - /** @var \DOMElement[] $authnStatementElements */ + /** @var \Dom\Element[] $authnStatementElements */ $authnStatementElements = XPath::xpQuery( $authnStatementElement, './saml_assertion:SubjectLocality/following-sibling::*', diff --git a/tests/SAML2/XML/saml/AuthzDecisionStatementTest.php b/tests/SAML2/XML/saml/AuthzDecisionStatementTest.php index 3a5441820..b129df072 100644 --- a/tests/SAML2/XML/saml/AuthzDecisionStatementTest.php +++ b/tests/SAML2/XML/saml/AuthzDecisionStatementTest.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\Test\SAML2\XML\saml; -use DOMDocument; +use Dom; use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; @@ -42,14 +42,14 @@ final class AuthzDecisionStatementTest extends TestCase use SerializableElementTestTrait; - /** @var \DOMDocument $assertionIDRef */ - private static DOMDocument $assertionIDRef; + /** @var \Dom\XMLDocument $assertionIDRef */ + private static Dom\XMLDocument $assertionIDRef; - /** @var \DOMDocument $assertionURIRef */ - private static DOMDocument $assertionURIRef; + /** @var \Dom\XMLDocument $assertionURIRef */ + private static Dom\XMLDocument $assertionURIRef; - /** @var \DOMDocument $assertion */ - private static DOMDocument $assertion; + /** @var \Dom\XMLDocument $assertion */ + private static Dom\XMLDocument $assertion; /** @@ -102,9 +102,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/SAML2/XML/saml/BaseIDTest.php b/tests/SAML2/XML/saml/BaseIDTest.php index ae4a5a737..1dbe66d20 100644 --- a/tests/SAML2/XML/saml/BaseIDTest.php +++ b/tests/SAML2/XML/saml/BaseIDTest.php @@ -88,10 +88,11 @@ public function testMarshalling(): void SAMLStringValue::fromString('urn:x-simplesamlphp:spnamequalifier'), ); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($baseId), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($baseId); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } @@ -143,6 +144,8 @@ public function testUnmarshallingUnregistered(): void $this->assertEquals('BaseID', $chunk->getLocalName()); $this->assertEquals(C::NS_SAML, $chunk->getNamespaceURI()); - $this->assertEquals($element->ownerDocument?->saveXML($element), strval($baseId)); + /** @var \Dom\XMLDocument $ownerDocument */ + $ownerDocument = $element->ownerDocument; + $this->assertEquals($ownerDocument->saveXML($element), strval($baseId)); } } diff --git a/tests/SAML2/XML/saml/ConditionTest.php b/tests/SAML2/XML/saml/ConditionTest.php index ec5064713..48588f221 100644 --- a/tests/SAML2/XML/saml/ConditionTest.php +++ b/tests/SAML2/XML/saml/ConditionTest.php @@ -83,10 +83,11 @@ public function testMarshalling(): void Audience::fromString('urn:some:audience'), ]); - $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); } @@ -113,6 +114,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/SAML2/XML/saml/ConditionsTest.php b/tests/SAML2/XML/saml/ConditionsTest.php index 8f5c20ba8..0b7fa048c 100644 --- a/tests/SAML2/XML/saml/ConditionsTest.php +++ b/tests/SAML2/XML/saml/ConditionsTest.php @@ -77,10 +77,11 @@ public function testMarshalling(): void ), ); - $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/SAML2/XML/saml/EncryptedAssertionTest.php b/tests/SAML2/XML/saml/EncryptedAssertionTest.php index 54871bc7d..af3fddb5b 100644 --- a/tests/SAML2/XML/saml/EncryptedAssertionTest.php +++ b/tests/SAML2/XML/saml/EncryptedAssertionTest.php @@ -135,10 +135,11 @@ public function testMarshalling(): void ); $encryptedAssertion = new EncryptedAssertion($ed, [$ek]); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($encryptedAssertion), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($encryptedAssertion); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } diff --git a/tests/SAML2/XML/saml/EncryptedAttributeTest.php b/tests/SAML2/XML/saml/EncryptedAttributeTest.php index 3147fb3ad..a625a2e1a 100644 --- a/tests/SAML2/XML/saml/EncryptedAttributeTest.php +++ b/tests/SAML2/XML/saml/EncryptedAttributeTest.php @@ -91,6 +91,12 @@ public function testMarshalling(): void $encryptedData = $encryptedAttribute->getEncryptedData(); $this->assertEquals(C::XMLENC_ELEMENT, $encryptedData->getType()); + + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($encryptedAttribute); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } diff --git a/tests/SAML2/XML/saml/EncryptedIDTest.php b/tests/SAML2/XML/saml/EncryptedIDTest.php index 52388d947..08a4c737e 100644 --- a/tests/SAML2/XML/saml/EncryptedIDTest.php +++ b/tests/SAML2/XML/saml/EncryptedIDTest.php @@ -130,10 +130,11 @@ public function testMarshalling(): void ); $eid = new EncryptedID($ed, [$ek]); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($eid), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($eid); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } @@ -185,7 +186,7 @@ public function testMarshallingElementOrdering(): void $this->assertCount(1, $eidElements); // Test ordering of EncryptedID contents - /** @var \DOMElement[] $eidElements */ + /** @var \Dom\Element[] $eidElements */ $eidElements = XPath::xpQuery($eidElement, './xenc:EncryptedData/following-sibling::*', $xpCache); $this->assertCount(1, $eidElements); $this->assertEquals('xenc:EncryptedKey', $eidElements[0]->tagName); diff --git a/tests/SAML2/XML/saml/EvidenceTest.php b/tests/SAML2/XML/saml/EvidenceTest.php index 39eac4808..05dfd7a7d 100644 --- a/tests/SAML2/XML/saml/EvidenceTest.php +++ b/tests/SAML2/XML/saml/EvidenceTest.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\Test\SAML2\XML\saml; -use DOMDocument; +use Dom; use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; @@ -43,14 +43,14 @@ final class EvidenceTest extends TestCase use SerializableElementTestTrait; - /** @var \DOMDocument $assertionIDRef */ - private static DOMDocument $assertionIDRef; + /** @var \Dom\XMLDocument $assertionIDRef */ + private static Dom\XMLDocument $assertionIDRef; - /** @var \DOMDocument $assertionURIRef */ - private static DOMDocument $assertionURIRef; + /** @var \Dom\XMLDocument $assertionURIRef */ + private static Dom\XMLDocument $assertionURIRef; - /** @var \DOMDocument $assertion */ - private static DOMDocument $assertion; + /** @var \Dom\XMLDocument $assertion */ + private static Dom\XMLDocument $assertion; /** @var \SimpleSAML\SAML2\XML\saml\EncryptedAssertion $encryptedAssertion */ private static EncryptedAssertion $encryptedAssertion; @@ -119,10 +119,11 @@ public function testMarshalling(): void $this->assertFalse($evidence->isEmptyElement()); - $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/SAML2/XML/saml/IssuerTest.php b/tests/SAML2/XML/saml/IssuerTest.php index 460495032..6eb717342 100644 --- a/tests/SAML2/XML/saml/IssuerTest.php +++ b/tests/SAML2/XML/saml/IssuerTest.php @@ -63,10 +63,11 @@ public function testMarshalling(): void SAMLStringValue::fromString('TheSPProvidedID'), ); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($issuer), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($issuer); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } diff --git a/tests/SAML2/XML/saml/NameIDTest.php b/tests/SAML2/XML/saml/NameIDTest.php index c80e83d87..71b551be6 100644 --- a/tests/SAML2/XML/saml/NameIDTest.php +++ b/tests/SAML2/XML/saml/NameIDTest.php @@ -71,9 +71,10 @@ public function testMarshalling(): void SAMLStringValue::fromString('TheSPProvidedID'), ); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($nameId), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($nameId); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } } diff --git a/tests/SAML2/XML/saml/OneTimeUseTest.php b/tests/SAML2/XML/saml/OneTimeUseTest.php index da53a6b27..835775856 100644 --- a/tests/SAML2/XML/saml/OneTimeUseTest.php +++ b/tests/SAML2/XML/saml/OneTimeUseTest.php @@ -50,9 +50,10 @@ public function testMarshalling(): void { $oneTimeUse = new OneTimeUse(); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($oneTimeUse), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($oneTimeUse); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } } diff --git a/tests/SAML2/XML/saml/ProxyRestrictionTest.php b/tests/SAML2/XML/saml/ProxyRestrictionTest.php index 24d70832d..6f269b01c 100644 --- a/tests/SAML2/XML/saml/ProxyRestrictionTest.php +++ b/tests/SAML2/XML/saml/ProxyRestrictionTest.php @@ -59,9 +59,10 @@ public function testMarshalling(): void NonNegativeIntegerValue::fromInteger(2), ); - $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); } } diff --git a/tests/SAML2/XML/saml/StatementTest.php b/tests/SAML2/XML/saml/StatementTest.php index 2bd226606..70aa081e3 100644 --- a/tests/SAML2/XML/saml/StatementTest.php +++ b/tests/SAML2/XML/saml/StatementTest.php @@ -83,10 +83,11 @@ public function testMarshalling(): void Audience::fromString('urn:some:audience'), ]); - $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); } @@ -133,6 +134,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/SAML2/XML/saml/SubjectConfirmationDataTest.php b/tests/SAML2/XML/saml/SubjectConfirmationDataTest.php index a11ed0dba..393904de7 100644 --- a/tests/SAML2/XML/saml/SubjectConfirmationDataTest.php +++ b/tests/SAML2/XML/saml/SubjectConfirmationDataTest.php @@ -80,10 +80,11 @@ public function testMarshalling(): void [$attr1, $attr2], ); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($subjectConfirmationData), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($subjectConfirmationData); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } diff --git a/tests/SAML2/XML/saml/SubjectConfirmationTest.php b/tests/SAML2/XML/saml/SubjectConfirmationTest.php index 4b85304b1..a01585017 100644 --- a/tests/SAML2/XML/saml/SubjectConfirmationTest.php +++ b/tests/SAML2/XML/saml/SubjectConfirmationTest.php @@ -98,10 +98,11 @@ public function testMarshalling(): void ), ); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($subjectConfirmation), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($subjectConfirmation); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } @@ -148,7 +149,7 @@ public function testMarshallingElementOrdering(): void ), ); - // Marshall it to a \DOMElement + // Marshall it to a \Dom\Element $subjectConfirmationElement = $subjectConfirmation->toXML(); // Test for a NameID @@ -157,7 +158,7 @@ public function testMarshallingElementOrdering(): void $this->assertCount(1, $subjectConfirmationElements); // Test ordering of SubjectConfirmation contents - /** @var \DOMElement[] $subjectConfirmationElements */ + /** @var \Dom\Element[] $subjectConfirmationElements */ $subjectConfirmationElements = XPath::xpQuery( $subjectConfirmationElement, './saml_assertion:NameID/following-sibling::*', diff --git a/tests/SAML2/XML/saml/SubjectLocalityTest.php b/tests/SAML2/XML/saml/SubjectLocalityTest.php index 8021d84f5..825de3c25 100644 --- a/tests/SAML2/XML/saml/SubjectLocalityTest.php +++ b/tests/SAML2/XML/saml/SubjectLocalityTest.php @@ -57,10 +57,11 @@ public function testMarshalling(): void DomainValue::fromString('idp.example.org'), ); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($subjectLocality), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($subjectLocality); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } diff --git a/tests/SAML2/XML/saml/SubjectTest.php b/tests/SAML2/XML/saml/SubjectTest.php index 3b8f30ea6..4a871c50b 100644 --- a/tests/SAML2/XML/saml/SubjectTest.php +++ b/tests/SAML2/XML/saml/SubjectTest.php @@ -4,7 +4,7 @@ namespace SimpleSAML\Test\SAML2\XML\saml; -use DOMDocument; +use Dom; use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; @@ -51,17 +51,17 @@ final class SubjectTest extends TestCase use SerializableElementTestTrait; - /** @var \DOMDocument */ - private static DOMDocument $subject; + /** @var \Dom\XMLDocument */ + private static Dom\XMLDocument $subject; - /** @var \DOMDocument */ - private static DOMDocument $baseId; + /** @var \Dom\XMLDocument */ + private static Dom\XMLDocument $baseId; - /** @var \DOMDocument */ - private static DOMDocument $nameId; + /** @var \Dom\XMLDocument */ + private static Dom\XMLDocument $nameId; - /** @var \DOMDocument */ - private static DOMDocument $subjectConfirmation; + /** @var \Dom\XMLDocument */ + private static Dom\XMLDocument $subjectConfirmation; public function setup(): void @@ -141,10 +141,11 @@ public function testMarshalling(): void ], ); - $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); } @@ -193,7 +194,7 @@ public function testMarshallingElementOrdering(): void ], ); - // Marshall it to a \DOMElement + // Marshall it to a \Dom\Element $subjectElement = $subject->toXML(); // Test for a NameID @@ -202,7 +203,7 @@ public function testMarshallingElementOrdering(): void $this->assertCount(1, $subjectElements); // Test ordering of Subject contents - /** @var \DOMElement[] $subjectElements */ + /** @var \Dom\Element[] $subjectElements */ $subjectElements = XPath::xpQuery($subjectElement, './saml_assertion:NameID/following-sibling::*', $xpCache); $this->assertCount(1, $subjectElements); $this->assertEquals('saml:SubjectConfirmation', $subjectElements[0]->tagName); diff --git a/tests/SAML2/XML/samlp/AbstractMessageTest.php b/tests/SAML2/XML/samlp/AbstractMessageTest.php index ab1c6ea89..2c2aa3909 100644 --- a/tests/SAML2/XML/samlp/AbstractMessageTest.php +++ b/tests/SAML2/XML/samlp/AbstractMessageTest.php @@ -4,7 +4,7 @@ namespace SimpleSAML\Test\SAML2\XML\samlp; -use DOMElement; +use Dom; use Exception; use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\Group; @@ -164,6 +164,7 @@ public function testConvertIssuerToXML(): void $xml = $response->toXML(); $xpCache = XPath::getXPath($xml); $xml_issuer = XPath::xpQuery($xml, './saml_assertion:Issuer', $xpCache); + /** @var \Dom\Element $xml_issuer */ $xml_issuer = $xml_issuer[0]; $this->assertFalse($xml_issuer->hasAttributes()); @@ -187,7 +188,7 @@ public function testConvertIssuerToXML(): void $xpCache = XPath::getXPath($xml); $xml_issuer = XPath::xpQuery($xml, './saml_assertion:Issuer', $xpCache); $xml_issuer = $xml_issuer[0]; - $this->assertInstanceOf(DOMElement::class, $xml_issuer); + $this->assertInstanceOf(Dom\Element::class, $xml_issuer); $this->assertTrue($xml_issuer->hasAttributes()); $this->assertEquals($issuer->getContent(), $xml_issuer->textContent); @@ -400,7 +401,7 @@ public function testParseAttributeQuery(): void $messageElement = $message->toXML(); $xp = XPath::xpQuery($messageElement, '.', XPath::getXPath($messageElement)); - /** @var \DOMElement $query */ + /** @var \Dom\Element $query */ $query = $xp[0]; $this->assertEquals('somethingNEW', $query->getAttribute('ID')); } diff --git a/tests/SAML2/XML/samlp/AbstractStatusResponseTest.php b/tests/SAML2/XML/samlp/AbstractStatusResponseTest.php index 221074f9c..5618d3cb2 100644 --- a/tests/SAML2/XML/samlp/AbstractStatusResponseTest.php +++ b/tests/SAML2/XML/samlp/AbstractStatusResponseTest.php @@ -83,12 +83,12 @@ public function testMarshalling(): void $statusElements = XPath::xpQuery($responseElement, './saml_protocol:Status', $xpCache); $this->assertCount(1, $statusElements); - /** @var \DOMElement[] $statusCodeElements */ + /** @var \Dom\Element[] $statusCodeElements */ $statusCodeElements = XPath::xpQuery($statusElements[0], './saml_protocol:StatusCode', $xpCache); $this->assertCount(1, $statusCodeElements); $this->assertEquals(C::STATUS_SUCCESS, $statusCodeElements[0]->getAttribute("Value")); - /** @var \DOMElement[] $nestedStatusCodeElements */ + /** @var \Dom\Element[] $nestedStatusCodeElements */ $nestedStatusCodeElements = XPath::xpQuery($statusCodeElements[0], './saml_protocol:StatusCode', $xpCache); $this->assertCount(1, $nestedStatusCodeElements); $this->assertEquals('urn:test:OurSubStatusCode', $nestedStatusCodeElements[0]->getAttribute("Value")); @@ -146,7 +146,7 @@ public function testMarshallingSignedResponseElementOrdering(): void $this->assertCount(1, $responseElements); // Test ordering of Response contents - /** @var \DOMElement[] $responseElements */ + /** @var \Dom\Element[] $responseElements */ $responseElements = XPath::xpQuery($responseElement, './saml_assertion:Issuer/following-sibling::*', $xpCache); $this->assertCount(3, $responseElements); $this->assertEquals('ds:Signature', $responseElements[0]->tagName); diff --git a/tests/SAML2/XML/samlp/ArtifactResolveTest.php b/tests/SAML2/XML/samlp/ArtifactResolveTest.php index 9006bb310..550aa6898 100644 --- a/tests/SAML2/XML/samlp/ArtifactResolveTest.php +++ b/tests/SAML2/XML/samlp/ArtifactResolveTest.php @@ -68,9 +68,10 @@ public function testMarshalling(): void $issuer, ); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($artifactResolve), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($issuer); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } } diff --git a/tests/SAML2/XML/samlp/ArtifactResponseTest.php b/tests/SAML2/XML/samlp/ArtifactResponseTest.php index 4109d1047..f7c07f2e2 100644 --- a/tests/SAML2/XML/samlp/ArtifactResponseTest.php +++ b/tests/SAML2/XML/samlp/ArtifactResponseTest.php @@ -102,9 +102,10 @@ public function testMarshalling(): void message: $authnRequest, ); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($artifactResponse), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($artifactResponse); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } } diff --git a/tests/SAML2/XML/samlp/ArtifactTest.php b/tests/SAML2/XML/samlp/ArtifactTest.php index b4a8fb21c..3d4ff5031 100644 --- a/tests/SAML2/XML/samlp/ArtifactTest.php +++ b/tests/SAML2/XML/samlp/ArtifactTest.php @@ -48,9 +48,10 @@ public function testMarshalling(): void { $artifact = Artifact::fromString('AAQAAM0ARI+cUaUKAx19/KC3fOV/vznNj8oE0JKKPQC8nTesXxPke7uRy+8='); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($artifact), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($artifact); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } } diff --git a/tests/SAML2/XML/samlp/AssertionIDRequestTest.php b/tests/SAML2/XML/samlp/AssertionIDRequestTest.php index 7135df6d0..33599acde 100644 --- a/tests/SAML2/XML/samlp/AssertionIDRequestTest.php +++ b/tests/SAML2/XML/samlp/AssertionIDRequestTest.php @@ -74,9 +74,10 @@ public function testMarshalling(): void destination: SAMLAnyURIValue::fromString('https://tiqr.stepup.org/idp/profile/saml2/Redirect/SSO'), ); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($assertionIDRequest), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($assertionIDRequest); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } } diff --git a/tests/SAML2/XML/samlp/AttributeQueryTest.php b/tests/SAML2/XML/samlp/AttributeQueryTest.php index 96a4dcfa0..00f829977 100644 --- a/tests/SAML2/XML/samlp/AttributeQueryTest.php +++ b/tests/SAML2/XML/samlp/AttributeQueryTest.php @@ -120,10 +120,11 @@ public function testMarshalling(): void issueInstant: SAMLDateTimeValue::fromString('2017-09-06T11:49:27Z'), ); - $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); } @@ -164,7 +165,7 @@ public function testAttributeNameFormat(): void // Test Attribute Names $xpCache = XPath::getXPath($attributeQueryElement); - /** @var \DOMElement[] $attributes */ + /** @var \Dom\Element[] $attributes */ $attributes = XPath::xpQuery($attributeQueryElement, './saml_assertion:Attribute', $xpCache); $this->assertCount(3, $attributes); $this->assertEquals('test1', $attributes[0]->getAttribute('Name')); diff --git a/tests/SAML2/XML/samlp/AuthnQueryTest.php b/tests/SAML2/XML/samlp/AuthnQueryTest.php index a4c631856..d9b314ad9 100644 --- a/tests/SAML2/XML/samlp/AuthnQueryTest.php +++ b/tests/SAML2/XML/samlp/AuthnQueryTest.php @@ -88,9 +88,10 @@ public function testMarshalling(): void sessionIndex: SAMLStringValue::fromString('phpunit'), ); - $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/SAML2/XML/samlp/AuthnRequestTest.php b/tests/SAML2/XML/samlp/AuthnRequestTest.php index 387f10ec7..08fcb58c4 100644 --- a/tests/SAML2/XML/samlp/AuthnRequestTest.php +++ b/tests/SAML2/XML/samlp/AuthnRequestTest.php @@ -112,10 +112,11 @@ public function testMarshalling(): void destination: SAMLAnyURIValue::fromString('https://tiqr.stepup.org/idp/profile/saml2/Redirect/SSO'), ); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($authnRequest), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($authnRequest); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } @@ -201,7 +202,7 @@ public function testMarshallingElementOrdering(): void $this->assertCount(1, $authnRequestElements); // Test ordering of AuthnRequest contents - /** @var \DOMElement[] $authnRequestElements */ + /** @var \Dom\Element[] $authnRequestElements */ $authnRequestElements = XPath::xpQuery( $authnRequestElement, './saml_assertion:Subject/following-sibling::*', diff --git a/tests/SAML2/XML/samlp/AuthzDecisionQueryTest.php b/tests/SAML2/XML/samlp/AuthzDecisionQueryTest.php index c45d2e66b..59daf8f6f 100644 --- a/tests/SAML2/XML/samlp/AuthzDecisionQueryTest.php +++ b/tests/SAML2/XML/samlp/AuthzDecisionQueryTest.php @@ -4,7 +4,7 @@ namespace SimpleSAML\Test\SAML2\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 AuthzDecisionQueryTest extends TestCase use SignedElementTestTrait; - /** @var \DOMDocument */ - private static DOMDocument $assertion; + /** @var \Dom\XMLDocument */ + private static Dom\XMLDocument $assertion; /** @@ -106,9 +106,10 @@ public function testMarshalling(): void issueInstant: SAMLDateTimeValue::fromString('2017-09-06T11:49:27Z'), ); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($authzDecisionQuery), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($authzDecisionQuery); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } } diff --git a/tests/SAML2/XML/samlp/ExtensionsTest.php b/tests/SAML2/XML/samlp/ExtensionsTest.php index dc77841c5..51cf07a2f 100644 --- a/tests/SAML2/XML/samlp/ExtensionsTest.php +++ b/tests/SAML2/XML/samlp/ExtensionsTest.php @@ -36,7 +36,7 @@ final class ExtensionsTest extends TestCase /** - * Prepare a basic DOMElement to test against + * Prepare a basic Dom\Element to test against */ public static function setUpBeforeClass(): void { @@ -69,10 +69,11 @@ public function testMarshalling(): void [new Chunk($ext1->documentElement), new Chunk($ext2->documentElement)], ); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($extensions), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($extensions); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } diff --git a/tests/SAML2/XML/samlp/GetCompleteTest.php b/tests/SAML2/XML/samlp/GetCompleteTest.php index fd8ca34da..22da81f4d 100644 --- a/tests/SAML2/XML/samlp/GetCompleteTest.php +++ b/tests/SAML2/XML/samlp/GetCompleteTest.php @@ -52,9 +52,10 @@ public function testMarshalling(): void { $getComplete = GetComplete::fromString('https://some/location'); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($getComplete), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($getComplete); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } } diff --git a/tests/SAML2/XML/samlp/IDPEntryTest.php b/tests/SAML2/XML/samlp/IDPEntryTest.php index f396b4c05..2a9819168 100644 --- a/tests/SAML2/XML/samlp/IDPEntryTest.php +++ b/tests/SAML2/XML/samlp/IDPEntryTest.php @@ -63,10 +63,11 @@ public function testMarshalling(): void SAMLAnyURIValue::fromString('urn:test:testLoc'), ); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($entry), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($entry); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } diff --git a/tests/SAML2/XML/samlp/IDPListTest.php b/tests/SAML2/XML/samlp/IDPListTest.php index 137826ae2..5764d347f 100644 --- a/tests/SAML2/XML/samlp/IDPListTest.php +++ b/tests/SAML2/XML/samlp/IDPListTest.php @@ -76,10 +76,11 @@ public function testMarshalling(): void $getComplete = GetComplete::fromString('https://some/location'); $list = new IDPList([$entry1, $entry2], $getComplete); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($list), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($list); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } @@ -110,7 +111,7 @@ public function testMarshallingElementOrdering(): void $this->assertCount(2, $listElements); // Test ordering of IDPList contents - /** @var \DOMElement[] $listElements */ + /** @var \Dom\Element[] $listElements */ $listElements = XPath::xpQuery($listElement, './saml_protocol:IDPEntry/following-sibling::*', $xpCache); $this->assertCount(2, $listElements); $this->assertEquals('samlp:IDPEntry', $listElements[0]->tagName); diff --git a/tests/SAML2/XML/samlp/LogoutRequestTest.php b/tests/SAML2/XML/samlp/LogoutRequestTest.php index c40270070..fc9ea215b 100644 --- a/tests/SAML2/XML/samlp/LogoutRequestTest.php +++ b/tests/SAML2/XML/samlp/LogoutRequestTest.php @@ -116,13 +116,12 @@ public function testMarshalling(): void SessionIndex::fromString('SessionIndexValue2'), ], ); - $logoutRequestElement = $logoutRequest->toXML(); - $xpCache = XPath::getXPath($logoutRequestElement); - $sessionIndexElements = XPath::xpQuery($logoutRequestElement, './saml_protocol:SessionIndex', $xpCache); - $this->assertCount(2, $sessionIndexElements); - $this->assertEquals('SessionIndexValue1', $sessionIndexElements[0]->textContent); - $this->assertEquals('SessionIndexValue2', $sessionIndexElements[1]->textContent); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($logoutRequest); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } @@ -152,7 +151,7 @@ public function testMarshallingElementOrdering(): void $this->assertCount(1, $logoutRequestElements); // Test ordering of LogoutRequest contents - /** @var \DOMElement[] $logoutRequestElements */ + /** @var \Dom\Element[] $logoutRequestElements */ $logoutRequestElements = XPath::xpQuery( $logoutRequestElement, './saml_assertion:NameID/following-sibling::*', diff --git a/tests/SAML2/XML/samlp/LogoutResponseTest.php b/tests/SAML2/XML/samlp/LogoutResponseTest.php index 8905e0adc..02953a36a 100644 --- a/tests/SAML2/XML/samlp/LogoutResponseTest.php +++ b/tests/SAML2/XML/samlp/LogoutResponseTest.php @@ -81,9 +81,10 @@ public function testMarshalling(): void status: $status, ); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($logoutResponse), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($logoutResponse); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } } diff --git a/tests/SAML2/XML/samlp/ManageNameIDRequestTest.php b/tests/SAML2/XML/samlp/ManageNameIDRequestTest.php index 5c7f90c68..2ad2fd2bb 100644 --- a/tests/SAML2/XML/samlp/ManageNameIDRequestTest.php +++ b/tests/SAML2/XML/samlp/ManageNameIDRequestTest.php @@ -79,9 +79,10 @@ public function testMarshalling(): void destination: SAMLAnyURIValue::fromString('https://tiqr.stepup.org/idp/profile/saml2/Redirect/SSO'), ); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($manageNameIdRequest), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($manageNameIdRequest); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } } diff --git a/tests/SAML2/XML/samlp/ManageNameIDResponseTest.php b/tests/SAML2/XML/samlp/ManageNameIDResponseTest.php index e51bc0a2d..b16d3b6c8 100644 --- a/tests/SAML2/XML/samlp/ManageNameIDResponseTest.php +++ b/tests/SAML2/XML/samlp/ManageNameIDResponseTest.php @@ -80,9 +80,10 @@ public function testMarshalling(): void issueInstant: SAMLDateTimeValue::fromString('2021-03-25T16:53:26Z'), ); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($manageNameIdResponse), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($manageNameIdResponse); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } } diff --git a/tests/SAML2/XML/samlp/NameIDMappingRequestTest.php b/tests/SAML2/XML/samlp/NameIDMappingRequestTest.php index 3ac456046..18860b28b 100644 --- a/tests/SAML2/XML/samlp/NameIDMappingRequestTest.php +++ b/tests/SAML2/XML/samlp/NameIDMappingRequestTest.php @@ -86,9 +86,10 @@ public function testMarshalling(): void destination: SAMLAnyURIValue::fromString('https://tiqr.stepup.org/idp/profile/saml2/Redirect/SSO'), ); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($nameIdMappingRequest), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($nameIdMappingRequest); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } } diff --git a/tests/SAML2/XML/samlp/NameIDMappingResponseTest.php b/tests/SAML2/XML/samlp/NameIDMappingResponseTest.php index 968989494..7bbec08c5 100644 --- a/tests/SAML2/XML/samlp/NameIDMappingResponseTest.php +++ b/tests/SAML2/XML/samlp/NameIDMappingResponseTest.php @@ -90,9 +90,10 @@ public function testMarshalling(): void identifier: $nameId, ); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($nameIdMappingResponse), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($nameIdMappingResponse); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } } diff --git a/tests/SAML2/XML/samlp/NameIDPolicyTest.php b/tests/SAML2/XML/samlp/NameIDPolicyTest.php index e8f3147f8..9c4513d22 100644 --- a/tests/SAML2/XML/samlp/NameIDPolicyTest.php +++ b/tests/SAML2/XML/samlp/NameIDPolicyTest.php @@ -65,10 +65,11 @@ public function testMarshalling(): void BooleanValue::fromBoolean(true), ); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($nameIdPolicy), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($nameIdPolicy); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } diff --git a/tests/SAML2/XML/samlp/NewEncryptedIDTest.php b/tests/SAML2/XML/samlp/NewEncryptedIDTest.php index 8a12bace8..b726bf318 100644 --- a/tests/SAML2/XML/samlp/NewEncryptedIDTest.php +++ b/tests/SAML2/XML/samlp/NewEncryptedIDTest.php @@ -130,10 +130,11 @@ public function testMarshalling(): void ); $eid = new NewEncryptedID($ed, [$ek]); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($eid), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($eid); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } @@ -185,7 +186,7 @@ public function testMarshallingElementOrdering(): void $this->assertCount(1, $eidElements); // Test ordering of NewEncryptedID contents - /** @var \DOMElement[] $eidElements */ + /** @var \Dom\Element[] $eidElements */ $eidElements = XPath::xpQuery($eidElement, './xenc:EncryptedData/following-sibling::*', $xpCache); $this->assertCount(1, $eidElements); $this->assertEquals('xenc:EncryptedKey', $eidElements[0]->tagName); diff --git a/tests/SAML2/XML/samlp/NewIDTest.php b/tests/SAML2/XML/samlp/NewIDTest.php index 5d0772bcd..5b9e687e0 100644 --- a/tests/SAML2/XML/samlp/NewIDTest.php +++ b/tests/SAML2/XML/samlp/NewIDTest.php @@ -48,9 +48,10 @@ public function testMarshalling(): void { $newID = NewID::fromString('simplesamlphp'); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($newID), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($newID); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } } diff --git a/tests/SAML2/XML/samlp/RequestedAuthnContextTest.php b/tests/SAML2/XML/samlp/RequestedAuthnContextTest.php index babc3158e..a3f69244e 100644 --- a/tests/SAML2/XML/samlp/RequestedAuthnContextTest.php +++ b/tests/SAML2/XML/samlp/RequestedAuthnContextTest.php @@ -61,10 +61,11 @@ public function testMarshalling(): void AuthnContextComparisonTypeValue::fromEnum(AuthnContextComparisonTypeEnum::Exact), ); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($requestedAuthnContext), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($requestedAuthnContext); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } diff --git a/tests/SAML2/XML/samlp/RequesterIDTest.php b/tests/SAML2/XML/samlp/RequesterIDTest.php index d99d32e44..5d7bded9f 100644 --- a/tests/SAML2/XML/samlp/RequesterIDTest.php +++ b/tests/SAML2/XML/samlp/RequesterIDTest.php @@ -52,9 +52,10 @@ public function testMarshalling(): void { $requesterId = RequesterID::fromString('urn:some:requester'); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($requesterId), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($requesterId); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } } diff --git a/tests/SAML2/XML/samlp/ResponseTest.php b/tests/SAML2/XML/samlp/ResponseTest.php index 240a74d9d..d45a16cce 100644 --- a/tests/SAML2/XML/samlp/ResponseTest.php +++ b/tests/SAML2/XML/samlp/ResponseTest.php @@ -87,9 +87,10 @@ public function testMarshalling(): void ], ); - $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/SAML2/XML/samlp/ScopingTest.php b/tests/SAML2/XML/samlp/ScopingTest.php index 9915bb3bc..1f92457ae 100644 --- a/tests/SAML2/XML/samlp/ScopingTest.php +++ b/tests/SAML2/XML/samlp/ScopingTest.php @@ -71,10 +71,11 @@ public function testMarshalling(): void ], ); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($scoping), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($scoping); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } @@ -102,12 +103,12 @@ public function testMarshallingElementOrdering(): void // Test for an IDPList $xpCache = XPath::getXPath($scopingElement); - /** @var \DOMElement[] $scopingElements */ + /** @var \Dom\Element[] $scopingElements */ $scopingElements = XPath::xpQuery($scopingElement, './saml_protocol:IDPList', $xpCache); $this->assertCount(1, $scopingElements); // Test ordering of Scoping contents - /** @var \DOMElement[] $scopingElements */ + /** @var \Dom\Element[] $scopingElements */ $scopingElements = XPath::xpQuery($scopingElement, './saml_protocol:IDPList/following-sibling::*', $xpCache); $this->assertCount(1, $scopingElements); $this->assertEquals('samlp:RequesterID', $scopingElements[0]->tagName); diff --git a/tests/SAML2/XML/samlp/SessionIndexTest.php b/tests/SAML2/XML/samlp/SessionIndexTest.php index 602c34301..f50912850 100644 --- a/tests/SAML2/XML/samlp/SessionIndexTest.php +++ b/tests/SAML2/XML/samlp/SessionIndexTest.php @@ -48,9 +48,10 @@ public function testMarshalling(): void { $sessionIndex = SessionIndex::fromString('SomeSessionIndex1'); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($sessionIndex), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($sessionIndex); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } } diff --git a/tests/SAML2/XML/samlp/StatusCodeTest.php b/tests/SAML2/XML/samlp/StatusCodeTest.php index 34bf3c8d4..73e3bb293 100644 --- a/tests/SAML2/XML/samlp/StatusCodeTest.php +++ b/tests/SAML2/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/SAML2/XML/samlp/StatusDetailTest.php b/tests/SAML2/XML/samlp/StatusDetailTest.php index db0aa8614..94fbe03f6 100644 --- a/tests/SAML2/XML/samlp/StatusDetailTest.php +++ b/tests/SAML2/XML/samlp/StatusDetailTest.php @@ -54,10 +54,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/SAML2/XML/samlp/StatusMessageTest.php b/tests/SAML2/XML/samlp/StatusMessageTest.php index 9c84a3cbd..7b0cd2dc0 100644 --- a/tests/SAML2/XML/samlp/StatusMessageTest.php +++ b/tests/SAML2/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/SAML2/XML/samlp/StatusTest.php b/tests/SAML2/XML/samlp/StatusTest.php index b8e88063a..6aa634697 100644 --- a/tests/SAML2/XML/samlp/StatusTest.php +++ b/tests/SAML2/XML/samlp/StatusTest.php @@ -4,7 +4,7 @@ namespace SimpleSAML\Test\SAML2\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; /** @@ -81,10 +81,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); } @@ -115,7 +116,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/SAML2/XML/samlp/TerminateTest.php b/tests/SAML2/XML/samlp/TerminateTest.php index c807423e1..a47885c46 100644 --- a/tests/SAML2/XML/samlp/TerminateTest.php +++ b/tests/SAML2/XML/samlp/TerminateTest.php @@ -48,9 +48,10 @@ public function testMarshalling(): void { $terminate = new Terminate(); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($terminate), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($terminate); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } } diff --git a/tests/SAML2/XML/shibmd/KeyAuthorityTest.php b/tests/SAML2/XML/shibmd/KeyAuthorityTest.php index c538b6e89..69e80ecd8 100644 --- a/tests/SAML2/XML/shibmd/KeyAuthorityTest.php +++ b/tests/SAML2/XML/shibmd/KeyAuthorityTest.php @@ -79,9 +79,10 @@ public function testMarshalling(): void $attr1 = new XMLAttribute('urn:test:something', 'test', 'attr1', SAMLStringValue::fromString('testval1')); $keyAuthority = new KeyAuthority($keys, UnsignedByteValue::fromInteger(2), [$attr1]); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($keyAuthority), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($keyAuthority); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } } diff --git a/tests/SAML2/XML/shibmd/ScopeTest.php b/tests/SAML2/XML/shibmd/ScopeTest.php index 863060566..f19c1b551 100644 --- a/tests/SAML2/XML/shibmd/ScopeTest.php +++ b/tests/SAML2/XML/shibmd/ScopeTest.php @@ -62,10 +62,11 @@ public function testMarshalling(): void BooleanValue::fromBoolean(false), ); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($scope), - ); + $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement); + $this->assertNotFalse($expectedXml); + $actualXml = strval($scope); + + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } @@ -83,7 +84,7 @@ public function testMarshallingRegexp(): void $scopeElement = $scope->toXML($document->documentElement); $xpCache = XPath::getXPath($scopeElement); - /** @var \DOMElement[] $scopeElements */ + /** @var \Dom\Element[] $scopeElements */ $scopeElements = XPath::xpQuery($scopeElement, '/root/shibmd:Scope', $xpCache); $this->assertCount(1, $scopeElements); $scopeElement = $scopeElements[0]; diff --git a/tests/Vulnerabilities/XmlSignatureWrappingTest.php b/tests/Vulnerabilities/XmlSignatureWrappingTest.php index 770716fb2..7bbad2785 100644 --- a/tests/Vulnerabilities/XmlSignatureWrappingTest.php +++ b/tests/Vulnerabilities/XmlSignatureWrappingTest.php @@ -72,7 +72,7 @@ private function getSignedAssertionWithSignatureThatReferencesAnotherAssertion() dirname(__DIR__, 1) . '/resources/xml/vulnerabilities/signedAssertionWithInvalidReferencedId.xml', ); - /** @var \DOMElement $element */ + /** @var \Dom\Element $element */ $element = $document->firstChild; return Assertion::fromXML($element); } @@ -87,7 +87,7 @@ private function getSignedAssertionWithEmbeddedAssertionReferencedInSignature(): dirname(__DIR__, 1) . '/resources/xml/vulnerabilities/signedAssertionReferencedEmbeddedAssertion.xml', ); - /** @var \DOMElement $element */ + /** @var \Dom\Element $element */ $element = $document->firstChild; return Assertion::fromXML($element); } diff --git a/tests/bin/authnrequest.php b/tests/bin/authnrequest.php index b7614d73b..4a5389606 100644 --- a/tests/bin/authnrequest.php +++ b/tests/bin/authnrequest.php @@ -45,4 +45,7 @@ $authnRequest = $authnRequest->toXML(); -echo $authnRequest->ownerDocument->saveXML(); +/** @var \Dom\XMLDocument $ownerDocument */ +$ownerDocument = $authnRequest->ownerDocument; + +echo $ownerDocument->saveXML(); diff --git a/tests/bin/encryptedassertion.php b/tests/bin/encryptedassertion.php index b7f3fea0b..796a9ba6b 100644 --- a/tests/bin/encryptedassertion.php +++ b/tests/bin/encryptedassertion.php @@ -25,4 +25,7 @@ $assertion = Assertion::fromXML($document->documentElement); $eassertion = new EncryptedAssertion($assertion->encrypt($encryptor)); -echo $eassertion->toXML()->ownerDocument->saveXML(); +/** @var \Dom\XMLDocument $ownerDocument */ +$ownerDocument = $eassertion->toXML()->ownerDocument; + +echo $ownerDocument->saveXML(); diff --git a/tests/bin/encryptedattribute.php b/tests/bin/encryptedattribute.php index bedbfc537..719eca872 100644 --- a/tests/bin/encryptedattribute.php +++ b/tests/bin/encryptedattribute.php @@ -29,4 +29,7 @@ ); $encAttribute = new EncryptedAttribute($attribute->encrypt($encryptor)); -echo $encAttribute->toXML()->ownerDocument->saveXML(); +/** @var \Dom\XMLDocument $ownerDocument */ +$ownerDocument = $encAttribute->toXML()->ownerDocument; + +echo $ownerDocument->saveXML(); diff --git a/tests/bin/encryptedid.php b/tests/bin/encryptedid.php index e009b49e0..6d2574115 100644 --- a/tests/bin/encryptedid.php +++ b/tests/bin/encryptedid.php @@ -23,4 +23,7 @@ $nid = new NameID(SAMLStringValue::fromString('very secret')); $eid = new EncryptedID($nid->encrypt($encryptor)); -echo $eid->toXML()->ownerDocument->saveXML(); +/** @var \DOM\XMLDocument $ownerDocument */ +$ownerDocument = $eid->toXML()->ownerDocument; + +echo $ownerDocument->saveXML(); diff --git a/tests/bin/entityattributes.php b/tests/bin/entityattributes.php index af7640079..a8e6f9971 100644 --- a/tests/bin/entityattributes.php +++ b/tests/bin/entityattributes.php @@ -110,4 +110,7 @@ ), ]); -echo $entityAttributes->toXML()->ownerDocument?->saveXML(); +/** @var \Dom\XMLDocument $ownerDocument */ +$ownerDocument = $entityAttributes->toXML()->ownerDocument; + +echo $ownerDocument->saveXML(); diff --git a/tests/bin/logoutrequest.php b/tests/bin/logoutrequest.php index 8823ec8d3..7ae75b393 100644 --- a/tests/bin/logoutrequest.php +++ b/tests/bin/logoutrequest.php @@ -43,4 +43,7 @@ $logoutRequest = $logoutRequest->toXML(); -echo $logoutRequest->ownerDocument->saveXML(); +/** @var \Dom\XMLDocument $ownerDocument */ +$ownerDocument = $logoutRequest->ownerDocument; + +echo $ownerDocument->saveXML(); diff --git a/tests/bin/signedAuthnrequest.php b/tests/bin/signedAuthnrequest.php index 3d8a9d9ee..0960f76a7 100644 --- a/tests/bin/signedAuthnrequest.php +++ b/tests/bin/signedAuthnrequest.php @@ -41,9 +41,14 @@ $unsignedAuthnRequest = $authnRequest->toXML(); -echo $unsignedAuthnRequest->ownerDocument->saveXML(); +/** @var \Dom\XMLDocument $ownerDocument */ +$ownerDocument = $unsignedAuthnRequest->ownerDocument; +echo $ownerDocument->saveXML(); $authnRequest->sign($signer); $signedAuthnRequest = $authnRequest->toXML(); -echo $signedAuthnRequest->ownerDocument->saveXML(); +/** @var \Dom\XMLDocument $ownerDocument */ +$ownerDocument = $signedAuthnRequest->ownerDocument; + +echo $ownerDocument->saveXML(); diff --git a/tests/bin/signedassertion.php b/tests/bin/signedassertion.php index e5d08dc12..2fdeb6935 100644 --- a/tests/bin/signedassertion.php +++ b/tests/bin/signedassertion.php @@ -19,4 +19,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/bin/signedassertion_tampered.php b/tests/bin/signedassertion_tampered.php index 5a58becc5..5729a3259 100644 --- a/tests/bin/signedassertion_tampered.php +++ b/tests/bin/signedassertion_tampered.php @@ -19,4 +19,8 @@ $unsignedAssertion = Assertion::fromXML($document->documentElement); $unsignedAssertion->sign($signer); -echo str_replace('127.0.0.1', '127.0.0.2', strval($unsignedAssertion->toXML()->ownerDocument->saveXML())); + +/** @var \Dom\XMLDocument $ownerDocument */ +$ownerDocument = $unsignedAssertion->toXML()->ownerDocument; + +echo str_replace('127.0.0.1', '127.0.0.2', strval($ownerDocument->saveXML())); diff --git a/tests/bin/signedassertion_with_comments.php b/tests/bin/signedassertion_with_comments.php index 51ad81396..d683a8154 100644 --- a/tests/bin/signedassertion_with_comments.php +++ b/tests/bin/signedassertion_with_comments.php @@ -19,8 +19,12 @@ $unsignedAssertion = Assertion::fromXML($document->documentElement); $unsignedAssertion->sign($signer); + +/** @var \Dom\XMLDocument $ownerDocument */ +$ownerDocument = $unsignedAssertion->toXML()->ownerDocument; + echo str_replace( 'SomeNameIDValue', 'SomeNameIDValue', - strval($unsignedAssertion->toXML()->ownerDocument->saveXML()), + strval($ownerDocument->saveXML()), ); diff --git a/tests/bin/signedresponse_with_signedassertion.php b/tests/bin/signedresponse_with_signedassertion.php index 51e5bacba..974fc6200 100644 --- a/tests/bin/signedresponse_with_signedassertion.php +++ b/tests/bin/signedresponse_with_signedassertion.php @@ -47,4 +47,8 @@ ); $unsignedResponse->sign($responseSigner); -echo $unsignedResponse->toXML()->ownerDocument->saveXML(); + +/** @var \Dom\XMLDocument $ownerDocument */ +$ownerDocument = $unsignedResponse->toXML()->ownerDocument; + +echo $ownerDocument->saveXML(); diff --git a/tests/bin/signedresponse_with_unsignedassertion.php b/tests/bin/signedresponse_with_unsignedassertion.php index d183eb039..2a3d7575f 100644 --- a/tests/bin/signedresponse_with_unsignedassertion.php +++ b/tests/bin/signedresponse_with_unsignedassertion.php @@ -40,4 +40,8 @@ ); $unsignedResponse->sign($responseSigner); -echo $unsignedResponse->toXML()->ownerDocument->saveXML(); + +/** @var \Dom\XMLDocument $ownerDocument */ +$ownerDocument = $unsignedResponse->toXML()->ownerDocument; + +echo $ownerDocument->saveXML(); diff --git a/tests/bin/unsignedresponse_with_signedassertion.php b/tests/bin/unsignedresponse_with_signedassertion.php index eacbc51c1..2e02a381b 100644 --- a/tests/bin/unsignedresponse_with_signedassertion.php +++ b/tests/bin/unsignedresponse_with_signedassertion.php @@ -43,4 +43,7 @@ assertions: [$signedAssertion], ); -echo $unsignedResponse->toXML()->ownerDocument->saveXML(); +/** @var \Dom\XMLDocument $ownerDocument */ +$ownerDocument = $unsignedResponse->toXML()->ownerDocument; + +echo $ownerDocument->saveXML();