title: Traits with own properties
body: <p>The objective of PHP traits is to manage a bunch of logic. However what is the best way to make this bunch of logic works according some dedicated properties and avoiding naming conflicts ?</p>
  <p>I'm thinking about MVC and particularly the model class. Indeed models seems to be good candidates for traits. Models can implement tree structure, be draftable, revisionnable, sluggable, and so on.</p>
  <p>I would like to write something like this:</p>
  <pre><code>class MyModel extends Model {
      use Tree, Revision, Slug;
      protected $_behaviors = array(
          'Tree' =&gt; array('parentFieldname' =&gt; 'p_id'),
          'Revision' =&gt; array(/* some options */),
          'Slug' =&gt; array(/* some options */)
      );
      public function __construct() {
          foreach($this-&gt;_behaviors as &amp;$options) {
              $options += /* trait defaults ? */
          }
      }
  }
  </code></pre>
  <p>If I intend to set the Tree trait like this :</p>
  <pre><code>trait Tree {
      protected $_defaults = array(
          'parentFieldname' =&gt; 'parent_id',
          /*...other options...*/
      );
      public function moveUp();
      public function moveDown();
      public function setParent(); //&lt;- need the `'parentFieldname' =&gt; 'p_id'`attribute
      /*...and so on...*/
  }
  </code></pre>
  <p>I'll reach into naming conflicts because of <code>$_defaults</code> since each trait needs its own defaults. Using the name of the trait as property name imply using something like <code>(new ReflectionClass(__CLASS__))-&gt;getTraits())</code>... which is not really awesome.</p>
  <p>In other words is there a way to create traits with &quot;overridable defaults&quot; and avoid naming conflicts ?</p>