PHP PSR-2 语句前后的新行
PHP PSR-2 new lines before/ after statments
示例 1:
$something = [1,2,3,4]
foreach ($something as $key => $value) {
//code code code
}
$something2 = [];
我找不到关于 foreach 之前和之后的新直播的明确答案,PSR-2 对此有何评论?
Point 2.3 "Lines" 可以选择在语句前后添加空行。在 "paragraphs" 中将代码块分开仍然很有用,以提高逻辑理解力和可读性。
Blank lines MAY be added to improve readability and to indicate related blocks of code.
示例 1:
$something = [1,2,3,4]
foreach ($something as $key => $value) {
//code code code
}
$something2 = [];
我找不到关于 foreach 之前和之后的新直播的明确答案,PSR-2 对此有何评论?
Point 2.3 "Lines" 可以选择在语句前后添加空行。在 "paragraphs" 中将代码块分开仍然很有用,以提高逻辑理解力和可读性。
Blank lines MAY be added to improve readability and to indicate related blocks of code.