Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"ext-dom": "*",

"simplesamlphp/assert": "~2.0",
"simplesamlphp/xml-common": "~2.0"
"simplesamlphp/xml-common": "dev-feature/dom-migration-php84"
},
"require-dev": {
"simplesamlphp/simplesamlphp-test-framework": "~1.11"
Expand All @@ -31,7 +31,7 @@
},
"extra": {
"branch-alias": {
"dev-master": "v2.0.x-dev"
"dev-master": "v3.0.x-dev"
}
},
"config": {
Expand Down
13 changes: 6 additions & 7 deletions src/CAS/Utils/XPath.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@

namespace SimpleSAML\CAS\Utils;

use DOMNode;
use DOMXPath;
use Dom;
use SimpleSAML\CAS\Constants as C;

/**
Expand All @@ -16,21 +15,21 @@
class XPath extends \SimpleSAML\XPath\XPath
{
/**
* Get a DOMXPath object that can be used to search for CAS elements.
* Get a Dom\XPath object that can be used to search for CAS 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
* cas-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);

/*
* - Registering 'cas' to the same URI again is fine.
* - If someone previously bound 'cas' to a different URI on the same DOMXPath,
* - If someone previously bound 'cas' to a different URI on the same Dom\XPath,
* your call will change its meaning for subsequent queries
* */
$xp->registerNamespace('cas', C::NS_CAS);
Expand Down
8 changes: 4 additions & 4 deletions src/CAS/XML/AbstractAttributes.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace SimpleSAML\CAS\XML;

use DOMElement;
use Dom;
use SimpleSAML\CAS\Constants as C;
use SimpleSAML\XML\ExtendableElementTrait;
use SimpleSAML\XMLSchema\XML\Constants\NS;
Expand Down Expand Up @@ -80,10 +80,10 @@ public function getIsFromNewLogin(): IsFromNewLogin
/**
* Convert this Attributes to XML.
*
* @param \DOMElement|null $parent The element we should append this Attributes to.
* @return \DOMElement
* @param \Dom\Element|null $parent The element we should append this Attributes to.
* @return \Dom\Element
*/
public function toXML(?DOMElement $parent = null): DOMElement
public function toXML(?Dom\Element $parent = null): Dom\Element
{
$e = $this->instantiateParentElement($parent);

Expand Down
8 changes: 4 additions & 4 deletions src/CAS/XML/AbstractAuthenticationFailure.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace SimpleSAML\CAS\XML;

use DOMElement;
use Dom;
use SimpleSAML\CAS\Type\CodeValue;
use SimpleSAML\XML\TypedTextContentTrait;
use SimpleSAML\XMLSchema\Type\StringValue;
Expand Down Expand Up @@ -52,10 +52,10 @@ public function getCode(): CodeValue
/**
* Convert this AuthenticationFailure to XML.
*
* @param \DOMElement|null $parent The element we should append to.
* @return \DOMElement This AuthenticatioFailure-element.
* @param \Dom\Element|null $parent The element we should append to.
* @return \Dom\Element This AuthenticatioFailure-element.
*/
public function toXML(?DOMElement $parent = null): DOMElement
public function toXML(?Dom\Element $parent = null): Dom\Element
{
$e = $this->instantiateParentElement($parent);

Expand Down
8 changes: 4 additions & 4 deletions src/CAS/XML/AbstractAuthenticationSuccess.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace SimpleSAML\CAS\XML;

use DOMElement;
use Dom;

/**
* Class for CAS authenticationSuccess
Expand Down Expand Up @@ -72,10 +72,10 @@ public function getProxies(): ?Proxies
/**
* Convert this AuthenticationSuccess to XML.
*
* @param \DOMElement|null $parent The element we should append this AuthenticationSuccess to.
* @return \DOMElement
* @param \Dom\Element|null $parent The element we should append this AuthenticationSuccess to.
* @return \Dom\Element
*/
public function toXML(?DOMElement $parent = null): DOMElement
public function toXML(?Dom\Element $parent = null): Dom\Element
{
$e = $this->instantiateParentElement($parent);

Expand Down
8 changes: 4 additions & 4 deletions src/CAS/XML/AbstractProxies.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace SimpleSAML\CAS\XML;

use DOMElement;
use Dom;
use SimpleSAML\CAS\Assert\Assert;
use SimpleSAML\CAS\Constants as C;
use SimpleSAML\XMLSchema\Exception\MissingElementException;
Expand Down Expand Up @@ -45,10 +45,10 @@ public function getProxy(): array
/**
* Convert this Proxies to XML.
*
* @param \DOMElement|null $parent The element we should append this Proxies to.
* @return \DOMElement
* @param \Dom\Element|null $parent The element we should append this Proxies to.
* @return \Dom\Element
*/
public function toXML(?DOMElement $parent = null): DOMElement
public function toXML(?Dom\Element $parent = null): Dom\Element
{
$e = $this->instantiateParentElement($parent);

Expand Down
8 changes: 4 additions & 4 deletions src/CAS/XML/AbstractProxyFailure.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace SimpleSAML\CAS\XML;

use DOMElement;
use Dom;
use SimpleSAML\CAS\Type\CodeValue;
use SimpleSAML\XML\TypedTextContentTrait;
use SimpleSAML\XMLSchema\Type\StringValue;
Expand Down Expand Up @@ -52,10 +52,10 @@ public function getCode(): CodeValue
/**
* Convert this ProxyFailure to XML.
*
* @param \DOMElement|null $parent The element we should append to.
* @return \DOMElement This ProxyFailure-element.
* @param \Dom\Element|null $parent The element we should append to.
* @return \Dom\Element This ProxyFailure-element.
*/
public function toXML(?DOMElement $parent = null): DOMElement
public function toXML(?Dom\Element $parent = null): Dom\Element
{
$e = $this->instantiateParentElement($parent);

Expand Down
8 changes: 4 additions & 4 deletions src/CAS/XML/AbstractProxySuccess.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace SimpleSAML\CAS\XML;

use DOMElement;
use Dom;

/**
* Class for CAS proxySuccess
Expand Down Expand Up @@ -39,10 +39,10 @@ public function getProxyTicket(): ProxyTicket
/**
* Convert this ProxySuccess to XML.
*
* @param \DOMElement|null $parent The element we should append to.
* @return \DOMElement This ProxySuccess-element.
* @param \Dom\Element|null $parent The element we should append to.
* @return \Dom\Element This ProxySuccess-element.
*/
public function toXML(?DOMElement $parent = null): DOMElement
public function toXML(?Dom\Element $parent = null): Dom\Element
{
$e = $this->instantiateParentElement($parent);

Expand Down
8 changes: 4 additions & 4 deletions src/CAS/XML/AbstractServiceResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace SimpleSAML\CAS\XML;

use DOMElement;
use Dom;

/**
* Class for CAS serviceResponse
Expand Down Expand Up @@ -39,10 +39,10 @@ public function getResponse(): AbstractResponse
/**
* Convert this ServiceResponse to XML.
*
* @param \DOMElement|null $parent The element we should append this ServiceResponse to.
* @return \DOMElement
* @param \Dom\Element|null $parent The element we should append this ServiceResponse to.
* @return \Dom\Element
*/
public function toXML(?DOMElement $parent = null): DOMElement
public function toXML(?Dom\Element $parent = null): Dom\Element
{
$e = $this->instantiateParentElement($parent);

Expand Down
6 changes: 3 additions & 3 deletions src/CAS/XML/Attributes.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace SimpleSAML\CAS\XML;

use DOMElement;
use Dom;
use SimpleSAML\CAS\Assert\Assert;
use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException;
use SimpleSAML\XMLSchema\Exception\MissingElementException;
Expand All @@ -19,15 +19,15 @@ final class Attributes extends AbstractAttributes
/**
* Convert XML into a cas:attributes-element
*
* @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
* 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, static::getLocalName(), InvalidDOMElementException::class);
Assert::same($xml->namespaceURI, static::getNamespaceURI(), InvalidDOMElementException::class);
Expand Down
12 changes: 6 additions & 6 deletions src/CAS/XML/AuthenticationDate.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace SimpleSAML\CAS\XML;

use DOMElement;
use Dom;
use SimpleSAML\CAS\Assert\Assert;
use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException;
use SimpleSAML\XMLSchema\Type\DateTimeValue;
Expand Down Expand Up @@ -44,9 +44,9 @@ public function getTimestamp(): DateTimeValue
/**
* Convert this element into an XML document.
*
* @return \DOMElement The root element of the DOM tree
* @return \Dom\Element The root element of the DOM tree
*/
public function toXML(?DOMElement $parent = null): DOMElement
public function toXML(?Dom\Element $parent = null): Dom\Element
{
$e = $this->instantiateParentElement($parent);
$e->textContent = strval($this->getTimestamp());
Expand All @@ -58,17 +58,17 @@ public function toXML(?DOMElement $parent = null): DOMElement
/**
* Convert XML into a cas:authenticationDate
*
* @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
* If the qualified name of the supplied element is wrong
*/
public static function fromXML(DOMElement $xml): static
public static function fromXML(Dom\Element $xml): static
{
Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class);
Assert::same($xml->namespaceURI, static::getNamespaceURI(), InvalidDOMElementException::class);

return new static(DateTimeValue::fromString($xml->textContent));
return new static(DateTimeValue::fromString((string) $xml->textContent));
}
}
8 changes: 4 additions & 4 deletions src/CAS/XML/AuthenticationFailure.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace SimpleSAML\CAS\XML;

use DOMElement;
use Dom;
use SimpleSAML\CAS\Assert\Assert;
use SimpleSAML\CAS\Type\CodeValue;
use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException;
Expand All @@ -20,21 +20,21 @@ final class AuthenticationFailure extends AbstractAuthenticationFailure
/**
* Initialize an AuthenticationFailure element.
*
* @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
* 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, static::getLocalName(), InvalidDOMElementException::class);
Assert::same($xml->namespaceURI, static::getNamespaceURI(), InvalidDOMElementException::class);

return new static(
StringValue::fromString($xml->textContent),
StringValue::fromString((string) $xml->textContent),
self::getAttribute($xml, 'code', CodeValue::class),
);
}
Expand Down
6 changes: 3 additions & 3 deletions src/CAS/XML/AuthenticationSuccess.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace SimpleSAML\CAS\XML;

use DOMElement;
use Dom;
use SimpleSAML\CAS\Assert\Assert;
use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException;
use SimpleSAML\XMLSchema\Exception\MissingElementException;
Expand All @@ -21,15 +21,15 @@ final class AuthenticationSuccess extends AbstractAuthenticationSuccess
/**
* Convert XML into a cas:authenticationSuccess-element
*
* @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
* 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, static::getLocalName(), InvalidDOMElementException::class);
Assert::same($xml->namespaceURI, static::getNamespaceURI(), InvalidDOMElementException::class);
Expand Down
6 changes: 3 additions & 3 deletions src/CAS/XML/Proxies.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace SimpleSAML\CAS\XML;

use DOMElement;
use Dom;
use SimpleSAML\CAS\Assert\Assert;
use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException;

Expand All @@ -18,13 +18,13 @@ final class Proxies extends AbstractProxies
/**
* Convert XML into a Proxies-element
*
* @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
* if the qualified name of the supplied element is wrong
*/
public static function fromXML(DOMElement $xml): static
public static function fromXML(Dom\Element $xml): static
{
Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class);
Assert::same($xml->namespaceURI, static::getNamespaceURI(), InvalidDOMElementException::class);
Expand Down
Loading
Loading