Skip to content

Commit ab88d5c

Browse files
committed
PHPCS: fix up the code base [3] - strict comparisons
Fixes relate to the following rules: * Use strict comparisons. * Use the `$strict` parameter when calling `in_array()`.
1 parent 155a1f4 commit ab88d5c

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/Scaffold_Command.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ public function _s( $args, $assoc_args ) {
421421
}
422422

423423
$response_code = wp_remote_retrieve_response_code( $response );
424-
if ( 200 != $response_code ) {
424+
if ( 200 !== (int) $response_code ) {
425425
WP_CLI::error( "Couldn't create theme (received $response_code response)." );
426426
}
427427

@@ -493,7 +493,7 @@ public function _s( $args, $assoc_args ) {
493493
function child_theme( $args, $assoc_args ) {
494494
$theme_slug = $args[0];
495495

496-
if ( in_array( $theme_slug, array( '.', '..' ) ) ) {
496+
if ( in_array( $theme_slug, array( '.', '..' ), true ) ) {
497497
WP_CLI::error( "Invalid theme slug specified. The slug cannot be '.' or '..'." );
498498
}
499499

@@ -639,7 +639,7 @@ function plugin( $args, $assoc_args ) {
639639
$plugin_name = ucwords( str_replace( '-', ' ', $plugin_slug ) );
640640
$plugin_package = str_replace( ' ', '_', $plugin_name );
641641

642-
if ( in_array( $plugin_slug, array( '.', '..' ) ) ) {
642+
if ( in_array( $plugin_slug, array( '.', '..' ), true ) ) {
643643
WP_CLI::error( "Invalid plugin slug specified. The slug cannot be '.' or '..'." );
644644
}
645645

@@ -811,7 +811,7 @@ private function scaffold_plugin_theme_tests( $args, $assoc_args, $type ) {
811811

812812
if ( ! empty( $args[0] ) ) {
813813
$slug = $args[0];
814-
if ( in_array( $slug, array( '.', '..' ) ) ) {
814+
if ( in_array( $slug, array( '.', '..' ), true ) ) {
815815
WP_CLI::error( "Invalid {$type} slug specified. The slug cannot be '.' or '..'." );
816816
}
817817
if ( 'theme' === $type ) {
@@ -977,7 +977,7 @@ protected function prompt_if_files_will_be_overwritten( $filename, $force ) {
977977
$default = false,
978978
$marker = '[s/r]: '
979979
);
980-
} while ( ! in_array( $answer, array( 's', 'r' ) ) );
980+
} while ( ! in_array( $answer, array( 's', 'r' ), true ) );
981981
$should_write_file = 'r' === $answer;
982982
}
983983

0 commit comments

Comments
 (0)