# Something|null return type declaration

- Thread: https://externals.io/message/89568
- Original archive: https://news-web.php.net/php.internals/89568
- Started by Tom Worster on 2015-12-03T14:58:45+00:00
- Messages: 3
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #89568 — Tom Worster — 2015-12-03T14:58:45+00:00

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

Not being a regular on this list, I want to ask if there is history of
discussion of a "something or nul" return type declaration for PHP 7.

I'm only interested in this narrowly defined change, the PHP equivalent of a
`/** @return Something|null */` dockblock tag *without* generalizing to `/**
@return A|B|C... */`.

If this is already argued to death, or even just a bit, I'd like to read the
RFC(s) and discussion. Grateful for pointers.

Tom

---

## #89575 — Ben Scholzen 'DASPRiD' — 2015-12-03T15:43:55+00:00

URL: https://externals.io/message/89568#89575 · In reply to: #89568

> Not being a regular on this list, I want to ask if there is history of
> discussion of a "something or nul" return type declaration for PHP 7.
>
> I'm only interested in this narrowly defined change, the PHP equivalent of a
> `/** @return Something|null */` dockblock tag *without* generalizing to `/**
> @return A|B|C... */`.
>
> If this is already argued to death, or even just a bit, I'd like to read the
> RFC(s) and discussion. Grateful for pointers.

There's an RFC for union types:
https://wiki.php.net/rfc/union_types

As far as I know, there was a general consent against a simple nullable 
hint.

-- 
Ben Scholzen 'DASPRiD'
Community Review Team Member | mail@dasprids.de
Zend Framework               | http://www.dasprids.de

---

## #89578 — Andrea Faulds — 2015-12-03T15:57:29+00:00

URL: https://externals.io/message/89568#89578 · In reply to: #89568

Hi Tom,

Tom Worster wrote:
> Not being a regular on this list, I want to ask if there is history of
> discussion of a "something or nul" return type declaration for PHP 7.

Yes. In fact there are currently two RFCs proposing different approaches 
for this, if you look at the wiki:

- http://wiki.php.net/rfc/nullable_types

- http://wiki.php.net/rfc/union_types

> If this is already argued to death, or even just a bit, I'd like to read the
> RFC(s) and discussion. Grateful for pointers.

If you search the archives of this mailing list (e.g. with marc.info, 
though there are other, probably better, websites) you can look at the 
discussions for these RFCs.

Hope this is helpful.

-- 
Andrea Faulds
http://ajf.me/
