Doc #75482 [Opn->Dup]: silent resolve/redefine trait conflict

From: Date: Fri, 03 Nov 2017 14:48:34 +0000
Subject: Doc #75482 [Opn->Dup]: silent resolve/redefine trait conflict
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-15210@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=75482&edit=1 ID: 75482 Updated by: pmmaga@php.net Reported by: bscheshir at gmail dot com Summary: silent resolve/redefine trait conflict -Status: Open +Status: Duplicate Type: Documentation Problem Package: Documentation problem PHP Version: 7.2.0RC5 Block user comment: N Private report: N New Comment: This is a duplicate of https://bugs.php.net/bug.php?id=74872 Previous Comments: ------------------------------------------------------------------------ [2017-11-03 14:20:01] bscheshir at gmail dot com Description: ------------ --- From manual page: http://www.php.net/language.oop5.traits --- https://3v4l.org/g5HRH how about same methods in C and C1? this is some hard to understand and I can't find example in docs Unexpected redefinition last(?)-trait method to class method Test script: --------------- <?php trait ATrait { public function a(){ return 'Aa'; } } trait BTrait { public function a(){ return 'Ba'; } } class C { use ATrait{ a as aa; } use BTrait{ a as ba; } public function a() { return static::aa() . static::ba(); } } $o = new C; echo $o->a(), "\n"; class C1 { use BTrait{ a as ba; } use ATrait{ a as aa; } public function a() { return static::aa() . static::ba(); } } $o = new C1; echo $o->a(), "\n"; class D { use ATrait{ ATrait::a as aa; } use BTrait{ BTrait::a as ba; } public function a() { return static::aa() . static::ba(); } } $o = new D; echo $o->a(), "\n"; Actual result: -------------- AaAa BaBa AaBa ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=75482&edit=1

« previous php.doc.bugs (#15210) next »