Example #1
0
 /**
  * Name bounded inside namespace.
  *
  * @return string
  */
 public function getBoundedName()
 {
     if ($this->alias) {
         return $this->alias->getText();
     } else {
         return $this->name->lastChild()->getText();
     }
 }
Example #2
0
 /**
  * Get the type of the parameter as defined by type hinting or doc comment.
  *
  * @return string[]
  *   The types as defined by phpdoc standard. Default is ['mixed'].
  */
 public function getTypes()
 {
     // If type hint is set then that is the type of the parameter.
     if ($this->typeHint) {
         if ($this->typeHint instanceof TokenNode) {
             if ($this->typeHint->getType() === T_ARRAY) {
                 $docTypes = $this->getDocTypes();
                 foreach ($docTypes as $docType) {
                     if ($docType !== 'array' && substr($docType, -2) !== '[]') {
                         return [$this->typeHint->getText()];
                     }
                 }
                 return $docTypes;
             } else {
                 return [$this->typeHint->getText()];
             }
         } else {
             return [$this->typeHint->getAbsolutePath()];
         }
     }
     return $this->getDocTypes();
 }