PhpDocExtractor
in package
implements
PropertyDescriptionExtractorInterface, PropertyTypeExtractorInterface, ConstructorArgumentTypeExtractorInterface, PropertyDocBlockExtractorInterface
Extracts data using a PHPDoc parser.
Tags
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
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
ACCESSOR
public
mixed
ACCESSOR
= 1
MUTATOR
public
mixed
MUTATOR
= 2
PROPERTY
public
mixed
PROPERTY
= 0
Properties
$accessorPrefixes
private
array<string|int, mixed>
$accessorPrefixes
$arrayMutatorPrefixes
private
array<string|int, mixed>
$arrayMutatorPrefixes
$contextFactory
private
ContextFactory
$contextFactory
$contexts
private
array<string|int, Context>
$contexts
= []
$docBlockFactory
private
DocBlockFactoryInterface
$docBlockFactory
$docBlocks
private
array<string, DocBlock|null, int|null, string|null}>
$docBlocks
= []
$mutatorPrefixes
private
array<string|int, mixed>
$mutatorPrefixes
$phpDocTypeHelper
private
PhpDocTypeHelper
$phpDocTypeHelper
$typeContextFactory
private
TypeContextFactory
$typeContextFactory
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|nullgetLongDescription()
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|nullgetShortDescription()
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|nullgetType()
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|nullgetTypeFromConstructor()
Gets type of an argument from constructor.
public
getTypeFromConstructor(string $class, string $property) : Type|null
Parameters
- $class : string
- $property : string
Return values
Type|nullgetTypes()
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>|nullgetTypesFromConstructor()
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>|nullcreateFromReflector()
Prevents a lot of redundant calls to ContextFactory::createForNamespace().
private
createFromReflector(ReflectionClass $reflector) : Context
Parameters
- $reflector : ReflectionClass
Return values
ContextfilterDocBlockParams()
private
filterDocBlockParams(DocBlock $docBlock, string $allowedParam) : DocBlock
Parameters
- $docBlock : DocBlock
- $allowedParam : string
Return values
DocBlockfindDocBlock()
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|nullgetDocBlockFromMethod()
private
getDocBlockFromMethod(string $class, string $ucFirstProperty, int $type) : DocBlock, string}|null
Parameters
- $class : string
- $ucFirstProperty : string
- $type : int
Return values
DocBlock, string}|nullgetDocBlockFromProperty()
private
getDocBlockFromProperty(string $class, string $property) : DocBlock|null
Parameters
- $class : string
- $property : string