PlainSprintf
This type has some magic behavior: whenever it appears as a function parameter (in a function with varargs), the argument must be a static string, and will be parsed for % formatting specifiers (which will determine the type of the varargs)
T is treated as a state machine. After the first %, each character causes the corresponding method in T to be looked up. For example, '%b' will "call" the method
function format_b(int $s) : string;
and consume an 'int' from the argument list.
Hex escapes are used for non-alphabetic characters. The '%%' pseudo-specifier consumes nothing and appears as
function format_0x25() : string;
Modifiers and multi-char entries can be encoded by return a new formatter instead of a string:
function format_upcase_l() : ListFormatter;
function format_0x2a(int $s) : PaddingFormatter;
Note that you could use an actual instance of T to do the formatting. We don't; T is only here to provide the types.
For another example on how to implement your own format string interface, see \HH\Lib\Str\SprintfFormat in the HSL.
Interface Synopsis
interface PlainSprintf {...}
Public Methods
->format_0x20(): PlainSprintf
->format_0x25(): string
->format_0x27(): SprintfQuote
->format_0x2b(): PlainSprintf
->format_0x2d(): PlainSprintf
->format_0x2e(): PlainSprintf
->format_0x30(): PlainSprintf
->format_0x31(): PlainSprintf
->format_0x32(): PlainSprintf
->format_0x33(): PlainSprintf
->format_0x34(): PlainSprintf
->format_0x35(): PlainSprintf
->format_0x36(): PlainSprintf
->format_0x37(): PlainSprintf
->format_0x38(): PlainSprintf
->format_0x39(): PlainSprintf
->format_b(int $s): string
->format_c(?int $s): string
->format_d(mixed $s): string
->format_e(?float $s): string
->format_f(mixed $s): string
->format_g(?float $s): string
->format_l(): PlainSprintf
->format_o(?int $s): string
->format_s(?arraykey $s): string
->format_u(?int $s): string
->format_upcase_e(?float $s): string
->format_upcase_f(?float $s): string
->format_upcase_x(?int $s): string
->format_x(mixed $s): string