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: 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:

Sorry it took me so long to reply. I got side-tracked with other work.

If you'd like to contribute a sniff, please attach it to this report and
I'll test and commit it as soon as possible.


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

[2010-11-30 19:55:31] sandermarechal

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?

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

[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
}
}

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

Search Discussions

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

    ID: 18086
    Comment 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:

    Patch added. I hope it's okay like this. I've never made a PEAR patch
    before.


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

    [2010-12-06 14:48:21] sandermarechal

    Added #patch
    bug:18086;patch:zend-function-opening-brace-sniff;revision:1291646901;.

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

    [2010-12-05 22:56:48] squiz

    Sorry it took me so long to reply. I got side-tracked with other work.

    If you'd like to contribute a sniff, please attach it to this report and
    I'll test and commit it as soon as possible.

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

    [2010-11-30 19:55:31] sandermarechal

    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?

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

    [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?

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

    The remainder of the comments for this report are too long. To view
    the rest of the comments, please view the bug report online at
    http://pear.php.net/bugs/bug.php?id=18086
  • Gsherwood at Dec 15, 2010 at 3:17 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
    +Status: Feedback
    -Type: Bug
    +Type: Feature/Change Request
    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:

    -Status: Bogus
    +Status: Feedback
    -Type: Bug
    +Type: Feature/Change Request
    Is this actually the same standard as PEAR?
    http://pear.php.net/manual/en/standards.funcdef.php

    if so, you can just include the PEAR/Functions/FunctionDeclarationSniff
    into a ZF standard instead of writing new code.

    Coincidently, found out about this last night:
    https://github.com/dploeger/CodeSniffer_Zend_New

    Maybe worth talking to this developer and helping out. He is using the
    PEAR standard for most sniffs.


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

    [2010-12-06 14:49:15] sandermarechal

    Patch added. I hope it's okay like this. I've never made a PEAR patch
    before.

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

    [2010-12-06 14:48:21] sandermarechal

    Added #patch
    bug:18086;patch:zend-function-opening-brace-sniff;revision:1291646901;.

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

    [2010-12-05 22:56:48] squiz

    Sorry it took me so long to reply. I got side-tracked with other work.

    If you'd like to contribute a sniff, please attach it to this report and
    I'll test and commit it as soon as possible.

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

    [2010-11-30 19:55:31] sandermarechal

    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?

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

    [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.

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

    The remainder of the comments for this report are too long. To view
    the rest of the comments, please view the bug report online at
    http://pear.php.net/bugs/bug.php?id=18086
  • S Marechal at Dec 15, 2010 at 10:14 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: Feedback
    Type: Feature/Change Request
    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:

    You're right. It's the same as PEAR. Perhaps the ZEND standard should
    use the PEAR function declaration sniff then instead of the Generic
    BsdAllman sniff?

    And thanks for the github link. That's going to be very useful!


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

    [2010-12-15 04:19:15] squiz

    -Status: Bogus
    +Status: Feedback
    -Type: Bug
    +Type: Feature/Change Request
    Is this actually the same standard as PEAR?
    http://pear.php.net/manual/en/standards.funcdef.php

    if so, you can just include the PEAR/Functions/FunctionDeclarationSniff
    into a ZF standard instead of writing new code.

    Coincidently, found out about this last night:
    https://github.com/dploeger/CodeSniffer_Zend_New

    Maybe worth talking to this developer and helping out. He is using the
    PEAR standard for most sniffs.

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

    [2010-12-06 14:49:15] sandermarechal

    Patch added. I hope it's okay like this. I've never made a PEAR patch
    before.

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

    [2010-12-06 14:48:21] sandermarechal

    Added #patch
    bug:18086;patch:zend-function-opening-brace-sniff;revision:1291646901;.

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

    [2010-12-05 22:56:48] squiz

    Sorry it took me so long to reply. I got side-tracked with other work.

    If you'd like to contribute a sniff, please attach it to this report and
    I'll test and commit it as soon as possible.

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

    [2010-11-30 19:55:31] sandermarechal

    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?

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

    The remainder of the comments for this report are too long. To view
    the rest of the comments, please view the bug report online at
    http://pear.php.net/bugs/bug.php?id=18086

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppear-bugs @
categoriesphp
postedDec 5, '10 at 9:55p
activeDec 15, '10 at 10:14p
posts4
users3
websitepear.php.net

People

Translate

site design / logo © 2022 Grokbase