| 1 | <?php |
||
| 15 | abstract class TypeHint implements HintInterface |
||
| 16 | { |
||
| 17 | /** |
||
| 18 | * @var string |
||
| 19 | */ |
||
| 20 | private $name; |
||
| 21 | |||
| 22 | /** |
||
| 23 | * @var Matchable[] |
||
| 24 | */ |
||
| 25 | private $matchers = []; |
||
| 26 | |||
| 27 | /** |
||
| 28 | * TypeHint constructor. |
||
| 29 | * @param string $name |
||
| 30 | */ |
||
| 31 | public function __construct(string $name) |
||
| 35 | |||
| 36 | /** |
||
| 37 | * @return string |
||
| 38 | */ |
||
| 39 | public function getName(): string |
||
| 43 | |||
| 44 | /** |
||
| 45 | * @param Matchable $matcher |
||
| 46 | * @return Disjunction |
||
| 47 | */ |
||
| 48 | public function addMatcher(Matchable $matcher): Matchable |
||
| 54 | |||
| 55 | /** |
||
| 56 | * @param string $name |
||
| 57 | * @param mixed $value |
||
| 58 | * @return bool |
||
| 59 | */ |
||
| 60 | protected function matchScalar(string $name, $value): bool |
||
| 81 | |||
| 82 | /** |
||
| 83 | * @param mixed $value |
||
| 84 | * @return bool |
||
| 85 | */ |
||
| 86 | public function match($value): bool |
||
| 90 | |||
| 91 | /** |
||
| 92 | * @param string $name |
||
| 93 | * @return bool |
||
| 94 | */ |
||
| 95 | private function isBuiltin(string $name): bool |
||
| 99 | |||
| 100 | /** |
||
| 101 | * @param string $name |
||
| 102 | * @param mixed $value |
||
| 103 | * @return bool |
||
| 104 | */ |
||
| 105 | private function matchBuiltin(string $name, $value): bool |
||
| 111 | } |
||
| 112 |
If you suppress an error, we recommend checking for the error condition explicitly: