Dunglas\PhpDocToTypeHint\Converter::getTypeFromTag PHP Метод

getTypeFromTag() приватный Метод

Gets the type of the parameter or an empty array if it is not defined.
private getTypeFromTag ( Tag $tag ) : array
$tag phpDocumentor\Reflection\DocBlock\Tag
Результат array
    private function getTypeFromTag(Tag $tag) : array
    {
        $type = $tag->getType();
        if (null === $type) {
            // No type specified
            return [];
        }
        if ($type instanceof Compound) {
            if ($type->has(2)) {
                // Several types, cannot guess
                return [];
            }
            $type0 = $type->get(0);
            $type1 = $type->get(1);
            if ($type0 instanceof Null_ && $type1 instanceof Null_) {
                // No type hint
                return [];
            }
            if (!$type0 instanceof Null_ && $type1 instanceof Null_) {
                return [$type0->__toString(), true];
            }
            if (!$type1 instanceof Null_ && $type0 instanceof Null_) {
                return [$type1->__toString(), true];
            }
            // Mixed types, cannot guess
            return [];
        }
        if ($type instanceof Array_) {
            // May contain more specific type declarations, but we only
            // convert to pure arrays
            return ['array', false];
        }
        return [$type->__toString(), false];
    }