phpdocSummary() public method

A short piece of text, usually one line, providing the basic function of the associated element.
public phpdocSummary ( ) : string | null
return string | null
Example #1
0
    /**
     * https://phpdoc.org/docs/latest/guides/docblocks.html
     */
    public function testPhpdocSummaryAndDescription()
    {
        $single = new Context(['comment' => '/** This is a single line DocComment. */']);
        $this->assertEquals('This is a single line DocComment.', $single->phpdocContent());
        $multi = new Context(['comment' => "/**\n * This is a multi-line DocComment.\n */"]);
        $this->assertEquals('This is a multi-line DocComment.', $multi->phpdocContent());
        $emptyWhiteline = new Context(['comment' => <<<END
/**
 * This is a summary
 *
 * This is a description
 */
END
]);
        $this->assertEquals('This is a summary', $emptyWhiteline->phpdocSummary());
        $periodNewline = new Context(['comment' => <<<END
     /**
     * This is a summary.
     * This is a description
     */
END
]);
        $this->assertEquals('This is a summary.', $periodNewline->phpdocSummary());
        $multilineSummary = new Context(['comment' => <<<END
     /**
     * This is a summary
     * but this is part of the summary
     */
END
]);
    }