예제 #1
0
파일: ParseVisitor.php 프로젝트: tpunt/phan
 /**
  * @param Node $node
  * The node where the constant was found
  *
  * @param string $name
  * The name of the constant
  *
  * @param Node|mixed $value
  * Either a node or a constant to be used as the value of
  * the constant.
  *
  * @param int $flags
  * Any flags on the definition of the constant
  *
  * @return void
  */
 private function addConstant(Node $node, string $name, $value, int $flags = 0)
 {
     // Give it a fully-qualified name
     $fqsen = FullyQualifiedGlobalConstantName::fromStringInContext($name, $this->context);
     // Create the constant
     $constant = new GlobalConstant($this->context->withLineNumberStart($node->lineno ?? 0), $name, new UnionType(), $flags, $fqsen);
     $constant->setFutureUnionType(new FutureUnionType($this->code_base, $this->context, $value));
     $this->code_base->addGlobalConstant($constant);
 }
예제 #2
0
파일: CodeBase.php 프로젝트: etsy/phan
 /**
  * @param GlobalConstant $global_constant
  * A global constant to add to the code base
  *
  * @return void
  */
 public function addGlobalConstant(GlobalConstant $global_constant)
 {
     $this->fqsen_global_constant_map[$global_constant->getFQSEN()] = $global_constant;
 }