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

前端 未结 5 556
死守一世寂寞
死守一世寂寞 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:07

    I'm pretty sure that I've seen another explanation somewhere… I don't know if it's true, but I feel like I should share it =)

    Ok, here it goes: no line should be longer than 80, but that does not account for the indentation. With the indentation, the limit is 120.

    So, if your current indentation is 80 (consider "guards", btw…) — you have only 40 characters remaining. But it your current indention is 40 or less — you can use up to 80 chars for the actual code.

提交回复
热议问题