title: Parsing PHP Doc Comments into a Data Structure
body: <p>I'm using the Reflection API in PHP to pull a DocComment (PHPDoc) string from a method</p>
  
  <pre><code>$r = new ReflectionMethod($object);
  $comment = $r-&gt;getDocComment();
  </code></pre>
  
  <p>This will return a string that looks something like this (depending on how well the method was documented)</p>
  
  <pre><code>/**
  * Does this great things
  *
  * @param string $thing
  * @return Some_Great_Thing
  */
  </code></pre>
  
  <p>Are there any built-in methods or functions that can parse a PHP Doc Comment String into a data structure?</p>
  
  <pre><code>$object = some_magic_function_or_method($comment_string);
  
  echo 'Returns a: ', $object-&gt;return;
  </code></pre>
  
  <p>Lacking that, what part of the <a href="http://phpdoc.org/" rel="noreferrer">PHPDoc source code</a> should I be looking at the do this myself. </p>
  
  <p>Lacking and/or in addition to that, is there third party code that's considered "better" at this that the PHPDoc code?</p>
  
  <p>I realize parsing these strings isn't rocket science, or even computer science, but I'd prefer a well tested library/routine/method that's been built to deal with a lot of the janky, semi-non-correct PHP Doc code that might exist in the wild.</p>