-
Notifications
You must be signed in to change notification settings - Fork 73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generated classes/files enhancements #233
Comments
In the generated |
WSDL:
This leads to broken code:
Not sure if this only happens in the new version or also in the old one. |
Constructors of child classes miss parent constructor calls. Given the following hierarchy:
The generated constructor of Not sure if this only happens in the new version or also in the old one. |
Currently, service classes return either a type or a Sorry for just posting this here, but I am currently unsure if these issues belong to the old or the new or both versions and I do not know how you would like to structure your work. Tell me if I should better create new issues :) |
No worries, this issue is perfectly suited to gather future enhancements, wether they are old issues or not. |
It has to be fixed within #234. If I understand well, this is the case when the Soap operation does not require any parameter, isn't? |
This is the default behaviour. In my point of view, adding the inherited constructor arguments to the child classes constructor is not necessarily useful because:
Most of the time, arguments are optional, so I usually use the fluent way: $struct = (new Struct())
->setValue($value)
->setAny($any)
; Or even the $struct = Struct::__set_state([
'value' => $value,
'any' => $any,
]); Nevertheless, calling the parent constructor without any argument could be added in order to handle removable properties. This is feasible only if there is no required arguments unless they are also added to the child constructor arguments at first position with its own required arguments. Let me know your thoughts about this. |
To be tested as there is a time |
Thanks @mikaelcom!
Most probably yes :)
If most of the properties are optional, I agree. However, in my case, nearly all are required. And if this is the case, it is easy to miss required parameters if the child constructor does not also include the parent properties. However, this of course depends on the use case and is completely opinionated, so feel free to ignore that suggestion :)
Sounds strange. I can only imagine this happened in really old PHP versions. However, since we now target PHP >= 7.4, I do not think that this leads to issues. |
Tasks:
use
statements on top of the class for every used class not in the same namespaceuse InvalidArgumentException
statement only if it's usedext-dom:*
to composer.json only ifxml
validation rule is used or if theDOMDocument
class is used within the generated classgetResult
andsetResult
usages withinServiceType
classses by returning null instead of bool in order to type-hint method and throw an exception if necessaryUnionRule
in order to match StyleCI (see WsdlToPhp/PackageEws365@f7cb291 and WsdlToPhp/PackageEws365@49631e9#diff-302f453a999740b20b4456f8a14ee56d561ae75ea578a341e5bb5b73fabb65ebR195-R197)The text was updated successfully, but these errors were encountered: