TypeHandling
abstract class TypeHandling (View source)
PHP type handling functions
Constants
PARSE_TYPE_PATTERN |
A property type parse pattern. |
LITERAL_TYPE_PATTERN |
A type pattern to detect literal types. |
Properties
static protected array | $collectionTypes |
Methods
Returns an array with type information, including element type for collection types (array, SplObjectStorage, ...)
Normalize data types so they match the PHP type names: int -> integer double -> float bool -> boolean
Returns true if the $type is a literal.
Returns true if the $type is a simple type.
Returns true if the $type is a collection type.
Parses a composite type like "\Foo\Collection<\Bar\Entity>" into "\Foo\Collection" Note: If the given type does not specify an element type it is not changed
No description
Return simple type or class for object
Details
static array
parseType(string $type)
Returns an array with type information, including element type for collection types (array, SplObjectStorage, ...)
static string
normalizeType(string $type)
Normalize data types so they match the PHP type names: int -> integer double -> float bool -> boolean
static bool
isLiteral(string $type)
Returns true if the $type is a literal.
static bool
isSimpleType(string $type)
Returns true if the $type is a simple type.
static bool
isCollectionType(string $type)
Returns true if the $type is a collection type.
static string
truncateElementType(string $type)
Parses a composite type like "\Foo\Collection<\Bar\Entity>" into "\Foo\Collection" Note: If the given type does not specify an element type it is not changed
static string
stripNullableType(string $type)
No description
static string
getTypeForValue(mixed $value)
Return simple type or class for object