Bug #19399 [Opn->Fbk]: Bogus "Missing @return tag"
| From: | gsherwood at squiz dot net | Date: | Thu, 26 Apr 2012 05:15:20 +0000 |
| Subject: | Bug #19399 [Opn->Fbk]: Bogus "Missing @return tag" | ||
| References: | 1 | Groups: | php.pear.bugs |
| Request: | Send a blank email to pear-bugs+get-8578@lists.php.net to get a copy of this message | ||
Edit report at https://pear.php.net/bugs/bug.php?id=19399&edit=1
ID: 19399
Updated by: gsherwood@squiz.net
Reported By: anthon dot pang at gmail dot com
Summary: Bogus "Missing @return tag"
-Status: Open
+Status: Feedback
Type: Bug
Package: PHP_CodeSniffer
Operating System: Ubuntu
Package Version: 1.3.3
PHP Version: 5.3.2
-Assigned To:
+Assigned To: squiz
Roadmap Versions:
New Comment:
-Status: Open
+Status: Feedback
-Assigned To:
+Assigned To: squiz
Even if the function is empty, you'll still be asked to include an
@return tag in the
function comment. In this case, you'd use "@return void" to indicate
that your
function is never supposed to return a value. This happens for both the
included
PEAR and Squiz standards but may not happen for custom standards.
Previous Comments:
------------------------------------------------------------------------
[2012-04-26 06:03:15] vipsoft
Description:
------------
phpcs reports "Missing @return tag" if the method contains an
anonymous function that does a return in its body.
Test script:
---------------
<?php
/**
* @package foo
*/
/**
* foo
*/
class Foo
{
/**
* bar
*/
public function bar()
{
array_filter(array(), function ($val)
{
return true;
});
}
}
Expected result:
----------------
No error
Actual result:
--------------
---------------------------------------------------------------------------
-----
FOUND 1 ERROR(S) AFFECTING 1 LINE(S)
---------------------------------------------------------------------------
-----
12 | ERROR | Missing @return tag in function comment
---------------------------------------------------------------------------
-----
------------------------------------------------------------------------
--
Edit this bug report at https://pear.php.net/bugs/bug.php?id=19399&edit=1