Some comment positions inside attributes can result in prettier failing with an exception
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
- 48/100
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.
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.
- 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
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 prettier/plugin-php
-
PHP 8.3 not allowed in options? Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 62/100
prettier/plugin-php#2416 · 2 bình luận · 6 reaction ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 64/100
prettier/plugin-php#2498 ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 55/100
prettier/plugin-php#2495 ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 55/100
prettier/plugin-php#2494 · 1 bình luận ·
-
strange format issue Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 48/100
prettier/plugin-php#2490 ·
Tất cả issue của prettier/plugin-php
Issue tương tự
-
sync-en
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 85/100
-
sync-en
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 85/100
-
Перевод устарел
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 78/100
-
[6.x]: "Cannot use object of type stdClass as array" loading Users index (regression of #19182) Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100