Skip to content

Commit e1e54fd

Browse files
committed
PHPCS: whitelist some code for select sniffs
1 parent badbdcb commit e1e54fd

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/Search_Replace_Command.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,8 @@ public function __invoke( $args, $assoc_args ) {
200200
$search_regex .= $old;
201201
$search_regex .= $this->regex_delimiter;
202202
$search_regex .= $this->regex_flags;
203+
204+
// phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged -- Preventing a warning when testing the regex.
203205
if ( false === @preg_match( $search_regex, '' ) ) {
204206
if ( $default_regex_delimiter ) {
205207
$flags_msg = $this->regex_flags ? "flags '$this->regex_flags'" : 'no flags';
@@ -236,6 +238,7 @@ public function __invoke( $args, $assoc_args ) {
236238
}
237239
}
238240
$export_insert_size = WP_CLI\Utils\get_flag_value( $assoc_args, 'export_insert_size', 50 );
241+
// phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison -- See the code, this is deliberate.
239242
if ( (int) $export_insert_size == $export_insert_size && $export_insert_size > 0 ) {
240243
$this->export_insert_size = $export_insert_size;
241244
}
@@ -691,7 +694,7 @@ private static function esc_like( $old ) {
691694
// 4.0
692695
$old = $wpdb->esc_like( $old );
693696
} else {
694-
// 3.9 or less
697+
// phpcs:ignore WordPress.WP.DeprecatedFunctions.like_escapeFound -- BC-layer for WP 3.9 or less.
695698
$old = like_escape( esc_sql( $old ) ); // Note: this double escaping is actually necessary, even though `esc_like()` will be used in a `prepare()`.
696699
}
697700

src/WP_CLI/SearchReplacer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ private function run_recursively( $data, $serialised, $recursion_level = 0, $vis
136136
if ( $serialised ) {
137137
return serialize( $data );
138138
}
139-
} catch ( Exception $error ) {
139+
} catch ( Exception $error ) { // phpcs:ignore Generic.CodeAnalysis.EmptyStatement.DetectedCatch -- Deliberally empty.
140140

141141
}
142142

0 commit comments

Comments
 (0)