title: Same namespace with files in different folders
body: <p>I'm trying to structure a project so that some code that is auto generated is in a sub folder <code>generated/</code>, but it has the same namespace as files in the parent directory.</p>
  
  <p>For example I have this structure which is giving me the error <code>PHP Fatal error:  Uncaught Error: Class 'MyProject\Foo' not found</code>.</p>
  
  <p>Is it possible to have the same namespace for 2 different files in different folders like this?</p>
  
  <pre><code>--lib/
  ----Foo.php
  ----generated/
  ----generated/Bar.php
  </code></pre>
  
  <p><code>lib/Foo.php</code></p>
  
  <pre class="lang-php prettyprint-override"><code>&lt;?php
  
  namespace MyProject;
  
  class Foo {
    ...
  }
  </code></pre>
  
  <p><code>lib/generated/Bar.php</code></p>
  
  <pre class="lang-php prettyprint-override"><code>&lt;?php
  
  namespace MyProject;
  
  class Bar {
  
    public function __construct() {
      $foo = new Foo();
    }
  }
  </code></pre>
  
  <p>My autoload section looks like this:</p>
  
  <pre><code>"autoload": {
        "psr-4": {
            "MyProject\\" : "lib/"
        }
    },
  </code></pre>