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

Commit 0a238a4

Browse files
committed
fix assignments as expressions
1 parent 7aec065 commit 0a238a4

File tree

4 files changed

+10
-6
lines changed

4 files changed

+10
-6
lines changed

src/PageSections/FunctionishReturnValues.hack

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,12 @@ final class FunctionishReturnValues extends PageSection {
4646

4747
$types =
4848
Vec\filter($docs['types'], $type ==> $type !== '\-' && $type !== '-');
49+
$typehint = $f->getReturnType();
4950
if ($types) {
5051
$ret .= '`'.Str\join($types, '|').'`';
51-
} else if ($type = $f->getReturnType()) {
52+
} else if ($typehint) {
5253
$ret .=
53-
'`'._Private\stringify_typehint($f->getNamespaceName(), $type).'`';
54+
'`'._Private\stringify_typehint($f->getNamespaceName(), $typehint).'`';
5455
}
5556
$text = $docs['text'];
5657
if ($text !== null) {

src/PageSections/InterfaceSynopsis.hack

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,8 @@ final class InterfaceSynopsis extends PageSection {
147147
if ($p !== null) {
148148
$ret .= ' extends '._Private\stringify_typehint($ns, $p);
149149
}
150-
if ($interfaces = $c->getInterfaceInfo()) {
150+
$interfaces = $c->getInterfaceInfo();
151+
if ($interfaces) {
151152
$ret .= $interfaces
152153
|> Vec\map($$, $i ==> _Private\stringify_typehint($ns, $i))
153154
|> Str\join($$, ', ')

src/PageSections/_Private/stringify_functionish_signature.hack

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ function stringify_functionish_signature(
5555
$ret .= stringify_generics($ns, $function->getGenericTypes());
5656
$ret .= stringify_parameters($ns, $format, $function, $docs);
5757

58-
if ($type = $function->getReturnType()) {
58+
$type = $function->getReturnType();
59+
if ($type) {
5960
$ret .= ': '.stringify_typehint($ns, $type);
6061
}
6162

src/PageSections/_Private/stringify_parameter.hack

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,11 @@ function stringify_parameter(
2626
}
2727

2828
$types = $docs['types'] ?? vec[];
29+
$typehint = $parameter->getTypehint();
2930
if ($types) {
3031
$s .= Str\join($types, '|').' ';
31-
} else if ($th = $parameter->getTypehint()) {
32-
$s .= stringify_typehint($ns, $th).' ';
32+
} else if ($typehint) {
33+
$s .= stringify_typehint($ns, $typehint).' ';
3334
}
3435

3536
if ($parameter->isVariadic()) {

0 commit comments

Comments
 (0)