> From: Will Fitch [mailto:[email protected]]
>
> I would like to take this opportunity to query on a consensus:
>
> Would you prefer to allow methods with type hinted return values to return
> null at will, or add a marker noting that it *may* return null?
>
> Example: Return null at will
>
> public ArrayIterator getIterator()
> {
> // something happened, will return null
> return null;
> }
>
> Example: Return only if identified as such
>
> public ArrayIterator? getIterator()
> {
> return null;
> }
I hate the syntax in the second example (using ?).
IMO allowing null should be the default unless specifically disallowed.
I far prefer the addition/use of a keyword ("notnull" or "null") to disallow
(or allow) as opposed to random symbol abuse (potential incompatibilities
notwithstanding).
John Crenshaw
Priacta, Inc.
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php