public function addVarToScope(Assign $node) { if (!$node->var instanceof NodeVar) { return; } $var = new Variable($node->var->name); $comment = $this->commentParser->parse($node->getAttribute('comments')); if ($comment->getVar($var->getName())) { $type = $comment->getVar($var->getName())->getType(); } else { $type = $this->typeResolver->getType($node->expr, $this->getIndex(), $this->scope); } $var->setType($type); $this->scope->addVar($var); }
public function addVar(Variable $var) { $this->vars[$var->getName()] = $var; }
protected function createEntry(Variable $var) { $type = $var->getType() instanceof FQCN ? $var->getType()->toString() : $var->getType(); return new Entry($var->getName(), $type); }