src/DefinitionResolver.php
public function getDeclarationLineFromNode($node): string
    {
        // If node is part of a declaration list, build a declaration line that discludes other elements in the list
        //  - [PropertyDeclaration] // public $a, [$b = 3], $c; => public $b = 3;
        //  - [ConstDeclaration|ClassConstDeclaration] // "const A = 3, [B = 4];" => "const B = 4;"
        if (
            ($declaration = ParserHelpers\tryGetPropertyDeclaration($node)) && ($elements = $declaration->propertyElements) ||
            ($declaration = ParserHelpers\tryGetConstOrClassConstDeclaration($node)) && ($elements = $declaration->constElements)
        ) {
            $defLine = $declaration->getText();
            $defLineStart = $declaration->getStart();

            $defLine = \substr_replace(
                $defLine,
                $node->getFullText(),
                $elements->getFullStart() - $defLineStart,
                $elements->getFullWidth()
            );
        } else {
            $defLine = $node->getText();
        }

        // Trim string to only include first line
        $defLine = \rtrim(\strtok($defLine, "\n"), "\r");

        // TODO - pretty print rather than getting text

        return $defLine;
    }
public function getDeclarationLineFromNode($node): string
    {
        // If node is part of a declaration list, build a declaration line that discludes other elements in the list
        //  - [PropertyDeclaration] // public $a, [$b = 3], $c; => public $b = 3;
        //  - [ConstDeclaration|ClassConstDeclaration] // "const A = 3, [B = 4];" => "const B = 4;"
        if (
            ($declaration = ParserHelpers\tryGetPropertyDeclaration($node)) && ($elements = $declaration->propertyElements) ||
            ($declaration = ParserHelpers\tryGetConstOrClassConstDeclaration($node)) && ($elements = $declaration->constElements)
        ) {
            $defLine = $declaration->getText();
            $defLineStart = $declaration->getStart();

            $defLine = \substr_replace(
                $defLine,
                $node->getFullText(),
                $elements->getFullStart() - $defLineStart,
                $elements->getFullWidth()
            );
        } else {
            $defLine = $node->getText();
        }

        // Trim string to only include first line
        $defLine = \rtrim(\strtok($defLine, "\n"), "\r");

        // TODO - pretty print rather than getting text

        return $defLine;
    }
public function getDeclarationLineFromNode ( $ node ) : string { // If node is part of a declaration list, build a declaration line that discludes other elements in the list //  - [PropertyDeclaration] // public $a, [$b = 3], $c; => public $b = 3; //  - [ConstDeclaration|ClassConstDeclaration] // "const A = 3, [B = 4];" => "const B = 4;" if ( ( $ declaration = ParserHelpers \ tryGetPropertyDeclaration ( $ node ) ) && ( $ elements = $ declaration -> propertyElements ) || ( $ declaration = ParserHelpers \ tryGetConstOrClassConstDeclaration ( $ node ) ) && ( $ elements = $ declaration -> constElements ) ) { $ defLine = $ declaration -> getText ( ) ; $ defLineStart = $ declaration -> getStart ( ) ; $ defLine = \ substr_replace ( $ defLine , $ node -> getFullText ( ) , $ elements -> getFullStart ( ) - $ defLineStart , $ elements -> getFullWidth ( ) ) ; } else { $ defLine = $ node -> getText ( ) ; } // Trim string to only include first line $ defLine = \ rtrim ( \ strtok ( $ defLine , "\n" ) , "\r" ) ; // TODO - pretty print rather than getting text return $ defLine ; }
Builds the declaration line for a given node. Declarations with multiple lines are trimmed.

@param Node $node
@return string
Builds the declaration line for a given node . Declarations with multiple lines are trimmed .