src/DefinitionResolver.php
private function getDocBlock(Node $node)
    {
        // TODO make more efficient (caching, ensure import table is in right format to begin with)
        $docCommentText = $node->getDocCommentText();
        if ($docCommentText !== null) {
            list($namespaceImportTable,,) = $node->getImportTablesForCurrentScope();
            foreach ($namespaceImportTable as $alias => $name) {
                $namespaceImportTable[$alias] = (string)$name;
            }
            $namespaceDefinition = $node->getNamespaceDefinition();
            if ($namespaceDefinition !== null && $namespaceDefinition->name !== null) {
                $namespaceName = (string)$namespaceDefinition->name->getNamespacedName();
            } else {
                $namespaceName = 'global';
            }
            $context = new Types\Context($namespaceName, $namespaceImportTable);

            try {
                // create() throws when it thinks the doc comment has invalid fields.
                // For example, a @see tag that is followed by something that doesn't look like a valid fqsen will throw.
                return $this->docBlockFactory->create($docCommentText, $context);
            } catch (\InvalidArgumentException $e) {
                return null;
            }
        }
        return null;
    }
private function getDocBlock(Node $node)
    {
        // TODO make more efficient (caching, ensure import table is in right format to begin with)
        $docCommentText = $node->getDocCommentText();
        if ($docCommentText !== null) {
            list($namespaceImportTable,,) = $node->getImportTablesForCurrentScope();
            foreach ($namespaceImportTable as $alias => $name) {
                $namespaceImportTable[$alias] = (string)$name;
            }
            $namespaceDefinition = $node->getNamespaceDefinition();
            if ($namespaceDefinition !== null && $namespaceDefinition->name !== null) {
                $namespaceName = (string)$namespaceDefinition->name->getNamespacedName();
            } else {
                $namespaceName = 'global';
            }
            $context = new Types\Context($namespaceName, $namespaceImportTable);

            try {
                // create() throws when it thinks the doc comment has invalid fields.
                // For example, a @see tag that is followed by something that doesn't look like a valid fqsen will throw.
                return $this->docBlockFactory->create($docCommentText, $context);
            } catch (\InvalidArgumentException $e) {
                return null;
            }
        }
        return null;
    }
private function getDocBlock ( Node $ node ) { // TODO make more efficient (caching, ensure import table is in right format to begin with) $ docCommentText = $ node -> getDocCommentText ( ) ; if ( $ docCommentText !== null ) { list ( $ namespaceImportTable , , ) = $ node -> getImportTablesForCurrentScope ( ) ; foreach ( $ namespaceImportTable as $ alias => $ name ) { $ namespaceImportTable [ $ alias ] = ( string ) $ name ; } $ namespaceDefinition = $ node -> getNamespaceDefinition ( ) ; if ( $ namespaceDefinition !== null && $ namespaceDefinition -> name !== null ) { $ namespaceName = ( string ) $ namespaceDefinition -> name -> getNamespacedName ( ) ; } else { $ namespaceName = 'global' ; } $ context = new Types \ Context ( $ namespaceName , $ namespaceImportTable ) ; try { // create() throws when it thinks the doc comment has invalid fields. // For example, a @see tag that is followed by something that doesn't look like a valid fqsen will throw. return $ this -> docBlockFactory -> create ( $ docCommentText , $ context ) ; } catch ( \ InvalidArgumentException $ e ) { return null ; } } return null ; }
Gets Doc Block with resolved names for a Node

@param Node $node
@return DocBlock|null
Gets Doc Block with resolved names for a Node