PhpStanExtractor
in package
implements
PropertyDescriptionExtractorInterface, PropertyTypeExtractorInterface, ConstructorArgumentTypeExtractorInterface
FinalYes
Extracts data using PHPStan parser.
Tags
Table of Contents
Interfaces
- PropertyDescriptionExtractorInterface
- Guesses the property's human readable description.
- PropertyTypeExtractorInterface
- Type Extractor Interface.
- ConstructorArgumentTypeExtractorInterface
- Infers the constructor argument type.
Constants
Properties
- $accessorPrefixes : array<string|int, mixed>
- $allowPrivateAccess : bool
- $arrayMutatorPrefixes : array<string|int, mixed>
- $contexts : array<string, TypeContext>
- $docBlocks : array<string, PhpDocNode|null, int|null, string|null, string|null}>
- $lexer : Lexer
- $mutatorPrefixes : array<string|int, mixed>
- $phpDocParser : PhpDocParser
- $phpStanTypeHelper : PhpStanTypeHelper
- $stringTypeResolver : StringTypeResolver
- $typeContextFactory : TypeContextFactory
Methods
- __construct() : mixed
- 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.
- canAccessMemberBasedOnItsVisibility() : bool
- filterDocBlockParams() : ParamTagValueNode|null
- getDescriptionsFromDocNode() : array{0: ?string, 1: ?string}
- A docblock is split into a template marker, a short description, an optional long description and a tags section.
- getDocBlock() : PhpDocNode|null, int|null, string|null, string|null}
- getDocBlockFromConstructor() : ParamTagValueNode|null
- getDocBlockFromMethod() : PhpDocNode, string, string}|null
- getDocBlockFromProperty() : PhpDocNode, int, string}|null
- getPhpDocNode() : PhpDocNode
Constants
ACCESSOR
private
mixed
ACCESSOR
= 1
MUTATOR
private
mixed
MUTATOR
= 2
PROPERTY
private
mixed
PROPERTY
= 0
Properties
$accessorPrefixes
private
array<string|int, mixed>
$accessorPrefixes
$allowPrivateAccess
private
bool
$allowPrivateAccess
= true
$arrayMutatorPrefixes
private
array<string|int, mixed>
$arrayMutatorPrefixes
$contexts
private
array<string, TypeContext>
$contexts
= []
$docBlocks
private
array<string, PhpDocNode|null, int|null, string|null, string|null}>
$docBlocks
= []
$lexer
private
Lexer
$lexer
$mutatorPrefixes
private
array<string|int, mixed>
$mutatorPrefixes
$phpDocParser
private
PhpDocParser
$phpDocParser
$phpStanTypeHelper
private
PhpStanTypeHelper
$phpStanTypeHelper
$stringTypeResolver
private
StringTypeResolver
$stringTypeResolver
$typeContextFactory
private
TypeContextFactory
$typeContextFactory
Methods
__construct()
public
__construct([array<int, string>|null $mutatorPrefixes = null ][, array<int, string>|null $accessorPrefixes = null ][, array<int, string>|null $arrayMutatorPrefixes = null ][, bool $allowPrivateAccess = true ]) : mixed
Parameters
- $mutatorPrefixes : array<int, string>|null = null
- $accessorPrefixes : array<int, string>|null = null
- $arrayMutatorPrefixes : array<int, string>|null = null
- $allowPrivateAccess : bool = true
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|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>|nullcanAccessMemberBasedOnItsVisibility()
private
canAccessMemberBasedOnItsVisibility(ReflectionProperty|ReflectionMethod $member) : bool
Parameters
- $member : ReflectionProperty|ReflectionMethod
Return values
boolfilterDocBlockParams()
private
filterDocBlockParams(PhpDocNode $docNode, string $allowedParam) : ParamTagValueNode|null
Parameters
- $docNode : PhpDocNode
- $allowedParam : string
Return values
ParamTagValueNode|nullgetDescriptionsFromDocNode()
A docblock is split into a template marker, a short description, an optional long description and a tags section.
private
getDescriptionsFromDocNode(PhpDocNode $docNode) : array{0: ?string, 1: ?string}
- The template marker is either empty, #@+ or #@-.
- The short description is started from a non-tag character, and until one or multiple newlines.
- The long description (optional) is started from a non-tag character, and until a new line is encountered followed by a tag.
- Tags, and the remaining characters
This method returns the short and the long descriptions.
Parameters
- $docNode : PhpDocNode
Return values
array{0: ?string, 1: ?string}getDocBlock()
private
getDocBlock(string $class, string $property) : PhpDocNode|null, int|null, string|null, string|null}
Parameters
- $class : string
- $property : string
Return values
PhpDocNode|null, int|null, string|null, string|null}getDocBlockFromConstructor()
private
getDocBlockFromConstructor(string &$class, string $property) : ParamTagValueNode|null
Parameters
- $class : string
- $property : string
Return values
ParamTagValueNode|nullgetDocBlockFromMethod()
private
getDocBlockFromMethod(string $class, string $ucFirstProperty, int $type) : PhpDocNode, string, string}|null
Parameters
- $class : string
- $ucFirstProperty : string
- $type : int
Return values
PhpDocNode, string, string}|nullgetDocBlockFromProperty()
private
getDocBlockFromProperty(string $class, string $property) : PhpDocNode, int, string}|null
Parameters
- $class : string
- $property : string
Return values
PhpDocNode, int, string}|nullgetPhpDocNode()
private
getPhpDocNode(string $rawDocNode) : PhpDocNode
Parameters
- $rawDocNode : string