Automattic\WooCommerce\Internal\Caches

VersionStringGenerator::log_invalid_cached_value │ private │ WC 1.0

Log a value found in the version string cache that isn't a usable version string.

This should never happen with a well-behaved object cache, so surface it for diagnosis rather than silently self-healing.

Method of the class: VersionStringGenerator{}

No Hooks.

Returns

void. Nothing (null).

Usage

// private - for code of main (parent) class only
$result = $this->log_invalid_cached_value( $id, $value, $regenerating ): void;
$id(string) (required)
The ID the invalid value was cached for.
$value(mixed) (required)
The invalid cached value.
$regenerating(true|false) (required)
Whether a replacement version is being generated.

VersionStringGenerator::log_invalid_cached_value() code WC 11.1.2

private function log_invalid_cached_value( string $id, $value, bool $regenerating ): void {
	$this->legacy_proxy->call_function( 'wc_get_logger' )->warning(
		sprintf(
			'Discarded an invalid version string cache entry for ID "%1$s" (got %2$s); %3$s.',
			$id,
			gettype( $value ),
			$regenerating ? 'the version will be regenerated' : 'the entry will be deleted'
		),
		array( 'source' => 'version-string-generator' )
	);
}