Skip to content

Commit 7794992

Browse files
committed
Upgrade to veewee/xml v4 with PHP 8.4+ Dom\ namespace
- Bump minimum PHP to 8.4 - Upgrade veewee/xml from ^3.6 to ^4.10 - Bump php-soap/engine to ^2.20, php-soap/wsdl to ^1.19, php-soap/xml to ^1.10 - Replace monorepo PSL with standalone packages (^6.1) - Migrate all DOM types: DOMElement -> Dom\Element, DOMNameSpaceNode -> Dom\NamespaceInfo - Switch locate_by_tag_name to locate_by_namespaced_tag_name (getElementsByTagName now matches qualified names in spec-compliant DOM) - Handle getAttribute() returning null instead of '' for missing attributes - Use toUnsafeLegacyDocument() in SchemaParser for goetas-webservices/xsd-reader compatibility (still uses DOMElement) - Add DOM stubs and phpVersion to psalm.xml - Remove PHP 8.3 from CI matrices
1 parent dcda227 commit 7794992

23 files changed

Lines changed: 159 additions & 113 deletions

.github/workflows/analyzers.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
strategy:
88
matrix:
99
operating-system: [ubuntu-latest]
10-
php-versions: [ '8.3', '8.4', '8.5' ]
10+
php-versions: [ '8.4', '8.5' ]
1111
composer-options: [ '--ignore-platform-req=php+' ]
1212
fail-fast: false
1313
name: PHP ${{ matrix.php-versions }} @ ${{ matrix.operating-system }}

.github/workflows/code-style.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
strategy:
88
matrix:
99
operating-system: [ubuntu-latest]
10-
php-versions: [ '8.3', '8.4', '8.5' ]
10+
php-versions: [ '8.4', '8.5' ]
1111
composer-options: [ '--ignore-platform-req=php+' ]
1212
fail-fast: false
1313
name: PHP ${{ matrix.php-versions }} @ ${{ matrix.operating-system }}

.github/workflows/tests.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
strategy:
88
matrix:
99
operating-system: [ubuntu-latest]
10-
php-versions: [ '8.3', '8.4', '8.5' ]
10+
php-versions: [ '8.4', '8.5' ]
1111
composer-options: [ '--ignore-platform-req=php+' ]
1212
dependency-preference: ['current', 'lowest', 'stable']
1313
fail-fast: false

