Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

False positive missing call to parent when setUp never returns

Abierto
#292 3 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
52/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Tranquilo
Stack tecnológico
php
Área
devtools, testing

Línea de trabajo

Start by reproducing the example with a PHPUnit TestCase whose setUp() returns never after markTestSkipped(). Find the PHPStan rule or test covering required parent::setUp() calls, add a regression case for the non-returning setup, and verify that the false-positive diagnostic is gone without changing other parent-call checks.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

When creating a test that has a setup method that never returns (e.g. because the whole test should be skipped), PHPStan will complain that the parent::setUp() should be called.

In this case, we have to choose between either setting up the parent before we skip the test (doing useless work in the process), setting up the parent after the skip, which will trigger an error about dead code, or baselining the original error. All of these solutions seem wrong to me and I think in this PHPStan just shouldn't tell you to call the parent.

Example:

final class MyTest extends TestCase
{
    protected function setUp(): never
    {
        self::markTestSkipped('Currently broken due to XYZ');
    }
}
Lenguaje dominante
PHP
Estrellas
544
Forks
58
Merge medio
2 d 1 h
PR fusionados (30 d)
5

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de phpstan/phpstan-phpunit

Todos los issues de phpstan/phpstan-phpunit

Issues similares

Más issues de PHP

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.