Skip to content

Commit

Permalink
Fix WordPress.Security phpcs report in Check model (#8473)
Browse files Browse the repository at this point in the history
  • Loading branch information
ismaeldcom authored Mar 26, 2024
1 parent 0c4b4ca commit a8068cf
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions changelog/fix-8470-phpcs-report
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: fix
Comment: Ignore a PHPCS rule in two lines.


4 changes: 4 additions & 0 deletions includes/fraud-prevention/models/class-check.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,8 @@ public static function validate_array( array $array ): bool {
*/
public static function list( string $operator, array $checks ) {
if ( ! in_array( $operator, self::$list_operators, true ) ) {
// $operator is a predefined constant, no need to escape.
// phpcs:ignore WordPress.Security.EscapeOutput
throw new Fraud_Ruleset_Exception( 'Operator for the check is invalid: ' . $operator );
}
if ( 0 < count(
Expand Down Expand Up @@ -183,6 +185,8 @@ function( $check ) {
*/
public static function check( string $key, string $operator, $value ) {
if ( ! in_array( $operator, self::$check_operators, true ) ) {
// $operator is a predefined constant, no need to escape.
// phpcs:ignore WordPress.Security.EscapeOutput
throw new Fraud_Ruleset_Exception( 'Operator for the check is invalid: ' . $operator );
}

Expand Down

0 comments on commit a8068cf

Please sign in to comment.