Changeset View
Changeset View
Standalone View
Standalone View
src/parser/PhutilTypeSpec.php
| Show All 33 Lines | |||||
| * | * | ||||
| * int|string | * int|string | ||||
| * map<int, bool> | * map<int, bool> | ||||
| * list<list<wild>> | * list<list<wild>> | ||||
| * optional int | * optional int | ||||
| * string (uppercase) | * string (uppercase) | ||||
| * | * | ||||
| */ | */ | ||||
| final class PhutilTypeSpec { | final class PhutilTypeSpec extends Phobject { | ||||
| private $type; | private $type; | ||||
| private $subtypes = array(); | private $subtypes = array(); | ||||
| private $optional; | private $optional; | ||||
| private $comment; | private $comment; | ||||
| private function __construct() {} | private function __construct() {} | ||||
| ▲ Show 20 Lines • Show All 110 Lines • ▼ Show 20 Lines | public static function checkMap(array $values, array $types) { | ||||
| } | } | ||||
| if ($missing) { | if ($missing) { | ||||
| throw new PhutilTypeMissingParametersException($missing); | throw new PhutilTypeMissingParametersException($missing); | ||||
| } | } | ||||
| foreach ($types as $key => $type) { | foreach ($types as $key => $type) { | ||||
| if (array_key_exists($key, $values)) { | if (array_key_exists($key, $values)) { | ||||
| $type->check($values[$key]); | $type->check($values[$key], $key); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| public static function getCommonParentClass($class_a, $class_b) { | public static function getCommonParentClass($class_a, $class_b) { | ||||
| $ancestors_a = array(); | $ancestors_a = array(); | ||||
| do { | do { | ||||
| $ancestors_a[] = $class_a; | $ancestors_a[] = $class_a; | ||||
| ▲ Show 20 Lines • Show All 1,735 Lines • Show Last 20 Lines | |||||