-
Notifications
You must be signed in to change notification settings - Fork 50
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
Properly support union types #30
Conversation
This is the cleaner alternative to PR php#25, which supports nested `<type>` elements, and renders them as union types in PHP 8 syntax.
Thanks for pursuing this @cmb69.
It would be good to see a given type rendered the same regardless of whether it is a standalone type or part of a union type in the prototype. At least for the short term, make sure to pass the type through I don't think I'd object if that method was phased out (and so all types became links), but that's probably a task best left for a later date (or at least a separate PR).
I've patched our old DocBook DTD with a quick change to support union types (not intersection) in php/doc-base@82d74e6 so the above |
I agree that this should kept separate. It might be useful to do that in advance, though, since it would simplify this PR; currently, the link to built-in types are only suppressed in methodsynopses, but not elsewhere. Anyhow, checking php/doc-en#151 shows that there's more work to be done (at least union return types are not properly rendered yet). |
We also do that for the PDF package, although we haven't touched that code otherwise. That might need to be done, despite the PDF rendering being broken anyway.
As suggested by Nikita.
This is all done in `format_type_methodsynopsis_text()` and `format_methodsynopsis()` already.
Applied as 4d91cb2. |
This is the cleaner alternative to PR #25, which supports nested
<type>
elements, and renders them as union types in PHP 8 syntax.This is just a quick and dirty POC for now, in the hope to get that going. Assuming our docbook would support nested types, the following patch to doc-en
would be rendered like
Note that the predefined types are now rendered as links, which might not be the worst idea generally.