title: Magento 2 - class does not exist on setup:di:compile
body: <p>I have some problem with Magento 2. I've made my own module, it looks to work fine, but when I have my module installed and make <code>php bin/magento setup:di:compile</code> there is this error:</p>
  
  <blockquote>
    <p>[ReflectionException] Class \MyInstaller does not exist</p>
  </blockquote>
  
  <p>It is thrown by <code>setup/src/Magento/Setup/Module/PhpScanner.php</code></p>
  
  <p>MyInstaller class exists, however I changed path to the class file. Originally, there was path <code>/my-libraries/MyInstaller.php</code>, but when I tested it locally, I had error as above:</p>
  
  <blockquote>
    <p>[ReflectionException] Class \MyInstaller does not exist</p>
  </blockquote>
  
  <p>When I changed folder name to mylibraries, on localhost it works fine. However, when I install module on external server, I have <code>ReflectionException</code>. It doesn't show when I change folder name to the original one - "my-libraries". As I observed, Magento still calls to the an old path. However, I tried to run new instance of Magento 2 and I still get this error.</p>
  
  <p>I tried to clear cache by:</p>
  
  <pre><code>bin/magento cache:clean
  bin/magento cache:flush
  </code></pre>
  
  <p>I tried to delete <code>/var</code> folder too. After enable my module, I make:</p>
  
  <pre><code>php bin/magento setup:upgrade
  </code></pre>
  
  <p>and</p>
  
  <pre><code>php bin/magento setup:static-content:deploy
  </code></pre>
  
  <p>Could you tell me, how can I force Magento to use new path to the file? Or should I change some cache settings on my server?</p>
  
  <p>I add, there is no namespace in MyInstaller class because I use the same file in another modules. But, I think they are not necessary if on localhost there is no error.</p>
  
  <p>There is MyInstaller class code:</p>
  
  <pre><code>&lt;?php
  
  if (!class_exists('MyInstaller', false)) {
  class MyInstaller implements MyInterface
  {
      private $translations;
      private $sliderEnabled = true;
      private $pages = array();
  
      public function __construct($sliderEnabled = true, array $translations = array())
      {
          $this-&gt;sliderEnabled = $sliderEnabled;
          $this-&gt;setTranslations($translations);
      }
  
      public function setTranslations(array $translations = array())
      {
          $this-&gt;translations = $translations;
  
      }
  
      public function addPages(array $pages = array())
      {
          $this-&gt;pages = array_values($pages);
      }
  
      public function renderInstallerSteps()
      {
          if (!$this-&gt;sliderEnabled || empty($this-&gt;pages) || !is_array($this-&gt;pages)) {
              return '';
          }
  
          $requirements = $this-&gt;checkRequirements();
          $params = array(
              'requirements' =&gt; $requirements,
              'translations' =&gt; $this-&gt;translations
          );
          $maxSteps = 0;
          $data = array(
              'steps' =&gt; array()
          );
          foreach ($this-&gt;pages as $page) {
              $page = (int)$page;
              if ($page &gt; 0) {
                  $step = $this-&gt;loadStep($page, $params);
                  $data['steps'][$page] = $step;
                  $maxSteps++;
              }
          }
  
          if ($maxSteps === 0) {
              return '';
          }
          $data['maxSteps'] = $maxSteps;
  
          return $this-&gt;loadTemplate('installer', $data);
      }
  
      private function loadStep($number, $params = null)
      {
          $step = $this-&gt;loadTemplate('step' . $number, $params);
          $step = $this-&gt;removeNewLines($step);
          return $step;
      }
  
      private function removeNewLines($string)
      {
          return trim(str_replace(PHP_EOL, ' ', $string));
      }
  
      private function loadTemplate($view, $data = null)
      {
          extract(array("content" =&gt; $data));
          ob_start();
          $viewFile = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'theme' . DIRECTORY_SEPARATOR . "$view.tpl.php";
  
          if (file_exists($viewFile)) {
              include $viewFile;
          } else {
              throw new Exception('View not exist in ' . get_class($this));
          }
          $content = ob_get_clean();
          return $content;
      }
  
      private function checkRequirements()
      {
          $data = array(
              'php' =&gt; array(
                  'test' =&gt; (version_compare(PHP_VERSION, '5.2.0') &gt; 0),
                  'label' =&gt; $this-&gt;translations['php_version']
              ),
              'curl' =&gt; array(
                  'test' =&gt; function_exists('curl_version'),
                  'label' =&gt; $this-&gt;translations['curl_enabled']
              ),
              'soap' =&gt; array(
                  'test' =&gt; class_exists('SoapClient'),
                  'label' =&gt; $this-&gt;translations['soap_enabled']
              )
          );
          return $data;
      }
  }
  </code></pre>
  
  <p>}</p>
  
  <p>Sorry, if description is chaotical, this is my first post here.</p>