question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

DocBlock identification

See original GitHub issue

DocBlock seem to be identified by the starting /** and following whitespace. This leads to the following edge case (from https://github.com/prettier/prettier-php/issues/30):

/**************
 * test       *
 **************/

is parsed as

{
  "kind": "doc",
  "isDoc": false,
  "lines": [
    "*************\n * test       *\n *************"
  ]
}

and

// a
// b

becomes

{
  "kind": "doc",
  "isDoc": false,
  "lines": [
    "a",
    "b"
  ]
}

Which makes it hard to re-print them the way they were found. Similarly, i can also not tell the difference between /* a */ and // a in the AST.

Maybe it would make sense to change the isDoc flag to just return true whenever /* ... */ syntax is used? Or add another flag?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
ichiriaccommented, Mar 4, 2018

Hi @mgrip,

This will be fixed in the next release. The isDoc was removed, and I’ve introduced 2 new nodes CommentLine or CommentBlock.

I stopped to trim them, so you will have the raw comment node /** foo **/ or # single line comment

For more details take a look at https://github.com/glayzzle/php-parser/issues/126#issuecomment-370268380

0reactions
mgripcommented, Mar 6, 2018

Thank you! 🙏

Read more comments on GitHub >

github_iconTop Results From Across the Web

Sample File (including Docblock Comment standards) - PHP
Each docblock in the example contains many details about writing Docblock Comments. Following those instructions is ... @version SVN: $Id$
Read more >
phpDocumentor Tutorial
A DocBlock is an extended C++-style PHP comment that begins with "/**" and has an "*" at the beginning of every line. DocBlocks...
Read more >
DocBlocks - Joomla! Coding Standards
Whereas normal code indenting uses real tabs, all whitespace in a Docblock uses real spaces. This provides better readability in source code browsers....
Read more >
How to Document Your Code Properly - OpenEMR Project Wiki
A DocBlock is format that evolved from C++. It is a clean, standards compliant way of documenting your code, which allows for easy...
Read more >
DocBlock Standard | Commerce PHP Extensions
Identify the details a developer needs to work with your code. Ignore the implementation details (i.e. private methods/properties and method ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found