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

ID: 16932
Updated by: gsherwood@squiz.net
Reported By: webmaster at mamo-net dot de
Summary: MethodScopeSniff does not support lambda functions
-Status: Open
+Status: Closed
Type: Bug
Package: PHP_CodeSniffer
Operating System: Win 7
Package Version: 1.2.1
PHP Version: 5.3.1
-Assigned To:
+Assigned To: squiz
Roadmap Versions:
New Comment:

-Status: Open
+Status: Closed
-Assigned To:
+Assigned To: squiz
This bug has been fixed in SVN.

If this was a documentation problem, the fix will appear on
pear.php.net by the end of next Sunday (CET).

If this was a problem with the pear.php.net website, the change should
be live shortly.

Otherwise, the fix will appear in the package's next release.

Thank you for the report and for helping us make PEAR better.




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

[2009-12-20 17:11:37] viscacha

Description:
------------
PHP 5.3+ introduced lambda functions / closures, but they do not
support declaring them as public/private/protected. MethodScopeSniff
does not really support that as there are several wrong warnings/errors
in the output.

Test script:
---------------
class Test {
public function method() {
$walk = function(&$a) {
$a = preg_replace("/[0-9]{3}[\s-]+/", "", trim($a));
};
// Do something with the lambda function...
}
}

Expected result:
----------------
No error message from CodeSniffer.

Actual result:
--------------
Using the MethodScopeSniff I get the following error:
No scope modifier specified for function "preg_replace"

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