composer.json

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,25 @@
1313
}
1414
},
1515
"require": {
16-
"php": "~8.3.0 || ~8.4.0 || ~8.5.0",
16+
"php": "~8.4.0 || ~8.5.0",
1717
"ext-dom": "*",
1818
"goetas-webservices/xsd-reader": "^0.4.11",
19-
"php-soap/engine": "^2.19",
20-
"php-soap/wsdl": "^1.18",
21-
"php-soap/xml": "^1.9.0",
22-
"veewee/xml": "^3.6",
23-
"php-standard-library/php-standard-library": "^3.0 || ^4.0 || ^5.0 || ^6.0",
19+
"php-soap/engine": "^2.20",
20+
"php-soap/wsdl": "^1.19",
21+
"php-soap/xml": "^1.10",
22+
"veewee/xml": "^4.10",
23+
"php-standard-library/dict": "^6.1",
24+
"php-standard-library/foundation": "^6.1",
25+
"php-standard-library/fun": "^6.1",
26+
"php-standard-library/iter": "^6.1",
27+
"php-standard-library/json": "^6.1",
28+
"php-standard-library/math": "^6.1",
29+
"php-standard-library/option": "^6.1",
30+
"php-standard-library/regex": "^6.1",
31+
"php-standard-library/result": "^6.1",
32+
"php-standard-library/str": "^6.1",
33+
"php-standard-library/type": "^6.1",
34+
"php-standard-library/vec": "^6.1",
2435
"symfony/console": "^5.4 || ^6.0 || ^7.0 || ^8.0",
2536
"webmozart/assert": "^1.11",
2637
"php-tui/php-tui": "^0.2.1"

psalm.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,14 @@
44
resolveFromConfigFile="true"
55
findUnusedCode="false"
66
ensureOverrideAttribute="false"
7+
phpVersion="8.4"
78
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
89
xmlns="https://getpsalm.org/schema/config"
910
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
1011
>
12+
<stubs>
13+
<file name="vendor/veewee/xml/stubs/DOM.phpstub" />
14+
</stubs>
1115
<projectFiles>
1216
<directory name="src"/>
1317
<ignoreFiles>

src/Parser/Definitions/AddressBindingTypeParser.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33

44
namespace Soap\WsdlReader\Parser\Definitions;
55

6-
use DOMElement;
6+
use Dom\Element;
77
use Soap\WsdlReader\Model\Definitions\AddressBindingType;
88
use VeeWee\Xml\Dom\Document;
99

1010
final class AddressBindingTypeParser
1111
{
12-
public function __invoke(Document $wsdl, DOMElement $namespacedElement): AddressBindingType
12+
public function __invoke(Document $wsdl, Element $namespacedElement): AddressBindingType
1313
{
1414
return AddressBindingType::from($namespacedElement->namespaceURI ?? '');
1515
}

src/Parser/Definitions/BindingOperationMessageParser.php

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

44
namespace Soap\WsdlReader\Parser\Definitions;
55

6-
use DOMElement;
6+
use Dom\Element;
77
use Psl\Type;
88
use Soap\WsdlReader\Model\Definitions\BindingOperationMessage;
99
use Soap\WsdlReader\Model\Definitions\BindingOperationMessages;
@@ -16,7 +16,7 @@
1616

1717
final class BindingOperationMessageParser
1818
{
19-
public function __invoke(Document $wsdl, DOMElement $message, StrategyInterface $strategy): BindingOperationMessage
19+
public function __invoke(Document $wsdl, Element $message, StrategyInterface $strategy): BindingOperationMessage
2020
{
2121
$xpath = $wsdl->xpath(new WsdlPreset($wsdl));
2222

@@ -28,29 +28,29 @@ public function __invoke(Document $wsdl, DOMElement $message, StrategyInterface
2828

2929
public static function tryParseFromOptionalSingleOperationMessage(
3030
Document $wsdl,
31-
DOMElement $operation,
31+
Element $operation,
3232
string $message,
3333
StrategyInterface $strategy
3434
): ?BindingOperationMessage {
3535
$xpath = $wsdl->xpath(new WsdlPreset($wsdl));
3636

3737
return wrap(
38-
static fn (): DOMElement => assert_element($xpath->querySingle('./wsdl:'.$message, $operation))
38+
static fn (): Element => assert_element($xpath->querySingle('./wsdl:'.$message, $operation))
3939
)->proceed(
40-
static fn (DOMElement $messageElement): BindingOperationMessage =>
40+
static fn (Element $messageElement): BindingOperationMessage =>
4141
(new self())($wsdl, $messageElement, $strategy),
4242
static fn () => null
4343
);
4444
}
4545

4646
/**
47-
* @param NodeList<DOMElement> $list
47+
* @param NodeList<Element> $list
4848
*/
4949
public static function tryParseList(Document $wsdl, NodeList $list, StrategyInterface $strategy): BindingOperationMessages
5050
{
5151
return new BindingOperationMessages(
5252
...$list->map(
53-
static fn (DOMElement $message): BindingOperationMessage => (new self)($wsdl, $message, $strategy)
53+
static fn (Element $message): BindingOperationMessage => (new self)($wsdl, $message, $strategy)
5454
)
5555
);
5656
}

src/Parser/Definitions/BindingOperationParser.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,28 @@
33

44
namespace Soap\WsdlReader\Parser\Definitions;
55

6-
use DOMElement;
6+
use Dom\Element;
77
use Soap\WsdlReader\Model\Definitions\BindingOperation;
88
use Soap\WsdlReader\Parser\Strategy\StrategyInterface;
99
use Soap\Xml\Xpath\WsdlPreset;
1010
use VeeWee\Xml\Dom\Document;
11-
use function VeeWee\Xml\Dom\Locator\Element\locate_by_tag_name;
11+
use function VeeWee\Xml\Dom\Locator\Element\locate_by_namespaced_tag_name;
1212

1313
final class BindingOperationParser
1414
{
15-
public function __invoke(Document $wsdl, DOMElement $operation, StrategyInterface $strategy): BindingOperation
15+
public function __invoke(Document $wsdl, Element $operation, StrategyInterface $strategy): BindingOperation
1616
{
1717
$xpath = $wsdl->xpath(new WsdlPreset($wsdl));
18-
$soapOperation = locate_by_tag_name($operation, 'operation')->expectFirst('Unable to locate the operation implementation in a WSDL operation element!');
18+
$soapOperation = locate_by_namespaced_tag_name($operation, '*', 'operation')->expectFirst('Unable to locate the operation implementation in a WSDL operation element!');
1919

2020
return new BindingOperation(
21-
name: $operation->getAttribute('name'),
21+
name: $operation->getAttribute('name') ?? '',
2222
implementation: $strategy->parseOperationImplementation($wsdl, $soapOperation),
2323
input: BindingOperationMessageParser::tryParseFromOptionalSingleOperationMessage($wsdl, $operation, 'input', $strategy),
2424
output: BindingOperationMessageParser::tryParseFromOptionalSingleOperationMessage($wsdl, $operation, 'output', $strategy),
2525
fault: BindingOperationMessageParser::tryParseList(
2626
$wsdl,
27-
$xpath->query('./wsdl:fault', $operation)->expectAllOfType(DOMElement::class),
27+
$xpath->query('./wsdl:fault', $operation)->expectAllOfType(Element::class),
2828
$strategy
2929
),
3030
);

src/Parser/Definitions/BindingParser.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,36 +3,36 @@
33

44
namespace Soap\WsdlReader\Parser\Definitions;
55

6-
use DOMElement;
6+
use Dom\Element;
77
use Soap\WsdlReader\Model\Definitions\Binding;
88
use Soap\WsdlReader\Model\Definitions\BindingOperations;
99
use Soap\WsdlReader\Model\Definitions\Bindings;
1010
use Soap\WsdlReader\Model\Definitions\QNamed;
1111
use Soap\WsdlReader\Parser\Strategy\StrategySelector;
1212
use Soap\Xml\Xpath\WsdlPreset;
1313
use VeeWee\Xml\Dom\Document;
14-
use function VeeWee\Xml\Dom\Locator\Element\locate_by_tag_name;
14+
use function VeeWee\Xml\Dom\Locator\Element\locate_by_namespaced_tag_name;
1515

1616
final class BindingParser
1717
{
18-
public function __invoke(Document $wsdl, DOMElement $binding): Binding
18+
public function __invoke(Document $wsdl, Element $binding): Binding
1919
{
2020
$xpath = $wsdl->xpath(new WsdlPreset($wsdl));
2121

22-
$soapBinding = locate_by_tag_name($binding, 'binding')->expectFirst('Unable to locate the SOAP binding in a WSDL binding element!');
22+
$soapBinding = locate_by_namespaced_tag_name($binding, '*', 'binding')->expectFirst('Unable to locate the SOAP binding in a WSDL binding element!');
2323
$addressBindingType = (new AddressBindingTypeParser())($wsdl, $soapBinding);
2424
$strategy = (new StrategySelector())($addressBindingType);
2525

2626
return new Binding(
27-
name: $binding->getAttribute('name'),
28-
type: QNamed::parse($binding->getAttribute('type')),
27+
name: $binding->getAttribute('name') ?? '',
28+
type: QNamed::parse($binding->getAttribute('type') ?? ''),
2929
addressBindingType: $addressBindingType,
3030
implementation: $strategy->parseBindingImplementation($wsdl, $soapBinding),
3131
operations: new BindingOperations(
3232
...$xpath->query('./wsdl:operation', $binding)
33-
->expectAllOfType(DOMElement::class)
33+
->expectAllOfType(Element::class)
3434
->map(
35-
static fn (DOMElement $operation) => (new BindingOperationParser())($wsdl, $operation, $strategy)
35+
static fn (Element $operation) => (new BindingOperationParser())($wsdl, $operation, $strategy)
3636
)
3737
),
3838
);
@@ -45,9 +45,9 @@ public static function tryParse(Document $wsdl): Bindings
4545

4646
return new Bindings(
4747
...$xpath->query('/wsdl:definitions/wsdl:binding')
48-
->expectAllOfType(DOMElement::class)
48+
->expectAllOfType(Element::class)
4949
->map(
50-
static fn (DOMElement $binding): Binding => $parse($wsdl, $binding)
50+
static fn (Element $binding): Binding => $parse($wsdl, $binding)
5151
)
5252
);
5353
}

src/Parser/Definitions/MessageParser.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
namespace Soap\WsdlReader\Parser\Definitions;
55

6-
use DOMElement;
6+
use Dom\Element;
77
use Soap\WsdlReader\Model\Definitions\Message;
88
use Soap\WsdlReader\Model\Definitions\Messages;
99
use Soap\WsdlReader\Model\Definitions\Part;
@@ -14,25 +14,25 @@
1414

1515
final class MessageParser
1616
{
17-
public function __invoke(Document $wsdl, DOMElement $message): Message
17+
public function __invoke(Document $wsdl, Element $message): Message
1818
{
1919
$xpath = $wsdl->xpath(new WsdlPreset($wsdl));
2020

2121
return new Message(
22-
name: $message->getAttribute('name'),
22+
name: $message->getAttribute('name') ?? '',
2323
parts: new Parts(
2424
...$xpath->query('./wsdl:part', $message)
25-
->expectAllOfType(DOMElement::class)
25+
->expectAllOfType(Element::class)
2626
->map(
27-
static function (DOMElement $part) {
27+
static function (Element $part) {
2828
$element = match (true) {
29-
$part->hasAttribute('element') => QNamed::parse($part->getAttribute('element')),
30-
$part->hasAttribute('type') => QNamed::parse($part->getAttribute('type')),
29+
$part->hasAttribute('element') => QNamed::parse($part->getAttribute('element') ?? ''),
30+
$part->hasAttribute('type') => QNamed::parse($part->getAttribute('type') ?? ''),
3131
default => null
3232
};
3333

3434
return new Part(
35-
name: $part->getAttribute('name'),
35+
name: $part->getAttribute('name') ?? '',
3636
element: $element,
3737
);
3838
}
@@ -48,9 +48,9 @@ public static function tryParse(Document $wsdl): Messages
4848

4949
return new Messages(
5050
...$xpath->query('/wsdl:definitions/wsdl:message')
51-
->expectAllOfType(DOMElement::class)
51+
->expectAllOfType(Element::class)
5252
->map(
53-
static fn (DOMElement $message) => $parse($wsdl, $message)
53+
static fn (Element $message) => $parse($wsdl, $message)
5454
)
5555
);
5656
}

0 commit comments

Comments
 (0)