Leading comments are treated as trailing comments to the previous function body
See original GitHub issueHello,
I’m trying to parse the following file:
<?php
/** function 1 summary
* @param Type $var Description
**/
function FunctionName1(Type $var = null)
{
}
/** function 2 summary
* @param Type $var Description
**/
function FunctionName2(Type $var = null)
{
}
The output of the library is as follows:
...
{
"kind": "function",
"leadingComments": [{"kind": "commentblock","value": "/** function 1 summary\r\n * @param Type $var Description\r\n **/"}],
"name": {
"kind": "identifier",
"name": "FunctionName1"
},
...
"body": {
"kind": "block",
"children": [],
"trailingComments": [{"kind": "commentblock","value": "/** function 2 summary\r\n * @param Type $var Description\r\n **/"}]
}
}
...
The problem is that the documentation of the FunctionName2 is treated as a trailing comment on the body of FunctionName1 instead of a leading comment on FunctionName2.
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (5 by maintainers)
Top Results From Across the Web
Why are Comment nodes treated differently than any other ...
Comment nodes are contained within the comments member of a block node, whereas most other nodes live inside the body member of a...
Read more >Programming - Commenting - Utah School of Computing
The top of any program file. This is called the "Header Comment". · Above every function. This is called the function header and...
Read more >Style and recommendations of commenting code
trailing comments explaining fields in data structures (apart from those, I don't really use single line comments); exceptional or purpose- ...
Read more >Documenting the code - Doxygen Manual
How to put comments in your code such that doxygen incorporates them in the ... of all comment blocks found within the body...
Read more >Go Doc Comments - The Go Programming Language
“Doc comments” are comments that appear immediately before top-level package, const, func, type, and var declarations with no intervening newlines.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@danilopolani, it’s normal, actually not yet released - will be done this week-end
Hi @aameen951,
The bug should be fixed from my latest commit - it will be released soon.