On 22.10.2014 10:37, Bob Weinand wrote:
> I know we have that already discussed a lot now, but I’d like to expose my
> points on the return value here:
>
> I imagine code like (supposing that we ever will have scalar typehints):
>
> function acceptsInt (int $i = null) {
> if ($i === null) {
> $i = 2 /* default value */;
> }
> /* do something with $i */
> }
NULL isn't a pointer for a default value - it's simply a type with no
value - no more - no less.
>From your example: why do you accept NULL if you need a integer default
value?
function acceptsInt (int $i = 2) { ...
Marc
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php