Skip to content

Commit f0cd4b6

Browse files
authored
Merge pull request #42 from veewee/skip-xsi-type-for-anonymous-complex-types
Skip xsi:type generation for anonymous complex types.
2 parents f90af5f + 176548d commit f0cd4b6

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"php-soap/engine": "^2.16",
2828
"php-soap/wsdl": "^1.14",
2929
"php-soap/xml": "^1.9",
30-
"php-soap/wsdl-reader": "^0.27"
30+
"php-soap/wsdl-reader": "^0.29"
3131
},
3232
"require-dev": {
3333
"vimeo/psalm": "~6.13",

src/Xml/Writer/XsiAttributeBuilder.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,12 @@ public static function forEncodedValue(
3939
return children([]);
4040
}
4141

42+
// Skip xsi:type declaration for anonymous complexTypes : they don't have an accessible name.
43+
$meta = $context->type->getMeta();
44+
if ($meta->isLocal()->unwrapOr(false)) {
45+
return children([]);
46+
}
47+
4248
[$xsiType, $includeXsiTargetNamespace] = match(true) {
4349
$encoder instanceof Feature\XsiTypeCalculator => [
4450
$encoder->resolveXsiTypeForValue($context, $value),

tests/PhpCompatibility/Schema036Test.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ protected function expectXml(): string
4949
<tns:test>
5050
<testParam xsi:type="tns:testType">
5151
<int xsi:type="xsd:int">123</int>
52-
<testType2 xsi:type="tns:testType2">
52+
<testType2>
5353
<int xsi:type="xsd:int">123</int>
5454
</testType2>
5555
</testParam>

0 commit comments

Comments
 (0)