Warn about docblock metadata on PHPUnit 12

Aperta
#182 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@alies-dev ci sta già lavorando.

Dal 9/11/2026.

  • #210 di @alies-dev — aperta

Valutazione

Difficoltà
4/5
Tempo stimato
1-2 giorni
Idoneità per principianti
35/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
php
Ambito
testing

Direzione di ricerca

Read the plugin code that interprets @test and @dataProvider metadata, then inspect its existing tests; the issue estimates roughly 90 lines with tests but names no files. Check how the installed PHPUnit version is obtained and how behavior is covered for PHPUnit 10 and 11. Done means PHPUnit 12+ docblock metadata is ignored or reported with migration hints, while PHPUnit 10/11 behavior remains correct.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

enhancement

PHPUnit 12 removed support for metadata in docblocks: @test, @dataProvider, @depends, @covers, @requires and friends are ignored, only attributes count. The plugin still treats these docblock tags as live, so on PHPUnit 12:

  • a method that is only marked @test is treated as a test, although PHPUnit never runs it;
  • providers referenced only via @dataProvider are validated and marked as used, although PHPUnit never calls them.

phpstan-phpunit tracks the same problem in phpstan/phpstan-phpunit#240.

Idea: detect the installed PHPUnit major version (for example PHPUnit\Runner\Version::id()), and on 12+ either stop reading docblock metadata or report each such tag with a hint to migrate to the attribute. It needs care to stay correct for projects on PHPUnit 10/11. Roughly 90 lines with tests.

Idea borrowed from phpstan/phpstan-phpunit.

Lingua principale
Gherkin
Stelle
79
Fork
38
Merge medio
6h 52m
PR unite (30g)
28

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di psalm/psalm-plugin-phpunit

Tutte le issue di psalm/psalm-plugin-phpunit

Issue simili

Altre issue su Testing & QA

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.