StatementWithoutSideEffectsRule with expected exception shouldn't raise error
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Anfängerfreundlichkeit
- 45/100
Rechercherichtung
Start with the provided PHPUnit reproducer and inspect the StatementWithoutSideEffectsRule behavior for iterator_to_array(). Confirm that the call still reports a diagnostic in production code but not when PHPUnit expects the thrown RuntimeException; done means the example passes without the false-positive error.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
final class MyTest extends \PHPUnit\Framework\TestCase
{
public function testMe(): void
{
$foo = new class([1]) extends ArrayIterator {
public function current(): void
{
throw new RuntimeException('foo');
}
};
$this->expectException(\RuntimeException::class);
iterator_to_array($foo);
}
}
This code reports Call to function iterator_to_array() on a separate line has no effect., but while it's ok on production code (like in https://phpstan.org/r/ee6218f3-4d37-4b5a-9a85-bc6d6ab44d2b) , with PHPUnit is legit as for expectException expectation.
- Vorherrschende Sprache
- PHP
- Sterne
- 544
- Forks
- 58
- Ø Merge
- 2 T. 1 Std.
- Gemergte PRs (30 T.)
- 5
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus phpstan/phpstan-phpunit
-
bug
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 68/100
phpstan/phpstan-phpunit#332 · 2 Kommentare ·
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 48/100
phpstan/phpstan-phpunit#321 ·
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 48/100
phpstan/phpstan-phpunit#309 ·
-
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 45/100
phpstan/phpstan-phpunit#299 · 2 Kommentare ·
-
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 52/100
phpstan/phpstan-phpunit#292 · 3 Kommentare ·
Alle Issues in phpstan/phpstan-phpunit
Ähnliche Issues
-
Solved site promotion gate fails on runner PHP patch drift (expects 8.2.33, runner installs 8.2.34) Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
Automattic/blocks-engine#2161 ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 70/100
Automattic/static-site-importer#1824 ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 70/100
-
0. Needs triage bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
-
0. Needs triage 35-feedback bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100