private function traverseVariable(\PHPParser_Node_Expr_Variable $node, LinkedFlowScope $scope) { if ('this' === $node->name) { if (null === $scope->getTypeOfThis()) { $node->setAttribute('type', $this->typeRegistry->getNativeType('none')); return $scope; } $node->setAttribute('type', $this->typeRegistry->getThisType($scope->getTypeOfThis())); return $scope; } if (is_string($node->name)) { $slot = $scope->getSlot($node->name); if ($slot && ($type = $slot->getType())) { $node->setAttribute('type', $type); } } else { $scope = $this->traverseChildren($node, $scope); } return $scope; }
private function createVar(LinkedFlowScope $scope, $name, $type) { $type = $this->registry->resolveType($type); $this->functionScope->declareVar($name)->setNameNode($n = new \PHPParser_Node_Expr_Variable($name)); $scope->inferSlotType($name, $type); $n->setAttribute('type', $type); return $n; }