> On Sep 2, 2020, at 12:05 PM, Michael Voříšek - ČVUT FEL
> <[email protected]> wrote:
>
> I like "void", as "null" can be ambiguous.
>
> Imagine function example($a = 'default value 1', $b = 'default value 2') {}
>
> With "void", we can allow skipping arguments in advance to the default
> pamameter value like example(void, 'test');.
>
I second the use of “void" over “null” - for what it's worth.
Mainly the rationale for me is that I would like to reserve “null” for empty or
non-existent object.
[
“key” => 1,
“key2” => null // empty object
]
“void" is already being used on the tail of functions to say, “This thing does
not return anything; and can be ignored.”
So:
foreach($collection as $key => void)
Says, “This thing can be ignored” (void) and not, “this thing doesn’t exist but
maybe should” (null).
Cheers,
Johs