Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

1.3.16 throwing errors on arrays after assertCount

Aperta
#206 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

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

Direzione di ricerca

Start by comparing the 1.3.15 and 1.3.16 changes linked in the report, then reproduce the interaction between assertCount(), reset(), and the array offset access shown. Done means the valid pattern no longer reports that the result may be false, with a regression test covering the example.

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

Descrizione

Our automated updates updated to 1.3.16 today and started failing phpstan. Based on the changes from 1.3.15 it's obvious what the issue is.

Our tests do something like this:

    $mails = $this->getMails();
    $this->assertCount(1, $mails);
    $mail = \reset($mails);
    $this->assertStringContainsString('foo', $mail['subject']);

Where getMails returns an array.

And this is throwing errors like Cannot access offset 'subject' on false.

Lingua principale
PHP
Stelle
544
Fork
58
Merge medio
2g 1h
PR unite (30g)
5

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

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 phpstan/phpstan-phpunit

Tutte le issue di phpstan/phpstan-phpunit

Issue simili

Altre issue su PHP

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.