php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #69911 Interface apply to trait
Submitted: 2015-06-23 11:14 UTC Modified: -
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: igor at glagola dot ru Assigned:
Status: Open Package: Compile Failure
PHP Version: 5.6.10 OS: Linux
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: igor at glagola dot ru
New email:
PHP Version: OS:

 

 [2015-06-23 11:14 UTC] igor at glagola dot ru
Description:
------------
Hi, I've got strange name collision, interface applies to trait's method before trait's method rename statement.

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

interface SomeInterface {
    public function theAction();
}

trait TheTrait {
    public function theAction($param) {
    }
}

class CC {
    public function theAction() {

    }
}

class BB extends CC implements SomeInterface {
    use TheTrait {
        TheTrait::theAction as otherAction;
    }
}


Expected result:
----------------
I expect no errors

Actual result:
--------------
PHP Fatal error:  Declaration of TheTrait::theAction() must be compatible with SomeInterface::theAction() in /tmp/a.php on line 22
PHP Stack trace:
PHP   1. {main}() /tmp/a.php:0

Patches

Add a Patch

Pull Requests

Add a Pull Request

 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Sun Sep 15 12:01:26 2019 UTC