Skip to content
This repository was archived by the owner on Jan 21, 2026. It is now read-only.

Commit 0bf3e53

Browse files
committed
Migrate to xsd-types
1 parent df3e7c5 commit 0bf3e53

22 files changed

Lines changed: 143 additions & 102 deletions

src/XML/fed/AbstractApplicationServiceType.php

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,20 @@
55
namespace SimpleSAML\WSSecurity\XML\fed;
66

77
use DOMElement;
8-
use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue, SAMLStringValue};
9-
use SimpleSAML\SAML2\XML\md\{Extensions, Organization};
8+
use SimpleSAML\SAML2\Type\SAMLAnyURIValue;
9+
use SimpleSAML\SAML2\Type\SAMLAnyURIListValue;
10+
use SimpleSAML\SAML2\Type\SAMLDateTimeValue;
11+
use SimpleSAML\SAML2\Type\SAMLStringValue;
12+
use SimpleSAML\SAML2\XML\md\Extensions;
13+
use SimpleSAML\SAML2\XML\md\Organization;
1014
use SimpleSAML\WSSecurity\Assert\Assert;
1115
use SimpleSAML\WSSecurity\Constants as C;
12-
use SimpleSAML\XML\Exception\{MissingElementException, SchemaViolationException};
13-
use SimpleSAML\XML\Type\{AnyURIValue, DurationValue, IDValue};
16+
use SimpleSAML\XMLSchema\Exception\MissingElementException;
17+
use SimpleSAML\XMLSchema\Exception\SchemaViolationException;
18+
use SimpleSAML\XMLSchema\Type\AnyURIValue;
19+
use SimpleSAML\XMLSchema\Type\DurationValue;
20+
use SimpleSAML\XMLSchema\Type\IDValue;
21+
use SimpleSAML\XMLSchema\Type\QNameValue;
1422

