On 17/06/2016 10:08, Björn Larsson wrote:
And pardon me, but saying that we can wait until an PHP 8.0 release
that we have no clue about when it will happen sounds in my eyes
a bit to far off. Going that direction means instead that boiler plate
code is needed to catch that exact number of parameters is sent.
A couple of points here: 8.0 doesn't need to be "a long way off", and we
can know exactly when it will happen if we make that decision - people
seem scared of doing this, for some reason, but it's not like we're
waiting for a pronouncement from $deity.
Meanwhile, this feature doesn't actually make things any different for
people writing functions, as I pointed out elsewhere: any parameter with
a type hint is already properly mandatory; any parameter without is
nullable anyway. So as a function author, you simply don't need to care:
function foo($bar) { var_dump($bar); }
foo();
foo(null);
The second version is not going to be prohibited by this change, so your
function has to either handle NULLs, or have a type hint.
As far as the user of the function goes, if you want to improve your
code quality, just make sure it runs without generating any warnings!
This is why I really don't understand what the hurry is to get this into
the release: the BC break may be marginal, but so is the benefit. Why
not just postpone both until the performance benefits are more concrete?
Regards,
--
Rowan Collins
[IMSoP]
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php