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

ID: 16961
Updated by: [email protected]
Reported By: thezero at jyxo dot com
Summary: Add support for anonymous functions in PHP 5.3
Status: Open
Type: Feature/Change Request
Package: PHP_CodeSniffer
Package Version: CVS
PHP Version: 5.3.1
Roadmap Versions:
New Comment:

PHP_CodeSniffer core has support for closures, but each sniff needs to
check for them using the core functions. I've been fixing sniffs as I
find them, so this task is ongoing.


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

[2009-12-31 11:53:44] thezero

Description:
------------
Anonymous functions in PHP 5.3 now emit E_NOTICE in
Generic_Sniffs_Formatting_DisallowMultipleStatementsSniff on lines 66 a
67.

Also, they raise many false positives in following sniffs:
* Squiz_Sniffs_PHP_InnerFunctionsSniff
* Squiz_Sniffs_Scope_MethodScopeSniff
* Generic_Sniffs_Functions_OpeningFunctionBraceBsdAllmanSniff (I
believe anonymous functions should have bracket on the same line as
function keyword)
* Squiz_Sniffs_PHP_NonExecutableCodeSniff
and possibly others.

Test script:
---------------
<?php
class User_Data_Memcache implements User_Data_Source
{
public function getData(User_Interface $user)
{
$fallback = $this->fallback;
return $this->find(self::CACHE_KEY_EXTENDED . $user->username(),
function() use ($fallback, $user) {
return $fallback->getData($user);
});
}
}

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

Search Discussions

  • Gsherwood at Jan 10, 2010 at 9:59 pm
    Edit report at http://pear.php.net/bugs/bug.php?id=16961&edit=1

    ID: 16961
    Updated by: [email protected]
    Reported By: thezero at jyxo dot com
    Summary: Add support for anonymous functions in PHP 5.3
    Status: Open
    Type: Feature/Change Request
    Package: PHP_CodeSniffer
    Package Version: CVS
    PHP Version: 5.3.1
    -Assigned To:
    +Assigned To: squiz
    Roadmap Versions:
    New Comment:

    -Assigned To:
    +Assigned To: squiz



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

    [2010-01-10 21:58:24] squiz

    PHP_CodeSniffer core has support for closures, but each sniff needs to
    check for them using the core functions. I've been fixing sniffs as I
    find them, so this task is ongoing.

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

    [2009-12-31 11:53:44] thezero

    Description:
    ------------
    Anonymous functions in PHP 5.3 now emit E_NOTICE in
    Generic_Sniffs_Formatting_DisallowMultipleStatementsSniff on lines 66 a
    67.

    Also, they raise many false positives in following sniffs:
    * Squiz_Sniffs_PHP_InnerFunctionsSniff
    * Squiz_Sniffs_Scope_MethodScopeSniff
    * Generic_Sniffs_Functions_OpeningFunctionBraceBsdAllmanSniff (I
    believe anonymous functions should have bracket on the same line as
    function keyword)
    * Squiz_Sniffs_PHP_NonExecutableCodeSniff
    and possibly others.

    Test script:
    ---------------
    <?php
    class User_Data_Memcache implements User_Data_Source
    {
    public function getData(User_Interface $user)
    {
    $fallback = $this->fallback;
    return $this->find(self::CACHE_KEY_EXTENDED . $user->username(),
    function() use ($fallback, $user) {
    return $fallback->getData($user);
    });
    }
    }

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

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppear-bugs @
categoriesphp
postedJan 10, '10 at 9:59p
activeJan 10, '10 at 9:59p
posts2
users1
websitepear.php.net

1 user in discussion

Gsherwood: 2 posts

People

Translate

site design / logo © 2023 Grokbase