使用了一些第三方包,经常会发现,引入某些第三方包后(比如在laravel5.6中引入viacreative/sudo-su),使用命令行工具会遇到这样的错误提示,卸载了第三方包后重新安装vendor目录问题立马解决。真是把人头发都愁白了:
PHP Fatal error: Uncaught TypeError: Argument 1 passed to Composer\Autoload\ClassLoader::addClassMap() must be of the type array, integer given, called in phar:///usr/local/bin/composer/src/Composer/Autoload/AutoloadGenerator.php on line 760 and defined in phar:///usr/local/bin/composer/vendor/composer/ClassLoader.php:92
Stack trace:
#0 phar:///usr/local/bin/composer/src/Composer/Autoload/AutoloadGenerator.php(760): Composer\Autoload\ClassLoader->addClassMap(1)
#1 phar:///usr/local/bin/composer/src/Composer/Autoload/AutoloadGenerator.php(303): Composer\Autoload\AutoloadGenerator->getStaticFile('5a552ffbd9a0ba3...', '/home/vagrant/C...', '/home/vagrant/C...', '/home/vagrant/C...', 50600)
#2 phar:///usr/local/bin/composer/src/Composer/Command/DumpAutoloadCommand.php(75): Composer\Autoload\AutoloadGenerator->dump(Object(Composer\Config), Object(Composer\Repository\InstalledFilesystemRepository), Object(Composer\Package\RootPackage), Object(Composer\Installer\InstallationManager), '/home/vagrant/C...', true)
#3 phar:///usr/local/ in phar:///usr/local/bin/composer/vendor/composer/ClassLoader.php on line 92
Fatal error: Uncaught TypeError: Argument 1 passed to Composer\Autoload\ClassLoader::addClassMap() must be of the type array, integer given, called in phar:///usr/local/bin/composer/src/Composer/Autoload/AutoloadGenerator.php on line 760 and defined in phar:///usr/local/bin/composer/vendor/composer/ClassLoader.php:92
Stack trace:
#0 phar:///usr/local/bin/composer/src/Composer/Autoload/AutoloadGenerator.php(760): Composer\Autoload\ClassLoader->addClassMap(1)
#1 phar:///usr/local/bin/composer/src/Composer/Autoload/AutoloadGenerator.php(303): Composer\Autoload\AutoloadGenerator->getStaticFile('5a552ffbd9a0ba3...', '/home/vagrant/C...', '/home/vagrant/C...', '/home/vagrant/C...', 50600)
#2 phar:///usr/local/bin/composer/src/Composer/Command/DumpAutoloadCommand.php(75): Composer\Autoload\AutoloadGenerator->dump(Object(Composer\Config), Object(Composer\Repository\InstalledFilesystemRepository), Object(Composer\Package\RootPackage), Object(Composer\Installer\InstallationManager), '/home/vagrant/C...', true)
#3 phar:///usr/local/ in phar:///usr/local/bin/composer/vendor/composer/ClassLoader.php on line 92