PHP: Parent class method 'static' type declaration not recognised when called by child class using parent::
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 72/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Tranquilo
- Stack tecnológico
- php
- Área
- developer-experience
Línea de trabajo
Empieza reproduciendo el ejemplo de PHP en el editor de NetBeans e inspecciona la resolución de tipos utilizada para parent::make() cuando el método padre devuelve static. La corrección estará terminada cuando la propiedad del hijo aparezca en el autocompletado y Ctrl-hover identifique la variable devuelta como una instancia de Foo2.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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
- Lenguaje dominante
- Java
- Estrellas
- 3.1k
- Forks
- 939
- Merge medio
- 5 d 3 h
- PR fusionados (30 d)
- 22
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de apache/netbeans
-
Contribution welcome kind:feature Platform
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
apache/netbeans#9614 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
kind:bug LSP needs:triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
apache/netbeans#9548 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Editor Java kind:feature needs:triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
Los mantenedores suelen responder en 1 día
-
The main Options dialog window has buttons with OK on the left instead of on the right on LinuxAbiertokind:bug needs:triage os:linux os:macos Platform UI
Dificultad 1/5 1-3 horas Aptitud para principiantes 68/100
Los mantenedores suelen responder en 1 día
-
Incorrect DTD for wstcref-FilesAbiertokind:bug needs:triage
Dificultad 1/5 1-3 horas Aptitud para principiantes 68/100
Los mantenedores suelen responder en 1 día
Todos los issues de apache/netbeans
Issues similares
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 74/100
Los mantenedores suelen responder en 1 día
-
team:Lumberjack
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
OpenLiberty/open-liberty#35998 ·
Los mantenedores suelen responder en 1 día
-
[BUG] SQS SendMessageBatch accepts more than 10 entries instead of TooManyEntriesInBatchRequestAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 67/100
floci-io/floci#5319 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Bug QWP
Dificultad 2/5 1-3 horas Aptitud para principiantes 79/100
Los mantenedores suelen responder en 3 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 64/100