Skip to content
This repository was archived by the owner on Sep 1, 2023. It is now read-only.

Commit 18b40c1

Browse files
committed
Bump version requirement, use new reify APIs
1 parent 9f0f497 commit 18b40c1

File tree

5 files changed

+9
-7
lines changed

5 files changed

+9
-7
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ sudo: required
22
language: generic
33
services: docker
44
env:
5-
- HHVM_VERSION=4.16-latest
5+
- HHVM_VERSION=4.17-latest
66
- HHVM_VERSION=latest
77
- HHVM_VERSION=nightly
88
install:

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@ TypeAssert [![Build Status](https://travis-ci.org/hhvm/type-assert.svg?branch=ma
33

44
Hack library for converting untyped data to typed data.
55

6-
Warning for `TypeAssert::matches_type_structure()`
6+
Warning for `TypeAssert\matches_type_structure()`
77
--------------------------------------------------
88

99
`TypeStructure<T>`, `type_structure()`, and `ReflectionTypeAlias::getTypeStructures()`
1010
are experimental features of HHVM, and not supported by Facebook or the HHVM team.
1111
This means that `matches_type_structure()` may need to be removed in a future release
1212
without warning.
1313

14-
`matches_type_structure()` is based on these APIs as there is not
15-
currently a viable alternative.
14+
We strongly recommend moving to `TypeAssert\matches<T>()` and
15+
`TypeCoerce\match<T>()` instead.
1616

1717
Installation
1818
------------
@@ -50,6 +50,7 @@ These include:
5050
- `not_null<T>(?T): T`
5151
- `instance_of<T>(classname<T>, mixed): T`
5252
- `classname_of<T>(classname<T>, mixed): classname<T>`
53+
- `matches<T>(mixed): T`
5354
- `matches_type_structure<T>(TypeStructure<T>, mixed): T`
5455

5556
Coercion
@@ -65,6 +66,7 @@ similar set of functions:
6566
- `resource(mixed): resource`
6667
- `num(mixed): num`
6768
- `arraykey(mixed): arraykey`
69+
- `match<T>(mixed): T`
6870
- `match_type_structure<T>(TypeStructure<T>, mixed): T`
6971

7072
These will do 'safe' transformations, such as int-ish strings to int, ints to

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"license": "MIT",
55
"keywords": ["hack", "TypeAssert" ],
66
"require": {
7-
"hhvm": "^4.16",
7+
"hhvm": "^4.17",
88
"hhvm/hsl": "^4.0"
99
},
1010
"extra": {

src/TypeAssert.hack

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ function matches_type_structure<T>(TypeStructure<T> $ts, mixed $value): T {
6161

6262
function matches<reify T>(mixed $value): T {
6363
return matches_type_structure(
64-
\HH\ReifiedGenerics\getTypeStructure<T>(),
64+
\HH\ReifiedGenerics\get_type_structure<T>(),
6565
$value,
6666
);
6767
}

src/TypeCoerce.hack

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ function match_type_structure<T>(TypeStructure<T> $ts, mixed $value): T {
4646

4747
function match<reify T>(mixed $value): T {
4848
return match_type_structure(
49-
\HH\ReifiedGenerics\getTypeStructure<T>(),
49+
\HH\ReifiedGenerics\get_type_structure<T>(),
5050
$value,
5151
);
5252
}

0 commit comments

Comments
 (0)