Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在使用 SymfonyClassMapGenerator获取目录中所有类的数组:
ClassMapGenerator
ClassMapGenerator::createMap(__DIR__ . '/Generators')
这工作得很好——但ClassMapGenerator该类在 Symfony 3.3 中已被弃用,并在 symfony 4 中完全删除。
由于我们刚刚升级到 Symfony 4,这段代码不再有效。
我读过这篇文章,解释了它被删除的原因,但没有提供任何替代方案。
有任何想法吗?
我想出了如何通过用 Composer 的 ClassMapGenerator 替换 Symfony 导入来解决这个问题。
use Composer\Autoload\ClassMapGenerator;
语法完全相同