fern-api / fern

Input OpenAPI. Output SDKs and Docs.
https://buildwithfern.com
Apache License 2.0
2.6k stars 139 forks source link

feat(php): Support writing comments (w/ type hints) #4635

Closed amckinney closed 2 weeks ago

amckinney commented 2 weeks ago

This builds upon the changes introduced in https://github.com/fern-api/fern/pull/4634 and adds support for writing comments on arbitrary ASTNodes.

The idea here is simple - a separate Comment ASTNode sets the comment option in the Writer, which controls how the Type should be formatted (which is relevant for array and map types).

In the generator implementation, we continue to use the same php.Type constructors and don't need to think about when to choose comment rendering or not - it's all handled within the ASTNode that is writing it.