Copied!
CloneableFinalInstantiable
Methods
public __construct(?phpDocumentor\Reflection\FqsenResolver $fqsenResolver = NULL)
 

Initializes this TypeResolver with the means to create and resolve Fqsen objects.

public addKeyword(string $keyword, string $typeClassName) : void
 

Adds a keyword to the list of Keywords and associates it with a specific Value Object.

  • psalm-param class-string<Type> $typeClassName
public resolve(string $type, ?phpDocumentor\Reflection\Types\Context $context = NULL) : phpDocumentor\Reflection\Type
 

Analyzes the given type and returns the FQCN variant.

When a type is provided this method checks whether it is not a keyword or
Fully Qualified Class Name. If so it will use the given namespace and
aliases to expand the type to a FQCN representation.

This method only works as expected if the namespace and aliases are set;
no dynamic reflection is being performed here.

  • uses \Context::getNamespaceAliases()to check whether the first part of the relative type name should not be
    replaced with another namespace.
  • uses \Context::getNamespace()to determine with what to prefix the type name.
  • param string $type The relative or absolute type.
Constants
private phpDocumentor\Reflection\TypeResolver::OPERATOR_ARRAY = '[]'
 
  • var string Definition of the ARRAY operator for types
private phpDocumentor\Reflection\TypeResolver::OPERATOR_NAMESPACE = '\'
 
  • var string Definition of the NAMESPACE operator in PHP
private phpDocumentor\Reflection\TypeResolver::PARSER_IN_ARRAY_EXPRESSION = 2
 
  • var int the iterator parser is inside an array expression context
private phpDocumentor\Reflection\TypeResolver::PARSER_IN_COLLECTION_EXPRESSION = 3
 
  • var int the iterator parser is inside a collection expression context
private phpDocumentor\Reflection\TypeResolver::PARSER_IN_COMPOUND = 0
 
  • var int the iterator parser is inside a compound context
private phpDocumentor\Reflection\TypeResolver::PARSER_IN_NULLABLE = 1
 
  • var int the iterator parser is inside a nullable expression context
Properties
private phpDocumentor\Reflection\FqsenResolver $fqsenResolver
 
  • psalm-readonly
private array $keywords
 
  • var array<string,string> List of recognized keywords and unto which Value Object they map
  • psalm-var array<string, class-string<Type>>
Methods
private isFqsen(string $type) : bool
 

Tests whether the given type is a Fully Qualified Structural Element Name.

  • psalm-mutation-free
private isKeyword(string $type) : bool
 

Detects whether the given type represents a PHPDoc keyword.

  • param string $type A relative or absolute type as defined in the phpDocumentor documentation.
  • psalm-mutation-free
private isPartialStructuralElementName(string $type) : bool
 

Detects whether the given type represents a relative structural element name.

  • param string $type A relative or absolute type as defined in the phpDocumentor documentation.
  • psalm-mutation-free
private makeCollectionFromObject(phpDocumentor\Reflection\Types\Object_ $object, phpDocumentor\Reflection\Type $valueType, ?phpDocumentor\Reflection\Type $keyType = NULL) : phpDocumentor\Reflection\Types\Collection
 
  • psalm-pure
private parseTypes(ArrayIterator $tokens, phpDocumentor\Reflection\Types\Context $context, int $parserContext) : phpDocumentor\Reflection\Type
 

Analyse each tokens and creates types

  • param ArrayIterator<int,string|null> $tokens the iterator on tokens
  • param int $parserContext on of self::PARSER_* constants, indicating
    the context where we are in the parsing
private resolveClassString(ArrayIterator $tokens, phpDocumentor\Reflection\Types\Context $context) : phpDocumentor\Reflection\Type
 

Resolves class string

  • param ArrayIterator<int,(string|null)> $tokens
private resolveCollection(ArrayIterator $tokens, phpDocumentor\Reflection\Type $classType, phpDocumentor\Reflection\Types\Context $context) : phpDocumentor\Reflection\Type
 

Resolves the collection values and keys

  • param ArrayIterator<int,(string|null)> $tokens
  • return Array_|Iterable_|Collection
private resolveInterfaceString(ArrayIterator $tokens, phpDocumentor\Reflection\Types\Context $context) : phpDocumentor\Reflection\Type
 

Resolves class string

  • param ArrayIterator<int,(string|null)> $tokens
private resolveIntRange(ArrayIterator $tokens) : phpDocumentor\Reflection\Type
 

Resolves integer ranges

  • param ArrayIterator<int,(string|null)> $tokens
private resolveKeyword(string $type) : phpDocumentor\Reflection\Type
 

Resolves the given keyword (such as string) into a Type object representing that keyword.

  • psalm-mutation-free
private resolveSingleType(string $type, phpDocumentor\Reflection\Types\Context $context) : object
 

resolve the given type into a type object

private resolveTypedObject(string $type, ?phpDocumentor\Reflection\Types\Context $context = NULL) : phpDocumentor\Reflection\Types\Object_
 

Resolves the given FQSEN string into an FQSEN object.

  • psalm-mutation-free
© 2022 Bruce Wells
Search Namespaces \ Classes
Configuration