Search Discussions

  • Webmaster at Dec 21, 2009 at 3:20 am
    Edit report at http://pear.php.net/bugs/bug.php?id=16932&edit=1

    ID: 16932
    Updated by: webmaster@mamo-net.de
    Reported By: webmaster at mamo-net dot de
    Summary: MethodScopeSniff does not support lambda functions
    Status: Closed
    Type: Bug
    Package: PHP_CodeSniffer
    Operating System: Win 7
    Package Version: 1.2.1
    PHP Version: 5.3.1
    Assigned To: squiz
    Roadmap Versions:
    New Comment:

    Thank you for the fast response, but I copied the MethodScopeSniff from
    SVN Rev. 292390 to my CodeSniffer standard and the error is occuring
    again, seems as the fix is not working properly. Can you check that,
    please?


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

    [2009-12-21 00:32:35] squiz

    -Status: Open
    +Status: Closed
    -Assigned To:
    +Assigned To: squiz
    This bug has been fixed in SVN.

    If this was a documentation problem, the fix will appear on
    pear.php.net by the end of next Sunday (CET).

    If this was a problem with the pear.php.net website, the change should
    be live shortly.

    Otherwise, the fix will appear in the package's next release.

    Thank you for the report and for helping us make PEAR better.

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

    [2009-12-20 17:11:37] viscacha

    Description:
    ------------
    PHP 5.3+ introduced lambda functions / closures, but they do not
    support declaring them as public/private/protected. MethodScopeSniff
    does not really support that as there are several wrong warnings/errors
    in the output.

    Test script:
    ---------------
    class Test {
    public function method() {
    $walk = function(&$a) {
    $a = preg_replace("/[0-9]{3}[\s-]+/", "", trim($a));
    };
    // Do something with the lambda function...
    }
    }

    Expected result:
    ----------------
    No error message from CodeSniffer.

    Actual result:
    --------------
    Using the MethodScopeSniff I get the following error:
    No scope modifier specified for function "preg_replace"

    ------------------------------------------------------------------------
  • Gsherwood at Dec 22, 2009 at 1:46 pm
    Edit report at http://pear.php.net/bugs/bug.php?id=16932&edit=1

    ID: 16932
    Updated by: gsherwood@squiz.net
    Reported By: webmaster at mamo-net dot de
    Summary: MethodScopeSniff does not support lambda functions
    Status: Closed
    Type: Bug
    Package: PHP_CodeSniffer
    Operating System: Win 7
    Package Version: 1.2.1
    PHP Version: 5.3.1
    Assigned To: squiz
    Roadmap Versions:
    New Comment:

    You'll need the core files as well, not just the sniffs. Support for
    closures was added to the core a few weeks ago but all the sniffs need
    to add support individually.

    Can you do a full checkout from SVN and install from the checkout?


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

    [2009-12-21 03:20:03] viscacha

    Thank you for the fast response, but I copied the MethodScopeSniff from
    SVN Rev. 292390 to my CodeSniffer standard and the error is occuring
    again, seems as the fix is not working properly. Can you check that,
    please?

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

    [2009-12-21 00:32:35] squiz

    -Status: Open
    +Status: Closed
    -Assigned To:
    +Assigned To: squiz
    This bug has been fixed in SVN.

    If this was a documentation problem, the fix will appear on
    pear.php.net by the end of next Sunday (CET).

    If this was a problem with the pear.php.net website, the change should
    be live shortly.

    Otherwise, the fix will appear in the package's next release.

    Thank you for the report and for helping us make PEAR better.

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

    [2009-12-20 17:11:37] viscacha

    Description:
    ------------
    PHP 5.3+ introduced lambda functions / closures, but they do not
    support declaring them as public/private/protected. MethodScopeSniff
    does not really support that as there are several wrong warnings/errors
    in the output.

    Test script:
    ---------------
    class Test {
    public function method() {
    $walk = function(&$a) {
    $a = preg_replace("/[0-9]{3}[\s-]+/", "", trim($a));
    };
    // Do something with the lambda function...
    }
    }

    Expected result:
    ----------------
    No error message from CodeSniffer.

    Actual result:
    --------------
    Using the MethodScopeSniff I get the following error:
    No scope modifier specified for function "preg_replace"

    ------------------------------------------------------------------------
  • Webmaster at Dec 23, 2009 at 1:18 am
    Edit report at http://pear.php.net/bugs/bug.php?id=16932&edit=1

    ID: 16932
    Updated by: webmaster@mamo-net.de
    Reported By: webmaster at mamo-net dot de
    Summary: MethodScopeSniff does not support lambda functions
    Status: Closed
    Type: Bug
    Package: PHP_CodeSniffer
    Operating System: Win 7
    Package Version: 1.2.1
    PHP Version: 5.3.1
    Assigned To: squiz
    Roadmap Versions:
    New Comment:

    The svn snapshot is working like a charm, thanks for that!


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

    [2009-12-21 22:34:25] squiz

    You'll need the core files as well, not just the sniffs. Support for
    closures was added to the core a few weeks ago but all the sniffs need
    to add support individually.

    Can you do a full checkout from SVN and install from the checkout?

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

    [2009-12-21 03:20:03] viscacha

    Thank you for the fast response, but I copied the MethodScopeSniff from
    SVN Rev. 292390 to my CodeSniffer standard and the error is occuring
    again, seems as the fix is not working properly. Can you check that,
    please?

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

    [2009-12-21 00:32:35] squiz

    -Status: Open
    +Status: Closed
    -Assigned To:
    +Assigned To: squiz
    This bug has been fixed in SVN.

    If this was a documentation problem, the fix will appear on
    pear.php.net by the end of next Sunday (CET).

    If this was a problem with the pear.php.net website, the change should
    be live shortly.

    Otherwise, the fix will appear in the package's next release.

    Thank you for the report and for helping us make PEAR better.

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

    [2009-12-20 17:11:37] viscacha

    Description:
    ------------
    PHP 5.3+ introduced lambda functions / closures, but they do not
    support declaring them as public/private/protected. MethodScopeSniff
    does not really support that as there are several wrong warnings/errors
    in the output.

    Test script:
    ---------------
    class Test {
    public function method() {
    $walk = function(&$a) {
    $a = preg_replace("/[0-9]{3}[\s-]+/", "", trim($a));
    };
    // Do something with the lambda function...
    }
    }

    Expected result:
    ----------------
    No error message from CodeSniffer.

    Actual result:
    --------------
    Using the MethodScopeSniff I get the following error:
    No scope modifier specified for function "preg_replace"

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

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppear-bugs @
categoriesphp
postedDec 21, '09 at 12:32a
activeDec 23, '09 at 1:18a
posts4
users2
websitepear.php.net

2 users in discussion

Webmaster: 2 posts Gsherwood: 2 posts

People

Translate

site design / logo © 2022 Grokbase