Removed useless Hyperf\Di\ClassLoader::$proxies, because merge it into Composer\Autoload\ClassLoader::$classMap. (#4888)

Co-authored-by: assert <zhangchengming@kkguan.com>
Co-authored-by: 李铭昕 <715557344@qq.com>
This commit is contained in:
张城铭 2022-06-30 18:34:16 +08:00 committed by GitHub
parent 9c3da93e03
commit b394845103
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 14 deletions

View File

@ -66,6 +66,7 @@ composer analyse
- [#4874](https://github.com/hyperf/hyperf/pull/4874) Use `wait` instead of `parallel` for coroutine style tcp server.
- [#4875](https://github.com/hyperf/hyperf/pull/4875) Use the original style when regenerating models.
- [#4880](https://github.com/hyperf/hyperf/pull/4880) Support `ignoreAnnotations` for `Annotation Reader`.
- [#4888](https://github.com/hyperf/hyperf/pull/4888) Removed useless `Hyperf\Di\ClassLoader::$proxies`, because merge it into `Composer\Autoload\ClassLoader::$classMap`.
## Changed

View File

@ -26,12 +26,6 @@ class ClassLoader
{
protected ComposerClassLoader $composerClassLoader;
/**
* The container to collect all the classes that would be proxy.
* [ OriginalClassName => ProxyFileAbsolutePath ].
*/
protected array $proxies = [];
public function __construct(ComposerClassLoader $classLoader, string $proxyFileDir, string $configDir, ScanHandlerInterface $handler)
{
$this->setComposerClassLoader($classLoader);
@ -44,8 +38,9 @@ class ClassLoader
$classLoader->addClassMap($config->getClassMap());
$scanner = new Scanner($this, $config, $handler);
$this->proxies = $scanner->scan($this->getComposerClassLoader()->getClassMap(), $proxyFileDir);
$classLoader->addClassMap(
$scanner->scan($classLoader->getClassMap(), $proxyFileDir)
);
}
public function loadClass(string $class): void
@ -112,12 +107,7 @@ class ClassLoader
protected function locateFile(string $className): ?string
{
if (isset($this->proxies[$className]) && file_exists($this->proxies[$className])) {
$file = $this->proxies[$className];
} else {
$file = $this->getComposerClassLoader()->findFile($className);
}
$file = $this->getComposerClassLoader()->findFile($className);
return is_string($file) ? $file : null;
}