Bug #54310 [Com]: Class Method & Function Arguments are allowed to be named the same

From: Date: Tue, 22 Mar 2011 12:16:50 +0000
Subject: Bug #54310 [Com]: Class Method & Function Arguments are allowed to be named the same
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-159701@lists.php.net to get a copy of this message
Edit report at http://bugs.php.net/bug.php?id=54310&edit=1

 ID:                 54310
 Comment by:         jinmoku at hotmail dot com
 Reported by:        nicholas dot j dot miller at gmail dot com
 Summary:            Class Method & Function Arguments are allowed to be
                     named the same
 Status:             Open
 Type:               Bug
 Package:            *Compile Issues
 Operating System:   ANY
 PHP Version:        5.3.6
 Block user comment: N
 Private report:     N

 New Comment:

see 
http://bugs.php.net/bug.php?id=43512


Previous Comments:
------------------------------------------------------------------------
[2011-03-19 03:59:22] nicholas dot j dot miller at gmail dot com

Description:
------------
When writing class method and function declarations, php allows multiple

parameters with the same name. This seems like something that should
produce a 
warning or notice.

Test script:
---------------
class Foo
{
    public function bar($param, $param) {
       echo $param;
    }
}


$foo = new Foo();
$foo->bar('param1', 'param2');

Expected result:
----------------
I feel as though this should produce a warning or notice.

Actual result:
--------------
Runs without any issues and echos 'param2'


------------------------------------------------------------------------



-- 
Edit this bug report at http://bugs.php.net/bug.php?id=54310&edit=1


Thread (5 messages)

« previous php.bugs (#159701) next »