Skip to content

Commit acaca46

Browse files
authored
Merge pull request #58 from veewee/feature/veewee-xml-v4-migration
Migrate to veewee/xml v4 and PHP 8.4+
2 parents 15d1860 + 3d30bd6 commit acaca46

File tree

21 files changed

+92
-131
lines changed

21 files changed

+92
-131
lines changed

.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: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,23 +21,34 @@
2121
}
2222
],
2323
"require": {
24-
"php": "~8.3.0 || ~8.4.0 || ~8.5.0",
25-
"php-standard-library/php-standard-library": "^3.0 || ^4.0 || ^5.0 || ^6.0",
24+
"php": "~8.4.0 || ~8.5.0",
25+
"php-standard-library/collection": "^6.1",
26+
"php-standard-library/dict": "^6.1",
27+
"php-standard-library/encoding": "^6.1",
28+
"php-standard-library/foundation": "^6.1",
29+
"php-standard-library/fun": "^6.1",
30+
"php-standard-library/iter": "^6.1",
31+
"php-standard-library/option": "^6.1",
32+
"php-standard-library/regex": "^6.1",
33+
"php-standard-library/result": "^6.1",
34+
"php-standard-library/str": "^6.1",
35+
"php-standard-library/type": "^6.1",
36+
"php-standard-library/vec": "^6.1",
2637
"veewee/reflecta": "~0.16",
27-
"veewee/xml": "^3.6",
28-
"php-soap/engine": "^2.19",
29-
"php-soap/wsdl": "^1.18",
30-
"php-soap/xml": "^1.9",
31-
"php-soap/wsdl-reader": "^0.31"
38+
"veewee/xml": "^4.10",
39+
"php-soap/engine": "^2.20",
40+
"php-soap/wsdl": "^1.19",
41+
"php-soap/xml": "^1.10",
42+
"php-soap/wsdl-reader": "^0.32"
3243
},
3344
"require-dev": {
3445
"vimeo/psalm": "~6.13",
3546
"phpunit/phpunit": "~12.4",
3647
"php-cs-fixer/shim": "~3.88",
3748
"symfony/var-dumper": "^7.0 || ^6.4",
3849
"php-standard-library/psalm-plugin": "^2.3",
39-
"php-soap/engine-integration-tests": "^1.10",
40-
"php-soap/psr18-transport": "^1.8",
50+
"php-soap/engine-integration-tests": "^1.12",
51+
"php-soap/psr18-transport": "^2.0",
4152
"guzzlehttp/guzzle": "^7.8",
4253
"phpbench/phpbench": "^1.6"
4354
},

