加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > PHP教程 > 正文

php – PSR-2是否需要垂直对齐?

发布时间:2020-12-13 13:25:05 所属栏目:PHP教程 来源:网络整理
导读:这两者之间允许什么: $value = 'value';$user = 'John';$timestamp = 1480927909;$day = date('Y-m-d',$timestamp); 要么 $value = 'value';$user = 'John';$timestamp = 1480927909;$day = date('Y-m-d',$timestamp); PSR-2没有针对这种线间对齐的具体规则
这两者之间允许什么:
$value = 'value';
$user = 'John';
$timestamp = 1480927909;
$day = date('Y-m-d',$timestamp);

要么

$value     = 'value';
$user      = 'John';
$timestamp = 1480927909;
$day       = date('Y-m-d',$timestamp);
PSR-2没有针对这种线间对齐的具体规则:

从PSR-2 Conclusion:

There are many elements of style and practice intentionally omitted by this guide. These include but are not limited to:

  • Declaration of global variables and global constants
  • Declaration of functions
  • Operators and assignment
  • Inter-line alignment
  • Comments and documentation blocks
  • Class name prefixes and suffixes
  • Best practices

Future recommendations MAY revise and extend this guide to address those or other elements of style and practice.

对于它的价值,PHP-FIG Group的行间对齐是discussed for PSR-1,但是从最终版本中删除了:

The way-back original long-form PSR-1 covered inter-line alignment,globals,ternaries,assignment,and lots of other things. Those ended up getting removed for various reasons; their epitaph is at the conclusion of PSR-2.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读