TypeGenerator
in package
implements
GeneratorInterface
Interfaces, Classes, Traits and Enums
Table of Contents
- $internalPhpTypes : array<string|int, string>
- $isInternalPhpType : bool
- $nullable : bool
- $type : string
- $validIdentifierMatcher : string
- __toString() : string
- fromTypeString() : TypeGenerator
- generate() : mixed
- __construct() : mixed
- isInternalPhpType() : bool
- trimNullable() : array<string|int, bool>|array<string|int, string>
- trimType() : array<string|int, bool>|array<string|int, string>
Properties
$internalPhpTypes
private
static array<string|int, string>
$internalPhpTypes
= ['void', 'int', 'float', 'string', 'bool', 'array', 'callable', 'iterable', 'object']
Tags
$isInternalPhpType
private
bool
$isInternalPhpType
$nullable
private
bool
$nullable
$type
private
string
$type
$validIdentifierMatcher
private
static string
$validIdentifierMatcher
= '/^[a-zA-Z_\\x80-\\xff][a-zA-Z0-9_\\x80-\\xff]*' . '(\\\\[a-zA-Z_\\x80-\\xff][a-zA-Z0-9_\\x80-\\xff]*)*$/'
a regex pattern to match valid class names or types
Methods
__toString()
public
__toString() : string
Return values
string —the cleaned type string
fromTypeString()
public
static fromTypeString(string $type) : TypeGenerator
Parameters
- $type : string
Tags
Return values
TypeGenerator —generate()
public
generate() : mixed
Return values
mixed —__construct()
private
__construct() : mixed
Return values
mixed —isInternalPhpType()
private
static isInternalPhpType(string $type) : bool
Parameters
- $type : string
Return values
bool —trimNullable()
private
static trimNullable(string $type) : array<string|int, bool>|array<string|int, string>
Parameters
- $type : string
Return values
array<string|int, bool>|array<string|int, string> —ordered tuple, first key represents whether the type is nullable, second is the trimmed string
trimType()
private
static trimType(string $type) : array<string|int, bool>|array<string|int, string>
Parameters
- $type : string
Return values
array<string|int, bool>|array<string|int, string> —ordered tuple, first key represents whether the values was trimmed, second is the trimmed string