Bug #80248 [Com]: Swapping parameter names during inheritance does not throw
Edit report at https://bugs.php.net/bug.php?id=80248&edit=1
ID: 80248
Comment by: michael dot vorisek at emal dot cz
Reported by: michael dot vorisek at email dot cz
Summary: Swapping parameter names during inheritance does not
throw
Status: Not a bug
Type: Bug
Package: Scripting Engine problem
Operating System: any
PHP Version: 8.0.0RC2
Block user comment: N
Private report: N
New Comment:
Can this be addresses or is there any strong argument to allow it?
Example: https://3v4l.org/X8omS
by allowing reusing names for a different position, code may behave very unexpectedly when using/not
using named arguments
renaming to a completely new name is safe
Previous Comments:
------------------------------------------------------------------------
[2020-10-16 21:35:29] nikic@php.net
Behavior described in the "Alternatives" section of a proposal is non-normative.
------------------------------------------------------------------------
[2020-10-16 21:24:58] michael dot vorisek at email dot cz
Description:
------------
see test script from https://wiki.php.net/rfc/named_params
It does not throw.
In addition, I think, any parameter name reused on different position should throw.
Test script:
---------------
interface I {
public function test($foo, $bar);
}
class C implements I {
public function test($bar, $foo) {}
}
// Fatal error: Parameter $foo of C::test() at position #2 conflicts with
// parameter $foo of I::test() at position #1
Expected result:
----------------
catchable error
Actual result:
--------------
no error
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=80248&edit=1
Thread (3 messages)