PhpStorm 2021.2 语法错误即使在修复后也不会消失 [英] PhpStorm 2021.2 Syntax errors not going away even after they are fixed
问题描述
这个问题似乎是在我更新到最新版本 2021.2 后出现的,但我不确定这是否是我的问题的原因.
This issue seems to appear after I have updated to the latest version 2021.2 but I am not sure if this is the cause of my problem.
问题是,当我编辑 PHP 文件时,即使我非常确定我已经修复了突出显示的错误,语法错误也不会消失.
The problem is that, when I am editing the PHP file, the syntax error doesn't go away even I am very certain that I have fixed the highlighted error.
这里有几个例子:
当我编写类似
$x = 1;
的内容时,编辑器会提示我未使用局部变量$x
.美好的.但即使我稍后使用$x
也不会消失.
When I write something like
$x = 1;
, the editor prompts me that the local variable$x
is unused. Fine. But this won't go away even I use$x
later on.
我经常使用自动完成功能.例如,当我想输入 $this->getSomeObject($id)
时,我只能输入 $this->getS
并按 Enter 让 PhpStorm 输出类似$this->getSomeObject()"之类的东西.
I use the autocomplete feature a lot. So for example when I want to type $this->getSomeObject($id)
, I can only just type $this->getS
and press Enter to let PhpStorm outputs something like "$this->getSomeObject()".
现在,由于 getSomeObject()
需要一个参数,PhpStorm 会用红色在该行下划线,表示缺少必需的参数 $id".美好的.但是,即使我填写了缺失的部分,这个错误也不会消失.这意味着 IDE 仍将在 $this->getSomeObject($id)
行下划线并抱怨我缺少必需的参数 $id".
Now, as getSomeObject()
expects a parameter, PhpStorm would underline this line with red, saying that "Required parameter $id is missing". Fine. However, this error won't go away even I fill in the missing piece.
Which means that the IDE will still underline the line $this->getSomeObject($id)
and complain that I "Required parameter $id is missing".
我在我的代码中到处都看到了类似的问题,其中 PhpStorm 报告了未使用的局部变量"、缺少必需的参数"、未定义的变量"等问题.等永远不会消失.即使在我重新打开有问题的文件之后也没有.
I see similar problems everywhere in my code, where PhpStorm reports of "unused local variable", "required parameter missing", "undefined variable" etc. never go away. Not even after I reopen the offending file.
重新打开项目可以消除过时的错误高亮,但类似的错误会再次发生.
Reopening the project can eliminate the outdated error highlights, but similar errors will occur again.
我什至尝试使缓存失效(文件/使缓存失效,重新启动).
I even try invalidating caches (File/invalidate caches, restart).
示例:
版本:
PhpStorm 2021.2
Build #PS-212.4746.100, built on July 28, 2021
Licensed to orhan erday
Subscription is active until December 21, 2021.
For educational use only.
Runtime version: 11.0.11+9-b1504.13 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Windows 10 10.0
GC: ParNew, ConcurrentMarkSweep
Memory: 2996M
Cores: 12
Registry: run.processes.with.pty=TRUE, ide.balloon.shadow.size=0
Non-Bundled Plugins: String Manipulation (8.15.203.000.3), intellij.prettierJS (212.4746.57), de.espend.idea.laravel (0.15.4), de.espend.idea.php.annotation (8.0.0), fr.adrienbrault.idea.symfony2plugin (0.23.210), ru.adelf.idea.dotenv (2021.3.0.212), com.laravel_idea.plugin (4.3.4.212)
推荐答案
您需要检查 idea.log
文件(Help | Show log in XXX
)可能的异常等
You would need to check the idea.log
file (Help | Show log in XXX
) for possible exceptions etc.
但现在对我来说它看起来可能是 https://youtrack.jetbrains.com/issue/IDEA-275168.
But right now for me it looks like it could be https://youtrack.jetbrains.com/issue/IDEA-275168.
如果上述情况是您的情况,那么请禁用捆绑的Grazie plug,重新启动 PhpStorm 并再次检查 - 更好吗?
If the above is your case then please disable bundled Grazie plug, restart PhpStorm and check again -- any better?
这篇关于PhpStorm 2021.2 语法错误即使在修复后也不会消失的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!