Esempio n. 1
0
 /**
  * Parses the type of a class-constant from the given phpdoc
  *
  * @param PC_Obj_Constant $const the constant
  */
 public function parse_const_doc($const)
 {
     if (isset($this->constComments[$const->get_name()])) {
         // if we already know the value, we don't have to use the phpdoc
         // TODO we could issue a warning here if the type differs
         if ($const->get_type()->is_unknown()) {
             $type = $this->parse_var_from($this->constComments[$const->get_name()]);
             if ($type !== null) {
                 $const->set_type($type);
             }
         }
         unset($this->constComments[$const->get_name()]);
     }
 }
Esempio n. 2
0
 /**
  * Builds a PC_Obj_Constant from the given row
  *
  * @param array $row the row from db
  * @return PC_Obj_Constant the constant
  */
 private function build_const($row)
 {
     $type = unserialize($row['type']);
     if ($type === null) {
         $type = new PC_Obj_MultiType();
     }
     $const = new PC_Obj_Constant($row['file'], $row['line'], $row['name'], $type, $row['class']);
     $const->set_id($row['id']);
     return $const;
 }