Skip to content

Commit 0f06788

Browse files
committed
Fixed bug #554 : ScopeIndentSniff causes errors when encountering an unmatched parenthesis
1 parent 2501460 commit 0f06788

File tree

7 files changed

+25
-0
lines changed

7 files changed

+25
-0
lines changed

CodeSniffer/Standards/Generic/Sniffs/WhiteSpace/ScopeIndentSniff.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,7 @@ public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
217217
// the same level as where they were opened (but can be more).
218218
if ($checkToken !== null
219219
&& $tokens[$checkToken]['code'] === T_CLOSE_PARENTHESIS
220+
&& isset($tokens[$checkToken]['parenthesis_opener']) === true
220221
) {
221222
if ($this->_debug === true) {
222223
$line = $tokens[$i]['line'];

CodeSniffer/Standards/Generic/Tests/WhiteSpace/ScopeIndentUnitTest.1.inc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -857,4 +857,9 @@ try {
857857
return false;
858858
}
859859

860+
/*
861+
$a = array(
862+
*/
863+
);
864+
860865
echo ""

CodeSniffer/Standards/Generic/Tests/WhiteSpace/ScopeIndentUnitTest.1.inc.fixed

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -857,4 +857,9 @@ function foo()
857857
return false;
858858
}
859859

860+
/*
861+
$a = array(
862+
*/
863+
);
864+
860865
echo ""

CodeSniffer/Standards/Generic/Tests/WhiteSpace/ScopeIndentUnitTest.2.inc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -857,4 +857,9 @@ try {
857857
return false;
858858
}
859859

860+
/*
861+
$a = array(
862+
*/
863+
);
864+
860865
echo ""

CodeSniffer/Standards/Generic/Tests/WhiteSpace/ScopeIndentUnitTest.2.inc.fixed

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -857,4 +857,9 @@ function foo()
857857
return false;
858858
}
859859

860+
/*
861+
$a = array(
862+
*/
863+
);
864+
860865
echo ""

CodeSniffer/Standards/Generic/Tests/WhiteSpace/ScopeIndentUnitTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,9 @@ public function getErrorList($testFile='ScopeIndentUnitTest.inc')
141141
823 => 1,
142142
848 => 1,
143143
860 => 1,
144+
861 => 1,
145+
863 => 1,
146+
865 => 1,
144147
);
145148

146149
}//end getErrorList()

package.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ http://pear.php.net/dtd/package-2.0.xsd">
4646
- Fixed bug #523 : Generic ScopeIndent errors for IF in FINALLY
4747
- Fixed bug #527 : Closure inside IF statement is not tokenized correctly
4848
- Fixed bug #551 : Multiple catch blocks not checked in Squiz.ControlStructures.ControlSignature sniff
49+
- Fixed bug #554 : ScopeIndentSniff causes errors when encountering an unmatched parenthesis
4950
</notes>
5051
<contents>
5152
<dir name="/">

0 commit comments

Comments
 (0)