in_loop = true; foreach ($stmt->init as $init) { if (ExpressionChecker::analyze($statements_checker, $init, $for_context) === false) { return false; } } foreach ($stmt->cond as $condition) { if (ExpressionChecker::analyze($statements_checker, $condition, $for_context) === false) { return false; } } $statements_checker->analyze($stmt->stmts, $for_context, $context); foreach ($stmt->loop as $expr) { if (ExpressionChecker::analyze($statements_checker, $expr, $for_context) === false) { return false; } } foreach ($context->vars_in_scope as $var => $type) { if ($type->isMixed()) { continue; } if ($for_context->vars_in_scope[$var]->isMixed()) { $context->vars_in_scope[$var] = $for_context->vars_in_scope[$var]; } if ((string) $for_context->vars_in_scope[$var] !== (string) $type) { $context->vars_in_scope[$var] = Type::combineUnionTypes( $context->vars_in_scope[$var], $for_context->vars_in_scope[$var] ); } } $context->vars_possibly_in_scope = array_merge( $for_context->vars_possibly_in_scope, $context->vars_possibly_in_scope ); return null; } }