Skip to content

Commit 2fd4721

Browse files
committed
Add a case to identify unescaped static method calls in the sniff
1 parent 20d3d19 commit 2fd4721

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Diff for: WordPress/Sniffs/Security/EscapeOutputSniff.php

+8
Original file line numberDiff line numberDiff line change
@@ -737,6 +737,14 @@ protected function check_code_is_escaped( $start, $end ) {
737737

738738
$content = $functionName;
739739

740+
// Check if it's static method call.
741+
$double_colon = $this->phpcsFile->findNext( Tokens::$emptyTokens, ( $i + 1 ), $end, true );
742+
if ( false !== $double_colon
743+
&& \T_DOUBLE_COLON === $this->tokens[ $double_colon ]['code']
744+
) {
745+
// Set the pointer to the end of the method.
746+
$i = $this->phpcsFile->findNext( \T_CLOSE_PARENTHESIS, $i, $end );
747+
}
740748
} else {
741749
$content = $this->tokens[ $i ]['content'];
742750
$ptr = $i;

0 commit comments

Comments
 (0)