Edit report at https://bugs.php.net/bug.php?id=60153&edit=1

 ID:                 60153
 User updated by:    tsteiner at nerdclub dot net
 Reported by:        tsteiner at nerdclub dot net
 Summary:            Interface method prototypes not enforced when
                     implementd via traits.
 Status:             Open
 Type:               Bug
 Package:            Class/Object related
 PHP Version:        5.4.0beta2
 Block user comment: N
 Private report:     N

 New Comment:

Sorry, the expected result should be

PHP Fatal error:  Declaration of C::oneArgument() must be compatible with 
I::oneArgument($a) in test.php on line 11


Previous Comments:
------------------------------------------------------------------------
[2011-10-27 19:58:30] tsteiner at nerdclub dot net

Description:
------------
When an class implements an interface and then uses a method defined in a trait 
for the implementation, the prototype of the method is not enforced.

Test script:
---------------
<?php

interface I {
    public function oneArgument($a);
}

trait T {
    public function oneArgument() {}
}

class C implements I {
    use T;
}


Expected result:
----------------
PHP Fatal error:  Declaration of C::oneArgument() must be compatible with 
C::oneArgument($a) in test.php on line 11

Actual result:
--------------
Script compiles and runs without error.


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



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

Reply via email to