|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2012-02-21 02:53 UTC] aharvey@php.net
-Package: Compile Warning
+Package: Class/Object related
[2012-02-21 09:26 UTC] gron@php.net
-Status: Open
+Status: Suspended
[2012-02-21 09:26 UTC] gron@php.net
[2012-02-21 15:24 UTC] greywire at gmail dot com
[2012-02-26 15:32 UTC] gron@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 11:00:02 2025 UTC |
Description: ------------ There is no way to resolve a conflict in two used traits with the same property. The resolution method used to resolve conflicting method names should be able to be used similarly on properties. I realize this may be the intended behavior to discourage use of properties in traits as properties were not originally intended in traits, but since properties are allowed, there should be a way to resolve the conflict, and the solution is simple and fits with existing syntax. Test script: --------------- <?php trait testone { public $test; } trait testtwo { public $test; } //** this should work but doesn't class traittest { use testtwo, testone { testone::$test insteadof testtwo; testtwo::$test as $testalso; } } ?> Expected result: ---------------- No errors or warnings. Actual result: -------------- Parse error: syntax error, unexpected '$test' (T_VARIABLE), expecting identifier (T_STRING) in index.php on line 14