Merge pull request #2403 from woocommerce/PCP-3346-type-error-with-w-3-total-cache-plugin

W3 Total Cache: Remove type from file parameter as sometimes null gets passed causing errors (3346)
This commit is contained in:
Emili Castells 2024-07-09 16:20:45 +02:00 committed by GitHub
commit 36a13f6500
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -368,7 +368,16 @@ class CompatModule implements ModuleInterface {
// W3 Total Cache.
add_filter(
'w3tc_minify_js_do_tag_minification',
function( bool $do_tag_minification, string $script_tag, string $file ) {
/**
* Filter callback for 'w3tc_minify_js_do_tag_minification'.
*
* @param bool $do_tag_minification Whether to do tag minification.
* @param string $script_tag The script tag.
* @param string|null $file The file path.
* @return bool Whether to do tag minification.
* @psalm-suppress MissingClosureParamType
*/
function( bool $do_tag_minification, string $script_tag, $file ) {
if ( $file && strpos( $file, 'ppcp' ) !== false ) {
return false;
}