/**
* @param Node $node
* An AST_VAR node
*
* @param Context $context
* The context in which the variable is found
*
* @param CodeBase $code_base
*
* @return Variable
* A variable begotten from a node
*/
public static function fromNodeInContext(Node $node, Context $context, CodeBase $code_base, bool $should_check_type = true) : Variable
{
$variable_name = AST::variableName($node);
// Get the type of the assignment
$union_type = $should_check_type ? UnionType::fromNode($context, $code_base, $node) : new UnionType();
$variable = new Variable($context->withLineNumberStart($node->lineno ?? 0)->withLineNumberEnd($node->endLineno ?? 0), $variable_name, $union_type, $node->flags);
return $variable;
}