repo.or.cz
/
hiphop-php.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
New inference: improved error message for unresolved type
[hiphop-php.git]
/
hphp
/
hack
/
test
/
typecheck
/
nullable_generic_good.php
blob
d808d1caf2d195986667e45998444595c999e691
1
<
?hh
// strict
2
// Copyright 2004-present Facebook. All Rights Reserved.
3
4
function
coerce
<
T
>(
5
TypeStructure
<
T
>
$ts
,
6
mixed
$value
,
7
):
T
{
8
//UNSAFE
9
}
10
11
function
getNullableParamOfType
<
T
>(
12
TypeStructure
<
T
>
$ts
,
13
mixed
$value
14
):
?T
{
15
if
(
$value
===
null
) {
16
return null
;
17
}
18
return
coerce
(
$ts
,
$value
);
19
}