Ejemplo n.º 1
0
 /**
  * Tests whether the getTypes method correctly converts the given tags.
  *
  * @param string   $type     Type string to test
  * @param string[] $expected Array of expected types
  *
  * @covers \phpDocumentor\Reflection\DocBlock\Tag\ParamTag::getTypes()
  *
  * @dataProvider provideTypesToExpand
  */
 public function testExpandTypeIntoCorrectFcqn($type, $expected)
 {
     $docblock = new \phpDocumentor\Reflection\DocBlock('', '\\My\\Namespace', array('Alias' => '\\My\\Namespace\\Aliasing'));
     $tag = new ParamTag('param', $type . ' $my_type');
     $tag->setDocBlock($docblock);
     $this->assertEquals($expected, $tag->getTypes());
 }
Ejemplo n.º 2
0
 private function parseTags($tags)
 {
     $lines = explode(PHP_EOL, $tags);
     foreach ($lines as $line) {
         if (preg_match('#^\\@param#', $line)) {
             $paramTag = new ParamTag($line);
             $this->params[$paramTag->getName()] = $paramTag;
         } elseif (preg_match('#^\\@return#', $line)) {
             $this->returnTag = new ReturnTag($line);
         }
     }
 }
Ejemplo n.º 3
0
 /**
  * Test that the \phpDocumentor\Reflection\DocBlock\Tag\ParamTag can
  * understand the @param DocBlock.
  *
  * @param string $type        	
  * @param string $content        	
  * @param string $extractedType        	
  * @param string $extractedTypes        	
  * @param string $extractedVarName        	
  * @param string $extractedDescription
  *        	@covers \phpDocumentor\Reflection\DocBlock\Tag\ParamTag
  *        	@dataProvider provideDataForConstructor
  *        	
  * @return void
  */
 public function testConstructorParsesInputsIntoCorrectFields($type, $content, $extractedType, $extractedTypes, $extractedVarName, $extractedDescription)
 {
     $tag = new ParamTag($type, $content);
     $this->assertEquals($type, $tag->getName());
     $this->assertEquals($extractedType, $tag->getType());
     $this->assertEquals($extractedTypes, $tag->getTypes());
     $this->assertEquals($extractedVarName, $tag->getVariableName());
     $this->assertEquals($extractedDescription, $tag->getDescription());
 }