2015-11-02 12:22 GMT+03:00 Rowan Collins <rowan.coll...@gmail.com>:

> Should they? func_get_args() can be used to simulate any function
> signature, so you could equally say that the following are "compatible":



Hello! Thank you for the answer.
However, question is not about func_get_args() at all, it can be removed to
simplify an example. However, I still have a doubts that these two
signatures are not compatible.

First definition declares exactly one single parameter, which can be absent
during the method call, so I can even write

public static function test() {}

Second definition defines zero or more arguments, so it can be also
described by the same signature:

public static function test() {}

Signature with variadic args will be incompatible if the first definition
requires additional arguments before optional and second signature doesn't
respect this, see https://3v4l.org/5Fsou (this behaviour is correct and
warnings are expected).

But if the number of required parameters are matching, then whole signature
should be matching. PHP5.6 with HHVM prove this fact, see:
https://3v4l.org/YCmPS, and PHP7.0 probably doesn't play well.

If you think, that the new logic in PHP7.0 is correct, then it should be
nice to have a small notice in BC change with PHP5.6 logic, somewhere in
http://php.net/manual/en/migration70.incompatible.php#migration70.incompatible.other.func-parameters
.

Reply via email to