Documentation

PhpDocExtractor
in package
implements PropertyDescriptionExtractorInterface, PropertyTypeExtractorInterface, ConstructorArgumentTypeExtractorInterface, PropertyDocBlockExtractorInterface

Extracts data using a PHPDoc parser.

Tags
author

Kévin Dunglas dunglas@gmail.com

final

Table of Contents

Interfaces

PropertyDescriptionExtractorInterface
Guesses the property's human readable description.
PropertyTypeExtractorInterface
Type Extractor Interface.
ConstructorArgumentTypeExtractorInterface
Infers the constructor argument type.
PropertyDocBlockExtractorInterface
Extract a property's doc block.

Constants

ACCESSOR  = 1
MUTATOR  = 2
PROPERTY  = 0

Properties

$accessorPrefixes  : array<string|int, mixed>
$arrayMutatorPrefixes  : array<string|int, mixed>
$contextFactory  : ContextFactory
$contexts  : array<string|int, Context>
$docBlockFactory  : DocBlockFactoryInterface
$docBlocks  : array<string, DocBlock|null, int|null, string|null}>
$mutatorPrefixes  : array<string|int, mixed>
$phpDocTypeHelper  : PhpDocTypeHelper
$typeContextFactory  : TypeContextFactory

Methods

__construct()  : mixed
getDocBlock()  : DocBlock|null
Gets the first available doc block for a property. It finds the doc block by the following priority: - constructor promoted argument, - the class property, - a mutator method for that property.
getLongDescription()  : string|null
Gets the long description of the property.
getShortDescription()  : string|null
Gets the short description of the property.
getType()  : Type|null
getTypeFromConstructor()  : Type|null
Gets type of an argument from constructor.
getTypes()  : array<string|int, Type>|null
Gets types of a property.
getTypesFromConstructor()  : array<string|int, Type>|null
Gets types of an argument from constructor.
createFromReflector()  : Context
Prevents a lot of redundant calls to ContextFactory::createForNamespace().
filterDocBlockParams()  : DocBlock
findDocBlock()  : DocBlock|null, int|null, string|null}
getDocBlockFromConstructor()  : DocBlock|null
getDocBlockFromMethod()  : DocBlock, string}|null
getDocBlockFromProperty()  : DocBlock|null

Constants

Properties

$accessorPrefixes

private array<string|int, mixed> $accessorPrefixes

$arrayMutatorPrefixes

private array<string|int, mixed> $arrayMutatorPrefixes

$docBlocks

private array<string, DocBlock|null, int|null, string|null}> $docBlocks = []

Methods

__construct()

public __construct([DocBlockFactoryInterface|null $docBlockFactory = null ][, array<string|int, string>|null $mutatorPrefixes = null ][, array<string|int, string>|null $accessorPrefixes = null ][, array<string|int, string>|null $arrayMutatorPrefixes = null ]) : mixed
Parameters
$docBlockFactory : DocBlockFactoryInterface|null = null
$mutatorPrefixes : array<string|int, string>|null = null
$accessorPrefixes : array<string|int, string>|null = null
$arrayMutatorPrefixes : array<string|int, string>|null = null

getDocBlock()

Gets the first available doc block for a property. It finds the doc block by the following priority: - constructor promoted argument, - the class property, - a mutator method for that property.

public getDocBlock(string $class, string $property) : DocBlock|null

If no doc block is found, it will return null.

Parameters
$class : string
$property : string
Return values
DocBlock|null

getLongDescription()

Gets the long description of the property.

public getLongDescription(string $class, string $property[, array<string|int, mixed> $context = [] ]) : string|null
Parameters
$class : string
$property : string
$context : array<string|int, mixed> = []
Return values
string|null

getShortDescription()

Gets the short description of the property.

public getShortDescription(string $class, string $property[, array<string|int, mixed> $context = [] ]) : string|null
Parameters
$class : string
$property : string
$context : array<string|int, mixed> = []
Return values
string|null

getType()

public getType(string $class, string $property[, array<string|int, mixed> $context = [] ]) : Type|null
Parameters
$class : string
$property : string
$context : array<string|int, mixed> = []
Return values
Type|null

getTypeFromConstructor()

Gets type of an argument from constructor.

public getTypeFromConstructor(string $class, string $property) : Type|null
Parameters
$class : string
$property : string
Return values
Type|null

getTypes()

Gets types of a property.

public getTypes(string $class, string $property[, array<string|int, mixed> $context = [] ]) : array<string|int, Type>|null

since Symfony 7.3, use "getType" instead

Parameters
$class : string
$property : string
$context : array<string|int, mixed> = []
Return values
array<string|int, Type>|null

getTypesFromConstructor()

Gets types of an argument from constructor.

public getTypesFromConstructor(string $class, string $property) : array<string|int, Type>|null

since Symfony 7.3, use "getTypeFromConstructor" instead

Parameters
$class : string
$property : string
Return values
array<string|int, Type>|null

createFromReflector()

Prevents a lot of redundant calls to ContextFactory::createForNamespace().

private createFromReflector(ReflectionClass $reflector) : Context
Parameters
$reflector : ReflectionClass
Return values
Context

findDocBlock()

private findDocBlock(string $class, string $property) : DocBlock|null, int|null, string|null}
Parameters
$class : string
$property : string
Return values
DocBlock|null, int|null, string|null}

getDocBlockFromConstructor()

private getDocBlockFromConstructor(string $class, string $property) : DocBlock|null
Parameters
$class : string
$property : string
Return values
DocBlock|null

getDocBlockFromMethod()

private getDocBlockFromMethod(string $class, string $ucFirstProperty, int $type) : DocBlock, string}|null
Parameters
$class : string
$ucFirstProperty : string
$type : int
Return values
DocBlock, string}|null

getDocBlockFromProperty()

private getDocBlockFromProperty(string $class, string $property) : DocBlock|null
Parameters
$class : string
$property : string
Return values
DocBlock|null

        
On this page

Search results