prettier / prettier/plugin-php
Breaks if comments precede an include statement in mixed HTML/PHP files
オープン
まだ誰も着手していません。
bug
comments
inline
- 主要言語
- PHP
- スター
- 1.9k
- フォーク
- 139
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
When running the plugin on a Wordpress template file with some commented lines, behaviour is not as expected.
In this example, the comment line (line 22 in the playground) // $feed_section_class = 'has-top-padding grey-bg'; somehow is duplicated and the closing ?> is inserted prematurely.
@prettier/plugin-php v0.15.2
Playground link
Input:
<?php
/*
Template Name: File
*/
get_header(); ?>
<?php
$home_url = home_url();
$theme_path = get_template_directory_uri();
?>
<main>
<?php include locate_template('content-product-secondary-nav.php'); ?>
<section>
<h1>Title</h1>
<p>Some content here</p>
</section>
<?php // $feed_section_class = 'has-top-padding grey-bg';
// include( locate_template( 'content-brilliance-feeds.php' ) );
include locate_template('content-sub-footer.php'); ?>
</main>
<?php get_template_part('content', 'brochure-popup'); ?>
<?php get_template_part('content', 'quote-popup'); ?>
<?php get_footer(); ?>
Output:
<?php
/*
Template Name: File
*/
get_header(); ?>
<?php
$home_url = home_url();
$theme_path = get_template_directory_uri();
?>
<main>
<?php include locate_template('content-product-secondary-nav.php'); ?>
<section>
<h1>Title</h1>
<p>Some content here</p>
</section>
<?php // $feed_section_class = 'has-top-padding grey-bg';
// $feed_section_class = 'has-top-padding grey-bg';
?>// include( locate_template( 'content-brilliance-feeds.php' ) );
include locate_template('content-sub-footer.php'); ?>
</main>
<?php get_template_part('content', 'brochure-popup'); ?>
<?php get_template_part('content', 'quote-popup'); ?>
<?php get_footer(); ?>
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
リンクされた Prettier PHP playground で入力を再現し、報告された出力と比較します。混在した HTML/PHP テンプレート内の include 文の前にあるコメントに重点を置いてください。この playground のケースに対する formatter のエントリポイントを追跡します。完了条件は、コメントが重複せず、PHP の閉じ区切り文字が早い段階で挿入されず、include が正しくフォーマットされたままであることです。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- php, wordpress
- 領域
- tooling
- issue の種類
- バグ
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- 明確に書かれている
- 初心者へのやさしさ
- 45/100