diff --git a/WordPress/Sniffs/NamingConventions/ValidVariableNameSniff.php b/WordPress/Sniffs/NamingConventions/ValidVariableNameSniff.php index 6a6d660058..beeece5916 100644 --- a/WordPress/Sniffs/NamingConventions/ValidVariableNameSniff.php +++ b/WordPress/Sniffs/NamingConventions/ValidVariableNameSniff.php @@ -280,15 +280,16 @@ protected function mergeWhiteList( $phpcs_file ) { return; } - if ( ! empty( $this->customPropertiesWhitelist ) ) { - if ( ! is_array( $this->customPropertiesWhitelist ) ) { - // Incorrectly set property. - $phpcs_file->addWarning( - 'The customVariablesWhitelist property should be provided with type="array".', - 0, - 'WrongFormatCustomVariablesWhitelist' - ); - } + if ( + ! empty( $this->customPropertiesWhitelist ) + && ! is_array( $this->customPropertiesWhitelist ) + ) { + // Incorrectly set property. + $phpcs_file->addWarning( + 'The customVariablesWhitelist property should be provided with type="array".', + 0, + 'WrongFormatCustomVariablesWhitelist' + ); // Potentially correct incorrect format. if ( is_string( $this->customPropertiesWhitelist ) ) {