From 8c81cc62abe207f1a1568b6bfae9e6adb14177ba Mon Sep 17 00:00:00 2001 From: jrfnl Date: Sat, 19 Aug 2023 01:47:36 +0200 Subject: [PATCH] CS: closures not using `$this` should be static --- WordPress/Sniffs/DB/PreparedSQLPlaceholdersSniff.php | 2 +- WordPress/Sniffs/DB/PreparedSQLSniff.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/WordPress/Sniffs/DB/PreparedSQLPlaceholdersSniff.php b/WordPress/Sniffs/DB/PreparedSQLPlaceholdersSniff.php index 1e481d8229..043175d8fb 100644 --- a/WordPress/Sniffs/DB/PreparedSQLPlaceholdersSniff.php +++ b/WordPress/Sniffs/DB/PreparedSQLPlaceholdersSniff.php @@ -327,7 +327,7 @@ public function process_token( $stackPtr ) { if ( $stripped_content !== $content ) { $vars_without_wpdb = array_filter( TextStrings::getEmbeds( $content ), - function ( $symbol ) { + static function ( $symbol ) { return preg_match( '`^\{?\$\{?wpdb\??->`', $symbol ) !== 1; } ); diff --git a/WordPress/Sniffs/DB/PreparedSQLSniff.php b/WordPress/Sniffs/DB/PreparedSQLSniff.php index 7e1dc613b6..7b6529ef90 100644 --- a/WordPress/Sniffs/DB/PreparedSQLSniff.php +++ b/WordPress/Sniffs/DB/PreparedSQLSniff.php @@ -176,7 +176,7 @@ public function process_token( $stackPtr ) { $bad_variables = array_filter( TextStrings::getEmbeds( $this->tokens[ $this->i ]['content'] ), - function ( $symbol ) { + static function ( $symbol ) { return preg_match( '`^\{?\$\{?wpdb\??->`', $symbol ) !== 1; } );