Codeception / Codeception/AspectMock
Parent class not found by locator
还没有人认领这个 Issue。
- 主要语言
- PHP
- 星标
- 784
- 派生
- 132
- PR 合并指标
- 30 天内没有已合并 PR
描述
When using custom autoloader and try to get an instance of a class which has parent or implements an interface form the same custom namespace I have an error "PHP Fatal error: Uncaught InvalidArgumentException: Class [parent class name] was not found by locator in /workspace/projects/test/vendor/goaop/parser-reflection/src/ReflectionEngine.php:112".
I have very simple setup:
```
init([
'debug' => true,
'includePaths' => [__DIR__. '/lib'],
]);
$kernel->loadFile(__DIR__ . '/autoload.php'); // custom autoloader
$b = new \lib\B();
```
Class \lib\B:
```
namespace lib;
class B extends A {}
```
Class \lib\A:
```
namespace lib;
class A
{
public function getName()
{
return static::class;
}
}
```
Class B is loaded via my custom autoloader, but then the locator tries to load parent class A via composer autoloader and returns this error. Is this a bug, or I'm doing something wrong?
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
先在自定义 autoload.php 中使用 AspectMock\Kernel::init 和 loadFile 进行复现,然后检查 vendor/goaop/parser-reflection/src/ReflectionEngine.php 的第 112 行。使用继承 lib\A 的 lib\B 复现该失败,并跟踪 locator 如何处理父类。完成的标准是该设置不再将父类报告为缺失,并且有一个覆盖自定义 namespace autoloader 的回归测试。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- php
- 领域
- testing
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100