mirror of
https://gitee.com/hyperf/hyperf.git
synced 2024-12-02 03:37:44 +08:00
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:
parent
9c3da93e03
commit
b394845103
@ -66,6 +66,7 @@ composer analyse
|
|||||||
- [#4874](https://github.com/hyperf/hyperf/pull/4874) Use `wait` instead of `parallel` for coroutine style tcp server.
|
- [#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.
|
- [#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`.
|
- [#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
|
## Changed
|
||||||
|
|
||||||
|
@ -26,12 +26,6 @@ class ClassLoader
|
|||||||
{
|
{
|
||||||
protected ComposerClassLoader $composerClassLoader;
|
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)
|
public function __construct(ComposerClassLoader $classLoader, string $proxyFileDir, string $configDir, ScanHandlerInterface $handler)
|
||||||
{
|
{
|
||||||
$this->setComposerClassLoader($classLoader);
|
$this->setComposerClassLoader($classLoader);
|
||||||
@ -44,8 +38,9 @@ class ClassLoader
|
|||||||
$classLoader->addClassMap($config->getClassMap());
|
$classLoader->addClassMap($config->getClassMap());
|
||||||
|
|
||||||
$scanner = new Scanner($this, $config, $handler);
|
$scanner = new Scanner($this, $config, $handler);
|
||||||
|
$classLoader->addClassMap(
|
||||||
$this->proxies = $scanner->scan($this->getComposerClassLoader()->getClassMap(), $proxyFileDir);
|
$scanner->scan($classLoader->getClassMap(), $proxyFileDir)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function loadClass(string $class): void
|
public function loadClass(string $class): void
|
||||||
@ -112,12 +107,7 @@ class ClassLoader
|
|||||||
|
|
||||||
protected function locateFile(string $className): ?string
|
protected function locateFile(string $className): ?string
|
||||||
{
|
{
|
||||||
if (isset($this->proxies[$className]) && file_exists($this->proxies[$className])) {
|
$file = $this->getComposerClassLoader()->findFile($className);
|
||||||
$file = $this->proxies[$className];
|
|
||||||
} else {
|
|
||||||
$file = $this->getComposerClassLoader()->findFile($className);
|
|
||||||
}
|
|
||||||
|
|
||||||
return is_string($file) ? $file : null;
|
return is_string($file) ? $file : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user