Comments in between multi-line variable assignments should validate
還沒有人認領這個 Issue。
評估
研究方向
先重現針對多行指定和陣列範例所回報的 PHPCS 錯誤,然後檢查強制等號前空格的 ruleset 或規則。issue 未指定檔案或測試;當對齊的指定和陣列項目之間的註解能夠通過驗證,同時繼續強制執行現有對齊方式時,即表示完成。
由索引模型根據 Issue 內容生成。
描述
Suppose you have:
// group 1
$foo = 1;
$barbaz = 'variable';
$boo = null;
$anothervar = new \stdClass();
// group 2
// some comment about $foo
$foo = 1;
// some comment about $barbaz
$barbaz = 'variable';
$boo = null;
// some comment about $anothervar
$anothervar = new \stdClass();
With the current PHPCS ruleset group 1 would pass but group 2 would not and generate errors.
In my opinion this should be legal for single line small comments to exist in a multi-line group.
I am not sure though that this would be supported by a PHPCS rule. Probably not? Maybe we could turn off spaces before equals sign or set to severity 0. The thing is this pattern often exists in our codebase (for example here). If we have a reason why we allow and like the alignment in group 1, we should allow here as well.
By the way this would also apply to values assignment in arrays:
$my_array = [
'id' => 0,
// some comment about this key:
'name' => 'Foo',
// some comment about this other key
'location' => 123,
'etc' => null,
];
- 主要語言
- 沒有語言資料
- 星號
- 0
- 分支
- 2
- PR 合併指標
- 30 天內沒有已合併 PR
環境準備
這個專案沒有提供開發容器、Dockerfile 或貢獻指南,環境需要你自己搭建:先看它的 README,通用步驟見我們的新手貢獻指南。
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 78/100
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 84/100
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 84/100
mpfaffenberger/privateer_reimagined#649 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 68/100
hacs/integration#5563 · 1 則留言 ·
維護者通常 2 天內回覆
-
難度 1/5 1 小時以內 新手友好度 92/100
維護者通常 1 天內回覆