|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull Requests
Pull requests:
HistoryAllCommentsChangesGit/SVN commits
[2017-07-07 04:13 UTC] requinix@php.net
-Status: Open
+Status: Verified
-PHP Version: 7.2.0alpha3
+PHP Version: 7.1.7
[2017-07-07 04:13 UTC] requinix@php.net
[2020-03-06 10:21 UTC] nikic@php.net
-Status: Verified
+Status: Duplicate
[2020-03-06 10:21 UTC] nikic@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 07:00:01 2025 UTC |
Description: ------------ If we use: use Trait1 { Trait1::init as private method1trait1; } use Trait2 { Trait2::init as public method1trait2; } works. Test script: --------------- <?php trait Trait1 { public function init() { echo("Trait1 - init\n"); } } trait Trait2 { public function init() { echo("Trait2 - init\n"); } } class Test { use Trait1 { init as private method1trait1; } use Trait2 { init as public method1trait2; } final public function __construct() { $this->init(); $this->method1trait1(); $this->method1trait2(); } public function init() { echo("Test - init\n"); } } $test = new Test(); $reflection = new ReflectionClass( $test ); foreach($reflection->getTraitAliases() as $k => $v) { echo $k.' => '.$v."\n"; } Expected result: ---------------- Test - init Trait1 - init Trait2 - init method1trait1 => Trait1::init method1trait2 => Trait2::init Actual result: -------------- Test - init Trait1 - init Trait1 - init method1trait1 => Trait1::init method1trait2 => Trait1::init