Suggest assertTrue()/assertFalse() over assertSame(true|false, ...)

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

I maintainer di solito rispondono entro 1 giorno

Una pull request collegata è già stata integrata.

  • #198 di @alies-dev — integrata

Valutazione

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

Direzione di ricerca

Start with the plugin’s afterMethodCallAnalysis hook and the existing check for assertSame(null, ...), then inspect its helper and tests. Add coverage for literal true and false as the first argument to assertSame and assertNotSame, and confirm the plugin reports the suggested PHPUnit assertion; the issue estimates roughly 45 lines including tests.

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

Descrizione

enhancement good first issue

$this->assertSame(true, $isPaid) is clearer as $this->assertTrue($isPaid) and gives a better failure message.

phpstan-phpunit reports it (AssertSameBooleanExpectedRule).

Idea: same hook and helper as the assertSame(null, ...) check: in afterMethodCallAnalysis, detect a literal true/false first argument to assertSame/assertNotSame and emit a plugin issue. Roughly 45 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.