diff --git a/inc/Engine/Common/Queue/RUCSSQueueRunner.php b/inc/Engine/Common/Queue/RUCSSQueueRunner.php index 2ea78889a1..9d7e7b9c96 100644 --- a/inc/Engine/Common/Queue/RUCSSQueueRunner.php +++ b/inc/Engine/Common/Queue/RUCSSQueueRunner.php @@ -162,7 +162,8 @@ public function maybe_dispatch_async_request() { * * @param string $context Optional identifer for the context in which this action is being processed, e.g. 'WP CLI' or 'WP Cron' * Generally, this should be capitalised and not localised as it's a proper noun. - * @return int The number of actions processed. + * + * @return void */ public function run( $context = 'WP Cron' ) { \ActionScheduler_Compatibility::raise_memory_limit(); @@ -179,7 +180,6 @@ public function run( $context = 'WP Cron' ) { } do_action( 'action_scheduler_after_process_queue' );// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound - return $processed_actions; } /** diff --git a/inc/Engine/CriticalPath/ProcessorService.php b/inc/Engine/CriticalPath/ProcessorService.php index 175a823d6d..fab7b7c5c9 100644 --- a/inc/Engine/CriticalPath/ProcessorService.php +++ b/inc/Engine/CriticalPath/ProcessorService.php @@ -163,6 +163,8 @@ private function check_cpcss_job_status( $job_id, $item_path, $item_url, $is_mob ) { return $this->on_job_success( $item_path, $item_url, $job_details->data->critical_path, $is_mobile, $item_type ); } + + return $this->on_job_error( $job_details, $item_url, $is_mobile, $item_type ); } /** diff --git a/inc/Engine/HealthCheck/ActionSchedulerCheck.php b/inc/Engine/HealthCheck/ActionSchedulerCheck.php index bb9f55f02c..2281931a4d 100644 --- a/inc/Engine/HealthCheck/ActionSchedulerCheck.php +++ b/inc/Engine/HealthCheck/ActionSchedulerCheck.php @@ -31,6 +31,7 @@ public static function get_subscribed_events(): array { * @return void */ public function activate() { + // @phpstan-ignore-next-line add_action( 'rocket_activation', [ $this, 'maybe_recreate_as_tables' ] ); } diff --git a/inc/Engine/Media/ImageDimensions/ImageDimensions.php b/inc/Engine/Media/ImageDimensions/ImageDimensions.php index 49764f31cc..77e3832511 100644 --- a/inc/Engine/Media/ImageDimensions/ImageDimensions.php +++ b/inc/Engine/Media/ImageDimensions/ImageDimensions.php @@ -313,6 +313,8 @@ private function set_dimensions( string $image, array $sizes ) { return 'width="' . $initial_width['width'] . '" height="' . (int) round( $sizes[1] * $ratio ) . '"'; } + + return false; } /** diff --git a/inc/ThirdParty/Hostings/Godaddy.php b/inc/ThirdParty/Hostings/Godaddy.php index e4601b57b3..0876e85b09 100644 --- a/inc/ThirdParty/Hostings/Godaddy.php +++ b/inc/ThirdParty/Hostings/Godaddy.php @@ -22,6 +22,7 @@ class Godaddy implements Subscriber_Interface { * @param string $vip_url Godaddy vip url. */ public function __construct( $vip_url = '' ) { + // @phpstan-ignore-next-line $this->vip_url = method_exists( '\WPaas\Plugin', 'vip' ) ? \WPaas\Plugin::vip() : $vip_url; } diff --git a/inc/ThirdParty/Hostings/Pressidium.php b/inc/ThirdParty/Hostings/Pressidium.php index a248b9e0ed..5fd03ad8f2 100644 --- a/inc/ThirdParty/Hostings/Pressidium.php +++ b/inc/ThirdParty/Hostings/Pressidium.php @@ -73,6 +73,7 @@ public function clear_cache_after_pressidium() { * @return void */ public function clean_pressidium() { + // @phpstan-ignore-next-line $plugin = NinukisCaching::get_instance(); $plugin->purgeAllCaches(); } @@ -106,6 +107,7 @@ private function get_paths( $urls ) { * @return void */ private function purge_cache( $paths ) { + // @phpstan-ignore-next-line NinukisCaching::get_instance()->purge_cache( $paths ); } diff --git a/inc/ThirdParty/Hostings/Savvii.php b/inc/ThirdParty/Hostings/Savvii.php index ead1090b18..a6f7417546 100644 --- a/inc/ThirdParty/Hostings/Savvii.php +++ b/inc/ThirdParty/Hostings/Savvii.php @@ -63,14 +63,18 @@ public function varnish_addon_title( $settings ) { public function clear_cache_after_savvii() { if ( ! ( + // @phpstan-ignore-next-line isset( $_REQUEST[ CacheFlusherPlugin::NAME_FLUSH_NOW ] ) && + // @phpstan-ignore-next-line check_admin_referer( CacheFlusherPlugin::NAME_FLUSH_NOW ) ) && ! ( + // @phpstan-ignore-next-line isset( $_REQUEST[ CacheFlusherPlugin::NAME_DOMAINFLUSH_NOW ] ) && + // @phpstan-ignore-next-line check_admin_referer( CacheFlusherPlugin::NAME_DOMAINFLUSH_NOW ) ) ) { diff --git a/inc/ThirdParty/Hostings/WPEngine.php b/inc/ThirdParty/Hostings/WPEngine.php index b862f765c2..e87c105923 100644 --- a/inc/ThirdParty/Hostings/WPEngine.php +++ b/inc/ThirdParty/Hostings/WPEngine.php @@ -57,6 +57,7 @@ public function varnish_addon_title( $settings ) { * @since 3.6.1 */ public function run_rocket_bot_after_wpengine() { + // @phpstan-ignore-next-line if ( ! wpe_param( 'purge-all' ) ) { return; } @@ -85,10 +86,12 @@ public function run_rocket_bot_after_wpengine() { */ public function clean_wpengine() { if ( method_exists( 'WpeCommon', 'purge_memcached' ) ) { + // @phpstan-ignore-next-line WpeCommon::purge_memcached(); } if ( method_exists( 'WpeCommon', 'purge_varnish_cache' ) ) { + // @phpstan-ignore-next-line WpeCommon::purge_varnish_cache(); } } diff --git a/inc/ThirdParty/Plugins/CDN/CloudflareFacade.php b/inc/ThirdParty/Plugins/CDN/CloudflareFacade.php index 28796876d1..40d8af676a 100644 --- a/inc/ThirdParty/Plugins/CDN/CloudflareFacade.php +++ b/inc/ThirdParty/Plugins/CDN/CloudflareFacade.php @@ -19,6 +19,7 @@ class CloudflareFacade { * @return void */ private function set_hooks() { + // @phpstan-ignore-next-line $this->hooks = new Hooks(); } diff --git a/inc/ThirdParty/Plugins/ContactForm7.php b/inc/ThirdParty/Plugins/ContactForm7.php index 9d3043668d..ade7210f6a 100644 --- a/inc/ThirdParty/Plugins/ContactForm7.php +++ b/inc/ThirdParty/Plugins/ContactForm7.php @@ -70,6 +70,7 @@ public function conditionally_enqueue_scripts() { return; } if ( did_action( 'wp_enqueue_scripts' ) ) { + // @phpstan-ignore-next-line wpcf7_enqueue_scripts(); return; } @@ -84,6 +85,7 @@ public function conditionally_enqueue_styles() { return; } if ( did_action( 'wp_enqueue_scripts' ) ) { + // @phpstan-ignore-next-line wpcf7_enqueue_styles(); return; } @@ -100,6 +102,7 @@ public function load_scripts_fallback() { return; } + // @phpstan-ignore-next-line wpcf7_enqueue_scripts(); } diff --git a/inc/ThirdParty/Plugins/Ecommerce/WooCommerceSubscriber.php b/inc/ThirdParty/Plugins/Ecommerce/WooCommerceSubscriber.php index 38e5ab84f5..06197b41cf 100644 --- a/inc/ThirdParty/Plugins/Ecommerce/WooCommerceSubscriber.php +++ b/inc/ThirdParty/Plugins/Ecommerce/WooCommerceSubscriber.php @@ -512,6 +512,7 @@ public function exclude_product_shipping_taxonomy( $excluded_taxonomies ) { * @return bool */ private function product_has_gallery_images() { + // @phpstan-ignore-next-line $product = wc_get_product( get_the_ID() ); if ( empty( $product ) ) { return false; @@ -529,6 +530,7 @@ public function show_empty_product_gallery_with_delayJS() { return; } + // @phpstan-ignore-next-line if ( ! is_product() ) { return; } @@ -560,6 +562,7 @@ public function show_notempty_product_gallery_with_delayJS( $exclusions = [] ): return $exclusions; } + // @phpstan-ignore-next-line if ( ! is_product() ) { return $exclusions; } @@ -612,13 +615,15 @@ public function disallow_rocket_clean_post(): void { * @return void */ public function allow_rocket_clean_post( int $product_id ): void { - $urls = []; + $urls = []; + // @phpstan-ignore-next-line $category_list = wc_get_product_category_list( $product_id ); if ( preg_match_all( '/]*?\s+)?href=(["\'])(?.*?)\1/i', $category_list, $matches ) ) { $urls = $matches['urls']; } + // @phpstan-ignore-next-line $shop_page = get_permalink( wc_get_page_id( 'shop' ) ); if ( empty( $shop_page ) ) { diff --git a/inc/ThirdParty/Plugins/I18n/TranslatePress.php b/inc/ThirdParty/Plugins/I18n/TranslatePress.php index 53c8edc7cf..9220150fcf 100644 --- a/inc/ThirdParty/Plugins/I18n/TranslatePress.php +++ b/inc/ThirdParty/Plugins/I18n/TranslatePress.php @@ -41,6 +41,7 @@ public static function get_subscribed_events() { * @return string */ public function detect_homepage( $home_url, $url ) { + // @phpstan-ignore-next-line $translatepress = TRP_Translate_Press::get_trp_instance(); $converter = $translatepress->get_component( 'url_converter' ); @@ -77,6 +78,7 @@ function_exists( 'trp_get_languages' ) * @return array */ public function add_langs_to_admin_bar( $langlinks ) { + // @phpstan-ignore-next-line $translatepress = TRP_Translate_Press::get_trp_instance(); $language_switcher = $translatepress->get_component( 'language_switcher' ); @@ -127,6 +129,7 @@ public function get_active_languages_uri( $urls ) { $home_url = home_url(); + // @phpstan-ignore-next-line $translatepress = TRP_Translate_Press::get_trp_instance(); $settings = $translatepress->get_component( 'settings' ); @@ -156,6 +159,7 @@ public function get_active_languages_codes( $codes ) { $codes = (array) $codes; } + // @phpstan-ignore-next-line $translatepress = TRP_Translate_Press::get_trp_instance(); $settings = $translatepress->get_component( 'settings' ); @@ -185,6 +189,7 @@ public function get_home_url_for_lang( $home_url, $lang ) { return $home_url; } + // @phpstan-ignore-next-line $translatepress = TRP_Translate_Press::get_trp_instance(); $converter = $translatepress->get_component( 'url_converter' ); $settings = $translatepress->get_component( 'settings' ); @@ -223,6 +228,7 @@ public function get_translated_post_urls( $urls, $url, $post_type, $regex ) { $urls = (array) $urls; } + // @phpstan-ignore-next-line $translatepress = TRP_Translate_Press::get_trp_instance(); $settings = $translatepress->get_component( 'settings' ); @@ -248,6 +254,7 @@ public function get_translated_post_urls( $urls, $url, $post_type, $regex ) { * @return void */ public function clear_post_languages( $post_id ) { + // @phpstan-ignore-next-line $translatepress = TRP_Translate_Press::get_trp_instance(); $converter = $translatepress->get_component( 'url_converter' ); @@ -286,6 +293,7 @@ public function clear_post_languages( $post_id ) { * @return void */ public function clear_post_after_updating_translation( $update_strings, $settings ) { + // @phpstan-ignore-next-line $translatepress = TRP_Translate_Press::get_trp_instance(); $converter = $translatepress->get_component( 'url_converter' ); diff --git a/inc/ThirdParty/Plugins/Optimization/Hummingbird.php b/inc/ThirdParty/Plugins/Optimization/Hummingbird.php index 734092d3ee..95bf18e73e 100644 --- a/inc/ThirdParty/Plugins/Optimization/Hummingbird.php +++ b/inc/ThirdParty/Plugins/Optimization/Hummingbird.php @@ -146,7 +146,12 @@ private function check_emoji() { return false; } - if ( $this->options->get( 'emoji' ) && WP_Hummingbird_Settings::get_setting( 'emoji', 'advanced' ) ) { + if ( + $this->options->get( 'emoji' ) + && + // @phpstan-ignore-next-line + WP_Hummingbird_Settings::get_setting( 'emoji', 'advanced' ) + ) { // Translators: %1$s = Plugin name, %2$s = , %3$s = . $this->errors[] = sprintf( _x( '%1$s %2$sdisable emoji%3$s conflicts with WP Rockets %2$sdisable emoji%3$s', 'Hummingbird notice', 'rocket' ), 'Hummingbird', '', '' ); return true; @@ -168,8 +173,10 @@ private function check_gzip() { return false; } + // @phpstan-ignore-next-line $gzip = WP_Hummingbird_Utils::get_module( 'gzip' ); + // @phpstan-ignore-next-line if ( ! $gzip instanceof \WP_Hummingbird_Module_GZip ) { return false; } @@ -204,8 +211,10 @@ private function check_browser_caching() { return false; } + // @phpstan-ignore-next-line $caching = WP_Hummingbird_Utils::get_module( 'caching' ); + // @phpstan-ignore-next-line if ( ! $caching instanceof \WP_Hummingbird_Module_Caching ) { return false; } @@ -240,8 +249,10 @@ private function check_cache() { return false; } + // @phpstan-ignore-next-line $cache = WP_Hummingbird_Utils::get_module( 'page_cache' ); + // @phpstan-ignore-next-line if ( ! $cache instanceof \WP_Hummingbird_Module_Page_Cache ) { return false; } @@ -274,8 +285,10 @@ private function check_assets() { return false; } + // @phpstan-ignore-next-line $minify = WP_Hummingbird_Utils::get_module( 'minify' ); + // @phpstan-ignore-next-line if ( ! $minify instanceof \WP_Hummingbird_Module_Minify ) { return false; } diff --git a/inc/ThirdParty/Plugins/SEO/AllInOneSEOPack.php b/inc/ThirdParty/Plugins/SEO/AllInOneSEOPack.php index df76ee563b..822c0fec42 100644 --- a/inc/ThirdParty/Plugins/SEO/AllInOneSEOPack.php +++ b/inc/ThirdParty/Plugins/SEO/AllInOneSEOPack.php @@ -57,7 +57,9 @@ public function add_all_in_one_seo_sitemap( $sitemaps ) { } if ( - ( ! $aioseo_v4 && ! $sitemap_enabled ) || + ( ! $aioseo_v4 && ! $sitemap_enabled ) + || + // @phpstan-ignore-next-line ( $aioseo_v4 && ! aioseo()->options->sitemap->general->enable ) ) { return $sitemaps; diff --git a/inc/ThirdParty/Plugins/SEO/RankMathSEO.php b/inc/ThirdParty/Plugins/SEO/RankMathSEO.php index a3360302a6..f9e9e40bc0 100644 --- a/inc/ThirdParty/Plugins/SEO/RankMathSEO.php +++ b/inc/ThirdParty/Plugins/SEO/RankMathSEO.php @@ -30,6 +30,7 @@ public function __construct( Options_Data $option ) { * Subscribed events. */ public static function get_subscribed_events() { + // @phpstan-ignore-next-line if ( ! defined( 'RANK_MATH_FILE' ) || ! Helper::is_module_active( 'sitemap' ) ) { return []; } @@ -45,8 +46,9 @@ public static function get_subscribed_events() { * @param array $sitemaps Sitemaps to preload. * @return array Updated Sitemaps to preload */ - public function rocket_sitemap( $sitemaps ) { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals + public function rocket_sitemap( $sitemaps ) { + // @phpstan-ignore-next-line $sitemaps[] = Router::get_base_url( 'sitemap_index.xml' ); return $sitemaps; diff --git a/inc/ThirdParty/Plugins/SEO/SEOPress.php b/inc/ThirdParty/Plugins/SEO/SEOPress.php index 23e896bebc..8c8c3bb9ca 100644 --- a/inc/ThirdParty/Plugins/SEO/SEOPress.php +++ b/inc/ThirdParty/Plugins/SEO/SEOPress.php @@ -31,6 +31,7 @@ public static function get_subscribed_events() { return []; } + // @phpstan-ignore-next-line if ( ! method_exists( seopress_get_service( 'SitemapOption' ), 'isEnabled' ) || 1 !== (int) seopress_get_service( 'SitemapOption' )->isEnabled() ) { return []; } diff --git a/inc/ThirdParty/Plugins/SEO/TheSEOFramework.php b/inc/ThirdParty/Plugins/SEO/TheSEOFramework.php index 9eeba9f29c..6b52213bb2 100644 --- a/inc/ThirdParty/Plugins/SEO/TheSEOFramework.php +++ b/inc/ThirdParty/Plugins/SEO/TheSEOFramework.php @@ -66,6 +66,7 @@ public function add_tsf_sitemap_to_preload( $sitemaps ) { // The autoloader in TSF doesn't check for file_exists(). So, use version compare instead to prevent fatal errors. if ( version_compare( rocket_get_constant( 'THE_SEO_FRAMEWORK_VERSION', false ), '4.0', '>=' ) ) { // TSF 4.0+. Expect the class to exist indefinitely. + // @phpstan-ignore-next-line $sitemap_bridge = Sitemap::get_instance(); foreach ( $sitemap_bridge->get_sitemap_endpoint_list() as $id => $data ) { @@ -78,6 +79,7 @@ public function add_tsf_sitemap_to_preload( $sitemaps ) { } } else { // Deprecated. TSF <4.0. + // @phpstan-ignore-next-line $sitemaps[] = the_seo_framework()->get_sitemap_xml_url(); } diff --git a/inc/ThirdParty/Plugins/Security/WordFenceCompatibility.php b/inc/ThirdParty/Plugins/Security/WordFenceCompatibility.php index ce5f376a66..1a46493efd 100644 --- a/inc/ThirdParty/Plugins/Security/WordFenceCompatibility.php +++ b/inc/ThirdParty/Plugins/Security/WordFenceCompatibility.php @@ -57,6 +57,7 @@ public function pop_old_ip( string $old_rucss_ip ) { } // Update whitelist. + // @phpstan-ignore-next-line wfConfig::set( 'whitelisted', implode( ',', $whitelist ) ); } @@ -74,6 +75,7 @@ public function pop_ip_from_whitelist() { } // Update whitelist. + // @phpstan-ignore-next-line wfConfig::set( 'whitelisted', implode( ',', $whitelist ) ); } @@ -85,6 +87,7 @@ public function pop_ip_from_whitelist() { */ private function can_pop_ip( string $ip ) { // Get all whitelists. + // @phpstan-ignore-next-line $whitelists = wfConfig::get( 'whitelisted', '' ); // Convert to array. @@ -119,7 +122,7 @@ public function whitelist_wordfence_firewall_ips() { * * @since 3.10 * - * @param array list of IPs should be whitelisted + * @param array $ips list of IPs should be whitelisted */ $ips = apply_filters( 'rocket_wordfence_whitelisted_ips', self::WHITELISTED_IPS ); @@ -128,6 +131,7 @@ public function whitelist_wordfence_firewall_ips() { } foreach ( $ips as $ip ) { + // @phpstan-ignore-next-line wordfence::whitelistIP( $ip ); } } diff --git a/inc/ThirdParty/Themes/Themify.php b/inc/ThirdParty/Themes/Themify.php index 86e89d637c..1e7272d9b6 100644 --- a/inc/ThirdParty/Themes/Themify.php +++ b/inc/ThirdParty/Themes/Themify.php @@ -41,6 +41,7 @@ public static function get_subscribed_events() { * @return void */ public function disabling_concat_on_theme() { + // @phpstan-ignore-next-line $data = themify_get_data(); $remove_unused_css = $this->options->get( 'remove_unused_css', false ); @@ -53,6 +54,7 @@ public function disabling_concat_on_theme() { $data = $this->maybe_enable( $data ); } + // @phpstan-ignore-next-line themify_set_data( $data ); } @@ -84,6 +86,7 @@ public function disabling_concat_on_rucss( $old, $new ) { // phpcs:ignore Univer return; } + // @phpstan-ignore-next-line $data = themify_get_data(); if ( ! $new['remove_unused_css'] ) { @@ -94,6 +97,7 @@ public function disabling_concat_on_rucss( $old, $new ) { // phpcs:ignore Univer $data = $this->maybe_enable( $data ); } + // @phpstan-ignore-next-line themify_set_data( $data ); }