False positive missing call to parent when setUp never returns
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 52/100
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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');
}
}
- Ngôn ngữ chính
- PHP
- Star
- 544
- Fork
- 58
- Merge trung bình
- 2 ngày 1 giờ
- Pull request đã merge (30 ngày)
- 5
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của phpstan/phpstan-phpunit
-
bug
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 68/100
phpstan/phpstan-phpunit#332 · 2 bình luận ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
phpstan/phpstan-phpunit#321 ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
phpstan/phpstan-phpunit#309 ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 45/100
phpstan/phpstan-phpunit#299 · 2 bình luận ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 20/100
phpstan/phpstan-phpunit#291 ·
Tất cả issue của phpstan/phpstan-phpunit
Issue tương tự
-
Solved site promotion gate fails on runner PHP patch drift (expects 8.2.33, runner installs 8.2.34) Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Automattic/blocks-engine#2161 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
Automattic/static-site-importer#1824 ·
-
[Chore] Keep one viget-block-generator skill and replicate it, instead of four tracked copies Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
-
Cannot reset column width Đang mở0. Needs triage bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
-
0. Needs triage 35-feedback bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100