System error: Class ... should be known at this point

未关闭
#9,958 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
48/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃
技术栈
php
领域
backend, devtools

调研方向

Start with AddParamBasedOnParentClassMethodRector.php at the reported reflection lookup, then inspect how Rector discovers classes and processes files. The reproducer is the LDAPAccountManager/lam project linked in the report; compare behavior between Rector 2.7.x and 2.8.0 or later. Done means Rector processes the affected files without the reported system error.

由索引模型根据 Issue 内容生成。

描述

bug

Bug Report

Subject Details
Rector version 2.8.3

I get lots of errors that classes could not be processed because they should be known at this point. This did not happen with 2.7.x and started with version 2.8.0.
Skipping the rule that shows up in the stack trace only leads to a different rule that fails.

Minimal PHP Code Causing Issue

Unable to provide a minimal test case but you can run rector here:

https://github.com/LDAPAccountManager/lam

[ERROR] Could not process
"/home/github/actions-runner2/_work/lam/lam/lam/lib/2factor.inc" file,
due to:
"System error: "Class "LAM\LIB\TWO_FACTOR\BaseProvider" should be known
at this point"

Stack trace:
#0
vendor/rector/rector/rules/Php80/Rector/ClassMethod/AddParamBasedOnPare
ntClassMethodRector.php(119):
Rector\Rector\AbstractRector->fetchClassLikeReflection()
#1 vendor/rector/rector/src/Rector/RectorRunner.php(60):
Rector\Php80\Rector\ClassMethod\AddParamBasedOnParentClassMethodRector-
>refactor()
#2
vendor/rector/rector/src/PhpParser/NodeTraverser/RectorNodeTraverser.ph
p(94): Rector\Rector\RectorRunner->run()
#3
vendor/rector/rector/src/PhpParser/NodeTraverser/RectorNodeTraverser.ph
p(44):
Rector\PhpParser\NodeTraverser\RectorNodeTraverser->traverseArray()
#4
vendor/rector/rector/src/PhpParser/NodeTraverser/RectorNodeTraverser.ph
p(115):
Rector\PhpParser\NodeTraverser\RectorNodeTraverser->traverseNode()
#5
vendor/rector/rector/src/PhpParser/NodeTraverser/RectorNodeTraverser.ph
p(44):
Rector\PhpParser\NodeTraverser\RectorNodeTraverser->traverseArray()
#6
vendor/rector/rector/src/PhpParser/NodeTraverser/RectorNodeTraverser.ph
p(115):
Rector\PhpParser\NodeTraverser\RectorNodeTraverser->traverseNode()
#7
vendor/rector/rector/src/PhpParser/NodeTraverser/RectorNodeTraverser.ph
p(37):
Rector\PhpParser\NodeTraverser\RectorNodeTraverser->traverseArray()
#8 vendor/rector/rector/src/Application/FileProcessor.php(106):
Rector\PhpParser\NodeTraverser\RectorNodeTraverser->traverse()
#9
vendor/rector/rector/src/Application/ApplicationFileProcessor.php(198):
Rector\Application\FileProcessor->processFile()
#10
vendor/rector/rector/src/Application/ApplicationFileProcessor.php(166):
Rector\Application\ApplicationFileProcessor->processFile()
#11
vendor/rector/rector/src/Application/ApplicationFileProcessor.php(136):
Rector\Application\ApplicationFileProcessor->processFiles()
#12 vendor/rector/rector/src/Console/Command/ProcessCommand.php(182):
Rector\Application\ApplicationFileProcessor->run()
#13
vendor/rector/rector/vendor/symfony/console/Command/Command.php(289):
Rector\Console\Command\ProcessCommand->execute()
#14 vendor/rector/rector/vendor/symfony/console/Application.php(920):
RectorPrefix202610\Symfony\Component\Console\Command\Command->run()
#15 vendor/rector/rector/vendor/symfony/console/Application.php(280):
RectorPrefix202610\Symfony\Component\Console\Application->doRunCommand
()
#16 vendor/rector/rector/src/Console/ConsoleApplication.php(75):
RectorPrefix202610\Symfony\Component\Console\Application->doRun()
#17 vendor/rector/rector/vendor/symfony/console/Application.php(163):
Rector\Console\ConsoleApplication->doRun()
#18 vendor/rector/rector/bin/rector.php(171):
RectorPrefix202610\Symfony\Component\Console\Application->run()
#19 vendor/rector/rector/bin/rector(5): require_once('...')
#20 vendor/bin/rector(119): include('...')
#21 {main}". On line: 58

Expected Behaviour

Process the files without system errors.

主要语言
PHP
星标
10.5k
派生
742
PR 合并指标
30 天内没有已合并 PR

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

rectorphp/rector 的其他 Issue

查看 rectorphp/rector 的全部 Issue

相似的 Issue

更多 PHP Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。