2017-10-01 101 views
0

在我的MacOS上運行PHP開發服務器時,我從作曲家那裏得到以下錯誤。作曲家致命錯誤:無法重新聲明composerRequire

Fatal error: Cannot redeclare composerRequire01a3dc0b1f885ed2b645be37711584c1() 
(previously declared in /Users/<user>/Desktop/<app>/vendor/composer/autoload_real.php:63) 
in /Users/<user>/Desktop/<app>/vendor/composer/autoload_real.php on line 70 

運行在我的Windows此完全相同的代碼然而,當箱子似乎一切都運行完美的罰款。我已經驗證過我不會多次包含自動加載的require語句。什麼可能導致這個?如果這有什麼不同,我使用HomeBrew的Composer。我只是看不到如此多的特定文件名稱空間。

編輯

作曲autoload_real.php

<?php 

// autoload_real.php @generated by Composer 

class ComposerAutoloaderInit01a3dc0b1f885ed2b645be37711584c1 
{ 
    private static $loader; 

    public static function loadClassLoader($class) 
    { 
     if ('Composer\Autoload\ClassLoader' === $class) { 
      require __DIR__ . '/ClassLoader.php'; 
     } 
    } 

    public static function getLoader() 
    { 
     if (null !== self::$loader) { 
      return self::$loader; 
     } 

     spl_autoload_register(array('ComposerAutoloaderInit01a3dc0b1f885ed2b645be37711584c1', 'loadClassLoader'), true, true); 
     self::$loader = $loader = new \Composer\Autoload\ClassLoader(); 
     spl_autoload_unregister(array('ComposerAutoloaderInit01a3dc0b1f885ed2b645be37711584c1', 'loadClassLoader')); 

     $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); 
     if ($useStaticLoader) { 
      require_once __DIR__ . '/autoload_static.php'; 

      call_user_func(\Composer\Autoload\ComposerStaticInit01a3dc0b1f885ed2b645be37711584c1::getInitializer($loader)); 
     } else { 
      $map = require __DIR__ . '/autoload_namespaces.php'; 
      foreach ($map as $namespace => $path) { 
       $loader->set($namespace, $path); 
      } 

      $map = require __DIR__ . '/autoload_psr4.php'; 
      foreach ($map as $namespace => $path) { 
       $loader->setPsr4($namespace, $path); 
      } 

      $classMap = require __DIR__ . '/autoload_classmap.php'; 
      if ($classMap) { 
       $loader->addClassMap($classMap); 
      } 
     } 

     $loader->register(true); 

     if ($useStaticLoader) { 
      $includeFiles = Composer\Autoload\ComposerStaticInit01a3dc0b1f885ed2b645be37711584c1::$files; 
     } else { 
      $includeFiles = require __DIR__ . '/autoload_files.php'; 
     } 
     foreach ($includeFiles as $fileIdentifier => $file) { 
      composerRequire01a3dc0b1f885ed2b645be37711584c1($fileIdentifier, $file); 
     } 

     return $loader; 
    } 
} 

function composerRequire01a3dc0b1f885ed2b645be37711584c1($fileIdentifier, $file) 
{ 
    if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { 
     require $file; 

     $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true; 
    } 
} 
+0

你能粘貼作曲家生成的'/ vendor/composer/autoload_real.php'嗎? – Federkun

+0

@Federkun新增 – Xenology

+0

爲什麼這些類和函數名稱tho? –

回答

0

看來你讓現有項目目錄的副本,並嘗試囤它在一個新的目錄

嘗試刪除composer.lockvendor/並運行composer update

I '不是100%肯定,但希望它能幫助

相關問題