Hello,
Le lun. 2 mars 2015 à 00:03, Marcio Almada <[email protected]> a écrit :
Hi, internals
>
> I'm moving the "Strict Argument Count" RFC into discussion phase:
>
> RFC: https://wiki.php.net/rfc/strict_argcount
> PR: https://github.com/php/php-src/pull/1108
>
> Many different opinions were collected during research phase and the RFC
> was updated with real BC break measurements and other important sections.
> So, before discussing:
>
> - Even if you already read the RFC in the past, read it again now.
> - Don't claim **possible** massive BC breaks before read the
> measurements already done. No matter how seasoned you are with PHP, real
> numbers matter most than assumptions. Your measurements are welcome too.
> - Try the patch. Really.
> - Consider reading the use case present on this post: goo.gl/3ykdIy
> - Keep discussion on topic and remember we are all trying to improve PHP
> in some way :)
>
> Thanks,
> Márcio
>
I'm globally +0.5, however I have some concerns:
What about constructors?
Children classes may have a bigger number of arguments for their ctors than
their parents. Even if not very elegant, it is possible some are passing a
fixed number of arguments while constructing an object, whether that object
will take it into account or not.
Something like:
class A {
function __construct($a)
}
class B extends A {
function __construct($a, $b)
}
$kind = $bool ? "A" : "B";
$object = new $kind($foo, $bar);
Why aren't you using E_NOTICE?
[1]: Run-time notices. Indicate that the script encountered something that
could indicate an error, but could also happen in the normal course of
running a script.
E_DEPRECATED:
-1, what is E_DEPRECATED is supposed to be removed in a future version. And
that is a huge BC break if it happens. Btw, you're not mentioning in which
version of PHP the support of extra parameters would be removed.
E_WARNING:
-1, IMHO, calling functions/methods with more arguments generally has less
impact than other aspects that currently generate E_NOTICES (e.g. using
undefined variables, constants,...). Using an error reporting level
stronger than for those cases looks inconsistent.
Cheers and thanks for the impressive work so far!
Patrick
[1] http://php.net/manual/en/errorfunc.constants.php