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

Does PSR-2 require vertical alignment?

这两者之间允许什么:

$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 组 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.