3 ms·
Introducing `false` as a standalone type but not `true` is what makes this weird. Generic, literal returns are fine. Python is another language that has it [1].
by bow_ 4y ago
Introducing `false` as a standalone type but not `true` is what makes this weird. Generic, literal returns are fine. Python is another language that has it [1].
The introduction of the RFC [2] also still mentions `false` is of type bool:
> null corresponds to PHP's unit type, i.e. the type which holds a single value. false is a literal type of type bool.
But why call it bool if `true` is not a standalone type too?
[1] https://docs.python.org/3/library/typing.html#typing.Literal https://docs.python.org/3/library/typing.html#typing.Literal
[2] https://wiki.php.net/rfc/null-false-standalone-types https://wiki.php.net/rfc/null-false-standalone-types