Skip to content

Commit a163f4a

Browse files
committed
Fix reserved names and add new test case.
1 parent 333b537 commit a163f4a

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

classes/tests/critical.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public function _duplicateFunctionParameter($line) {
9595
* @return boolean Line matches test.
9696
*/
9797
public function _reservedNames($line) {
98-
$regex = "#(?:^|\s)(class|interface|trait)\s+?(?:bool|int|float|string|null|false|true|resource|object|mixed|numeric)(?:$|\s|{)#i";
98+
$regex = "#^\s*?(class|interface|trait)\s+?(?:bool|int|float|string|null|false|true|resource|object|mixed|numeric)(?:$|\s|{)#i";
9999
if (preg_match($regex, $line)) {
100100
return true;
101101
}

testcases.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ static function renderArrayMap(&$parser, $value = '', $delimiter = ',', $var = '
2222
"\\u{xyz}";
2323

2424
//Reserved Class/Interface/Trait Names
25+
} class bool { /*...*/ } //Should not get caught, along with this: class object
2526
class bool { /*...*/ }
2627
class int { /*...*/ }
2728
class float { /*...*/ }

0 commit comments

Comments
 (0)