What is a line length “soft limit” and how do I interpret this in the PSR-2 convention?

前端 未结 5 551
死守一世寂寞
死守一世寂寞 2021-02-03 18:29

I don\'t understand this part of php\'s PSR-2 convention:

The soft limit on line length MUST be 120 characters; automated style checkers MUST

5条回答
  •  野趣味
    野趣味 (楼主)
    2021-02-03 19:11

    It's pretty easy:

    • 0-80: Always ok
    • 80-120: Acceptable (if there's a good reason for it, e.g. a string where wrapping it would be ugly)
    • 120+: Lint tools, IDEs, etc. MUST show a warning (but never an error!) since the line might be ugly/unreadable/...

提交回复
热议问题