\Phabstractic\Data\TypesType

Functions

getValueType()

getValueType(mixed  $value) : \Phabstractic\Data\Types\Type|boolean

Generates an enumerated Type representative value from a given variable

This steps through the various type tests PHP is able to do to determine the type of a variable (bool, int, etc.) and then returns that type as a representative value from the Type Class above (an actual instance).

Note: With a Typed Object, the enumeration instance includes the immediate class value available from get_class of the value regardless of inheritance, implementation, or trait

Note: This function only checks user-defined functions for 'function' type. Not internal functions. The 'function' type is based on the string type, so it supersedes the string type if evaluated as true.

Important: This returns a enumeration object with an enumeration value. Unless a typed object, then returns an array with an enumeration object with an enumerated value, AND the object.

VERSION 3 INFORMATION:

Parameters

mixed $value

The variable we wish to determine

Returns

\Phabstractic\Data\Types\Type|boolean —

The enumeration instance, or false on 'failure'

stringToType()

stringToType(string  $string) : \Phabstractic\Data\Types\Type\Falcraft\Data\Types\Type|null

Generates a type enumeration instance based on a given string

This function takes a string input and steps through various possible values to generate a new instance of a type enumeration.

Note: This function cannot return 'typed' objects, only standard generic objects inheriting from stdClass.

Important: This returns a enumeration object with an enumeration value.

Parameters

string $string

The string to evaluate

Returns

\Phabstractic\Data\Types\Type\Falcraft\Data\Types\Type|null —

The type object set to the appropriate type, or null otherwise