Skip to content

Conversation

Zodiac1978
Copy link
Member

Fixes #31

@stklcode
Copy link
Contributor

stklcode commented Jun 19, 2025

Looks like it could be convenient to move the if-defined-ignore-error_log block into a method and just use self::debug_log( '...' ); in all 5 places.

	/**
	 * Log error message, if WP_DEBUG is enabled.
	 *
	 * @param string $message Error message.
	 */
	private static function debug_log( $message ) {
		if ( defined( 'WP_DEBUG_LOG' ) && WP_DEBUG_LOG ) {
			// phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log
			error_log( $message );
		}
	}

@2ndkauboy
Copy link
Member

Having a function makes sense to me as well.

@stklcode stklcode force-pushed the 31-ignore-error-logging-warning branch from 1141fc0 to 0ba6173 Compare June 19, 2025 12:55
Copy link
Contributor

@stklcode stklcode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Silencing the warning is OK.

Hope my additional changes are as well.

@stklcode stklcode added this to the 1.0.2 milestone Jun 19, 2025
@stklcode stklcode merged commit f61ff99 into master Jun 19, 2025
1 of 2 checks passed
@Zodiac1978 Zodiac1978 deleted the 31-ignore-error-logging-warning branch June 19, 2025 13:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ignore error_log warnin from Plugin Check
3 participants