Skip to content

Commit 8fa96bf

Browse files
committed
Merge branch 'release-3.x'
2 parents e715ce3 + 4db7dfe commit 8fa96bf

71 files changed

Lines changed: 459 additions & 289 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/workflows/php.yml‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ jobs:
1919
strategy:
2020
fail-fast: false
2121
matrix:
22-
php-version: ['8.3', '8.4', '8.5']
22+
php-version: ['8.5', '8.6']
2323

24-
uses: simplesamlphp/simplesamlphp-test-framework/.github/workflows/reusable_phplinter.yml@v1
24+
uses: simplesamlphp/simplesamlphp-test-framework/.github/workflows/reusable_phplinter.yml@release-2.x
2525
secrets: inherit
2626
with:
2727
php-version: ${{ matrix.php-version }}
@@ -31,7 +31,7 @@ jobs:
3131
strategy:
3232
fail-fast: false
3333

34-
uses: simplesamlphp/simplesamlphp-test-framework/.github/workflows/reusable_linter.yml@v1
34+
uses: simplesamlphp/simplesamlphp-test-framework/.github/workflows/reusable_linter.yml@release-2.x
3535
secrets: inherit
3636
with:
3737
enable_eslinter: false
@@ -47,7 +47,7 @@ jobs:
4747
fail-fast: false
4848
matrix:
4949
operating-system: [ubuntu-latest]
50-
php-versions: ['8.3', '8.4', '8.5']
50+
php-versions: ['8.5', '8.6']
5151

5252
steps:
5353
- name: Setup PHP, with composer and extensions
@@ -57,7 +57,7 @@ jobs:
5757
php-version: ${{ matrix.php-versions }}
5858
extensions: ctype, date, dom, filter, intl, pcre, soap, sodium, spl, xml
5959
tools: composer
60-
ini-values: error_reporting=E_ALL
60+
ini-values: error_reporting=E_ALL, display_errors=on
6161
coverage: pcov
6262

6363
- name: Setup problem matchers for PHP
@@ -109,7 +109,7 @@ jobs:
109109
fail-fast: true
110110
matrix:
111111
operating-system: [windows-latest]
112-
php-versions: ['8.3', '8.4', '8.5']
112+
php-versions: ['8.5', '8.6']
113113

114114
steps:
115115
- name: Setup PHP, with composer and extensions
@@ -119,7 +119,7 @@ jobs:
119119
php-version: ${{ matrix.php-versions }}
120120
extensions: ctype, date, dom, filter, intl, pcre, soap, sodium, spl, xml, zip
121121
tools: composer
122-
ini-values: error_reporting=E_ALL
122+
ini-values: error_reporting=E_ALL, display_errors=on
123123
coverage: none
124124

125125
- name: Setup problem matchers for PHP
@@ -217,7 +217,7 @@ jobs:
217217
uses: shivammathur/setup-php@v2
218218
with:
219219
# Should be the lowest supported version
220-
php-version: '8.3'
220+
php-version: '8.5'
221221
extensions: ctype, date, dom, filter, pcre, soap, spl, xml
222222
tools: composer
223223
coverage: none

‎composer.json‎

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@
99
}
1010
],
1111
"require": {
12-
"php": "^8.3",
12+
"php": "^8.5",
1313
"ext-dom": "*",
1414
"ext-spl": "*",
1515

16-
"simplesamlphp/assert": "~2.0",
17-
"simplesamlphp/xml-common": "~2.8"
16+
"simplesamlphp/assert": "~3.0",
17+
"simplesamlphp/xml-common": "~3.0"
1818
},
1919
"require-dev": {
20-
"simplesamlphp/simplesamlphp-test-framework": "~1.11"
20+
"simplesamlphp/simplesamlphp-test-framework": "~2.0"
2121
},
2222
"autoload": {
2323
"psr-4": {
@@ -31,7 +31,7 @@
3131
},
3232
"extra": {
3333
"branch-alias": {
34-
"dev-master": "v2.0.x-dev"
34+
"dev-master": "v3.0.x-dev"
3535
}
3636
},
3737
"config": {
@@ -42,5 +42,19 @@
4242
"simplesamlphp/composer-xmlprovider-installer": true,
4343
"simplesamlphp/composer-module-installer": true
4444
}
45+
},
46+
"scripts": {
47+
"pre-commit": [
48+
"vendor/bin/phpcs -p",
49+
"vendor/bin/phpstan analyze -c phpstan.neon",
50+
"vendor/bin/phpstan analyze -c phpstan-dev.neon",
51+
"vendor/bin/phpunit --no-coverage --testdox"
52+
],
53+
"tests": [
54+
"vendor/bin/phpunit --no-coverage"
55+
],
56+
"propose-fix": [
57+
"vendor/bin/phpcs --report=diff"
58+
]
4559
}
4660
}

‎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\WSDL\Utils;
66

7-
use DOMNode;
8-
use DOMXPath;
7+
use Dom;
98
use SimpleSAML\WSDL\Constants as C;
109
use SimpleSAML\XPath\XPath as XPathUtils;
1110

