Skip to content

Commit 60d4799

Browse files
Andrew Kennedymeta-codesync[bot]
authored andcommitted
Migrate Str functions to TypedFormatString
Summary: Use `TypedFormatString` in place of `FormatString` in functions in `Str`. Reviewed By: viratyosin Differential Revision: D90621610 fbshipit-source-id: ef263f88a5bbb3a0c5598f8514e150e1ff8e9396
1 parent e0e9fe6 commit 60d4799

File tree

2 files changed

+18
-8
lines changed

2 files changed

+18
-8
lines changed

hphp/hsl/src/str/format.php

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,14 @@ public function format_wild(): SprintfFormat;
7171
* @guide /hack/built-in-types/string
7272
* @guide /hack/functions/format-strings
7373
*/
74-
function format(
75-
SprintfFormatString $format_string,
76-
mixed ...$format_args
74+
<<__NoAutoLikes>>
75+
function format<Targs as (mixed...)>(
76+
\HH\TypedFormatString<SprintfFormat, Targs> $format_string,
77+
... Targs $format_args,
7778
)[]: string {
78-
return _Str\vsprintf_l(null, $format_string, $format_args);
79+
return _Str\vsprintf_l(
80+
null,
81+
$format_string,
82+
HH\FIXME\UNSAFE_CAST<(mixed...), vec<mixed>>($format_args),
83+
);
7984
}

hphp/hsl/src/str/format_l.php

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,15 @@
2020
* @guide /hack/built-in-types/string
2121
* @guide /hack/functions/format-strings
2222
*/
23-
function format_l(
23+
<<__NoAutoLikes>>
24+
function format_l<Targs as (mixed...)>(
2425
Locale\Locale $locale,
25-
SprintfFormatString $format_string,
26-
mixed ...$format_args
26+
\HH\TypedFormatString<SprintfFormat, Targs> $format_string,
27+
... Targs $format_args,
2728
)[]: string {
28-
return _Str\vsprintf_l($locale, $format_string, $format_args);
29+
return _Str\vsprintf_l(
30+
$locale,
31+
$format_string,
32+
HH\FIXME\UNSAFE_CAST<(mixed...), vec<mixed>>($format_args),
33+
);
2934
}

0 commit comments

Comments
 (0)