Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

[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.

triplepoint added some commits
Jonathan Hanson triplepoint 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 triplepoint 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Oct 23, 2012
  1. Jonathan Hanson

    repair for Bug #19655

    triplepoint authored
    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.
  2. Jonathan Hanson

    Update CodeSniffer/Standards/Squiz/Tests/Functions/MultiLineFunctionD…

    triplepoint authored
    …eclarationUnitTest.inc
    
    Missing semicolon. Good catch @sqmk
This page is out of date. Refresh to see the latest.
2  CodeSniffer/Standards/PEAR/Sniffs/Functions/FunctionDeclarationSniff.php
View
@@ -117,6 +117,8 @@ public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
if ($tokens[$open]['line'] === $tokens[$close]['line']) {
$singleLine = true;
}
+ } else {
+ $singleLine = true;
}
} else {
$singleLine = true;
7 CodeSniffer/Standards/Squiz/Tests/Functions/MultiLineFunctionDeclarationUnitTest.inc
View
@@ -90,4 +90,9 @@ $noArgs_longVars = function () use (
) {
// body
};
-?>
+
+$shortArgs = function ($one, $two) {
+ // body
+};
+
+?>
Something went wrong with that request. Please try again.