Closed lstrojny closed 7 months ago
Hello,
Thanks for reporting the issue. That seems like a proper fix to me:
Before:
> http://test-uri/:a {
+ ?boolean $flag
+ $
}
After:
> http://test-uri/:a {
?boolean $flag
?string $mandatory
?boolean $optional
}
If created a PR with your suggestion. Can you check it to make sure this is what you had in mind out and see if it works for you? https://github.com/php-soap/wsdl-reader/pull/24
Thanks! Fix looks good and works fine
Just to make sure it's a broad enough fix: checking for ElementContainer would be too broad?
Not sure ATM:
As far as I understand that interface, it is implemented by Group
, Sequence
and Choice
(and references to them) which we cover.
However I can also see ComplexType and I'm not sure how that will behave. Maybe we can find an example for that specific case and see how it goes?
If I change the if statement to
if ($element instanceof ElementContainer) {
return $this->__invoke($element, $context);
}
All tests seem to pass:
................................................................. 65 / 95 ( 68%)
.............................. 95 / 95 (100%)
Time: 00:11.202, Memory: 8.00 MB
OK (95 tests, 95 assertions)
However, I'dd like to be sure and test it out on having an anonymous complex type in there. Will try to find an example when I find more time. Feel free to play around yourself as well :)
I've tried some versions with complexTypes and it seems to compile those. I'm gonna just merge it as-is and see if someone comes up with a failing scenario for nested anonymous complex types. Currently this has been reported a second time, so a fix is more urgent.
Bug Report
Summary
Current behaviour
Given this type:
Code generation will fail with non-empty-string assertion:
Fix
Not 100% certain, but it looks like the culprit is in
\Soap\WsdlReader\Metadata\Converter\Types\Visitor\ElementContainerVisitor::parseElementItem
. It handles choice and group but not sequence. Adding an instanceof check for sequence here, fixes the issue.