Skip to content

Commit 6d817d8

Browse files
committed
Fixed bug #20093 : Bug with ternary operator token
1 parent 146a9b5 commit 6d817d8

File tree

5 files changed

+6
-0
lines changed

5 files changed

+6
-0
lines changed

CodeSniffer/Standards/Generic/Tests/PHP/LowerCaseConstantUnitTest.inc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,4 +63,6 @@ class MyClass
6363
$var = array('foo' => new True());
6464
}
6565
}
66+
67+
$x = $f?FALSE:true;
6668
?>

CodeSniffer/Standards/Generic/Tests/PHP/LowerCaseConstantUnitTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ public function getErrorList($testFile='LowerCaseConstantUnitTest.inc')
5959
42 => 1,
6060
47 => 1,
6161
48 => 1,
62+
67 => 1,
6263
);
6364
break;
6465
case 'LowerCaseConstantUnitTest.js':

CodeSniffer/Standards/Generic/Tests/PHP/UpperCaseConstantUnitTest.inc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,4 +64,5 @@ class MyClass
6464
}
6565
}
6666

67+
$x = $f?false:TRUE;
6768
?>

CodeSniffer/Standards/Generic/Tests/PHP/UpperCaseConstantUnitTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ public function getErrorList()
5555
42 => 1,
5656
47 => 1,
5757
48 => 1,
58+
67 => 1,
5859
);
5960

6061
}//end getErrorList()

CodeSniffer/Tokenizers/PHP.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -445,6 +445,7 @@ public function tokenizeString($string, $eolChar='\n')
445445
&& $token[0] === T_STRING
446446
&& $tokens[($stackPtr + 1)] === ':'
447447
&& $tokens[($stackPtr - 1)][0] !== T_PAAMAYIM_NEKUDOTAYIM
448+
&& $tokens[($stackPtr - 1)] !== '?'
448449
) {
449450
$stopTokens = array(
450451
T_CASE,

0 commit comments

Comments
 (0)