[PEAR-BUG] Bug #20358 [Opn->Fbk]: Incorrect indentitation failures

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

 ID:               20358
 Updated by:       [email protected]
 Reported By:      andrewi dot wd at gmail dot com
 Summary:          Incorrect indentitation failures
-Status:           Open
+Status:           Feedback
 Type:             Bug
 Package:          PHP_CodeSniffer
 Operating System: Ubuntu
 Package Version:  1.5.4
 PHP Version:      5.5.9
-Assigned To:      
+Assigned To:      squiz
 Roadmap Versions: 
 New Comment:

-Status:      Open
+Status:      Feedback
-Assigned To:
+Assigned To: squiz
The ScopeIndent sniff that comes with PHP_CodeSniffer pairs up the
closing and 
opening PHP tags to form a block, so it wants you to indent the opening
tag to the 
same level as the closing tag. Personally, I think that makes the code
easier to 
read, but it is personal preference. But you'll need to write your own
ScopeIndent 
sniff if you don't like it that way because PHPCS doesnt ship with an
alternative.

The second errors is due to the first. PHPCS uses the indent of the open
tags to set 
the expected indent for the code that comes after it. So once you fi the
first 
problem, the second problem goes away.

So in this case, PHP_CodeSniffer is working as intended and you'll need
to use your 
own custom sniffs if you want it to enforce a different indentation
standard.


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

[2014-08-06 10:12:53] #d44640491491e51ea51

Description:
------------
Incorrect phpcs behaviour after open php tag is placed into previous
methods

Test script:
---------------
    public function echoScript()
    {
        ?>
        <script type='text/javascript'>
        </script>
    <?php
    }

    public function someMethod($arg)
    {
        $x = 1;
    }

Expected result:
----------------
No phpcs erorrs

Actual result:
--------------
Line 9: phpcs: Line indented incorrectly: expected 8 spaces, found 4.
Line 12: phpcs: Line indented incorrectly: expected at least 12 spaces,
found 8.

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


-- 
Edit this bug report at https://pear.php.net/bugs/bug.php?id=20358&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.