[PEAR-BUG] Bug #20372 [Fbk->Csd]: LineLength Rule with Multibyte Encoding

[email protected]
Newsgroups php.pear.bugs
Message-ID <[email protected]>
Edit report at https://pear.php.net/bugs/bug.php?id=20372&edit=1

 ID:               20372
 Updated by:       [email protected]
 Reported By:      pear at xfragger dot de
 Summary:          LineLength Rule with Multibyte Encoding
-Status:           Feedback
+Status:           Closed
 Type:             Bug
 Package:          PHP_CodeSniffer
 Operating System: MacOSX
 Package Version:  1.5.4
 PHP Version:      5.5.14
 Assigned To:      squiz
 Roadmap Versions: 
 New Comment:

-Status: Feedback
+Status: Closed
well, thanks... didn't see that encoding-settings


Previous Comments:
------------------------------------------------------------------------

[2014-08-21 05:56:35] squiz

-Status:      Open
+Status:      Feedback
-Assigned To:
+Assigned To: squiz
If your code contains, or may contain, chars in a different charset, you
need to 
specify the --encoding command line argument. Example is here: 
https://github.com/squizlabs/PHP_CodeSniffer/wiki/Advanced-Usage#specifying-
an-encoding

In the 2.x versions, you can specify this in a custom coding standard as
well. See 
the hard-coded command line values example here: 
https://github.com/squizlabs/PHP_CodeSniffer/wiki/Annotated-ruleset.xml

You would use this: <arg name="encoding" value="utf8"/>

This mostly just affects the line length checks, so the reduced
performance isn't 
always desired for large code bases that don't tend to really care about
line length 
warnings, so it isn't the default behaviour. In the future, I would like
it to be, but I'd 
probably increase the min PHP version at the same time.

------------------------------------------------------------------------

[2014-08-20 11:22:06] xfragger

Description:
------------
A Line, which contains 120 characters, but one character is  
multibyte, PHPCS counts 121 characters.

Test script:
---------------
$foo = ['name' => 'Möller', 'bar' => 'bar', 'xhsfjskahfsdjkashdjak' =>
'lorem ipsum', 'anotherKey' => 'anotherValue12'];

Expected result:
----------------
no warning

Actual result:
--------------
WARNING | Line exceeds 120 characters; contains 121 
characters

------------------------------------------------------------------------


-- 
Edit this bug report at https://pear.php.net/bugs/bug.php?id=20372&edit=1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.