Hacktoberfest 2026:維護者為十月標記出來的 issue,仍然開放、適合新手。 瀏覽 Hacktoberfest issue

multi-line comment duplicated, leaking outside PHP blocks

未關閉
#1,228 7 則留言 9 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

評估

難度
4/5
預估耗時
3-5 天
新手友好度
45/100
Issue 類型
缺陷
描述清晰度
基本清楚
活躍度
停滯
技術堆疊
php
領域
tooling

研究方向

首先使用連結的 Playground 範例重現已回報的多行註解重複問題,然後比較列出的涉及空白行、註解長度和程式碼區塊的各種情況。追蹤負責註解和 PHP 區塊邊界的 PHP 格式化路徑。在回報的各種情況下,註解只輸出一次並且保持在 PHP 區塊內,即視為完成。

由索引模型根據 Issue 內容生成。

描述

bug comments inline

The obvious problem is that the multi-line comment is being duplicated and jumping outside the PHP block. But it's weirder, variations are below the main report example.

@prettier/plugin-php v0.11.2
Playground link

Input:

<?php ?>
<?php ?>

<?php
/**
 * comment
 */

$var = 0;
$var = 1;
?>
<?php ?>

Output:


<?php  ?>

 /**
 * comment
 */<?php
/**
 * comment
 */
?>
$var = 0;
$var = 1;
?>

Additional examples (links go to playground variations):

  • Add a blank line between the first two <?php ?> blocks: Works correctly.
  • Remove all blank lines between <?php ?> blocks: Works correctly (mostly, whitespace)
  • Add a single character to the comment (comments): Works correctly (mostly, whitespace)
  • Add two characters to the comment (commentss): Broken

I didn't run into this with empty PHP blocks, here's the are some examples with code in the PHP blocks, behavior appears to be the same:

主要語言
PHP
星號
1.9k
分支
139
PR 合併指標
30 天內沒有已合併 PR

貢獻指南

開啟貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

prettier/plugin-php 的其他 Issue

查看 prettier/plugin-php 的全部 Issue

相似的 Issue

更多 PHP Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。