Should a trait be in a separate file?
<p>Assume this situation:</p>

<pre><code>interface IFoo
{
  public function Bar();
}

trait Foo
{
  public function Bar()
  {
    echo 'Bar';
  }
}

class FooBar implements IFoo
{
   use Foo;
}

$foobar = new FooBar();
$foobar-&gt;Bar(); //echos 'Bar';
</code></pre>

<p>I put class FooBar in its own file, and interface IFoo also in it own file.</p>

<p>But what should I do with trait Foo:</p>

<ul>
<li>In its own file? (my preference)</li>
<li>Together with the inferface IFoo?</li>
<li>When the trait is given its own file, how will autoloading deal with that?</li>
</ul>

<p>note: netbeans marks the code of class FooBar as invalid. Netbeans does not detect that trait Foo is used to implement IFoo. Bug?</p>
