The idea here is simple - a separate CommentASTNode 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.
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 thecomment
option in theWriter
, which controls how theType
should be formatted (which is relevant forarray
andmap
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 theASTNode
that is writing it.