prettier / prettier/plugin-php
Some comment positions inside attributes can result in prettier failing with an exception
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- PHP
- Star
- 1.9k
- Fork
- 139
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
Not sure which cases these include exactly but some cases result in pretter stopping with an error:
Error: Comment "// abc" was not printed. Please report this error!
I know that i was also able to produce that error with other positions, but various other work fine so it is a bit weird.
Playground also shows it: Link to playground
Prettier 2.88.0 (but also tried latest)
PHP Plugin 0.19.6 (but also tried latest)
# Options (if any):
--no-options
Input:
<?php declare(strict_types=1);
namespace App\Controller\General;
use App\Dto\BarDto;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Attribute\MapRequestPayload;
use Symfony\Component\Serializer\Normalizer\AbstractNormalizer;
class EnrollmentController extends AbstractController
{
public function save(
#[
MapRequestPayload(
serializationContext: [ // abc
AbstractNormalizer::CALLBACKS => [
'abc' => 'trim',
],
],
),
]
BarDto $data,
): Response {
return $this->json(['foo']);
}
}
Output:
None. Errror as mentioned above.
Expected behavior:
No error and correctly formatted.
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.
Hướng nghiên cứu
Tái hiện ngoại lệ bằng đầu vào PHP được cung cấp trong playground được liên kết hoặc phiên bản plugin mới nhất, sau đó truy vết cách plugin PHP xử lý các comment bên trong các thuộc tính. Hoàn thành khi đầu vào được định dạng thành công và giữ lại comment mà không có lỗi “Comment was not printed”.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- php
- Lĩnh vực
- tooling
- Loại issue
- Lỗi
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 48/100