examples/encoders/simpleType/anyXml.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function iso(Context $context): Iso
3636
$targetElementName = $context->type->getXmlTargetNodeName();
3737
return new Iso(
3838
to: static fn (array $data): string => document_encode([$targetElementName => $data])
39-
->manipulate(static fn (\DOMDocument $document) => $document->documentElement->setAttributeNS(
39+
->manipulate(static fn (\Dom\XMLDocument $document) => $document->documentElement->setAttributeNS(
4040
VeeWee\Xml\Xmlns\Xmlns::xsi()->value(),
4141
'xsi:type',
4242
'custom:type'

psalm.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,17 @@
88
findUnusedBaselineEntry="true"
99
findUnusedCode="false"
1010
ensureOverrideAttribute="false"
11+
phpVersion="8.4"
1112
>
1213
<projectFiles>
1314
<directory name="src"/>
1415
<ignoreFiles>
1516
<directory name="vendor"/>
1617
</ignoreFiles>
1718
</projectFiles>
19+
<stubs>
20+
<file name="vendor/veewee/xml/stubs/DOM.phpstub"/>
21+
</stubs>
1822
<plugins>
1923
<pluginClass class="Psl\Psalm\Plugin"/>
2024
<pluginClass class="VeeWee\Reflecta\Psalm\Plugin"/>

src/Encoder/SoapEnc/ApacheMapEncoder.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
namespace Soap\Encoding\Encoder\SoapEnc;
55

66
use Closure;
7-
use DOMElement;
7+
use Dom\Element as DomElement;
88
use Soap\Encoding\Encoder\Context;
99
use Soap\Encoding\Encoder\SimpleType\ScalarTypeEncoder;
1010
use Soap\Encoding\Encoder\XmlEncoder;
@@ -84,7 +84,7 @@ private function decodeArray(Context $context, Element $value): array
8484
$xpath = $value->document()->xpath();
8585

8686
return readChildren($element)->reduce(
87-
static function (array $map, DOMElement $item) use ($context, $xpath): array {
87+
static function (array $map, DomElement $item) use ($context, $xpath): array {
8888
$key = $xpath->evaluate('string(./key)', string(), $item);
8989
/** @psalm-var mixed $value */
9090
$value = ElementValueReader::forEncoder(

src/Encoder/SoapEnc/SoapArrayEncoder.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
namespace Soap\Encoding\Encoder\SoapEnc;
55

66
use Closure;
7-
use DOMElement;
7+
use Dom\Element as DomElement;
88
use Soap\Encoding\Encoder\Context;
99
use Soap\Encoding\Encoder\Feature\ListAware;
1010
use Soap\Encoding\Encoder\XmlEncoder;
@@ -100,7 +100,7 @@ private function decodeArray(Context $context, SoapArrayAccess $arrayAccess, Ele
100100
* @param list<mixed> $list
101101
* @return list<mixed>
102102
*/
103-
static function (array $list, DOMElement $item) use ($iso): array {
103+
static function (array $list, DomElement $item) use ($iso): array {
104104
/** @var mixed $value */
105105
$value = $iso->from(Element::fromDOMElement($item));
106106

src/Encoder/SoapEnc/SoapObjectEncoder.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
namespace Soap\Encoding\Encoder\SoapEnc;
55

66
use Closure;
7-
use DOMElement;
7+
use Dom\Element as DomElement;
88
use Soap\Encoding\Encoder\Context;
99
use Soap\Encoding\Encoder\SimpleType\ScalarTypeEncoder;
1010
use Soap\Encoding\Encoder\XmlEncoder;
@@ -75,8 +75,8 @@ private function decodeArray(Context $context, Element $value): object
7575
$element = $value->element();
7676

7777
return (object) readChildren($element)->reduce(
78-
static function (array $map, DOMElement $item) use ($context): array {
79-
$key = $item->localName ?? 'unkown';
78+
static function (array $map, DomElement $item) use ($context): array {
79+
$key = $item->localName;
8080
/** @psalm-var mixed $value */
8181
$value = ElementValueReader::forEncoder(
8282
$context->withType(XsdType::any()),

src/Fault/Encoder/Soap11FaultEncoder.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,9 @@ private function from(string $fault): Soap11Fault
9090
$detail = $xpath->query('./detail');
9191

9292
return new Soap11Fault(
93-
faultCode: WhitespaceRestriction::collapse($xpath->querySingle('./faultcode')->textContent),
94-
faultString: WhitespaceRestriction::collapse($xpath->querySingle('./faultstring')->textContent),
95-
faultActor: $actor->count() ? trim($actor->expectFirst()->textContent) : null,
93+
faultCode: WhitespaceRestriction::collapse($xpath->querySingle('./faultcode')->textContent ?? ''),
94+
faultString: WhitespaceRestriction::collapse($xpath->querySingle('./faultstring')->textContent ?? ''),
95+
faultActor: $actor->count() ? trim($actor->expectFirst()->textContent ?? '') : null,
9696
detail: $detail->count() ? Document::fromXmlNode($detail->expectFirst())->stringifyDocumentElement() : null,
9797
);
9898
}

0 commit comments

Comments
 (0)