Skip to content

Commit

Permalink
fix: new phpcs issues
Browse files Browse the repository at this point in the history
  • Loading branch information
sjinks committed Sep 20, 2023
1 parent de01a4e commit f32b951
Show file tree
Hide file tree
Showing 10 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion lib/helpers/wp-cli-db/class-wp-cli-db.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public function validate_subcommand( array $command ) {
];

if ( ! in_array( $subcommand, $allowed_subcommands, true ) ) {
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- CLI
// phpcs:ignore WordPress.Security.EscapeOutput.ExceptionNotEscaped -- CLI
throw new Exception( "The `wp db $subcommand` subcommand is not permitted for this site." );
}

Expand Down
2 changes: 1 addition & 1 deletion tests/cache/test-vary-cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function setUp(): void {
// phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_set_error_handler
set_error_handler( static function ( int $errno, string $errstr ) {
if ( $errno & error_reporting() ) {
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- CLI
// phpcs:ignore WordPress.Security.EscapeOutput.ExceptionNotEscaped -- CLI
throw new ErrorException( $errstr, $errno );
}

Expand Down
2 changes: 1 addition & 1 deletion tests/files/acl/test-acl.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function setUp(): void {
// phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_set_error_handler
set_error_handler( static function ( int $errno, string $errstr ) {
if ( error_reporting() & $errno ) {
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- CLI
// phpcs:ignore WordPress.Security.EscapeOutput.ExceptionNotEscaped -- CLI
throw new ErrorException( $errstr, $errno );
}

Expand Down
2 changes: 1 addition & 1 deletion tests/files/acl/test-pre-wp-utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public function setUp(): void {
// phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_set_error_handler
set_error_handler( static function ( int $errno, string $errstr ) {
if ( error_reporting() & $errno ) {
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- CLI
// phpcs:ignore WordPress.Security.EscapeOutput.ExceptionNotEscaped -- CLI
throw new ErrorException( $errstr, $errno );
}

Expand Down
2 changes: 1 addition & 1 deletion tests/files/test-vip-filesystem.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function setUp(): void {
// phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_set_error_handler
set_error_handler( static function ( int $errno, string $errstr ) {
if ( $errno & error_reporting() ) {
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- CLI
// phpcs:ignore WordPress.Security.EscapeOutput.ExceptionNotEscaped -- CLI
throw new ErrorException( $errstr, $errno );
}

Expand Down
2 changes: 1 addition & 1 deletion tests/files/test-wp-filesystem-vip.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function setUp(): void {
// phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_set_error_handler
set_error_handler( static function ( int $errno, string $errstr ) {
if ( error_reporting() & $errno ) {
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- CLI
// phpcs:ignore WordPress.Security.EscapeOutput.ExceptionNotEscaped -- CLI
throw new ErrorException( $errstr, $errno );
}

Expand Down
4 changes: 2 additions & 2 deletions tests/mock-constants.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public static function clear(): void {

public static function define( string $constant, $value ): void {
if ( isset( self::$constants[ $constant ] ) ) {
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- CLI
// phpcs:ignore WordPress.Security.EscapeOutput.ExceptionNotEscaped -- CLI
throw new InvalidArgumentException( sprintf( "Constant \"%s\" is already defined. Stacktrace:\n%s", $constant, self::$constants[ $constant ][1] ) );
}

Expand All @@ -36,7 +36,7 @@ public static function defined( string $constant ): bool {

public static function constant( string $constant ) {
if ( ! isset( self::$constants[ $constant ] ) ) {
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- CLI
// phpcs:ignore WordPress.Security.EscapeOutput.ExceptionNotEscaped -- CLI
throw new InvalidArgumentException( sprintf( 'Constant "%s" is not defined', $constant ) );
}

Expand Down
2 changes: 1 addition & 1 deletion tests/prometheus/test-prometheus.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function setUp(): void {
// As of PHPUnit 10.x, expectWarning() is removed. We'll use a custom error handler to test for warnings.
// phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_set_error_handler
set_error_handler( static function ( int $errno, string $errstr ): never {
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- CLI
// phpcs:ignore WordPress.Security.EscapeOutput.ExceptionNotEscaped -- CLI
throw new \Exception( $errstr, $errno );
}, E_USER_WARNING );
}
Expand Down
2 changes: 1 addition & 1 deletion tests/search/includes/classes/test-class-search.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function setUp(): void {
// As of PHPUnit 10.x, expectWarning() is removed. We'll use a custom error handler to test for warnings.
// phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_set_error_handler
set_error_handler( static function ( int $errno, string $errstr ): never {
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- CLI
// phpcs:ignore WordPress.Security.EscapeOutput.ExceptionNotEscaped -- CLI
throw new \Exception( $errstr, $errno );
}, E_USER_WARNING );
}
Expand Down
2 changes: 1 addition & 1 deletion tests/test-vip-cache-manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function setUp(): void {
$this->original_error_reporting = error_reporting();
set_error_handler( static function ( int $errno, string $errstr ) {
if ( error_reporting() & $errno ) {
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- CLI
// phpcs:ignore WordPress.Security.EscapeOutput.ExceptionNotEscaped -- CLI
throw new ErrorException( $errstr, $errno );
}

Expand Down

0 comments on commit f32b951

Please sign in to comment.