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

前端之家收集整理的这篇文章主要介绍了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.

原文链接:https://www.f2er.com/php/137305.html

猜你在找的PHP相关文章