Problem/Motivation
Discovered while working on this: #2572709: [meta] Fix 'Drupal.Files.LineLength' coding standard
Install drupal/coder, add Drupal.Files.LineLength to phpcs.xml.dist and do this:
../vendor/bin/phpcs -p -s lib/Drupal/Component/Utility/Html.php
You'll see this output:
FILE: ...Users/paul/pj2/drupal/core/lib/Drupal/Component/Utility/Html.php
----------------------------------------------------------------------
FOUND 0 ERRORS AND 6 WARNINGS AFFECTING 6 LINES
----------------------------------------------------------------------
103 | WARNING | Line exceeds 80 characters; contains 91 characters
| | (Drupal.Files.LineLength.TooLong)
199 | WARNING | Line exceeds 80 characters; contains 82 characters
| | (Drupal.Files.LineLength.TooLong)
202 | WARNING | Line exceeds 80 characters; contains 82 characters
| | (Drupal.Files.LineLength.TooLong)
203 | WARNING | Line exceeds 80 characters; contains 82 characters
| | (Drupal.Files.LineLength.TooLong)
351 | WARNING | Line exceeds 80 characters; contains 82 characters
| | (Drupal.Files.LineLength.TooLong)
386 | WARNING | Line exceeds 80 characters; contains 104 characters
| | (Drupal.Files.LineLength.TooLong)
----------------------------------------------------------------------
Line 351 contains multi-byte characters, and is under 80 chars when you look at it, but is presumably an edge case if you just count bytes:
* will convert "é" to "é", whereas Html::escape() will not convert "é"
Proposed resolution
Remaining tasks
User interface changes
API changes
Data model changes
Comments
Comment #2
mile23Comment #3
klausiDuplicate of #2333251: Coder review support for UTF-8.
Make sure to set
<arg name="encoding" value="utf-8"/>in your phpcs.xml file.