FAQ
Edit report at http://pear.php.net/bugs/bug.php?id=18086&edit=1

ID: 18086
Updated by: gsherwood@squiz.net
Reported By: s dot marechal at jejik dot com
Summary: False positive. In ZEND standard, opening brace is
not always on a new line
-Status: Open
+Status: Bogus
Type: Bug
Package: PHP_CodeSniffer
Operating System: Windows Server 2003
Package Version: 1.2.2
PHP Version: 5.3.3
-Assigned To:
+Assigned To: squiz
Roadmap Versions:
New Comment:

-Status: Open
+Status: Bogus
-Assigned To:
+Assigned To: squiz
The Zend standard is NOT the Zend Framework coding standard. It is
simply a collection of sniffs contributed by people working at/with Zend
over the last few years. I've been asking if someone wants to create a
ZF standard for quite a while, but nobody has contributed anything.

Please do not use PHP_CodeSniffer to check ZF code unless you've managed
to get a ZF standard from someone.


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

[2010-11-29 09:02:36] sandermarechal

Description:
------------
According to the ZEND Coding Style, if a function has a long
declaration, it can be broken over several lines. In that case, the
closing parenthesis goes on a newline, followed by a space, followed by
the opening bracket. See
http://framework.zend.com/manual/en/coding-standard.coding-style.html
section "Function and Method Declaration", second example.

PHP_CodeSniffer uses
Generic_Sniffs_Functions_OpeningFunctionBraceBsdAllmanSniff for the ZEND
standard. This incorrectly triggers an error on such long declarations:
"Opening brace should be on a new line". This is incorrect. It should
not generate an error.

Test script:
---------------
Example from the Zend Framework Coding Style linked above:

/**
* Documentation Block Here
*/
class Foo
{
/**
* Documentation Block Here
*/
public function bar($arg1, $arg2, $arg3,
$arg4, $arg5, $arg6
) {
// all contents of function
// must be indented four spaces
}
}

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

