php – 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.

相关文章

统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...
统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...
前言 之前做了微信登录,所以总结一下微信授权登录并获取用户...
FastAdmin是我第一个接触的后台管理系统框架。FastAdmin是一...
之前公司需要一个内部的通讯软件,就叫我做一个。通讯软件嘛...
统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...