PHPStan\Analyser\Scope::assignVariable PHP Method

assignVariable() public method

public assignVariable ( string $variableName, PHPStan\Type\Type $type = null ) : self
$variableName string
$type PHPStan\Type\Type
return self
    public function assignVariable(string $variableName, Type $type = null) : self
    {
        $variableTypes = $this->getVariableTypes();
        $variableTypes[$variableName] = $type !== null ? $type : new MixedType(true);
        return new self($this->broker, $this->printer, $this->getFile(), $this->isDeclareStrictTypes(), $this->getClass(), $this->getFunction(), $this->getNamespace(), $variableTypes, $this->inClosureBindScopeClass, $this->getAnonymousFunctionReturnType(), $this->isInAnonymousClass() ? $this->getAnonymousClass() : null, $this->getInFunctionCall(), $this->isNegated(), $this->moreSpecificTypes);
    }