Example #1
0
 /**
  * Adds type information to the structure.
  *
  * @todo Move this method to a better spot with namespace and alias access (together with namespace and alias stuff).
  *
  * @param string[] $types
  *
  * @return void
  */
 public function setTypes($types)
 {
     foreach ($types as $type) {
         if ($type == '') {
             continue;
         }
         $type = trim($this->expandType($type));
         // strip ampersands
         $name = str_replace('&', '', $type);
         $type_object = $this->xml->addChild('type', $name);
         // register whether this variable is by reference by checking the first and last character
         $type_object['by_reference'] = substr($type, 0, 1) === '&' || substr($type, -1) === '&' ? 'true' : 'false';
     }
     $this->xml['type'] = $this->expandType($this->tag->getType());
 }