withImportNames() reports a change on a short name already imported next to a same-short-name alias
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
- 65/100
Hướng nghiên cứu
Look at NameImporter::resolveNameInUse() and NameImportingPostRector. The bug is about detecting a false positive change when a short name is already imported and a same-short-name alias appears later. Start by understanding the import resolution logic, then write a test with the provided minimal code to reproduce the issue. 'Done' means the file is not listed in changed_files on a dry-run when the output is identical.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Bug Report
| Subject | Details |
|---|---|
| Rector version | 2.6.7, also on current main |
With withImportNames(), a class already used by its short name is reported as changed when another class with the same short name is imported under an alias after it.
The output is identical, but the file is counted as changed. With --dry-run it is never cached, so it is processed again on every run. With the aliased import first, nothing is reported.
Minimal PHP Code Causing Issue
namespace App;
use App\Dto\Response;
use App\Client\Response as ClientResponse;
final class SomeService
{
public function map(ClientResponse $clientResponse): Response
{
return new Response();
}
}
vendor/bin/rector process --dry-run --output-format=json lists the file under changed_files, with "changed_files": 0 in totals, on every run.
NameImporter::resolveNameInUse() matches App\Client\Response as ClientResponse by its short name and returns Response, which is already what the code says.
Expected Behaviour
No change reported, the file is cached.
🤖 Drafted with AI assistance.
- Ngôn ngữ chính
- PHP
- Star
- 10.4k
- Fork
- 742
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
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 rectorphp/rector
-
feature
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 52/100
-
bug
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 55/100
Tất cả issue của rectorphp/rector
Issue tương tự
-
Infrastructure: actions Module: zmscitizenapi Module: zmsentities php Type: Bug unit tests
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
it-at-m/eappointment#3480 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
CI: composer install fails — league/flysystem 1.x blocked by security advisory GHSA-cxf4-7mrp-vvprĐang mởdevops type: bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
Maintainer thường phản hồi trong vòng 1 ngày
-
needs approval
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
Maintainer thường phản hồi trong vòng 3 ngày
-
product / avatars product / self-hosted product / storage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
appwrite/appwrite#13985 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày