Skip to content

Commit f3a603f

Browse files
authored
Merge pull request #1670 from WordPress-Coding-Standards/feature/validatedsanitized-minor-code-readability
ValidatedSanitizedInput: minor code readability improvement
2 parents 3a30b78 + 4e05eaa commit f3a603f

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

WordPress/Sniffs/Security/ValidatedSanitizedInputSniff.php

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,12 @@ function ( $symbol ) {
133133

134134
// Check for validation first.
135135
if ( ! $this->is_validated( $stackPtr, $array_key, $this->check_validation_in_scope_only ) ) {
136-
$this->phpcsFile->addError( 'Detected usage of a non-validated input variable: %s', $stackPtr, 'InputNotValidated', $error_data );
137-
// return; // Should we just return and not look for sanitizing functions ?
136+
$this->phpcsFile->addError(
137+
'Detected usage of a non-validated input variable: %s',
138+
$stackPtr,
139+
'InputNotValidated',
140+
$error_data
141+
);
138142
}
139143

140144
if ( $this->has_whitelist_comment( 'sanitization', $stackPtr ) ) {
@@ -150,7 +154,12 @@ function ( $symbol ) {
150154

151155
// Now look for sanitizing functions.
152156
if ( ! $this->is_sanitized( $stackPtr, true ) ) {
153-
$this->phpcsFile->addError( 'Detected usage of a non-sanitized input variable: %s', $stackPtr, 'InputNotSanitized', $error_data );
157+
$this->phpcsFile->addError(
158+
'Detected usage of a non-sanitized input variable: %s',
159+
$stackPtr,
160+
'InputNotSanitized',
161+
$error_data
162+
);
154163
}
155164
}
156165

0 commit comments

Comments
 (0)