@@ -17,15 +16,15 @@
1716
class XPath extends XPathUtils
1817
{
1918
/**
20-
* Get a DOMXPath object that can be used to search for XMLDSIG elements.
19+
* Get a Dom\XPath object that can be used to search for XMLDSIG elements.
2120
*
22-
* @param \DOMNode $node The document to associate to the DOMXPath object.
21+
* @param \Dom\Node $node The document to associate to the Dom\XPath object.
2322
* @param bool $autoregister Whether to auto-register all namespaces used in the document
2423
*
25-
* @return \DOMXPath A DOMXPath object ready to use in the given document, with the XMLDSIG namespace already
24+
* @return \Dom\XPath A Dom\XPath object ready to use in the given document, with the XMLDSIG namespace already
2625
* registered.
2726
*/
28-
public static function getXPath(DOMNode $node, bool $autoregister = false): DOMXPath
27+
public static function getXPath(Dom\Node $node, bool $autoregister = false): Dom\XPath
2928
{
3029
$xp = parent::getXPath($node, $autoregister);
3130

‎src/XML/soap12/AbstractAddress.php‎

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

55
namespace SimpleSAML\WSDL\XML\soap12;
66

7-
use DOMElement;
7+
use Dom;
88
use SimpleSAML\Assert\Assert;
99
use SimpleSAML\WSDL\Constants as C;
1010
use SimpleSAML\WSDL\Type\RequiredValue;
@@ -56,12 +56,12 @@ public function getLocation(): AnyURIValue
5656
/**
5757
* Initialize a Address element.
5858
*
59-
* @param \DOMElement $xml The XML element we should load.
59+
* @param \Dom\Element $xml The XML element we should load.
6060
*
6161
* @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException
6262
* if the qualified name of the supplied element is wrong
6363
*/
64-
public static function fromXML(DOMElement $xml): static
64+
public static function fromXML(Dom\Element $xml): static
6565
{
6666
Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class);
6767
Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class);
@@ -81,10 +81,10 @@ public static function fromXML(DOMElement $xml): static
8181
/**
8282
* Convert this tBinding to XML.
8383
*
84-
* @param \DOMElement|null $parent The element we are converting to XML.
85-
* @return \DOMElement The XML element after adding the data corresponding to this tBinding
84+
* @param \Dom\Element|null $parent The element we are converting to XML.
85+
* @return \Dom\Element The XML element after adding the data corresponding to this tBinding
8686
*/
87-
public function toXML(?DOMElement $parent = null): DOMElement
87+
public function toXML(?Dom\Element $parent = null): Dom\Element
8888
{
8989
$e = parent::toXML($parent);
9090
$e->setAttribute('location', $this->getLocation()->getValue());

‎src/XML/soap12/AbstractBinding.php‎

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

55
namespace SimpleSAML\WSDL\XML\soap12;
66

7-
use DOMElement;
7+
use Dom;
88
use SimpleSAML\Assert\Assert;
99
use SimpleSAML\WSDL\Constants as C;
1010
use SimpleSAML\WSDL\Type\RequiredValue;
@@ -81,12 +81,12 @@ public function isEmptyElement(): bool
8181
/**
8282
* Initialize a Binding element.
8383
*
84-
* @param \DOMElement $xml The XML element we should load.
84+
* @param \Dom\Element $xml The XML element we should load.
8585
*
8686
* @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException
8787
* if the qualified name of the supplied element is wrong
8888
*/
89-
public static function fromXML(DOMElement $xml): static
89+
public static function fromXML(Dom\Element $xml): static
9090
{
9191
Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class);
9292
Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class);
@@ -107,10 +107,10 @@ public static function fromXML(DOMElement $xml): static
107107
/**
108108
* Convert this tBinding to XML.
109109
*
110-
* @param \DOMElement|null $parent The element we are converting to XML.
111-
* @return \DOMElement The XML element after adding the data corresponding to this tBinding
110+
* @param \Dom\Element|null $parent The element we are converting to XML.
111+
* @return \Dom\Element The XML element after adding the data corresponding to this tBinding
112112
*/
113-
public function toXML(?DOMElement $parent = null): DOMElement
113+
public function toXML(?Dom\Element $parent = null): Dom\Element
114114
{
115115
$e = parent::toXML($parent);
116116

‎src/XML/soap12/AbstractBody.php‎

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

55
namespace SimpleSAML\WSDL\XML\soap12;
66

7-
use DOMElement;
7+
use Dom;
88
use SimpleSAML\WSDL\Constants as C;
99
use SimpleSAML\WSDL\Type\RequiredValue;
1010
use SimpleSAML\WSDL\Type\UseChoiceValue;
@@ -83,10 +83,10 @@ public function isEmptyElement(): bool
8383
/**
8484
* Convert this tBody to XML.
8585
*
86-
* @param \DOMElement|null $parent The element we are converting to XML.
87-
* @return \DOMElement The XML element after adding the data corresponding to this tBody
86+
* @param \Dom\Element|null $parent The element we are converting to XML.
87+
* @return \Dom\Element The XML element after adding the data corresponding to this tBody
8888
*/
89-
public function toXML(?DOMElement $parent = null): DOMElement
89+
public function toXML(?Dom\Element $parent = null): Dom\Element
9090
{
9191
$e = parent::toXML($parent);
9292

‎src/XML/soap12/AbstractFault.php‎

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

55
namespace SimpleSAML\WSDL\XML\soap12;
66

7-
use DOMElement;
7+
use Dom;
88
use SimpleSAML\Assert\Assert;
99
use SimpleSAML\WSDL\Constants as C;
1010
use SimpleSAML\WSDL\Type\RequiredValue;
@@ -49,12 +49,12 @@ final public function __construct(
4949
/**
5050
* Initialize a Body element.
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);
@@ -76,10 +76,10 @@ public static function fromXML(DOMElement $xml): static
7676
/**
7777
* Convert this tFault to XML.
7878
*
79-
* @param \DOMElement|null $parent The element we are converting to XML.
80-
* @return \DOMElement The XML element after adding the data corresponding to this tFault
79+
* @param \Dom\Element|null $parent The element we are converting to XML.
80+
* @return \Dom\Element The XML element after adding the data corresponding to this tFault
8181
*/
82-
public function toXML(?DOMElement $parent = null): DOMElement
82+
public function toXML(?Dom\Element $parent = null): Dom\Element
8383
{
8484
return parent::toXML($parent);
8585
}

‎src/XML/soap12/AbstractHeader.php‎

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@
44

55
namespace SimpleSAML\WSDL\XML\soap12;
66

7-
use DOMElement;
7+
use Dom;
88
use SimpleSAML\Assert\Assert;
9-
use SimpleSAML\WSDL\Constants as C;
9+
use SimpleSAML\WSDL\Constants as C_WSDL;
1010
use SimpleSAML\WSDL\Type\RequiredValue;
1111
use SimpleSAML\WSDL\Type\UseChoiceValue;
1212
use SimpleSAML\WSDL\XML\wsdl\AbstractExtensibilityElement;
13+
use SimpleSAML\XML\Attribute as XMLAttribute;
14+
use SimpleSAML\XML\Constants as C;
1315
use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException;
1416
use SimpleSAML\XMLSchema\Exception\SchemaViolationException;
1517
use SimpleSAML\XMLSchema\Type\AnyURIValue;
@@ -26,7 +28,7 @@ abstract class AbstractHeader extends AbstractExtensibilityElement
2628
use BodyAttributesTrait;
2729

2830

29-
public const string NS = C::NS_WSDL_SOAP_12;
31+
public const string NS = C_WSDL::NS_WSDL_SOAP_12;
3032

3133
public const string NS_PREFIX = 'soap12';
3234

@@ -102,19 +104,19 @@ public function getParts(): ?NMTokensValue
102104
/**
103105
* Initialize a Header element.
104106
*
105-
* @param \DOMElement $xml The XML element we should load.
107+
* @param \Dom\Element $xml The XML element we should load.
106108
*
107109
* @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException
108110
* if the qualified name of the supplied element is wrong
109111
*/
110-
public static function fromXML(DOMElement $xml): static
112+
public static function fromXML(Dom\Element $xml): static
111113
{
112114
Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class);
113115
Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class);
114116

115117
$required = null;
116-
if ($xml->hasAttributeNS(C::NS_WSDL, 'required')) {
117-
$required = RequiredValue::fromString($xml->getAttributeNS(C::NS_WSDL, 'required'));
118+
if ($xml->hasAttributeNS(C_WSDL::NS_WSDL, 'required')) {
119+
$required = RequiredValue::fromString($xml->getAttributeNS(C_WSDL::NS_WSDL, 'required'));
118120
}
119121

120122
return new static(
@@ -132,13 +134,23 @@ public static function fromXML(DOMElement $xml): static
132134
/**
133135
* Convert this tHeader to XML.
134136
*
135-
* @param \DOMElement|null $parent The element we are converting to XML.
136-
* @return \DOMElement The XML element after adding the data corresponding to this tHeader
137+
* @param \Dom\Element|null $parent The element we are converting to XML.
138+
* @return \Dom\Element The XML element after adding the data corresponding to this tHeader
137139
*/
138-
public function toXML(?DOMElement $parent = null): DOMElement
140+
public function toXML(?Dom\Element $parent = null): Dom\Element
139141
{
140142
$e = parent::toXML($parent);
141143

144+
if (!$e->lookupPrefix($this->getMessage()->getNamespacePrefix()->getValue())) {
145+
$namespace = new XMLAttribute(
146+
C::NS_XMLNS,
147+
'xmlns',
148+
$this->getMessage()->getNamespacePrefix()->getValue(),
149+
$this->getMessage()->getNamespaceURI(),
150+
);
151+
$namespace->toXML($e);
152+
}
153+
142154
$e->setAttribute('message', $this->getMessage()->getValue());
143155
$e->setAttribute('parts', $this->getParts()->getValue());
144156
$e->setAttribute('use', $this->getUse()->getValue());

0 commit comments

Comments
 (0)