[PEAR-BUG] Req #20160 [Asn->Csd]: Line identing should start at the level of the PHP declaration

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

 ID:               20160
 Updated by:       [email protected]
 Reported By:      greencoppermine at gmail dot com
 Summary:          Line identing should start at the level of the PHP
                    declaration
-Status:           Assigned
+Status:           Closed
 Type:             Feature/Change Request
 Package:          PHP_CodeSniffer
 Operating System: Linux
 Package Version:  1.5.1
 PHP Version:      5.5.7
 Assigned To:      squiz
 Roadmap Versions: 
 New Comment:

-Status: Assigned
+Status: Closed
My previous comment seems to relate more to line length than
indentation. I've since 
changed the indent sniff so that it does respect the indent position of
the open tag.

This change will be released in 1.5.4


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

[2014-01-05 23:35:27] squiz

-Type:        Bug
+Type:        Feature/Change Request
-Assigned To:
+Assigned To: squiz
That's a personal opinion, but not the rule that is enforced by the
coding standards 
PHP_CodeSniffer ships with. The intention is to keep short lines, not a
low number of 
non-whitespace characters per line.

You can write you own sniff to enforce your rule, although I will leave
this open as a 
feature request to add an option to the existing sniff that checks this.
Either way, 
you'd need to use a custom coding standard to enforce this.

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

[2013-12-29 02:30:01] greencopper

Description:
------------
When PHP code is inserted into a HTML file and as a result indented
according to the level of the HTML markup, the idention should count
from that place.

Test script:
---------------
<head>
    <meta charset="utf-8">
    <title>Foo</title>
    <?php
        if (isset($_POST['bar'])) {
            echo '<meta name="description" content="foo bar foo
bar">'."\r\n";
        } else {
            echo '<meta name="description" content="bar foo bar
foo">'."\r\n";
        }
    ?>

Expected result:
----------------
Because the idention starts where it does phpcs reports:

Line indented incorrectly; expected 0 spaces, found 4
Line indented incorrectly; expected 0 spaces, found 4
Line indented incorrectly; expected 8 spaces, found 12


Actual result:
--------------
The idention count should start at the level of the <?php declaration.

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


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