Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Some comment positions inside attributes can result in prettier failing with an exception

オープン
#2,283 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
48/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
php
領域
tooling

調査の方向性

リンク先の playground または最新の plugin バージョンで、提供された PHP 入力を使って例外を再現し、その後、属性内のコメントに対する PHP plugin のコメント処理を追跡します。入力が正常にフォーマットされ、「Comment was not printed」エラーなしでコメントが保持されれば完了です。

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
PHP
スター
1.9k
フォーク
139
PR マージ指標
30日以内にマージされた PR はありません

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

prettier/plugin-php のほかの issue

prettier/plugin-php の issue をすべて見る

似ている issue

PHP の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。