Automattic / Automattic/VIP-Coding-Standards
Catch incorrect bloginfo() usage
- 主要言語
- PHP
- スター
- 261
- フォーク
- 44
- 平均マージ
- 19分
- マージ済み PR(30日)
- 1
説明
## What problem would the enhancement address for VIP?
When using `bloginfo()`, the caller should not echo the output, as `bloginfo()` does this internally (see [here](https://developer.wordpress.org/reference/functions/bloginfo/#source)). Callers should simply call `bloginfo()` without any `echo`, but if the callers want to control when the output is echoed, they should use `get_bloginfo()` ([#](https://developer.wordpress.org/reference/functions/get_bloginfo/)). Our standards should catch these kinds of issues in code.
## Describe the solution you'd like
The usage of `echo bloginfo()` should be caught and advice given on using `get_bloginfo()` instead or to skip the echo.
## What code should be reported as a violation?
echo bloginfo( 'name' );
## What code should *not* be reported as a violation?
echo get_bloginfo( 'name' );
コントリビューションガイド
調査の方向性
関数の使用状況を検査する PHP_CodeSniffer ルールから始め、bloginfo() と get_bloginfo() をエントリーポイントとして使用します。echo bloginfo( 'name' ) が、echo を省略するか get_bloginfo() を使用するよう助言付きで報告され、echo get_bloginfo( 'name' ) は報告されないことを確認します。利用可能であれば、関連するルールテストを実行します。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- php
- 領域
- tooling
- issue の種類
- 機能追加
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- 明確に書かれている
- 初心者へのやさしさ
- 35/100