Page MenuHomePhabricator

final class PhutilTypeSpec
Arcanist Technical Documentation ()

Perform type checks using a simple type grammar. The grammar supports the following basic types:

int
float
bool
string
null
callable
regex
wild
AnyClassOrInterfaceName

It supports the following complex types:

list<type>
map<type, type>
type|type

A type may be marked as optional by suffixing it with "?" or prefixing it with the word "optional":

int?
optional int

A type may have a human-readable comment in parentheses, at the end:

int (must be even)

For example, these are valid type specifications:

int|string
map<int, bool>
list<list<wild>>
optional int
string (uppercase)

Methods

private function __construct()

This method is not documented.
Return
this//Implicit.//

public function getType()

This method is not documented.
Return
wild

public function check($value, $name)

This method is not documented.
Parameters
$value
$name
Return
wild

public static function checkMap($values, $types)

This method is not documented.
Parameters
array$values
array$types
Return
wild

public static function getCommonParentClass($class_a, $class_b)

This method is not documented.
Parameters
$class_a
$class_b
Return
wild

public static function getTypeOf($value)

This method is not documented.
Parameters
$value
Return
wild

private static function getTypeOfVector($vector)

This method is not documented.
Parameters
array$vector
Return
wild

public function toString()

This method is not documented.
Return
wild

public static function newFromString($string)

This method is not documented.
Parameters
$string
Return
wild

public static function didReduceTokens($rule, $production, $tokens)

This method is not documented.
Parameters
$rule
$production
array$tokens
Return
wild

private static function getLexer()

This method is not documented.
Return
wild

private static function parseTokens($tokens, $callback)

This method is not documented.
Parameters
array$tokens
$callback
Return
wild