PHPStan\Type\ObjectType::checkSubclassAcceptability PHP Method

checkSubclassAcceptability() private method

private checkSubclassAcceptability ( string $thatClass ) : boolean
$thatClass string
return boolean
    private function checkSubclassAcceptability(string $thatClass) : bool
    {
        if ($this->getClass() === $thatClass) {
            return true;
        }
        if (!$this->exists($this->getClass()) || !$this->exists($thatClass)) {
            return false;
        }
        $thisReflection = new \ReflectionClass($this->getClass());
        $thatReflection = new \ReflectionClass($thatClass);
        if ($thisReflection->getName() === $thatReflection->getName()) {
            // class alias
            return true;
        }
        if ($thisReflection->isInterface() && $thatReflection->isInterface()) {
            return $thatReflection->implementsInterface($this->getClass());
        }
        return $thatReflection->isSubclassOf($this->getClass());
    }