/**
  * Parses the given docblock string for annotations.
  *
  * @param string $docBlockString The docblock string to parse.
  * @param string $context The parsing context.
  * @return array Array of annotations. If no annotations are found, an empty array is returned.
  */
 public function parse($docBlockString, $context = '')
 {
     // Strip out some known inline tags.
     $input = str_replace(self::$strippedTags, '', $docBlockString);
     // Cut of the beginning of the input until the first '@'.
     if (!preg_match('/^\\s*\\*\\s*(@.*)/ms', $input, $match)) {
         return array();
     }
     return parent::parse($match[1], $context);
 }
Exemple #2
0
 public function createTestParser()
 {
     $parser = new Parser();
     $parser->setDefaultAnnotationNamespace('Doctrine\\Tests\\Common\\Annotations\\');
     return $parser;
 }
 /**
  * @group DCOM-6
  */
 public function testNonexistantNamespaceAlias()
 {
     $parser = new Parser();
     $result = $parser->parse('@nonalias:Name(foo="bar")');
     $this->assertEquals(0, count($result));
 }