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

ID: 16961
Comment by: jeff_dickey
Reported By: jdickey at seven-sigma dot com
Summary: Add support for anonymous functions in PHP 5.3
Status: Closed
Type: Feature/Change Request
Package: PHP_CodeSniffer
Package Version: CVS
PHP Version: 5.3.1
Assigned To: squiz
New Comment:

Would it be possible to link to such bug reports from this feature
request or other easily-findable place? I'm currently working on a
couple of projects that have been using the PEAR sniffs with the
attitude "we shouldn't have to write our own code standards..."


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

[2010-08-11 06:32:33] squiz

<div id="changeset">
<span class="removed">-Status: Assigned</span>
<span class="added">+Status: Closed</span>
</div>Considering this is an ongoing feature request, I'm going to close
it and just deal with any issues as bug reports.

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

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

<div id="changeset">
<span class="removed">-Assigned To:</span>
<span class="added">+Assigned To: squiz</span>
</div>

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

[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

Previous

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 2 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