Skip to content

Commit f58f162

Browse files
committed
Merge branch 'finer_forbidden_function_token' of https://github.com/Billz95/PHP_CodeSniffer
2 parents e22ff22 + 28faa56 commit f58f162

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/Standards/Generic/Sniffs/PHP/ForbiddenFunctionsSniff.php

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,18 @@ public function register()
7474

7575
// If we are not pattern matching, we need to work out what
7676
// tokens to listen for.
77-
$string = '<?php ';
77+
$hasHaltCompiler = false;
78+
$string = '<?php ';
7879
foreach ($this->forbiddenFunctionNames as $name) {
79-
$string .= $name.'();';
80+
if ($name === '__halt_compiler') {
81+
$hasHaltCompiler = true;
82+
} else {
83+
$string .= $name.'();';
84+
}
85+
}
86+
87+
if ($hasHaltCompiler === true) {
88+
$string .= '__halt_compiler();';
8089
}
8190

8291
$register = [];

0 commit comments

Comments
 (0)