Cloneable Final Instantiable
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 $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.
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
private $fqsenResolver
private $keywords
  • var array List of recognized keywords and unto which Value Object they map
  • psalm-var array>
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.

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

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

  • 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

private resolveClassString ( ArrayIterator $tokens , phpDocumentor\Reflection\Types\Context $context ) : phpDocumentor\Reflection\Type

Resolves class string

private resolveCollection ( ArrayIterator $tokens , phpDocumentor\Reflection\Type $classType , phpDocumentor\Reflection\Types\Context $context ) : phpDocumentor\Reflection\Type

Resolves the collection values and keys

  • return Array_ | Iterable_ | Collection
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
© 2021 Bruce Wells
Search Namespaces \ Classes