From c727606e7a684f14ed5f0c9e87dfe91efb5aade3 Mon Sep 17 00:00:00 2001 From: Daniel Dudzic Date: Tue, 9 Jul 2024 15:31:27 +0200 Subject: [PATCH 1/2] W3 Total Cache: Remove type from as sometimes null gets passed causing errors --- modules/ppcp-compat/src/CompatModule.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ppcp-compat/src/CompatModule.php b/modules/ppcp-compat/src/CompatModule.php index a2d0a3bad..a50475544 100644 --- a/modules/ppcp-compat/src/CompatModule.php +++ b/modules/ppcp-compat/src/CompatModule.php @@ -368,7 +368,7 @@ 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 ) { + function( bool $do_tag_minification, string $script_tag, $file ) { if ( $file && strpos( $file, 'ppcp' ) !== false ) { return false; } From 743f50438083416387d9805c875be47fbf46a722 Mon Sep 17 00:00:00 2001 From: Daniel Dudzic Date: Tue, 9 Jul 2024 16:05:54 +0200 Subject: [PATCH 2/2] Fix Psalm errors --- modules/ppcp-compat/src/CompatModule.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/modules/ppcp-compat/src/CompatModule.php b/modules/ppcp-compat/src/CompatModule.php index a50475544..09c35c24f 100644 --- a/modules/ppcp-compat/src/CompatModule.php +++ b/modules/ppcp-compat/src/CompatModule.php @@ -368,6 +368,15 @@ class CompatModule implements ModuleInterface { // W3 Total Cache. add_filter( 'w3tc_minify_js_do_tag_minification', + /** + * 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;