Description
I am proposing that the "Line wrapping" guideline for docblocks in PHP and JavaScript files is changed so it is fixed at 120 characters. The current guideline is:
DocBlock text should wrap to the next line after 80 characters of text. If the DocBlock itself is indented on the left 20 character positions, the wrap could occur at position 100, but should not extend beyond a total of 120 characters wide.
Issue Description
80 characters is very narrow. A large proportion of docblocks in WordPress core don't adhere to this, especially when it comes to @param
tags with detailed documentation and array arguments which use the extended @type
syntax. If the line length limit is assumed to be 80 characters then it's possible for over half the length to be taken up before the description starts.
URL of the Page with the Issue
- https://developer.wordpress.org/coding-standards/inline-documentation-standards/javascript/#line-wrapping
- https://developer.wordpress.org/coding-standards/inline-documentation-standards/php/#formatting-guidelines ("Line wrapping" section)
Why is this a problem?
Docblocks in PHP and JavaScript files have line lengths of varying width. There is little consistency.
Suggested Fix
Let's set the recommended line length limit to 120 characters in all cases.