Skip to content

Commit d841a8e

Browse files
committed
Fixed bug #938 : CallTimePassByReferenceSniff ignores functions with return value
1 parent 884a8ae commit d841a8e

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

CodeSniffer/Standards/Generic/Sniffs/Functions/CallTimePassByReferenceSniff.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,8 @@ public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
6868
// within their definitions. For example: function myFunction...
6969
// "myFunction" is T_STRING but we should skip because it is not a
7070
// function or method *call*.
71-
// Also skip if the return value is being assigned to a variable.
7271
$prevCode = $tokens[$prev]['code'];
73-
if ($prevCode === T_FUNCTION
74-
|| $prevCode === T_CLASS
75-
|| isset(PHP_CodeSniffer_Tokens::$assignmentTokens[$prevCode]) === true
76-
) {
72+
if ($prevCode === T_FUNCTION || $prevCode === T_CLASS) {
7773
return;
7874
}
7975

package.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ http://pear.php.net/dtd/package-2.0.xsd">
8282
- Fixed bug #928 : Endless loop when sniffing a PHP file with a git merge conflict inside a function
8383
- Fixed bug #937 : Shebang can cause PSR1 SideEffects warning
8484
-- Thanks to Clay Loveless for the patch
85+
- Fixed bug #938 : CallTimePassByReferenceSniff ignores functions with return value
8586
</notes>
8687
<contents>
8788
<dir name="/">

0 commit comments

Comments
 (0)