public function addVariables(Scope $otherScope) : self { $variableTypes = $this->getVariableTypes(); foreach ($otherScope->getVariableTypes() as $name => $variableType) { if ($this->hasVariableType($name)) { $variableType = $this->getVariableType($name)->combineWith($variableType); } $variableTypes[$name] = $variableType; } return new self($this->broker, $this->printer, $this->getFile(), $this->getAnalysedContextFile(), $this->isDeclareStrictTypes(), $this->getClass(), $this->getFunction(), $this->getNamespace(), $variableTypes, $this->inClosureBindScopeClass, $this->getAnonymousFunctionReturnType(), $this->isInAnonymousClass() ? $this->getAnonymousClass() : null, $this->getInFunctionCall(), $this->isNegated(), $this->moreSpecificTypes); }