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

 ID:                 63911
 Updated by:         g...@php.net
 Reported by:        bitluni at bitluni dot net
 Summary:            Ignore conflicting trait methods originationg from
                     identical sub traits
-Status:             Open
+Status:             Verified
-Type:               Feature/Change Request
+Type:               Bug
 Package:            Class/Object related
 Operating System:   debian
 PHP Version:        5.4.10
 Block user comment: N
 Private report:     N

 New Comment:

This is indeed a bug. Unfortunately, this case slipped and did not get tested. 
It 
is a perfectly valid usecase, and should not require the use of insteadof at 
all.

Best regards
Stefan


Previous Comments:
------------------------------------------------------------------------
[2013-09-15 17:23:42] heruan at aldu dot net

insteadOf in this case is just a workaround, since there is nothing to 'use 
instead of' something else because here there is a property/method conflicting 
with its very self!
And BTW insteadOf cannot be used as a workaround with properties.

------------------------------------------------------------------------
[2013-05-03 10:26:44] simon at simon dot geek dot nz

This is still occurring with PHP 5.5, commit 
cbe2870b72c4cfdb5c295e83c88d7cff5c39e396 (Fri May 3 12:25:49 2013 +0400).

Not being able to use multiple traits that have the same trait somewhere in 
their 
composition trees is a rather major limitation of the trait system.

------------------------------------------------------------------------
[2013-01-06 10:31:40] bitluni at bitluni dot net

@necktrox

I know there is 'insteadof' but see my example, there is just one function 
implemented yet still I get collision error. The traits are just usable very 
flat at the moment. If you have an hirachical stucture of traits like I do, you 
have to do potentally exponetial count of 'insteadof's in the top level class 
even there's not one dublicate function implemented.

------------------------------------------------------------------------
[2013-01-06 02:36:02] necktrox at gmail dot com

# from http://php.net/manual/de/language.oop5.traits.php

trait A {
    public function smallTalk() {
        echo 'a';
    }
    public function bigTalk() {
        echo 'A';
    }
}

trait B {
    public function smallTalk() {
        echo 'b';
    }
    public function bigTalk() {
        echo 'B';
    }
}

class Talker {
    use A, B {
        B::smallTalk insteadof A;
        A::bigTalk insteadof B;
    }
}

------------------------------------------------------------------------
[2013-01-05 18:39:11] bitluni at bitluni dot net

same issue for properties

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


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=63911


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

Reply via email to