Search Discussions

  • S Marechal at Nov 30, 2010 at 7:31 am
    Edit report at http://pear.php.net/bugs/bug.php?id=18086&edit=1

    ID: 18086
    Updated by: s.marechal@jejik.com
    Reported By: s dot marechal at jejik dot com
    Summary: False positive. In ZEND standard, opening brace is
    not always on a new line
    Status: Bogus
    Type: Bug
    Package: PHP_CodeSniffer
    Operating System: Windows Server 2003
    Package Version: 1.2.2
    PHP Version: 5.3.3
    Assigned To: squiz
    Roadmap Versions:
    New Comment:

    Perhaps the standard should be renamed in PHP_CodeSniffer then?


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

    [2010-11-29 09:59:31] squiz

    -Status: Open
    +Status: Bogus
    -Assigned To:
    +Assigned To: squiz
    The Zend standard is NOT the Zend Framework coding standard. It is
    simply a collection of sniffs contributed by people working at/with Zend
    over the last few years. I've been asking if someone wants to create a
    ZF standard for quite a while, but nobody has contributed anything.

    Please do not use PHP_CodeSniffer to check ZF code unless you've managed
    to get a ZF standard from someone.

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

    [2010-11-29 09:02:36] sandermarechal

    Description:
    ------------
    According to the ZEND Coding Style, if a function has a long
    declaration, it can be broken over several lines. In that case, the
    closing parenthesis goes on a newline, followed by a space, followed by
    the opening bracket. See
    http://framework.zend.com/manual/en/coding-standard.coding-style.html
    section "Function and Method Declaration", second example.

    PHP_CodeSniffer uses
    Generic_Sniffs_Functions_OpeningFunctionBraceBsdAllmanSniff for the ZEND
    standard. This incorrectly triggers an error on such long declarations:
    "Opening brace should be on a new line". This is incorrect. It should
    not generate an error.

    Test script:
    ---------------
    Example from the Zend Framework Coding Style linked above:

    /**
    * Documentation Block Here
    */
    class Foo
    {
    /**
    * Documentation Block Here
    */
    public function bar($arg1, $arg2, $arg3,
    $arg4, $arg5, $arg6
    ) {
    // all contents of function
    // must be indented four spaces
    }
    }

    ------------------------------------------------------------------------
  • Gsherwood at Nov 30, 2010 at 9:49 am
    Edit report at http://pear.php.net/bugs/bug.php?id=18086&edit=1

    ID: 18086
    Updated by: gsherwood@squiz.net
    Reported By: s dot marechal at jejik dot com
    Summary: False positive. In ZEND standard, opening brace is
    not always on a new line
    Status: Bogus
    Type: Bug
    Package: PHP_CodeSniffer
    Operating System: Windows Server 2003
    Package Version: 1.2.2
    PHP Version: 5.3.3
    Assigned To: squiz
    Roadmap Versions:
    New Comment:

    I actually want to merge the standard into the Generic standard, but
    it's a big BC break and needs to be handled carefully with other merges.
    So I'm not planning a name change, although the standard has a
    ruleset.xml file in SVN already that says that it is out of date, so it
    is at least documented in 1.3.0.


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

    [2010-11-30 08:32:10] sandermarechal

    Perhaps the standard should be renamed in PHP_CodeSniffer then?

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

    [2010-11-29 09:59:31] squiz

    -Status: Open
    +Status: Bogus
    -Assigned To:
    +Assigned To: squiz
    The Zend standard is NOT the Zend Framework coding standard. It is
    simply a collection of sniffs contributed by people working at/with Zend
    over the last few years. I've been asking if someone wants to create a
    ZF standard for quite a while, but nobody has contributed anything.

    Please do not use PHP_CodeSniffer to check ZF code unless you've managed
    to get a ZF standard from someone.

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

    [2010-11-29 09:02:36] sandermarechal

    Description:
    ------------
    According to the ZEND Coding Style, if a function has a long
    declaration, it can be broken over several lines. In that case, the
    closing parenthesis goes on a newline, followed by a space, followed by
    the opening bracket. See
    http://framework.zend.com/manual/en/coding-standard.coding-style.html
    section "Function and Method Declaration", second example.

    PHP_CodeSniffer uses
    Generic_Sniffs_Functions_OpeningFunctionBraceBsdAllmanSniff for the ZEND
    standard. This incorrectly triggers an error on such long declarations:
    "Opening brace should be on a new line". This is incorrect. It should
    not generate an error.

    Test script:
    ---------------
    Example from the Zend Framework Coding Style linked above:

    /**
    * Documentation Block Here
    */
    class Foo
    {
    /**
    * Documentation Block Here
    */
    public function bar($arg1, $arg2, $arg3,
    $arg4, $arg5, $arg6
    ) {
    // all contents of function
    // must be indented four spaces
    }
    }

    ------------------------------------------------------------------------
  • S Marechal at Nov 30, 2010 at 6:54 pm
    Edit report at http://pear.php.net/bugs/bug.php?id=18086&edit=1

    ID: 18086
    Updated by: s.marechal@jejik.com
    Reported By: s dot marechal at jejik dot com
    Summary: False positive. In ZEND standard, opening brace is
    not always on a new line
    Status: Bogus
    Type: Bug
    Package: PHP_CodeSniffer
    Operating System: Windows Server 2003
    Package Version: 1.2.2
    PHP Version: 5.3.3
    Assigned To: squiz
    Roadmap Versions:
    New Comment:

    Okay, thanks.

    In the mean time I have scratched my own itch and wrote a sniff that
    correctly handles the test script I posted above. Perhaps this is
    something you'd want to have too? If so, where shall I post it? Here or
    in a new bug?


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

    [2010-11-30 10:50:13] squiz

    I actually want to merge the standard into the Generic standard, but
    it's a big BC break and needs to be handled carefully with other merges.
    So I'm not planning a name change, although the standard has a
    ruleset.xml file in SVN already that says that it is out of date, so it
    is at least documented in 1.3.0.

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

    [2010-11-30 08:32:10] sandermarechal

    Perhaps the standard should be renamed in PHP_CodeSniffer then?

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

    [2010-11-29 09:59:31] squiz

    -Status: Open
    +Status: Bogus
    -Assigned To:
    +Assigned To: squiz
    The Zend standard is NOT the Zend Framework coding standard. It is
    simply a collection of sniffs contributed by people working at/with Zend
    over the last few years. I've been asking if someone wants to create a
    ZF standard for quite a while, but nobody has contributed anything.

    Please do not use PHP_CodeSniffer to check ZF code unless you've managed
    to get a ZF standard from someone.

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

    [2010-11-29 09:02:36] sandermarechal

    Description:
    ------------
    According to the ZEND Coding Style, if a function has a long
    declaration, it can be broken over several lines. In that case, the
    closing parenthesis goes on a newline, followed by a space, followed by
    the opening bracket. See
    http://framework.zend.com/manual/en/coding-standard.coding-style.html
    section "Function and Method Declaration", second example.

    PHP_CodeSniffer uses
    Generic_Sniffs_Functions_OpeningFunctionBraceBsdAllmanSniff for the ZEND
    standard. This incorrectly triggers an error on such long declarations:
    "Opening brace should be on a new line". This is incorrect. It should
    not generate an error.

    Test script:
    ---------------
    Example from the Zend Framework Coding Style linked above:

    /**
    * Documentation Block Here
    */
    class Foo
    {
    /**
    * Documentation Block Here
    */
    public function bar($arg1, $arg2, $arg3,
    $arg4, $arg5, $arg6
    ) {
    // all contents of function
    // must be indented four spaces
    }
    }

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

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppear-bugs @
categoriesphp
postedNov 29, '10 at 8:58a
activeNov 30, '10 at 6:54p
posts4
users2
websitepear.php.net

2 users in discussion

S Marechal: 2 posts Gsherwood: 2 posts

People

Translate

site design / logo © 2022 Grokbase