TypeHandlingUtility

class \TYPO3\CMS\Extbase\Utility\TypeHandlingUtility

PHP type handling functions

Table of Contents

Constants

LITERAL_TYPE_PATTERN  : mixed = '/^(?:integer|int|float|double|boolean|bool|str...
A type pattern to detect literal types.
PARSE_TYPE_PATTERN  : mixed = '/^\\\\?(?P<type>integer|int|float|double|boole...
A property type parse pattern.

Properties

$collectionTypes  : array

Methods

isCollectionType()  : bool
Returns TRUE if the $type is a collection type.
isCoreType()  : bool
Returns TRUE if the $type is a CMS core type object.
isLiteral()  : bool
Returns TRUE if the $type is a literal.
isSimpleType()  : bool
Returns TRUE if the $type is a simple type.
isValidTypeForMultiValueComparison()  : bool
Returns TRUE when the given value can be used in an "in" comparison in a query.
normalizeType()  : string
Normalize data types so they match the PHP type names: int -> integer double -> float bool -> boolean
parseType()  : array
Returns an array with type information, including element type for collection types (array, SplObjectStorage, ...)

Constants

LITERAL_TYPE_PATTERN

A type pattern to detect literal types.

public mixed LITERAL_TYPE_PATTERN = '/^(?:integer|int|float|double|boolean|bool|string)$/'

PARSE_TYPE_PATTERN

A property type parse pattern.

public mixed PARSE_TYPE_PATTERN = '/^\\\\?(?P<type>integer|int|float|double|boolean|bool|strin…
Show the full value'/^\\\\?(?P<type>integer|int|float|double|boolean|bool|string|DateTimeImmutable|DateTime|[A-Z][a-zA-Z0-9\\\\]+|object|resource|array|ArrayObject|SplObjectStorage|TYPO3\\\\CMS\\\\Extbase\\\\Persistence\\\\ObjectStorage)(?:<\\\\?(?P<elementType>[a-zA-Z0-9\\\\]+)>)?/'

Properties

$collectionTypes

protected static array $collectionTypes = ['array', \ArrayObject::class, \SplObjectStorage::class, \TY…
Show the full value['array', \ArrayObject::class, \SplObjectStorage::class, \TYPO3\CMS\Extbase\Persistence\ObjectStorage::class]

Methods

isCollectionType()

Returns TRUE if the $type is a collection type.

public static isCollectionType(string $type) : bool

Parameters

$type : string

Return values

bool

isCoreType()

Returns TRUE if the $type is a CMS core type object.

public static isCoreType(string|object $type) : bool

Parameters

$type : string|object

Return values

bool

isLiteral()

Returns TRUE if the $type is a literal.

public static isLiteral(string $type) : bool

Parameters

$type : string

Return values

bool

isSimpleType()

Returns TRUE if the $type is a simple type.

public static isSimpleType(string $type) : bool

Parameters

$type : string

Return values

bool

isValidTypeForMultiValueComparison()

Returns TRUE when the given value can be used in an "in" comparison in a query.

public static isValidTypeForMultiValueComparison(mixed $value) : bool

Parameters

$value : mixed

Return values

bool

normalizeType()

Normalize data types so they match the PHP type names: int -> integer double -> float bool -> boolean

public static normalizeType(string $type) : string

Parameters

$type : string

Data type to unify

Return values

string —

unified data type

parseType()

Returns an array with type information, including element type for collection types (array, SplObjectStorage, ...)

public static parseType(string $type) : array

Parameters

$type : string

Type of the property (see PARSE_TYPE_PATTERN)

Tags

throws
InvalidTypeException

Return values

array —

An array with information about the type

On this page