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

@triplepoint

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
@triplepoint 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
@triplepoint triplepoint Update CodeSniffer/Standards/Squiz/Tests/Functions/MultiLineFunctionD…
…eclarationUnitTest.inc

Missing semicolon. Good catch @sqmk
60d37b1
@gsherwood
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

@gsherwood 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. @triplepoint

    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. @triplepoint

    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.
View
2  CodeSniffer/Standards/PEAR/Sniffs/Functions/FunctionDeclarationSniff.php
@@ -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;
View
7 CodeSniffer/Standards/Squiz/Tests/Functions/MultiLineFunctionDeclarationUnitTest.inc
@@ -90,4 +90,9 @@ $noArgs_longVars = function () use (
) {
// body
};
-?>
+
+$shortArgs = function ($one, $two) {
+ // body
+};
+
+?>
Something went wrong with that request. Please try again.