Пример #1
0
    public function testTagCaseSensitivity()
    {
        $fixture = <<<DOCBLOCK
/**
 * This is a short description.
 *
 * This is a long description.
 *
 * @method null something()
 * @Method({"GET", "POST"})
 */
DOCBLOCK;
        $object = new DocBlock($fixture);
        $this->assertEquals('This is a short description.', $object->getShortDescription());
        $this->assertEquals('This is a long description.', $object->getLongDescription()->getContents());
        $tags = $object->getTags();
        $this->assertCount(2, $tags);
        $this->assertTrue($object->hasTag('method'));
        $this->assertTrue($object->hasTag('Method'));
        $this->assertInstanceOf(__NAMESPACE__ . '\\DocBlock\\Tag\\MethodTag', $tags[0]);
        $this->assertInstanceOf(__NAMESPACE__ . '\\DocBlock\\Tag', $tags[1]);
        $this->assertNotInstanceOf(__NAMESPACE__ . '\\DocBlock\\Tag\\MethodTag', $tags[1]);
    }
Пример #2
0
 /**
  * Get method return type based on it DocBlock comment
  *
  * @param \ReflectionMethod $reflection
  *
  * @return null|string
  */
 protected function getReturnTypeFromDocBlock(\ReflectionMethod $reflection)
 {
     $type = null;
     $phpdoc = new DocBlock($reflection);
     if ($phpdoc->hasTag('return')) {
         $type = $phpdoc->getTagsByName('return')[0]->getContent();
     }
     return $type;
 }