Skip to content

Commit 96770aa

Browse files
committed
Migrate DOM-classes to PHP 8.4's new DOM-API
1 parent 628f821 commit 96770aa

37 files changed

Lines changed: 150 additions & 151 deletions

composer.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@
1414
"ext-dom": "*",
1515

1616
"simplesamlphp/assert": "~2.0",
17-
"simplesamlphp/xml-common": "~2.8",
18-
"simplesamlphp/xml-ws-policy": "~1.3",
19-
"simplesamlphp/xml-wss-core": "~1.4"
17+
"simplesamlphp/xml-common": "dev-feature/dom-migration-php84",
18+
"simplesamlphp/xml-ws-policy": "dev-feature/dom-migration-php84",
19+
"simplesamlphp/xml-wss-core": "dev-feature/dom-migration-php84"
2020
},
2121
"require-dev": {
2222
"simplesamlphp/simplesamlphp-test-framework": "~1.11",
23-
"simplesamlphp/xml-soap": "~2.3"
23+
"simplesamlphp/xml-soap": "dev-feature/dom-migration-php84"
2424
},
2525
"autoload": {
2626
"psr-4": {

src/Utils/XPath.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44

55
namespace SimpleSAML\WebServices\Addressing\Utils;
66

7-
use DOMNode;
8-
use DOMXPath;
7+
use Dom;
98
use SimpleSAML\WebServices\Addressing\Constants as C;
109

1110
/**
@@ -16,15 +15,15 @@
1615
class XPath extends \SimpleSAML\XPath\XPath
1716
{
1817
/*
19-
* Get a DOMXPath object that can be used to search for WS-Addressing elements.
18+
* Get a Dom\XPath object that can be used to search for WS-Addressing elements.
2019
*
21-
* @param \DOMNode $node The document to associate to the DOMXPath object.
20+
* @param \Dom\Node $node The document to associate to the Dom\XPath object.
2221
* @param bool $autoregister Whether to auto-register all namespaces used in the document
2322
*
24-
* @return \DOMXPath A DOMXPath object ready to use in the given document, with several
23+
* @return \Dom\XPath A Dom\XPath object ready to use in the given document, with several
2524
* ws-related namespaces already registered.
2625
*/
27-
public static function getXPath(DOMNode $node, bool $autoregister = false): DOMXPath
26+
public static function getXPath(Dom\Node $node, bool $autoregister = false): Dom\XPath
2827
{
2928
$xp = parent::getXPath($node, $autoregister);
3029

src/XML/wsa_200408/AbstractAttributedQNameType.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
namespace SimpleSAML\WebServices\Addressing\XML\wsa_200408;
66

7-
use DOMElement;
7+
use Dom;
88
use SimpleSAML\WebServices\Addressing\Assert\Assert;
99
use SimpleSAML\XML\ExtendableAttributesTrait;
1010
use SimpleSAML\XML\TypedTextContentTrait;
@@ -49,12 +49,12 @@ final public function __construct(QNameValue $value, array $namespacedAttributes
4949
/**
5050
* Convert XML into a class instance
5151
*
52-
* @param \DOMElement $xml The XML element we should load
52+
* @param \Dom\Element $xml The XML element we should load
5353
*
5454
* @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException
5555
* If the qualified name of the supplied element is wrong
5656
*/
57-
public static function fromXML(DOMElement $xml): static
57+
public static function fromXML(Dom\Element $xml): static
5858
{
5959
Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class);
6060
Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class);
@@ -66,9 +66,9 @@ public static function fromXML(DOMElement $xml): static
6666
/**
6767
* Convert this element to XML.
6868
*
69-
* @param \DOMElement|null $parent The element we should append this element to.
69+
* @param \Dom\lement|null $parent The element we should append this element to.
7070
*/
71-
public function toXML(?DOMElement $parent = null): DOMElement
71+
public function toXML(?Dom\Element $parent = null): Dom\Element
7272
{
7373
$e = $this->instantiateParentElement($parent);
7474
$e->textContent = $this->getContent()->getValue();

src/XML/wsa_200408/AbstractAttributedURIType.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
namespace SimpleSAML\WebServices\Addressing\XML\wsa_200408;
66

7-
use DOMElement;
7+
use Dom;
88
use SimpleSAML\WebServices\Addressing\Assert\Assert;
99
use SimpleSAML\XML\ExtendableAttributesTrait;
1010
use SimpleSAML\XML\TypedTextContentTrait;
@@ -49,12 +49,12 @@ final public function __construct(AnyURIValue $value, array $namespacedAttribute
4949
/**
5050
* Convert XML into a class instance
5151
*
52-
* @param \DOMElement $xml The XML element we should load
52+
* @param \Dom\Element $xml The XML element we should load
5353
*
5454
* @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException
5555
* If the qualified name of the supplied element is wrong
5656
*/
57-
public static function fromXML(DOMElement $xml): static
57+
public static function fromXML(Dom\Element $xml): static
5858
{
5959
Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class);
6060
Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class);
@@ -66,9 +66,9 @@ public static function fromXML(DOMElement $xml): static
6666
/**
6767
* Convert this element to XML.
6868
*
69-
* @param \DOMElement|null $parent The element we should append this element to.
69+
* @param \Dom\Element|null $parent The element we should append this element to.
7070
*/
71-
public function toXML(?DOMElement $parent = null): DOMElement
71+
public function toXML(?Dom\Element $parent = null): Dom\Element
7272
{
7373
$e = $this->instantiateParentElement($parent);
7474
$e->textContent = $this->getContent()->getValue();

src/XML/wsa_200408/AbstractEndpointReferenceType.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
namespace SimpleSAML\WebServices\Addressing\XML\wsa_200408;
66

7-
use DOMElement;
7+
use Dom;
88
use SimpleSAML\WebServices\Addressing\Assert\Assert;
99
use SimpleSAML\XML\ExtendableAttributesTrait;
1010
use SimpleSAML\XML\ExtendableElementTrait;
@@ -125,14 +125,14 @@ public function getServiceName(): ?ServiceName
125125
*
126126
* Note: this method cannot be used when extending this class, if the constructor has a different signature.
127127
*
128-
* @param \DOMElement $xml The XML element we should load.
128+
* @param \Dom\Element $xml The XML element we should load.
129129
*
130130
* @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException
131131
* if the qualified name of the supplied element is wrong
132132
* @throws \SimpleSAML\XMLSchema\Exception\MissingAttributeException
133133
* if the supplied element is missing any of the mandatory attributes
134134
*/
135-
public static function fromXML(DOMElement $xml): static
135+
public static function fromXML(Dom\Element $xml): static
136136
{
137137
$qualifiedName = static::getClassName(static::class);
138138
Assert::eq(
@@ -173,9 +173,9 @@ public static function fromXML(DOMElement $xml): static
173173
/**
174174
* Add this endpoint reference to an XML element.
175175
*
176-
* @param \DOMElement|null $parent The element we should append this endpoint to.
176+
* @param \Dom\Element|null $parent The element we should append this endpoint to.
177177
*/
178-
public function toXML(?DOMElement $parent = null): DOMElement
178+
public function toXML(?Dom\Element $parent = null): Dom\Element
179179
{
180180
$e = parent::instantiateParentElement($parent);
181181

src/XML/wsa_200408/AbstractRelationshipType.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
namespace SimpleSAML\WebServices\Addressing\XML\wsa_200408;
66

7-
use DOMElement;
7+
use Dom;
88
use SimpleSAML\WebServices\Addressing\Assert\Assert;
99
use SimpleSAML\XML\ExtendableAttributesTrait;
1010
use SimpleSAML\XML\TypedTextContentTrait;
@@ -63,12 +63,12 @@ public function getRelationshipType(): ?QNameValue
6363
/**
6464
* Convert XML into a class instance
6565
*
66-
* @param \DOMElement $xml The XML element we should load
66+
* @param \Dom\Element $xml The XML element we should load
6767
*
6868
* @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException
6969
* If the qualified name of the supplied element is wrong
7070
*/
71-
public static function fromXML(DOMElement $xml): static
71+
public static function fromXML(Dom\Element $xml): static
7272
{
7373
Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class);
7474
Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class);
@@ -84,9 +84,9 @@ public static function fromXML(DOMElement $xml): static
8484
/**
8585
* Convert this element to XML.
8686
*
87-
* @param \DOMElement|null $parent The element we should append this element to.
87+
* @param \Dom\Element|null $parent The element we should append this element to.
8888
*/
89-
public function toXML(?DOMElement $parent = null): DOMElement
89+
public function toXML(?Dom\Element $parent = null): Dom\Element
9090
{
9191
$e = $this->instantiateParentElement($parent);
9292
$e->textContent = $this->getContent()->getValue();

src/XML/wsa_200408/AbstractRetryAfterType.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
namespace SimpleSAML\WebServices\Addressing\XML\wsa_200408;
66

7-
use DOMElement;
7+
use Dom;
88
use SimpleSAML\WebServices\Addressing\Assert\Assert;
99
use SimpleSAML\XML\ExtendableAttributesTrait;
1010
use SimpleSAML\XML\TypedTextContentTrait;
@@ -51,12 +51,12 @@ final public function __construct(
5151
/**
5252
* Convert XML into a class instance
5353
*
54-
* @param \DOMElement $xml The XML element we should load
54+
* @param \Dom\Element $xml The XML element we should load
5555
*
5656
* @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException
5757
* If the qualified name of the supplied element is wrong
5858
*/
59-
public static function fromXML(DOMElement $xml): static
59+
public static function fromXML(Dom\Element $xml): static
6060
{
6161
Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class);
6262
Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class);
@@ -68,9 +68,9 @@ public static function fromXML(DOMElement $xml): static
6868
/**
6969
* Convert this element to XML.
7070
*
71-
* @param \DOMElement|null $parent The element we should append this element to.
71+
* @param \Dom\Element|null $parent The element we should append this element to.
7272
*/
73-
public function toXML(?DOMElement $parent = null): DOMElement
73+
public function toXML(?Dom\Element $parent = null): Dom\Element
7474
{
7575
$e = $this->instantiateParentElement($parent);
7676
$e->textContent = $this->getContent()->getValue();

src/XML/wsa_200408/AbstractServiceNameType.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
namespace SimpleSAML\WebServices\Addressing\XML\wsa_200408;
66

7-
use DOMElement;
7+
use Dom;
88
use SimpleSAML\WebServices\Addressing\Assert\Assert;
99
use SimpleSAML\XML\ExtendableAttributesTrait;
1010
use SimpleSAML\XML\TypedTextContentTrait;
@@ -63,12 +63,12 @@ public function getPortName(): ?NCNameValue
6363
/**
6464
* Convert XML into a class instance
6565
*
66-
* @param \DOMElement $xml The XML element we should load
66+
* @param \Dom\Element $xml The XML element we should load
6767
*
6868
* @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException
6969
* If the qualified name of the supplied element is wrong
7070
*/
71-
public static function fromXML(DOMElement $xml): static
71+
public static function fromXML(Dom\Element $xml): static
7272
{
7373
Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class);
7474
Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class);
@@ -84,9 +84,9 @@ public static function fromXML(DOMElement $xml): static
8484
/**
8585
* Convert this element to XML.
8686
*
87-
* @param \DOMElement|null $parent The element we should append this element to.
87+
* @param \Dom\Element|null $parent The element we should append this element to.
8888
*/
89-
public function toXML(?DOMElement $parent = null): DOMElement
89+
public function toXML(?Dom\Element $parent = null): Dom\Element
9090
{
9191
$e = $this->instantiateParentElement($parent);
9292
$e->textContent = $this->getContent()->getValue();

src/XML/wsa_200408/ReferenceParameters.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
namespace SimpleSAML\WebServices\Addressing\XML\wsa_200408;
66

7-
use DOMElement;
7+
use Dom;
88
use SimpleSAML\WebServices\Addressing\Assert\Assert;
99
use SimpleSAML\XML\ExtendableElementTrait;
1010
use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException;
@@ -47,12 +47,12 @@ public function isEmptyElement(): bool
4747
/*
4848
* Convert XML into an ReferenceParameters element
4949
*
50-
* @param \DOMElement $xml The XML element we should load
50+
* @param \Dom\Element $xml The XML element we should load
5151
*
5252
* @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException
5353
* If the qualified name of the supplied element is wrong
5454
*/
55-
public static function fromXML(DOMElement $xml): static
55+
public static function fromXML(Dom\Element $xml): static
5656
{
5757
Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class);
5858
Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class);
@@ -66,9 +66,9 @@ public static function fromXML(DOMElement $xml): static
6666
/**
6767
* Convert this ReferenceParameters to XML.
6868
*
69-
* @param \DOMElement|null $parent The element we should add this ReferenceParameters to.
69+
* @param \Dom\Element|null $parent The element we should add this ReferenceParameters to.
7070
*/
71-
public function toXML(?DOMElement $parent = null): DOMElement
71+
public function toXML(?Dom\Element $parent = null): Dom\Element
7272
{
7373
$e = $this->instantiateParentElement($parent);
7474

src/XML/wsa_200408/ReferenceProperties.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
namespace SimpleSAML\WebServices\Addressing\XML\wsa_200408;
66

7-
use DOMElement;
7+
use Dom;
88
use SimpleSAML\WebServices\Addressing\Assert\Assert;
99
use SimpleSAML\XML\ExtendableElementTrait;
1010
use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException;
@@ -47,12 +47,12 @@ public function isEmptyElement(): bool
4747
/*
4848
* Convert XML into an ReferenceProperties element
4949
*
50-
* @param \DOMElement $xml The XML element we should load
50+
* @param \Dom\Element $xml The XML element we should load
5151
*
5252
* @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException
5353
* If the qualified name of the supplied element is wrong
5454
*/
55-
public static function fromXML(DOMElement $xml): static
55+
public static function fromXML(Dom\Element $xml): static
5656
{
5757
Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class);
5858
Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class);
@@ -66,9 +66,9 @@ public static function fromXML(DOMElement $xml): static
6666
/**
6767
* Convert this ReferenceProperties to XML.
6868
*
69-
* @param \DOMElement|null $parent The element we should add this ReferenceProperties to.
69+
* @param \Dom\Element|null $parent The element we should add this ReferenceProperties to.
7070
*/
71-
public function toXML(?DOMElement $parent = null): DOMElement
71+
public function toXML(?Dom\Element $parent = null): Dom\Element
7272
{
7373
$e = $this->instantiateParentElement($parent);
7474

0 commit comments

Comments
 (0)