MCP PHP SDK

DocBlockParser

Parses DocBlocks using phpdocumentor/reflection-docblock.

Tags
author

Kyrian Obikwelu koshnawaza@gmail.com

Table of Contents

Properties

$docBlockFactory  : DocBlockFactoryInterface
$logger  : LoggerInterface

Methods

__construct()  : mixed
getDescription()  : string|null
Gets the description from a DocBlock (summary + description body).
getParamDescription()  : string|null
Gets the description string from a Param tag.
getParamTags()  : array<string, Param>
Extracts "@param" tag information from a DocBlock, keyed by variable name (e.g., '$paramName').
getParamTypeString()  : string|null
Gets the type string from a Param tag.
parseDocBlock()  : DocBlock|null
Safely parses a DocComment string into a DocBlock object.

Properties

$docBlockFactory

private DocBlockFactoryInterface $docBlockFactory

$logger read-only

private LoggerInterface $logger = new NullLogger()

Methods

__construct()

public __construct([DocBlockFactoryInterface|null $docBlockFactory = null ][, LoggerInterface $logger = new NullLogger() ]) : mixed
Parameters
$docBlockFactory : DocBlockFactoryInterface|null = null
$logger : LoggerInterface = new NullLogger()

getDescription()

Gets the description from a DocBlock (summary + description body).

public getDescription(DocBlock|null $docBlock) : string|null
Parameters
$docBlock : DocBlock|null
Return values
string|null

getParamDescription()

Gets the description string from a Param tag.

public getParamDescription(Param|null $paramTag) : string|null
Parameters
$paramTag : Param|null
Return values
string|null

getParamTags()

Extracts "@param" tag information from a DocBlock, keyed by variable name (e.g., '$paramName').

public getParamTags(DocBlock|null $docBlock) : array<string, Param>
Parameters
$docBlock : DocBlock|null
Return values
array<string, Param>

getParamTypeString()

Gets the type string from a Param tag.

public getParamTypeString(Param|null $paramTag) : string|null
Parameters
$paramTag : Param|null
Return values
string|null

parseDocBlock()

Safely parses a DocComment string into a DocBlock object.

public parseDocBlock(string|false|null $docComment) : DocBlock|null
Parameters
$docComment : string|false|null
Return values
DocBlock|null

        
On this page

Search results