# Concept: 7.1 nullable function parameter format ...

- Thread: https://externals.io/message/95994
- Original archive: https://news-web.php.net/php.internals/95994
- Started by David Dj Eddy on 2016-09-14T15:10:29+00:00
- Messages: 2
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · RFCs at https://externals.io/rfc.md · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #95994 — David Dj Eddy — 2016-09-14T15:10:29+00:00

URL: https://externals.io/message/95994#95994

Issue: Currently the format for nullable function parameters is as
follows: `fn(?int $param)`; this makes little visual sense from an
outside perspective. What does the `?` mean? PHP does not have a `?`
data type; it is very visually ambiguous.

Suggestion: `fn(null|int $param)`. This uses the same syntax format
that other logic constructs in the language use as well as being very
explicit to the data types allowed for the parameter. For the moment
only `null|{one other data type}` would be the goal of the RFC;
however in future iterations multiple data types could be allowed.

Gauge initial interest in a alteratio of this type, thanks for your time.

David E.

---

## #95995 — Christoph M. Becker — 2016-09-14T16:03:50+00:00

URL: https://externals.io/message/95994#95995 · In reply to: #95994

> Issue: Currently the format for nullable function parameters is as
> follows: `fn(?int $param)`; this makes little visual sense from an
> outside perspective. What does the `?` mean? PHP does not have a `?`
> data type; it is very visually ambiguous.
> 
> Suggestion: `fn(null|int $param)`. This uses the same syntax format
> that other logic constructs in the language use as well as being very
> explicit to the data types allowed for the parameter. For the moment
> only `null|{one other data type}` would be the goal of the RFC;
> however in future iterations multiple data types could be allowed.
> 
> Gauge initial interest in a alteratio of this type, thanks for your time.

There has already been the union type RFC[1], which has recently been
declined.

[1] <https://wiki.php.net/rfc/union_types>

-- 
Christoph M. Becker
