getDefaultValueConstantName() 공개 메소드

예제 #1
0
파일: Template.php 프로젝트: nochso/writeme
 public function formatParameter(ReflectionMethod $method, ReflectionParameter $parameter)
 {
     $code = '$' . $parameter->getName();
     $text = '';
     if ($parameter->isDefaultValueAvailable()) {
         if ($parameter->isDefaultValueConstant()) {
             $code .= ' = ' . $parameter->getDefaultValueConstantName();
         }
         $code .= ' = ' . $parameter->getDefaultValueAsString();
     }
     if ($parameter->isPassedByReference()) {
         $code = '&' . $code;
     }
     $doc = $this->getMethodDocBlock($method);
     $paramTags = $doc->getTagsByName('param');
     $type = 'mixed';
     /** @var \phpDocumentor\Reflection\DocBlock\Tag\ParamTag $paramTag */
     foreach ($paramTags as $paramTag) {
         if ($paramTag->getVariableName() === '$' . $parameter->getName() && $paramTag->getDescription() !== '') {
             $text .= ' — ' . $paramTag->getDescription();
             $type = $paramTag->getType();
         }
     }
     return sprintf('%d. `%s` — `%s` %s', $parameter->getPosition() + 1, $code, $type, $text);
 }
 /**
  * {@inheritDoc}
  */
 public function getDefaultValueConstantName()
 {
     return $this->betterReflectionParameter->getDefaultValueConstantName();
 }