php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #80248 Swapping parameter names during inheritance does not throw
Submitted: 2020-10-16 21:24 UTC Modified: 2020-10-16 21:35 UTC
From: michael dot vorisek at email dot cz Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 8.0.0RC2 OS: any
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: michael dot vorisek at email dot cz
New email:
PHP Version: OS:

 

 [2020-10-16 21:24 UTC] 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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2020-10-16 21:35 UTC] nikic@php.net
-Status: Open +Status: Not a bug
 [2020-10-16 21:35 UTC] nikic@php.net
Behavior described in the "Alternatives" section of a proposal is non-normative.
 [2020-10-16 21:47 UTC] michael dot vorisek at emal dot cz
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
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri May 24 03:01:33 2024 UTC