Documentation

PhpStanExtractor
in package
implements PropertyDescriptionExtractorInterface, PropertyTypeExtractorInterface, ConstructorArgumentTypeExtractorInterface

FinalYes

Extracts data using PHPStan parser.

Tags
author

Baptiste Leduc baptiste.leduc@gmail.com

Table of Contents

Interfaces

PropertyDescriptionExtractorInterface
Guesses the property's human readable description.
PropertyTypeExtractorInterface
Type Extractor Interface.
ConstructorArgumentTypeExtractorInterface
Infers the constructor argument type.

Constants

ACCESSOR  = 1
MUTATOR  = 2
PROPERTY  = 0

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

Properties

$arrayMutatorPrefixes

private array<string|int, mixed> $arrayMutatorPrefixes

$docBlocks

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

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|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

canAccessMemberBasedOnItsVisibility()

private canAccessMemberBasedOnItsVisibility(ReflectionProperty|ReflectionMethod $member) : bool
Parameters
$member : ReflectionProperty|ReflectionMethod
Return values
bool

getDescriptionsFromDocNode()

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}

getDocBlockFromMethod()

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

getDocBlockFromProperty()

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

        
On this page

Search results