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

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

-Status: Assigned
+Status: Closed
Considering this is an ongoing feature request, I'm going to close it
and just deal with any issues as bug reports.


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

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

-Assigned To:
+Assigned To: squiz


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

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

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

Search Discussions

Discussion Posts

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 1 of 2 | next ›
Discussion Overview
grouppear-bugs @
categoriesphp
postedAug 11, '10 at 6:32a
activeAug 20, '10 at 12:19p
posts2
users2
websitepear.php.net

2 users in discussion

Jeff_dickey: 1 post Gsherwood: 1 post

People

Translate

site design / logo © 2022 Grokbase