1523
/**
1624
* A ApplicationServiceType
@@ -32,10 +40,11 @@ abstract class AbstractApplicationServiceType extends AbstractWebServiceDescript
3240
/**
3341
* ApplicationServiceType constructor.
3442
*
35-
* @param string[] $protocolSupportEnumeration A set of URI specifying the protocols supported.
36-
* @param \SimpleSAML\XML\Type\IDValue|null $ID The ID for this document. Defaults to null.
37-
* @param \SimpleSAML\SAML2\Type\DateTimeValue|null $validUntil Unix time of validity for this document. Defaults to null.
38-
* @param \SimpleSAML\XML\Type\DurationValue|null $cacheDuration Maximum time this document can be cached. Defaults to null.
43+
* @param \SimpleSAML\XMLSchema\Type\QNameValue $type The xsi-type of the element
44+
* @param \SimpleSAML\SAML2\Type\SAMLAnyURIListValue $protocolSupportEnumeration A set of URI specifying the protocols supported.
45+
* @param \SimpleSAML\XMLSchema\Type\IDValue|null $ID The ID for this document. Defaults to null.
46+
* @param \SimpleSAML\SAML2\Type\SAMLDateTimeValue|null $validUntil Unix time of validity for this document. Defaults to null.
47+
* @param \SimpleSAML\XMLSchema\Type\DurationValue|null $cacheDuration Maximum time this document can be cached. Defaults to null.
3948
* @param \SimpleSAML\SAML2\XML\md\Extensions|null $extensions An array of extensions. Defaults to an empty array.
4049
* @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null $errorURL An URI where to redirect users for support. Defaults to null.
4150
* @param \SimpleSAML\SAML2\XML\md\KeyDescriptor[] $keyDescriptor An array of KeyDescriptor elements.
@@ -59,7 +68,8 @@ abstract class AbstractApplicationServiceType extends AbstractWebServiceDescript
5968
* @param \SimpleSAML\WSSecurity\XML\fed\PassiveRequestorEndpoint[] $passiveRequestorEndpoint
6069
*/
6170
final public function __construct(
62-
array $protocolSupportEnumeration,
71+
QNameValue $type,
72+
SAMLAnyURIListValue $protocolSupportEnumeration,
6373
?IDValue $ID = null,
6474
?SAMLDateTimeValue $validUntil = null,
6575
?DurationValue $cacheDuration = null,
@@ -100,7 +110,7 @@ final public function __construct(
100110
);
101111

102112
parent::__construct(
103-
static::XSI_TYPE_PREFIX . ':' . static::XSI_TYPE_NAME,
113+
$type,
104114
$protocolSupportEnumeration,
105115
$ID,
106116
$validUntil,

src/XML/fed/AbstractAssertionType.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@
66

77
use DOMElement;
88
use SimpleSAML\WSSecurity\Assert\Assert;
9-
use SimpleSAML\XML\Exception\InvalidDOMElementException;
10-
use SimpleSAML\XML\{ExtendableAttributesTrait, ExtendableElementTrait};
11-
use SimpleSAML\XML\XsNamespace as NS;
9+
use SimpleSAML\XML\ExtendableAttributesTrait;
10+
use SimpleSAML\XML\ExtendableElementTrait;
11+
use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException;
12+
use SimpleSAML\XMLSchema\XML\Constants\NS;
1213

1314
/**
1415
* Class defining the AssertionType element
@@ -60,7 +61,7 @@ public function isEmptyElement(): bool
6061
* @param \DOMElement $xml
6162
* @return static
6263
*
63-
* @throws \SimpleSAML\XML\Exception\InvalidDOMElementException
64+
* @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException
6465
* if the qualified name of the supplied element is wrong
6566
*/
6667
public static function fromXML(DOMElement $xml): static
@@ -89,7 +90,6 @@ public function toXML(?DOMElement $parent = null): DOMElement
8990
$attr->toXML($e);
9091
}
9192

92-
/** @psalm-var \SimpleSAML\XML\SerializableElementInterface $child */
9393
foreach ($this->getElements() as $child) {
9494
if (!$child->isEmptyElement()) {
9595
$child->toXML($e);

src/XML/fed/AbstractAttributeExtensibleString.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@
66

77
use DOMElement;
88
use SimpleSAML\WSSecurity\Assert\Assert;
9-
use SimpleSAML\XML\Exception\InvalidDOMElementException;
10-
use SimpleSAML\XML\{ExtendableAttributesTrait, TypedTextContentTrait};
11-
use SimpleSAML\XML\Type\StringValue;
12-
use SimpleSAML\XML\XsNamespace as NS;
9+
use SimpleSAML\XML\ExtendableAttributesTrait;
10+
use SimpleSAML\XML\TypedTextContentTrait;
11+
use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException;
12+
use SimpleSAML\XMLSchema\Type\StringValue;
13+
use SimpleSAML\XMLSchema\XML\Constants\NS;
1314

1415
/**
1516
* An AbstractAttributeExtensibleString element
@@ -29,7 +30,7 @@ abstract class AbstractAttributeExtensibleString extends AbstractFedElement
2930

3031

3132
/**
32-
* @param \SimpleSAML\XML\Type\StringValue $content
33+
* @param \SimpleSAML\XMLSchema\Type\StringValue $content
3334
* @param \SimpleSAML\XML\Attribute[] $namespacedAttributes
3435
*/
3536
final public function __construct(StringValue $content, array $namespacedAttributes = [])

src/XML/fed/AbstractAttributeExtensibleURI.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66

77
use DOMElement;
88
use SimpleSAML\WSSecurity\Assert\Assert;
9-
use SimpleSAML\XML\Exception\InvalidDOMElementException;
109
use SimpleSAML\XML\ExtendableAttributesTrait;
11-
use SimpleSAML\XML\Type\AnyURIValue;
1210
use SimpleSAML\XML\TypedTextContentTrait;
13-
use SimpleSAML\XML\XsNamespace as NS;
11+
use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException;
12+
use SimpleSAML\XMLSchema\Type\AnyURIValue;
13+
use SimpleSAML\XMLSchema\XML\Constants\NS;
1414

1515
/**
1616
* An AbstractAttributeExtensibleURI element
@@ -30,7 +30,7 @@ abstract class AbstractAttributeExtensibleURI extends AbstractFedElement
3030

3131

3232
/**
33-
* @param \SimpleSAML\XML\Type\AnyURIValue $content
33+
* @param \SimpleSAML\XMLSchema\Type\AnyURIValue $content
3434
* @param \SimpleSAML\XML\Attribute[] $namespacedAttributes
3535
*/
3636
final public function __construct(AnyURIValue $content, array $namespacedAttributes = [])

src/XML/fed/AbstractAttributeServiceType.php

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,19 @@
55
namespace SimpleSAML\WSSecurity\XML\fed;
66

77
use DOMElement;
8-
use SimpleSAML\SAML\Type\{SAMLAnyURIValue, SAMLDateTimeValue, SAMLStringValue};
9-
use SimpleSAML\SAML2\XML\md\{Extensions, Organization};
8+
use SimpleSAML\SAML2\Type\SAMLAnyURIValue;
9+
use SimpleSAML\SAML2\Type\SAMLAnyURIListValue;
10+
use SimpleSAML\SAML2\Type\SAMLDateTimeValue;
11+
use SimpleSAML\SAML2\Type\SAMLStringValue;
12+
use SimpleSAML\SAML2\XML\md\Extensions;
13+
use SimpleSAML\SAML2\XML\md\Organization;
1014
use SimpleSAML\WSSecurity\Assert\Assert;
1115
use SimpleSAML\WSSecurity\Constants as C;
12-
use SimpleSAML\XML\Exception\{MissingElementException, SchemaViolationException};
13-
use SimpleSAML\XML\Type\{DurationValue, IDValue};
16+
use SimpleSAML\XMLSchema\Exception\MissingElementException;
17+
use SimpleSAML\XMLSchema\Exception\SchemaViolationException;
18+
use SimpleSAML\XMLSchema\Type\DurationValue;
19+
use SimpleSAML\XMLSchema\Type\IDValue;
20+
use SimpleSAML\XMLSchema\Type\QNameValue;
1421

1522
/**
1623
* A AttributeServiceType
@@ -32,10 +39,11 @@ abstract class AbstractAttributeServiceType extends AbstractWebServiceDescriptor
3239
/**
3340
* AttributeServiceType constructor.
3441
*
35-
* @param string[] $protocolSupportEnumeration A set of URI specifying the protocols supported.
36-
* @param \SimpleSAML\XML\Type\IDValue|null $ID The ID for this document. Defaults to null.
42+
* @param \SimpleSAML\XMLSchema\Type\QNameValue $type The xsi-type of the element
43+
* @param \SimpleSAML\SAML2\Type\SAMLAnyURIListValue $protocolSupportEnumeration A set of URI specifying the protocols supported.
44+
* @param \SimpleSAML\XMLSchema\Type\IDValue|null $ID The ID for this document. Defaults to null.
3745
* @param \SimpleSAML\SAML2\Type\SAMLDateTimeValue|null $validUntil Unix time of validity for this document. Defaults to null.
38-
* @param \SimpleSAML\XML\Type\DurationValue|null $cacheDuration Maximum time this document can be cached. Defaults to null.
46+
* @param \SimpleSAML\XMLSchema\Type\DurationValue|null $cacheDuration Maximum time this document can be cached. Defaults to null.
3947
* @param \SimpleSAML\SAML2\XML\md\Extensions|null $extensions An array of extensions. Defaults to an empty array.
4048
* @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null $errorURL An URI where to redirect users for support. Defaults to null.
4149
* @param \SimpleSAML\SAML2\XML\md\KeyDescriptor[] $keyDescriptor An array of KeyDescriptor elements.
@@ -58,7 +66,8 @@ abstract class AbstractAttributeServiceType extends AbstractWebServiceDescriptor
5866
* @param \SimpleSAML\WSSecurity\XML\fed\SingleSignOutNotificationEndpoint[] $singleSignOutNotificationEndpoint
5967
*/
6068
final public function __construct(
61-
array $protocolSupportEnumeration,
69+
QNameValue $type,
70+
SAMLAnyURIListValue $protocolSupportEnumeration,
6271
?IDValue $ID = null,
6372
?SAMLDateTimeValue $validUntil = null,
6473
?DurationValue $cacheDuration = null,
@@ -93,7 +102,7 @@ final public function __construct(
93102
);
94103

95104
parent::__construct(
96-
static::XSI_TYPE_PREFIX . ':' . static::XSI_TYPE_NAME,
105+
$type,
97106
$protocolSupportEnumeration,
98107
$ID,
99108
$validUntil,

src/XML/fed/AbstractClaimDialectType.php

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,12 @@
66

77
use DOMElement;
88
use SimpleSAML\WSSecurity\Assert\Assert;
9-
use SimpleSAML\XML\Exception\{InvalidDOMElementException, SchemaViolationException};
10-
use SimpleSAML\XML\{ExtendableAttributesTrait, ExtendableElementTrait};
11-
use SimpleSAML\XML\Type\AnyURIValue;
12-
use SimpleSAML\XML\XsNamespace as NS;
9+
use SimpleSAML\XML\ExtendableAttributesTrait;
10+
use SimpleSAML\XML\ExtendableElementTrait;
11+
use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException;
12+
use SimpleSAML\XMLSchema\Exception\SchemaViolationException;
13+
use SimpleSAML\XMLSchema\Type\AnyURIValue;
14+
use SimpleSAML\XMLSchema\XML\Constants\NS;
1315

1416
/**
1517
* Class defining the ClaimDialectType element
@@ -31,7 +33,7 @@ abstract class AbstractClaimDialectType extends AbstractFedElement
3133
/**
3234
* AbstractClaimDialectType constructor
3335
*
34-
* @param \SimpleSAML\XML\Type\AnyURIValue|null $Uri
36+
* @param \SimpleSAML\XMLSchema\Type\AnyURIValue|null $Uri
3537
* @param array<\SimpleSAML\XML\SerializableElementInterface> $children
3638
* @param array<\SimpleSAML\XML\Attribute> $namespacedAttributes
3739
*/
@@ -49,7 +51,7 @@ final public function __construct(
4951

5052

5153
/**
52-
* @return \SimpleSAML\XML\Type\AnyURIValue|null
54+
* @return \SimpleSAML\XMLSchema\Type\AnyURIValue|null
5355
*/
5456
public function getUri(): ?AnyURIValue
5557
{
@@ -63,7 +65,7 @@ public function getUri(): ?AnyURIValue
6365
* @param \DOMElement $xml
6466
* @return static
6567
*
66-
* @throws \SimpleSAML\XML\Exception\InvalidDOMElementException
68+
* @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException
6769
* if the qualified name of the supplied element is wrong
6870
*/
6971
public static function fromXML(DOMElement $xml): static

src/XML/fed/AbstractClaimDialectsOfferedType.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@
77
use DOMElement;
88
use SimpleSAML\WSSecurity\Assert\Assert;
99
use SimpleSAML\WSSecurity\XML\fed\ClaimDialect;
10-
use SimpleSAML\XML\Exception\{InvalidDOMElementException, MissingElementException, SchemaViolationException};
1110
use SimpleSAML\XML\ExtendableAttributesTrait;
12-
use SimpleSAML\XML\XsNamespace as NS;
11+
use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException;
12+
use SimpleSAML\XMLSchema\Exception\MissingElementException;
13+
use SimpleSAML\XMLSchema\Exception\SchemaViolationException;
14+
use SimpleSAML\XMLSchema\XML\Constants\NS;
1315

1416
/**
1517
* Class defining the ClaimDialectsOfferedType element
@@ -56,7 +58,7 @@ public function getClaimDialect(): array
5658
* @param \DOMElement $xml
5759
* @return static
5860
*
59-
* @throws \SimpleSAML\XML\Exception\InvalidDOMElementException
61+
* @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException
6062
* if the qualified name of the supplied element is wrong
6163
*/
6264
public static function fromXML(DOMElement $xml): static

src/XML/fed/AbstractClaimTypesOfferedType.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@
77
use DOMElement;
88
use SimpleSAML\WSSecurity\Assert\Assert;
99
use SimpleSAML\WSSecurity\XML\auth\ClaimType;
10-
use SimpleSAML\XML\Exception\{InvalidDOMElementException, MissingElementException, SchemaViolationException};
1110
use SimpleSAML\XML\ExtendableAttributesTrait;
12-
use SimpleSAML\XML\XsNamespace as NS;
11+
use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException;
12+
use SimpleSAML\XMLSchema\Exception\MissingElementException;
13+
use SimpleSAML\XMLSchema\Exception\SchemaViolationException;
14+
use SimpleSAML\XMLSchema\XML\Constants\NS;
1315

1416
/**
1517
* Class defining the ClaimTypesOfferedType element
@@ -56,7 +58,7 @@ public function getClaimType(): array
5658
* @param \DOMElement $xml
5759
* @return static
5860
*
59-
* @throws \SimpleSAML\XML\Exception\InvalidDOMElementException
61+
* @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException
6062
* if the qualified name of the supplied element is wrong
6163
*/
6264
public static function fromXML(DOMElement $xml): static

src/XML/fed/AbstractClaimTypesRequestedType.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@
77
use DOMElement;
88
use SimpleSAML\WSSecurity\Assert\Assert;
99
use SimpleSAML\WSSecurity\XML\auth\ClaimType;
10-
use SimpleSAML\XML\Exception\{InvalidDOMElementException, MissingElementException, SchemaViolationException};
1110
use SimpleSAML\XML\ExtendableAttributesTrait;
12-
use SimpleSAML\XML\XsNamespace as NS;
11+
use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException;
12+
use SimpleSAML\XMLSchema\Exception\MissingElementException;
13+
use SimpleSAML\XMLSchema\Exception\SchemaViolationException;
14+
use SimpleSAML\XMLSchema\XML\Constants\NS;
1315

1416
/**
1517
* Class defining the ClaimTypesRequestedType element
@@ -56,7 +58,7 @@ public function getClaimType(): array
5658
* @param \DOMElement $xml
5759
* @return static
5860
*
59-
* @throws \SimpleSAML\XML\Exception\InvalidDOMElementException
61+
* @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException
6062
* if the qualified name of the supplied element is wrong
6163
*/
6264
public static function fromXML(DOMElement $xml): static

src/XML/fed/AbstractClientPseudonymType.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@
66

77
use DOMElement;
88
use SimpleSAML\WSSecurity\Assert\Assert;
9-
use SimpleSAML\XML\Exception\{InvalidDOMElementException, SchemaViolationException};
10-
use SimpleSAML\XML\{ExtendableAttributesTrait, ExtendableElementTrait};
11-
use SimpleSAML\XML\XsNamespace as NS;
9+
use SimpleSAML\XML\ExtendableAttributesTrait;
10+
use SimpleSAML\XML\ExtendableElementTrait;
11+
use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException;
12+
use SimpleSAML\XMLSchema\Exception\SchemaViolationException;
13+
use SimpleSAML\XMLSchema\XML\Constants\NS;
1214

1315
use function array_pop;
1416

@@ -98,7 +100,7 @@ public function isEmptyElement(): bool
98100
* @param \DOMElement $xml
99101
* @return static
100102
*
101-
* @throws \SimpleSAML\XML\Exception\InvalidDOMElementException
103+
* @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException
102104
* if the qualified name of the supplied element is wrong
103105
*/
104106
public static function fromXML(DOMElement $xml): static

0 commit comments

Comments
 (0)