PHP: Parent class method 'static' type declaration not recognised when called by child class using parent::
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 72/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 冷清
- 技术栈
- php
调研方向
首先在 NetBeans 编辑器中重现 PHP 示例,并检查父方法返回 static 时 parent::make() 所使用的类型解析。子类属性出现在自动补全中,并且 Ctrl-hover 将返回的变量识别为 Foo2 实例后,修复就完成了。
由索引模型根据 Issue 内容生成。
描述
Apache NetBeans version
Apache NetBeans 30
What happened
When an overriding method in a PHP child class calls the parent class's overridden method using the parent:: identifier, and that method's return-type is static, NetBeans fails to resolve the variable returned by that call to an instance of the current (that is, child) class. Other members of the child class are not available in autocomplete, and the tooltip displayed by Ctrl+hover gives simply VARIABLE: $whatever.
Language / Project Type / NetBeans Component
PHP project
How to reproduce
<?php
class Foo1 {
public static function make(): static {
return new static();
}
}
class Foo2 extends Foo1 {
public $property = 1;
public static function make(): static {
$f = parent::make();
echo $f->//<-- Start typing 'property' here
return $f;
}
}
Place the cursor before the inline comment on line 16 and start to type 'property'. The $property property of class Foo2 should be available in autocomplete popup; instead, only general completions are offered.
Calling parent::make() in the child scope returns a Foo2 object; this is knowable from the static return type declared by Foo1::make() and NetBeans should make this determination.
Did this work correctly in an earlier version?
No / Don't know
Operating System
Gentoo Linux
JDK
Adoptium openjdk-21.0.10_p7
Apache NetBeans packaging
Apache NetBeans binary zip
Anything else
No response
Are you willing to submit a pull request?
No
- 主要语言
- Java
- 星标
- 3.1k
- 派生
- 939
- 平均合并
- 5 天 12 小时
- 30 天内合并 PR
- 23
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
apache/netbeans 的其他 Issue
-
Contribution welcome kind:feature Platform
难度 2/5 1-3 小时 新手友好度 72/100
apache/netbeans#9614 · 2 条评论 ·
维护者通常 1 天内回复
-
kind:bug LSP needs:triage
难度 2/5 1-3 小时 新手友好度 78/100
apache/netbeans#9548 · 1 条评论 ·
维护者通常 1 天内回复
-
Editor Java kind:feature needs:triage
难度 2/5 1-3 小时 新手友好度 65/100
维护者通常 1 天内回复
-
kind:bug needs:triage os:linux os:macos Platform UI
难度 1/5 1-3 小时 新手友好度 68/100
维护者通常 1 天内回复
-
kind:bug needs:triage
难度 1/5 1-3 小时 新手友好度 68/100
维护者通常 1 天内回复
相似的 Issue
-
Mend: dependency security vulnerability
难度 2/5 1-3 小时 新手友好度 62/100
opfab/operatorfabric-core#10653 ·
维护者通常 1 天内回复
-
GeminiUtil placeholder user turn ("Continue output. DO NOT look at this line ...") is flagged by prompt injection filters可能已有人在做 @innoprej 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 78/100
salesforce/multicloudj#667 ·
维护者通常 1 天内回复
-
bug documentation
难度 2/5 1-3 小时 新手友好度 88/100
MetricsHub/winrm-java#202 ·
维护者通常 1 天内回复
-
ASCN/cBioPortal Pipelines/cBioPortal
难度 2/5 1-3 小时 新手友好度 64/100
mskcc/smile-server#1990 ·