Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

[BUGFIX] #19655 - Commas in closure definitions were improperly parsed #64

Closed
wants to merge 2 commits into from

2 participants

Jonathan Hanson Greg Sherwood
Jonathan Hanson

I added a test for PEAR_Sniffs_Functions_FunctionDeclarationSniff to cover
undesirable behavior for closure definitions with multiple parameters on
a single line. See bug definition for details.

I also added a fix in PEAR_Sniffs_Functions_FunctionDeclarationSniff for this
condition.

added some commits October 22, 2012
Jonathan Hanson repair for Bug #19655
Added a test for PEAR_Sniffs_Functions_FunctionDeclarationSniff to cover
undesirable behavior for closure definitions with multiple parameters on
a single line.  See bug definition for details.

Added a fix in PEAR_Sniffs_Functions_FunctionDeclarationSniff for this
condition.
80fe937
Jonathan Hanson Update CodeSniffer/Standards/Squiz/Tests/Functions/MultiLineFunctionD…
…eclarationUnitTest.inc

Missing semicolon. Good catch @sqmk
60d37b1
Greg Sherwood
Owner

Sorry, didn't see this and did my own fix for it. Took the time to re-order the logic in that IF statement so it was easier (for me at least) to read.

This was fixed in this commit: 5369695

Greg Sherwood gsherwood closed this October 25, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 2 unique commits by 1 author.

Oct 22, 2012
Jonathan Hanson repair for Bug #19655
Added a test for PEAR_Sniffs_Functions_FunctionDeclarationSniff to cover
undesirable behavior for closure definitions with multiple parameters on
a single line.  See bug definition for details.

Added a fix in PEAR_Sniffs_Functions_FunctionDeclarationSniff for this
condition.
80fe937
Jonathan Hanson Update CodeSniffer/Standards/Squiz/Tests/Functions/MultiLineFunctionD…
…eclarationUnitTest.inc

Missing semicolon. Good catch @sqmk
60d37b1
This page is out of date. Refresh to see the latest.
2  CodeSniffer/Standards/PEAR/Sniffs/Functions/FunctionDeclarationSniff.php
@@ -117,6 +117,8 @@ public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
117 117
                     if ($tokens[$open]['line'] === $tokens[$close]['line']) {
118 118
                         $singleLine = true;
119 119
                     }
  120
+                } else {
  121
+                    $singleLine = true;
120 122
                 }
121 123
             } else {
122 124
                 $singleLine = true;
7  CodeSniffer/Standards/Squiz/Tests/Functions/MultiLineFunctionDeclarationUnitTest.inc
@@ -90,4 +90,9 @@ $noArgs_longVars = function () use (
90 90
 ) {
91 91
     // body
92 92
 };
93  
-?>
  93
+
  94
+$shortArgs = function ($one, $two) {
  95
+    // body
  96
+};
  97
+
  98
+?>
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.