本文整理汇总了PHP中phpDocumentor\Reflection\DocBlock::getLocation方法的典型用法代码示例。如果您正苦于以下问题:PHP DocBlock::getLocation方法的具体用法?PHP DocBlock::getLocation怎么用?PHP DocBlock::getLocation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类phpDocumentor\Reflection\DocBlock
的用法示例。
在下文中一共展示了DocBlock::getLocation方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Constructor
*
* @param string $name Name of the "entity"
* @param DocBlock|null $docblock Docblock
* @param BaseReflector|null $source Source Element.
*/
public function __construct($name, $docblock = null, $source = null)
{
$this->entityName = $name;
$this->lineNumber = $docblock ? $docblock->getLocation()->getLineNumber() : $source->getLineNumber();
$this->docblock = $docblock;
$this->source = $source;
}
示例2: __construct
/**
* Constructor
*
* @param \phpDocumentor\Plugin\Plugin $plugin Plugin to which this
* validator belongs.
* @param string $name Name of the "entity"
* @param \phpDocumentor\Reflection\DocBlock|null $docblock Docblock
* @param \phpDocumentor\Reflection\BaseReflector|null $source Source Element.
*/
public function __construct($plugin, $name, $docblock = null, $source = null)
{
$this->entityName = $name;
$this->lineNumber = $docblock ? $docblock->getLocation()->getLineNumber() : $source->getLineNumber();
$this->docblock = $docblock;
$this->source = $source;
parent::__construct($plugin->getEventDispatcher(), $plugin->getConfiguration(), $plugin->getTranslator());
}
示例3: testConstruct
/**
* @covers \phpDocumentor\Reflection\DocBlock
*
* @return void
*/
public function testConstruct()
{
$fixture = <<<DOCBLOCK
/**
* This is a short description
*
* This is a long description
*
* @see \\MyClass
* @return void
*/
DOCBLOCK;
$object = new DocBlock($fixture, new Context('\\MyNamespace', array('PHPDoc' => '\\phpDocumentor')), new Location(2));
$this->assertEquals('This is a short description', $object->getShortDescription());
$this->assertEquals('This is a long description', $object->getLongDescription()->getContents());
$this->assertCount(2, $object->getTags());
$this->assertTrue($object->hasTag('see'));
$this->assertTrue($object->hasTag('return'));
$this->assertFalse($object->hasTag('material_unit'));
$this->assertSame('MyNamespace', $object->getContext()->getNamespace());
$this->assertSame(array('PHPDoc' => '\\phpDocumentor'), $object->getContext()->getNamespaceAliases());
$this->assertSame(2, $object->getLocation()->getLineNumber());
}
示例4: testDocBlockKnowsAtWhichLineItIs
/**
* @covers ::__construct
* @covers ::getLocation
*
* @uses \phpDocumentor\Reflection\DocBlock\Description
* @uses \phpDocumentor\Reflection\Location
*/
public function testDocBlockKnowsAtWhichLineItIs()
{
$location = new Location(10);
$fixture = new DocBlock('', null, [], null, $location);
$this->assertSame($location, $fixture->getLocation());
}