PHPStan\Analyser\Scope::specifyExpressionType PHP Method

specifyExpressionType() public method

public specifyExpressionType ( PhpParser\Node $expr, PHPStan\Type\Type $type ) : self
$expr PhpParser\Node
$type PHPStan\Type\Type
return self
    public function specifyExpressionType(Node $expr, Type $type) : self
    {
        if ($expr instanceof Variable && is_string($expr->name)) {
            $variableName = $expr->name;
            $variableTypes = $this->getVariableTypes();
            $variableTypes[$variableName] = $type;
            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);
        }
        $exprString = $this->printer->prettyPrintExpr($expr);
        return $this->addMoreSpecificTypes([$exprString => $type]);
    }