From d24301b6d2cff7a9b5f170af81942c6f28d9dcb3 Mon Sep 17 00:00:00 2001 From: tbradsha <32492176+tbradsha@users.noreply.github.com> Date: Wed, 22 Jan 2025 12:59:58 -0700 Subject: [PATCH 01/19] Remove extra param on remove_filter/remove_action There's no arg count when removing. --- .../tests/php/test_Manager_integration.php | 3 +-- .../connection/tests/php/test_Manager_unit.php | 2 +- .../packages/image-cdn/src/compatibility/photon.php | 6 +++--- .../image-cdn/tests/php/test_class.image_cdn.php | 4 ++-- projects/packages/stats/tests/php/test-main.php | 12 ++++++------ .../stats/tests/php/test-xmlrpc-provider.php | 2 +- .../tests/php/integration/test-waf-compatibility.php | 4 ++-- .../lib/class-sync-jetpack-module-status.php | 8 ++++---- .../jetpack/3rd-party/class.jetpack-amp-support.php | 2 +- projects/plugins/jetpack/3rd-party/woocommerce.php | 2 +- .../admin-pages/class-jetpack-redux-state-helper.php | 2 +- .../plugins/jetpack/class.frame-nonce-preview.php | 2 +- .../class.wpcom-json-api-update-post-endpoint.php | 2 +- ...lass.wpcom-json-api-update-post-v1-1-endpoint.php | 2 +- ...lass.wpcom-json-api-update-post-v1-2-endpoint.php | 2 +- .../jetpack/modules/infinite-scroll/infinity.php | 2 +- .../jetpack/modules/markdown/easy-markdown.php | 8 ++++---- .../modules/theme-tools/compat/twentysixteen.php | 2 +- .../modules/theme-tools/compat/twentytwenty.php | 2 +- .../_inc/lib/test_class.rest-api-authentication.php | 4 ++-- .../php/_inc/lib/test_class.rest-api-endpoints.php | 4 ++-- .../php/modules/shortcodes/test-class.gravatar.php | 6 +++--- .../php/modules/shortcodes/test-class.mixcloud.php | 6 +++--- 23 files changed, 44 insertions(+), 45 deletions(-) diff --git a/projects/packages/connection/tests/php/test_Manager_integration.php b/projects/packages/connection/tests/php/test_Manager_integration.php index dd16afad44312..a6721fab04a09 100644 --- a/projects/packages/connection/tests/php/test_Manager_integration.php +++ b/projects/packages/connection/tests/php/test_Manager_integration.php @@ -633,8 +633,7 @@ public function test_disconnect_user( $remote_response, $expected_user_token_cou $this, $callback, ), - 10, - 3 + 10 ); $this->assertCount( $expected_user_token_count, $this->manager->get_connected_users() ); diff --git a/projects/packages/connection/tests/php/test_Manager_unit.php b/projects/packages/connection/tests/php/test_Manager_unit.php index ed0e875be5a37..143937b16031e 100644 --- a/projects/packages/connection/tests/php/test_Manager_unit.php +++ b/projects/packages/connection/tests/php/test_Manager_unit.php @@ -171,7 +171,7 @@ public function test_api_url_defaults() { $this->manager->api_url( 'another_thing/' ) ); - remove_filter( 'jetpack_constant_default_value', array( $this, 'filter_api_constant' ), 10, 2 ); + remove_filter( 'jetpack_constant_default_value', array( $this, 'filter_api_constant' ), 10 ); } /** diff --git a/projects/packages/image-cdn/src/compatibility/photon.php b/projects/packages/image-cdn/src/compatibility/photon.php index 3dff7ea4a5951..79edb1f6cda68 100644 --- a/projects/packages/image-cdn/src/compatibility/photon.php +++ b/projects/packages/image-cdn/src/compatibility/photon.php @@ -24,11 +24,11 @@ function jetpack_image_cdn_photon_compat() { * Image_CDN_Core class. And the filters are now handled by the Image_CDN_Core class itself. */ // @phan-suppress-next-line PhanUndeclaredFunctionInCallable -- Just removing this deprecated filter function. No point in stubbing it. - remove_filter( 'jetpack_photon_url', 'jetpack_photon_url', 10, 3 ); + remove_filter( 'jetpack_photon_url', 'jetpack_photon_url', 10 ); // @phan-suppress-next-line PhanUndeclaredFunctionInCallable -- Just removing this deprecated filter function. No point in stubbing it. - remove_filter( 'jetpack_photon_pre_args', 'jetpack_photon_parse_wpcom_query_args', 10, 2 ); + remove_filter( 'jetpack_photon_pre_args', 'jetpack_photon_parse_wpcom_query_args', 10 ); // @phan-suppress-next-line PhanUndeclaredFunctionInCallable -- Just removing this deprecated filter function. No point in stubbing it. - remove_filter( 'jetpack_photon_skip_for_url', 'jetpack_photon_banned_domains', 9, 2 ); + remove_filter( 'jetpack_photon_skip_for_url', 'jetpack_photon_banned_domains', 9 ); // @phan-suppress-next-line PhanUndeclaredFunctionInCallable -- Just removing this deprecated filter function. No point in stubbing it. remove_filter( 'widget_text', 'jetpack_photon_support_text_widgets' ); diff --git a/projects/packages/image-cdn/tests/php/test_class.image_cdn.php b/projects/packages/image-cdn/tests/php/test_class.image_cdn.php index 21f0adc39886b..d2415c2990af8 100644 --- a/projects/packages/image-cdn/tests/php/test_class.image_cdn.php +++ b/projects/packages/image-cdn/tests/php/test_class.image_cdn.php @@ -1085,7 +1085,7 @@ public function test_image_cdn_filter_the_content_width_height_attributes_when_i add_filter( 'jetpack_photon_post_image_args', $filter_callback, 10, 2 ); $filtered_content = Image_CDN::filter_the_content( $sample_html ); - remove_filter( 'jetpack_photon_post_image_args', $filter_callback, 10, 2 ); + remove_filter( 'jetpack_photon_post_image_args', $filter_callback, 10 ); $first_line = strtok( $filtered_content, "\n" ); // Should contain an image tag on the first line. $attributes = wp_kses_hair( $first_line, wp_allowed_protocols() ); @@ -1515,7 +1515,7 @@ public function test_image_cdn_in_rest_response_external_media() { add_filter( 'pre_http_request', array( $this, 'pre_http_request_mocked_download_url' ), 10, 2 ); $response = rest_get_server()->dispatch( $request ); - remove_filter( 'pre_http_request', array( $this, 'pre_http_request_mocked_download_url' ), 10, 2 ); + remove_filter( 'pre_http_request', array( $this, 'pre_http_request_mocked_download_url' ), 10 ); $this->assertEquals( 200, $response->get_status() ); diff --git a/projects/packages/stats/tests/php/test-main.php b/projects/packages/stats/tests/php/test-main.php index b6c479043b03a..9ba04f93e6ad2 100644 --- a/projects/packages/stats/tests/php/test-main.php +++ b/projects/packages/stats/tests/php/test-main.php @@ -131,7 +131,7 @@ public function test_jetpack_is_dnt_enabled() { $_SERVER['HTTP_DNT'] = true; add_filter( 'jetpack_honor_dnt_header_for_stats', array( __CLASS__, 'filter_jetpack_honor_dnt_header_for_stats' ), 10, 2 ); $this->assertTrue( Stats::jetpack_is_dnt_enabled() ); - remove_filter( 'jetpack_honor_dnt_header_for_stats', array( __CLASS__, 'filter_jetpack_honor_dnt_header_for_stats' ), 10, 2 ); + remove_filter( 'jetpack_honor_dnt_header_for_stats', array( __CLASS__, 'filter_jetpack_honor_dnt_header_for_stats' ), 10 ); } /** @@ -149,7 +149,7 @@ public function test_jetpack_is_dnt_enabled_without_filter() { public function test_jetpack_is_dnt_enabled_with_filter_without_header() { add_filter( 'jetpack_honor_dnt_header_for_stats', array( __CLASS__, 'filter_jetpack_honor_dnt_header_for_stats' ), 10, 2 ); $this->assertFalse( Stats::jetpack_is_dnt_enabled() ); - remove_filter( 'jetpack_honor_dnt_header_for_stats', array( __CLASS__, 'filter_jetpack_honor_dnt_header_for_stats' ), 10, 2 ); + remove_filter( 'jetpack_honor_dnt_header_for_stats', array( __CLASS__, 'filter_jetpack_honor_dnt_header_for_stats' ), 10 ); } /** @@ -189,7 +189,7 @@ public function test_should_track_will_return_false_without_active_stats_module( public function test_should_track_will_return_true_with_active_stats_module() { add_filter( 'jetpack_active_modules', array( __CLASS__, 'filter_jetpack_active_modules_add_stats' ), 10, 2 ); $should_track = Stats::should_track(); - remove_filter( 'jetpack_active_modules', array( __CLASS__, 'filter_jetpack_active_modules_add_stats' ), 10, 2 ); + remove_filter( 'jetpack_active_modules', array( __CLASS__, 'filter_jetpack_active_modules_add_stats' ), 10 ); $this->assertTrue( $should_track ); } @@ -200,7 +200,7 @@ public function test_template_redirect_adds_wp_footer_hook() { add_filter( 'jetpack_active_modules', array( __CLASS__, 'filter_jetpack_active_modules_add_stats' ), 10, 2 ); Stats::template_redirect(); $has_action = has_action( 'wp_footer', array( Tracking_Pixel::class, 'add_amp_pixel' ) ); - remove_filter( 'jetpack_active_modules', array( __CLASS__, 'filter_jetpack_active_modules_add_stats' ), 10, 2 ); + remove_filter( 'jetpack_active_modules', array( __CLASS__, 'filter_jetpack_active_modules_add_stats' ), 10 ); $this->assertSame( 101, $has_action ); } @@ -211,7 +211,7 @@ public function test_template_redirect_adds_web_stories_print_analytics_hook() { add_filter( 'jetpack_active_modules', array( __CLASS__, 'filter_jetpack_active_modules_add_stats' ), 10, 2 ); Stats::template_redirect(); $has_action = has_action( 'web_stories_print_analytics', array( Tracking_Pixel::class, 'add_amp_pixel' ) ); - remove_filter( 'jetpack_active_modules', array( __CLASS__, 'filter_jetpack_active_modules_add_stats' ), 10, 2 ); + remove_filter( 'jetpack_active_modules', array( __CLASS__, 'filter_jetpack_active_modules_add_stats' ), 10 ); $this->assertSame( 101, $has_action ); } @@ -222,7 +222,7 @@ public function test_template_redirect_adds_wp_enqueue_scripts_hook() { add_filter( 'jetpack_active_modules', array( __CLASS__, 'filter_jetpack_active_modules_add_stats' ), 10, 2 ); Stats::template_redirect(); $has_action = has_action( 'wp_enqueue_scripts', array( Tracking_Pixel::class, 'enqueue_stats_script' ) ); - remove_filter( 'jetpack_active_modules', array( __CLASS__, 'filter_jetpack_active_modules_add_stats' ), 10, 2 ); + remove_filter( 'jetpack_active_modules', array( __CLASS__, 'filter_jetpack_active_modules_add_stats' ), 10 ); $this->assertSame( 101, $has_action ); } diff --git a/projects/packages/stats/tests/php/test-xmlrpc-provider.php b/projects/packages/stats/tests/php/test-xmlrpc-provider.php index 5ae575946e70d..7e4c35482f195 100644 --- a/projects/packages/stats/tests/php/test-xmlrpc-provider.php +++ b/projects/packages/stats/tests/php/test-xmlrpc-provider.php @@ -79,7 +79,7 @@ public function test_xmlrpc_methods_will_not_add_get_blog_without_active_stats_m public function test_xmlrpc_methods_with_active_stats_module() { add_filter( 'jetpack_active_modules', array( __CLASS__, 'filter_jetpack_active_modules_add_stats' ), 10, 2 ); $xmlrpc_methods = $this->xmlrpc_instance->xmlrpc_methods( array() ); - remove_filter( 'jetpack_active_modules', array( __CLASS__, 'filter_jetpack_active_modules_add_stats' ), 10, 2 ); + remove_filter( 'jetpack_active_modules', array( __CLASS__, 'filter_jetpack_active_modules_add_stats' ), 10 ); $this->assertArrayHasKey( 'jetpack.getBlog', $xmlrpc_methods ); } diff --git a/projects/packages/waf/tests/php/integration/test-waf-compatibility.php b/projects/packages/waf/tests/php/integration/test-waf-compatibility.php index b4026996c21a7..a0e0ef8c825a1 100644 --- a/projects/packages/waf/tests/php/integration/test-waf-compatibility.php +++ b/projects/packages/waf/tests/php/integration/test-waf-compatibility.php @@ -168,7 +168,7 @@ public function testIpListMigration() { Waf_Compatibility::migrate_brute_force_protection_ip_allow_list(); // Clean up. - remove_filter( 'wordbless_wpdb_query_results', $filter, 10, 2 ); + remove_filter( 'wordbless_wpdb_query_results', $filter, 10 ); } } @@ -235,7 +235,7 @@ public function testIpListsDefaultOptions() { $this->assertFalse( get_option( Waf_Rules_Manager::IP_BLOCK_LIST_ENABLED_OPTION_NAME ) ); // Set the old generic option to true. - remove_filter( 'wordbless_wpdb_query_results', $filter_ip_list_option_false, 10, 2 ); + remove_filter( 'wordbless_wpdb_query_results', $filter_ip_list_option_false, 10 ); add_filter( 'wordbless_wpdb_query_results', $filter_ip_list_option_true, 10, 2 ); // Options default to true when the old generic option is set to true. diff --git a/projects/plugins/boost/compatibility/lib/class-sync-jetpack-module-status.php b/projects/plugins/boost/compatibility/lib/class-sync-jetpack-module-status.php index 7b97fd6027f0d..98410e66e3806 100644 --- a/projects/plugins/boost/compatibility/lib/class-sync-jetpack-module-status.php +++ b/projects/plugins/boost/compatibility/lib/class-sync-jetpack-module-status.php @@ -91,8 +91,8 @@ public function add_sync_from_jetpack_action() { } public function remove_sync_from_jetpack_action() { - remove_action( "jetpack_deactivate_module_{$this->jetpack_module_slug}", array( $this, 'sync_from_jetpack' ), 10, 2 ); - remove_action( "jetpack_activate_module_{$this->jetpack_module_slug}", array( $this, 'sync_from_jetpack' ), 10, 2 ); + remove_action( "jetpack_deactivate_module_{$this->jetpack_module_slug}", array( $this, 'sync_from_jetpack' ), 10 ); + remove_action( "jetpack_activate_module_{$this->jetpack_module_slug}", array( $this, 'sync_from_jetpack' ), 10 ); } /** @@ -104,7 +104,7 @@ public function add_sync_to_jetpack_action() { } public function remove_sync_to_jetpack_action() { - remove_action( "add_option_jetpack_boost_status_{$this->boost_module_slug}", array( $this, 'sync_to_jetpack' ), 10, 2 ); - remove_action( "update_option_jetpack_boost_status_{$this->boost_module_slug}", array( $this, 'sync_to_jetpack' ), 10, 2 ); + remove_action( "add_option_jetpack_boost_status_{$this->boost_module_slug}", array( $this, 'sync_to_jetpack' ), 10 ); + remove_action( "update_option_jetpack_boost_status_{$this->boost_module_slug}", array( $this, 'sync_to_jetpack' ), 10 ); } } diff --git a/projects/plugins/jetpack/3rd-party/class.jetpack-amp-support.php b/projects/plugins/jetpack/3rd-party/class.jetpack-amp-support.php index 3cc6c12fa04cd..b1320ef4be8a4 100644 --- a/projects/plugins/jetpack/3rd-party/class.jetpack-amp-support.php +++ b/projects/plugins/jetpack/3rd-party/class.jetpack-amp-support.php @@ -146,7 +146,7 @@ public static function amp_disable_the_content_filters() { */ public static function disable_comment_likes_before_the_content( $content ) { if ( self::is_amp_request() ) { - remove_filter( 'comment_text', 'comment_like_button', 12, 2 ); + remove_filter( 'comment_text', 'comment_like_button', 12 ); } return $content; } diff --git a/projects/plugins/jetpack/3rd-party/woocommerce.php b/projects/plugins/jetpack/3rd-party/woocommerce.php index 98f2a7419dc6f..3311389016019 100644 --- a/projects/plugins/jetpack/3rd-party/woocommerce.php +++ b/projects/plugins/jetpack/3rd-party/woocommerce.php @@ -89,7 +89,7 @@ function jetpack_woocommerce_remove_share() { if ( is_cart() || is_checkout() || is_account_page() ) { remove_filter( 'the_content', 'sharing_display', 19 ); if ( class_exists( 'Jetpack_Likes' ) ) { - remove_filter( 'the_content', array( Jetpack_Likes::init(), 'post_likes' ), 30, 1 ); + remove_filter( 'the_content', array( Jetpack_Likes::init(), 'post_likes' ), 30 ); } } } diff --git a/projects/plugins/jetpack/_inc/lib/admin-pages/class-jetpack-redux-state-helper.php b/projects/plugins/jetpack/_inc/lib/admin-pages/class-jetpack-redux-state-helper.php index 2c6865602d2b3..1d047e6d500dd 100644 --- a/projects/plugins/jetpack/_inc/lib/admin-pages/class-jetpack-redux-state-helper.php +++ b/projects/plugins/jetpack/_inc/lib/admin-pages/class-jetpack-redux-state-helper.php @@ -314,7 +314,7 @@ public static function get_update_modal_data() { // This allows us to embed videopress videos into the release post. add_filter( 'wp_kses_allowed_html', array( __CLASS__, 'allow_post_embed_iframe' ), 10, 2 ); $content = wp_kses_post( $post['content'] ); - remove_filter( 'wp_kses_allowed_html', array( __CLASS__, 'allow_post_embed_iframe' ), 10, 2 ); + remove_filter( 'wp_kses_allowed_html', array( __CLASS__, 'allow_post_embed_iframe' ), 10 ); $post_title = isset( $post['title'] ) ? $post['title'] : null; $title = wp_kses( $post_title, array() ); diff --git a/projects/plugins/jetpack/class.frame-nonce-preview.php b/projects/plugins/jetpack/class.frame-nonce-preview.php index dee3ee1a6f53d..4f2097cefe85a 100644 --- a/projects/plugins/jetpack/class.frame-nonce-preview.php +++ b/projects/plugins/jetpack/class.frame-nonce-preview.php @@ -102,7 +102,7 @@ public function maybe_display_post( $query ) { * @return array */ public function set_post_to_publish( $posts ) { - remove_filter( 'posts_results', array( $this, 'set_post_to_publish' ), 10, 2 ); + remove_filter( 'posts_results', array( $this, 'set_post_to_publish' ), 10 ); if ( empty( $posts ) || is_user_logged_in() || ! $this->is_frame_nonce_valid() ) { return $posts; diff --git a/projects/plugins/jetpack/json-endpoints/class.wpcom-json-api-update-post-endpoint.php b/projects/plugins/jetpack/json-endpoints/class.wpcom-json-api-update-post-endpoint.php index a0408c350c4cb..f806c059c9a1a 100644 --- a/projects/plugins/jetpack/json-endpoints/class.wpcom-json-api-update-post-endpoint.php +++ b/projects/plugins/jetpack/json-endpoints/class.wpcom-json-api-update-post-endpoint.php @@ -257,7 +257,7 @@ public function write_post( $path, $blog_id, $post_id ) { // unhook publicize, it's hooked again later -- without this, skipping services is impossible. if ( defined( 'IS_WPCOM' ) && IS_WPCOM ) { - remove_action( 'save_post', array( $GLOBALS['publicize_ui']->publicize, 'async_publicize_post' ), 100, 2 ); + remove_action( 'save_post', array( $GLOBALS['publicize_ui']->publicize, 'async_publicize_post' ), 100 ); add_action( 'rest_api_inserted_post', array( $GLOBALS['publicize_ui']->publicize, 'async_publicize_post' ) ); } diff --git a/projects/plugins/jetpack/json-endpoints/class.wpcom-json-api-update-post-v1-1-endpoint.php b/projects/plugins/jetpack/json-endpoints/class.wpcom-json-api-update-post-v1-1-endpoint.php index dc14a2ab1f3cb..0911e44cf2d4a 100644 --- a/projects/plugins/jetpack/json-endpoints/class.wpcom-json-api-update-post-v1-1-endpoint.php +++ b/projects/plugins/jetpack/json-endpoints/class.wpcom-json-api-update-post-v1-1-endpoint.php @@ -269,7 +269,7 @@ public function write_post( $path, $blog_id, $post_id ) { // unhook publicize, it's hooked again later -- without this, skipping services is impossible. if ( defined( 'IS_WPCOM' ) && IS_WPCOM ) { - remove_action( 'save_post', array( $GLOBALS['publicize_ui']->publicize, 'async_publicize_post' ), 100, 2 ); + remove_action( 'save_post', array( $GLOBALS['publicize_ui']->publicize, 'async_publicize_post' ), 100 ); add_action( 'rest_api_inserted_post', array( $GLOBALS['publicize_ui']->publicize, 'async_publicize_post' ) ); if ( $this->should_load_theme_functions( $post_id ) ) { diff --git a/projects/plugins/jetpack/json-endpoints/class.wpcom-json-api-update-post-v1-2-endpoint.php b/projects/plugins/jetpack/json-endpoints/class.wpcom-json-api-update-post-v1-2-endpoint.php index 84f0d63024dc3..90c6199663a1c 100644 --- a/projects/plugins/jetpack/json-endpoints/class.wpcom-json-api-update-post-v1-2-endpoint.php +++ b/projects/plugins/jetpack/json-endpoints/class.wpcom-json-api-update-post-v1-2-endpoint.php @@ -196,7 +196,7 @@ public function write_post( $path, $blog_id, $post_id ) { // unhook publicize, it's hooked again later -- without this, skipping services is impossible. if ( defined( 'IS_WPCOM' ) && IS_WPCOM ) { - remove_action( 'save_post', array( $GLOBALS['publicize_ui']->publicize, 'async_publicize_post' ), 100, 2 ); + remove_action( 'save_post', array( $GLOBALS['publicize_ui']->publicize, 'async_publicize_post' ), 100 ); if ( $this->should_load_theme_functions( $post_id ) ) { $this->load_theme_functions(); diff --git a/projects/plugins/jetpack/modules/infinite-scroll/infinity.php b/projects/plugins/jetpack/modules/infinite-scroll/infinity.php index dd50fb6292128..287b4701c58b9 100644 --- a/projects/plugins/jetpack/modules/infinite-scroll/infinity.php +++ b/projects/plugins/jetpack/modules/infinite-scroll/infinity.php @@ -1409,7 +1409,7 @@ public function query() { $infinite_scroll_query->query( $query_args ); - remove_filter( 'posts_where', array( $this, 'query_time_filter' ), 10, 2 ); + remove_filter( 'posts_where', array( $this, 'query_time_filter' ), 10 ); $results = array(); diff --git a/projects/plugins/jetpack/modules/markdown/easy-markdown.php b/projects/plugins/jetpack/modules/markdown/easy-markdown.php index b39cbf0db297c..fb61aa1835917 100644 --- a/projects/plugins/jetpack/modules/markdown/easy-markdown.php +++ b/projects/plugins/jetpack/modules/markdown/easy-markdown.php @@ -171,10 +171,10 @@ public function unload_markdown_for_posts() { remove_filter( 'wp_kses_allowed_html', array( $this, 'wp_kses_allowed_html' ) ); remove_action( 'after_wp_tiny_mce', array( $this, 'after_wp_tiny_mce' ) ); remove_action( 'wp_insert_post', array( $this, 'wp_insert_post' ) ); - remove_filter( 'wp_insert_post_data', array( $this, 'wp_insert_post_data' ), 10, 2 ); - remove_filter( 'edit_post_content', array( $this, 'edit_post_content' ), 10, 2 ); - remove_filter( 'edit_post_content_filtered', array( $this, 'edit_post_content_filtered' ), 10, 2 ); - remove_action( 'wp_restore_post_revision', array( $this, 'wp_restore_post_revision' ), 10, 2 ); + remove_filter( 'wp_insert_post_data', array( $this, 'wp_insert_post_data' ), 10 ); + remove_filter( 'edit_post_content', array( $this, 'edit_post_content' ), 10 ); + remove_filter( 'edit_post_content_filtered', array( $this, 'edit_post_content_filtered' ), 10 ); + remove_action( 'wp_restore_post_revision', array( $this, 'wp_restore_post_revision' ), 10 ); remove_filter( '_wp_post_revision_fields', array( $this, 'wp_post_revision_fields' ) ); remove_action( 'xmlrpc_call', array( $this, 'xmlrpc_actions' ) ); remove_filter( 'content_save_pre', array( $this, 'preserve_code_blocks' ), 1 ); diff --git a/projects/plugins/jetpack/modules/theme-tools/compat/twentysixteen.php b/projects/plugins/jetpack/modules/theme-tools/compat/twentysixteen.php index d70f0519b7be8..db6ac01c9ad67 100644 --- a/projects/plugins/jetpack/modules/theme-tools/compat/twentysixteen.php +++ b/projects/plugins/jetpack/modules/theme-tools/compat/twentysixteen.php @@ -57,7 +57,7 @@ function twentysixteen_remove_share() { if ( is_single() || is_archive() || is_home() ) { remove_filter( 'the_excerpt', 'sharing_display', 19 ); if ( class_exists( 'Jetpack_Likes' ) ) { - remove_filter( 'the_excerpt', array( Jetpack_Likes::init(), 'post_likes' ), 30, 1 ); + remove_filter( 'the_excerpt', array( Jetpack_Likes::init(), 'post_likes' ), 30 ); } } } diff --git a/projects/plugins/jetpack/modules/theme-tools/compat/twentytwenty.php b/projects/plugins/jetpack/modules/theme-tools/compat/twentytwenty.php index e842f0fe0eb23..2fea50aaf6fac 100644 --- a/projects/plugins/jetpack/modules/theme-tools/compat/twentytwenty.php +++ b/projects/plugins/jetpack/modules/theme-tools/compat/twentytwenty.php @@ -79,7 +79,7 @@ function twentytwenty_no_sharing_on_excerpts() { // Remove Likes. if ( class_exists( 'Jetpack_Likes' ) ) { - remove_filter( 'the_excerpt', array( Jetpack_Likes::init(), 'post_likes' ), 30, 1 ); + remove_filter( 'the_excerpt', array( Jetpack_Likes::init(), 'post_likes' ), 30 ); } } } diff --git a/projects/plugins/jetpack/tests/php/_inc/lib/test_class.rest-api-authentication.php b/projects/plugins/jetpack/tests/php/_inc/lib/test_class.rest-api-authentication.php index b8ce59e373ce7..9d855989d087a 100644 --- a/projects/plugins/jetpack/tests/php/_inc/lib/test_class.rest-api-authentication.php +++ b/projects/plugins/jetpack/tests/php/_inc/lib/test_class.rest-api-authentication.php @@ -68,8 +68,8 @@ public function tear_down() { unset( $_SERVER[ $key ] ); } } - remove_filter( 'rest_pre_dispatch', array( $this, 'rest_pre_dispatch' ), 100, 2 ); - remove_filter( 'pre_option_jetpack_private_options', array( $this, 'mock_jetpack_private_options' ), 10, 2 ); + remove_filter( 'rest_pre_dispatch', array( $this, 'rest_pre_dispatch' ), 100 ); + remove_filter( 'pre_option_jetpack_private_options', array( $this, 'mock_jetpack_private_options' ), 10 ); wp_set_current_user( 0 ); $jetpack = Jetpack::init(); // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable } diff --git a/projects/plugins/jetpack/tests/php/_inc/lib/test_class.rest-api-endpoints.php b/projects/plugins/jetpack/tests/php/_inc/lib/test_class.rest-api-endpoints.php index 8e9a9459462c5..c63e999ec2139 100644 --- a/projects/plugins/jetpack/tests/php/_inc/lib/test_class.rest-api-endpoints.php +++ b/projects/plugins/jetpack/tests/php/_inc/lib/test_class.rest-api-endpoints.php @@ -657,7 +657,7 @@ public function test_unlink_user() { // Create REST request in JSON format and dispatch $response = $this->create_and_get_request( 'connection/user', array( 'linked' => false ), 'POST' ); - remove_filter( 'pre_http_request', array( $this, 'mock_xmlrpc_success' ), 10, 3 ); + remove_filter( 'pre_http_request', array( $this, 'mock_xmlrpc_success' ), 10 ); // No way. Master user can't be unlinked. This is intended $this->assertResponseStatus( 403, $response ); @@ -686,7 +686,7 @@ public function test_unlink_user_cache_data_removal() { // Create REST request in JSON format and dispatch. $this->create_and_get_request( 'connection/user', array( 'linked' => false ), 'POST' ); - remove_filter( 'pre_http_request', array( $this, 'mock_xmlrpc_success' ), 10, 3 ); + remove_filter( 'pre_http_request', array( $this, 'mock_xmlrpc_success' ), 10 ); // Transient should be deleted after unlinking user. $this->assertFalse( get_transient( $transient_key ) ); diff --git a/projects/plugins/jetpack/tests/php/modules/shortcodes/test-class.gravatar.php b/projects/plugins/jetpack/tests/php/modules/shortcodes/test-class.gravatar.php index c8c8216ba2660..e158c2af17d0f 100644 --- a/projects/plugins/jetpack/tests/php/modules/shortcodes/test-class.gravatar.php +++ b/projects/plugins/jetpack/tests/php/modules/shortcodes/test-class.gravatar.php @@ -83,7 +83,7 @@ public function test_shortcodes_gravatar_profile() { $this->assertStringContainsString( '
', $shortcode_content ); $this->assertStringContainsString( " 96 ) ) ); $this->assertStringContainsString( "assertSame( '', $shortcode_content ); - remove_filter( 'pre_http_request', $http_request_filter, 10, 1 ); + remove_filter( 'pre_http_request', $http_request_filter, 10 ); } } diff --git a/projects/plugins/jetpack/tests/php/modules/shortcodes/test-class.mixcloud.php b/projects/plugins/jetpack/tests/php/modules/shortcodes/test-class.mixcloud.php index 4513bd850b40c..a3a77803bd3f2 100644 --- a/projects/plugins/jetpack/tests/php/modules/shortcodes/test-class.mixcloud.php +++ b/projects/plugins/jetpack/tests/php/modules/shortcodes/test-class.mixcloud.php @@ -86,7 +86,7 @@ public function test_shortcodes_mixcloud_remote_get_wp_error() { $this->assertEquals( $this->invalid_markup, $shortcode_content ); - remove_filter( 'pre_http_request', $http_request_filter, 10, 1 ); + remove_filter( 'pre_http_request', $http_request_filter, 10 ); } /** @@ -118,7 +118,7 @@ public function test_shortcodes_mixcloud_no_sandbox() { $this->assertEquals( '', $shortcode_content ); - remove_filter( 'pre_http_request', $http_request_filter, 10, 1 ); + remove_filter( 'pre_http_request', $http_request_filter, 10 ); } /** @@ -151,6 +151,6 @@ public function test_shortcodes_mixcloud_sandbox_have_allow_popups() { $this->assertEquals( '', $shortcode_content ); - remove_filter( 'pre_http_request', $http_request_filter, 10, 1 ); + remove_filter( 'pre_http_request', $http_request_filter, 10 ); } } From 8b157c36180e93590982263c5c4646f843c9718a Mon Sep 17 00:00:00 2001 From: tbradsha <32492176+tbradsha@users.noreply.github.com> Date: Wed, 22 Jan 2025 13:04:46 -0700 Subject: [PATCH 02/19] Remove extra param from rest_ensure_response That function doesn't allow a status code to be passed. Presumably we could override the WP_REST_Response status and force 200, but passing it through has worked so far, so keeping it that way. --- .../packages/my-jetpack/src/class-rest-products.php | 10 +++++----- .../packages/my-jetpack/src/class-rest-purchases.php | 2 +- .../my-jetpack/src/class-rest-zendesk-chat.php | 6 +++--- .../protect-status/src/class-rest-controller.php | 4 ++-- .../videopress/src/class-uploader-rest-endpoints.php | 4 ++-- projects/plugins/protect/src/class-rest-controller.php | 4 ++-- 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/projects/packages/my-jetpack/src/class-rest-products.php b/projects/packages/my-jetpack/src/class-rest-products.php index 166bd21ab03e5..e6dd8f2f2e8c5 100644 --- a/projects/packages/my-jetpack/src/class-rest-products.php +++ b/projects/packages/my-jetpack/src/class-rest-products.php @@ -204,7 +204,7 @@ public static function get_products( $request ) { $product_slugs = ! empty( $slugs ) ? array_map( 'trim', explode( ',', $slugs ) ) : array(); $response = Products::get_products( $product_slugs ); - return rest_ensure_response( $response, 200 ); + return rest_ensure_response( $response ); } /** @@ -217,7 +217,7 @@ public static function get_products_by_ownership() { 'unownedProducts' => Products::get_products_by_ownership( 'unowned' ), 'ownedProducts' => Products::get_products_by_ownership( 'owned' ), ); - return rest_ensure_response( $response, 200 ); + return rest_ensure_response( $response ); } /** @@ -266,7 +266,7 @@ public static function activate_products( $request ) { } set_transient( 'my_jetpack_product_activated', implode( ',', $products_array ), 10 ); - return rest_ensure_response( Products::get_products( $products_array ), 200 ); + return rest_ensure_response( Products::get_products( $products_array ) ); } /** @@ -299,7 +299,7 @@ public static function deactivate_products( $request ) { } } - return rest_ensure_response( Products::get_products( $products_array ), 200 ); + return rest_ensure_response( Products::get_products( $products_array ) ); } /** @@ -332,6 +332,6 @@ public static function install_plugins( $request ) { } } - return rest_ensure_response( Products::get_products( $products_array ), 200 ); + return rest_ensure_response( Products::get_products( $products_array ) ); } } diff --git a/projects/packages/my-jetpack/src/class-rest-purchases.php b/projects/packages/my-jetpack/src/class-rest-purchases.php index ead4493403c4e..023824a2476f3 100644 --- a/projects/packages/my-jetpack/src/class-rest-purchases.php +++ b/projects/packages/my-jetpack/src/class-rest-purchases.php @@ -72,6 +72,6 @@ public static function get_site_current_purchases() { return new WP_Error( 'site_data_fetch_failed', 'Site data fetch failed', array( 'status' => $response_code ? $response_code : 400 ) ); } - return rest_ensure_response( $body, 200 ); + return rest_ensure_response( $body ); } } diff --git a/projects/packages/my-jetpack/src/class-rest-zendesk-chat.php b/projects/packages/my-jetpack/src/class-rest-zendesk-chat.php index f852433b44b18..91c58ecee45da 100644 --- a/projects/packages/my-jetpack/src/class-rest-zendesk-chat.php +++ b/projects/packages/my-jetpack/src/class-rest-zendesk-chat.php @@ -76,7 +76,7 @@ public static function chat_authentication_permissions_callback() { public static function get_chat_authentication() { $authentication = get_transient( self::ZENDESK_AUTH_TOKEN ); if ( $authentication ) { - return rest_ensure_response( $authentication, 200 ); + return rest_ensure_response( $authentication ); } $proxied = function_exists( 'wpcom_is_proxied_request' ) ? wpcom_is_proxied_request() : false; @@ -97,7 +97,7 @@ public static function get_chat_authentication() { } set_transient( self::ZENDESK_AUTH_TOKEN, $body, self::TRANSIENT_EXPIRY ); - return rest_ensure_response( $body, 200 ); + return rest_ensure_response( $body ); } /** @@ -117,6 +117,6 @@ public static function get_chat_availability() { return new WP_Error( 'chat_config_data_fetch_failed', 'Chat config data fetch failed', array( 'status' => $response_code ) ); } - return rest_ensure_response( $body, 200 ); + return rest_ensure_response( $body ); } } diff --git a/projects/packages/protect-status/src/class-rest-controller.php b/projects/packages/protect-status/src/class-rest-controller.php index 9faa154565a88..77ff6019060e9 100644 --- a/projects/packages/protect-status/src/class-rest-controller.php +++ b/projects/packages/protect-status/src/class-rest-controller.php @@ -80,7 +80,7 @@ public static function register_rest_endpoints() { public static function api_check_plan() { $has_required_plan = Plan::has_required_plan(); - return rest_ensure_response( $has_required_plan, 200 ); + return rest_ensure_response( $has_required_plan ); } /** @@ -92,7 +92,7 @@ public static function api_check_plan() { */ public static function api_get_status( $request ) { $status = Status::get_status( $request['hard_refresh'] ); - return rest_ensure_response( $status, 200 ); + return rest_ensure_response( $status ); } /** diff --git a/projects/packages/videopress/src/class-uploader-rest-endpoints.php b/projects/packages/videopress/src/class-uploader-rest-endpoints.php index f8d62edd54361..d5a7c91f7ef53 100644 --- a/projects/packages/videopress/src/class-uploader-rest-endpoints.php +++ b/projects/packages/videopress/src/class-uploader-rest-endpoints.php @@ -91,7 +91,7 @@ public static function check_status( $request ) { try { $uploader = new Uploader( $attachment_id ); $status = $uploader->check_status(); - return rest_ensure_response( $status, 200 ); + return rest_ensure_response( $status ); } catch ( Upload_Exception $e ) { return new WP_Error( 'rest_invalid_param', @@ -112,7 +112,7 @@ public static function do_upload( $request ) { try { $uploader = new Uploader( $attachment_id ); $status = $uploader->upload(); - return rest_ensure_response( $status, 200 ); + return rest_ensure_response( $status ); } catch ( Upload_Exception $e ) { return new WP_Error( 'rest_invalid_param', diff --git a/projects/plugins/protect/src/class-rest-controller.php b/projects/plugins/protect/src/class-rest-controller.php index 0aa752ddfd6d1..4565febdf4e3b 100644 --- a/projects/plugins/protect/src/class-rest-controller.php +++ b/projects/plugins/protect/src/class-rest-controller.php @@ -438,7 +438,7 @@ public static function api_set_waf_upgrade_seen_status() { */ public static function api_get_onboarding_progress() { $progress = Onboarding::get_current_user_progress(); - return rest_ensure_response( $progress, 200 ); + return rest_ensure_response( $progress ); } /** @@ -469,6 +469,6 @@ public static function api_complete_onboarding_steps( $request ) { */ public static function api_get_scan_history() { $scan_history = Scan_History::get_scan_history( false ); - return rest_ensure_response( $scan_history, 200 ); + return rest_ensure_response( $scan_history ); } } From edae7442222a9d4625754e0f2be73482f773758d Mon Sep 17 00:00:00 2001 From: tbradsha <32492176+tbradsha@users.noreply.github.com> Date: Wed, 22 Jan 2025 13:10:09 -0700 Subject: [PATCH 03/19] Remove other stray args In most cases, these appear to be due to refactors. --- .../connection/legacy/class-jetpack-tracks-client.php | 2 +- .../forms/src/contact-form/class-contact-form-field.php | 2 +- .../features/verbum-comments/class-verbum-comments.php | 2 +- projects/packages/schema/src/class-schema.php | 2 +- projects/packages/status/tests/php/test-host.php | 2 +- projects/packages/sync/src/class-rest-endpoints.php | 2 +- projects/packages/sync/src/modules/class-callables.php | 2 +- .../packages/videopress/src/tus/class-transient-store.php | 2 +- projects/plugins/boost/app/rest-api/permissions/Nonce.php | 2 +- projects/plugins/crm/includes/ZeroBSCRM.AJAX.php | 4 ++-- .../plugins/crm/includes/ZeroBSCRM.DAL3.Obj.Contacts.php | 8 ++++---- .../plugins/crm/includes/ZeroBSCRM.MetaBoxes3.Tasks.php | 2 +- .../crm/modules/woo-sync/includes/class-woo-sync.php | 2 +- .../php/automation/class-automation-workflow-test.php | 2 +- .../tests/php/event-manager/class-event-manager-test.php | 8 +++----- .../plugins/debug-helper/modules/class-scan-helper.php | 2 +- .../plugins/inspect/app/REST_API/Permissions/Nonce.php | 4 ++-- projects/plugins/jetpack/modules/widgets/gallery.php | 3 +-- .../post-by-email/test-class.post-by-email-api.php | 2 +- .../php/modules/sitemaps/test-class.sitemap-buffer.php | 2 +- .../sync/class-wp-test-jetpack-sync-queue-base-tests.php | 2 +- .../tests/php/sync/test_class.jetpack-sync-full.php | 2 +- .../php/sync/test_class.jetpack-sync-modules-stats.php | 4 ++-- .../tests/php/sync/test_class.jetpack-sync-queue.php | 2 +- projects/plugins/vaultpress/class.vaultpress-hotfixes.php | 2 +- 25 files changed, 33 insertions(+), 36 deletions(-) diff --git a/projects/packages/connection/legacy/class-jetpack-tracks-client.php b/projects/packages/connection/legacy/class-jetpack-tracks-client.php index 4161c4138f5b4..ab6a740f2f749 100644 --- a/projects/packages/connection/legacy/class-jetpack-tracks-client.php +++ b/projects/packages/connection/legacy/class-jetpack-tracks-client.php @@ -80,7 +80,7 @@ public static function record_event( $event ) { return $event; } - $pixel = $event->build_pixel_url( $event ); + $pixel = $event->build_pixel_url(); if ( ! $pixel ) { return new WP_Error( 'invalid_pixel', 'cannot generate tracks pixel for given input', 400 ); diff --git a/projects/packages/forms/src/contact-form/class-contact-form-field.php b/projects/packages/forms/src/contact-form/class-contact-form-field.php index 7d26f68322ff4..55de33cce9092 100644 --- a/projects/packages/forms/src/contact-form/class-contact-form-field.php +++ b/projects/packages/forms/src/contact-form/class-contact-form-field.php @@ -1069,7 +1069,7 @@ public function render_field( $type, $id, $label, $value, $class, $placeholder, $field .= $this->render_textarea_field( $id, $label, $value, $field_class, $required, $required_field_text, $field_placeholder ); break; case 'radio': - $field .= $this->render_radio_field( $id, $label, $value, $field_class, $required, $required_field_text, $field_placeholder ); + $field .= $this->render_radio_field( $id, $label, $value, $field_class, $required, $required_field_text ); break; case 'checkbox': $field .= $this->render_checkbox_field( $id, $label, $value, $field_class, $required, $required_field_text ); diff --git a/projects/packages/jetpack-mu-wpcom/src/features/verbum-comments/class-verbum-comments.php b/projects/packages/jetpack-mu-wpcom/src/features/verbum-comments/class-verbum-comments.php index 03f0bd3419522..1ed4fec4f9b5d 100644 --- a/projects/packages/jetpack-mu-wpcom/src/features/verbum-comments/class-verbum-comments.php +++ b/projects/packages/jetpack-mu-wpcom/src/features/verbum-comments/class-verbum-comments.php @@ -256,7 +256,7 @@ public function enqueue_assets() { 'allowedBlocks' => \Verbum_Block_Utils::get_allowed_blocks(), 'embedNonce' => wp_create_nonce( 'embed_nonce' ), 'verbumBundleUrl' => plugins_url( 'dist/index.js', __FILE__ ), - 'isRTL' => is_rtl( $locale ), + 'isRTL' => is_rtl(), 'vbeCacheBuster' => $vbe_cache_buster, 'iframeUniqueId' => $iframe_unique_id, ) diff --git a/projects/packages/schema/src/class-schema.php b/projects/packages/schema/src/class-schema.php index 69f8dd258cfcc..2f3efaaa4c543 100644 --- a/projects/packages/schema/src/class-schema.php +++ b/projects/packages/schema/src/class-schema.php @@ -98,7 +98,7 @@ public static function as_number() { } public static function as_float() { - return new Schema_Parser( new Type_Float( true ) ); + return new Schema_Parser( new Type_Float() ); } /** diff --git a/projects/packages/status/tests/php/test-host.php b/projects/packages/status/tests/php/test-host.php index 3cc1ad2f07982..ef1273e01d2d5 100644 --- a/projects/packages/status/tests/php/test-host.php +++ b/projects/packages/status/tests/php/test-host.php @@ -157,7 +157,7 @@ public function get_calypso_env_data_provider() { */ public function test_get_source_query( $source, $expected ) { $_GET['source'] = $source; - $this->assertEquals( $expected, $this->host_obj->get_source_query( $source ) ); + $this->assertEquals( $expected, $this->host_obj->get_source_query() ); unset( $_GET['source'] ); } diff --git a/projects/packages/sync/src/class-rest-endpoints.php b/projects/packages/sync/src/class-rest-endpoints.php index 3371f797193b7..71a91bf7ff481 100644 --- a/projects/packages/sync/src/class-rest-endpoints.php +++ b/projects/packages/sync/src/class-rest-endpoints.php @@ -626,7 +626,7 @@ public static function checkout( $request ) { $sender = new REST_Sender(); if ( 'immediate' === $queue_name ) { - return rest_ensure_response( $sender->immediate_full_sync_pull( $number_of_items ) ); + return rest_ensure_response( $sender->immediate_full_sync_pull() ); } $response = $sender->queue_pull( $queue_name, $number_of_items, $args ); diff --git a/projects/packages/sync/src/modules/class-callables.php b/projects/packages/sync/src/modules/class-callables.php index c3f132dca687c..a8465c35c0e35 100644 --- a/projects/packages/sync/src/modules/class-callables.php +++ b/projects/packages/sync/src/modules/class-callables.php @@ -379,7 +379,7 @@ public function set_plugin_action_links() { $plugins_action_links = array(); // Is the transient lock in place? - $plugins_lock = get_transient( 'jetpack_plugin_api_action_links_refresh', false ); + $plugins_lock = get_transient( 'jetpack_plugin_api_action_links_refresh' ); if ( ! empty( $plugins_lock ) && ( isset( $current_screeen->id ) && 'plugins' !== $current_screeen->id ) ) { return; } diff --git a/projects/packages/videopress/src/tus/class-transient-store.php b/projects/packages/videopress/src/tus/class-transient-store.php index bd3f5ee93ef1c..d8ba7c6421265 100644 --- a/projects/packages/videopress/src/tus/class-transient-store.php +++ b/projects/packages/videopress/src/tus/class-transient-store.php @@ -25,7 +25,7 @@ class Transient_Store extends Tus_Abstract_Cache { * @return mixed|null */ public function cache_get( $key ) { - $contents = get_transient( $key, '' ); + $contents = get_transient( $key ); return empty( $contents ) ? null : $contents; } diff --git a/projects/plugins/boost/app/rest-api/permissions/Nonce.php b/projects/plugins/boost/app/rest-api/permissions/Nonce.php index fcc66623e241b..0e780ee0e09c9 100644 --- a/projects/plugins/boost/app/rest-api/permissions/Nonce.php +++ b/projects/plugins/boost/app/rest-api/permissions/Nonce.php @@ -47,7 +47,7 @@ class Nonce implements Permission { public function __construct( $action, $request_key = 'nonce' ) { $this->action = $action; $this->request_key = $request_key; - $this->generate_nonce( $action ); + $this->generate_nonce(); } public function verify( $request ) { diff --git a/projects/plugins/crm/includes/ZeroBSCRM.AJAX.php b/projects/plugins/crm/includes/ZeroBSCRM.AJAX.php index 3866c3b009640..33d561e56f6b1 100644 --- a/projects/plugins/crm/includes/ZeroBSCRM.AJAX.php +++ b/projects/plugins/crm/includes/ZeroBSCRM.AJAX.php @@ -1108,7 +1108,7 @@ function ZeroBSCRM_accept_quote() { ) { zeroBSCRM_sendJSONError( array( 'access' => 1 ), 403 ); } - } elseif ( ! zeroBSCRM_quotes_getFromHash( $quoteHash, -1 )['success'] ) { + } elseif ( ! zeroBSCRM_quotes_getFromHash( $quoteHash )['success'] ) { // phpcs:ignore WordPress.NamingConventions.ValidVariableName.VariableNotSnakeCase zeroBSCRM_sendJSONError( array( 'hash' => 1 ), 403 ); } @@ -4013,7 +4013,7 @@ function zeroBSCRM_AJAX_enactListViewBulkAction() { foreach ( $legitIDs as $id ) { // } Update quote as unaccepted (should verify this worked...) - zeroBS_markQuoteUnAccepted( $id, zeroBS_getCurrentUserUsername() ); + zeroBS_markQuoteUnAccepted( $id ); ++$unaccepted; diff --git a/projects/plugins/crm/includes/ZeroBSCRM.DAL3.Obj.Contacts.php b/projects/plugins/crm/includes/ZeroBSCRM.DAL3.Obj.Contacts.php index 61df355223d4e..77c1a61d94c4d 100644 --- a/projects/plugins/crm/includes/ZeroBSCRM.DAL3.Obj.Contacts.php +++ b/projects/plugins/crm/includes/ZeroBSCRM.DAL3.Obj.Contacts.php @@ -3571,11 +3571,11 @@ public function deleteContact($args=array()){ ) ); - } unset($trans); + } unset( $trans ); - // delete events - $events = zeroBS_getEventsByCustomerID($id,false,1000000,0,false); - foreach ($events as $event){ + // delete events + $events = zeroBS_getEventsByCustomerID( $id, false, 1000000, 0 ); + foreach ( $events as $event ) { // delete post $zbs->DAL->events->deleteEvent( // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase diff --git a/projects/plugins/crm/includes/ZeroBSCRM.MetaBoxes3.Tasks.php b/projects/plugins/crm/includes/ZeroBSCRM.MetaBoxes3.Tasks.php index 1f4a5414d0132..2404d5ccf4b7a 100644 --- a/projects/plugins/crm/includes/ZeroBSCRM.MetaBoxes3.Tasks.php +++ b/projects/plugins/crm/includes/ZeroBSCRM.MetaBoxes3.Tasks.php @@ -533,7 +533,7 @@ function zeroBSCRM_task_addEdit( $taskID = -1 ) { $html .= zeroBSCRM_task_ui_clear(); - $html .= zeroBSCRM_task_ui_for( $taskObject, $taskID ); + $html .= zeroBSCRM_task_ui_for( $taskObject ); // phpcs:ignore WordPress.NamingConventions.ValidVariableName.VariableNotSnakeCase $html .= zeroBSCRM_task_ui_clear(); diff --git a/projects/plugins/crm/modules/woo-sync/includes/class-woo-sync.php b/projects/plugins/crm/modules/woo-sync/includes/class-woo-sync.php index 62abc4c421cf2..2a8daf3f8e586 100644 --- a/projects/plugins/crm/modules/woo-sync/includes/class-woo-sync.php +++ b/projects/plugins/crm/modules/woo-sync/includes/class-woo-sync.php @@ -2226,7 +2226,7 @@ private function migrate_52(){ $new_sync_site = $this->add_sync_site( $data ); // verify - if ( is_array( $new_sync_site ) && !empty( $new_sync_site['site_key'] ) && $this->get_active_sync_site( $new_sync_site['site_key'], true ) ){ + if ( is_array( $new_sync_site ) && !empty( $new_sync_site['site_key'] ) && $this->get_active_sync_site( $new_sync_site['site_key'] ) ){ // backup and remove old settings update_option( 'jpcrm_woosync_52_mig_backup', $settings, false ); diff --git a/projects/plugins/crm/tests/php/automation/class-automation-workflow-test.php b/projects/plugins/crm/tests/php/automation/class-automation-workflow-test.php index 6745296571a07..eb8c68abb7bb4 100644 --- a/projects/plugins/crm/tests/php/automation/class-automation-workflow-test.php +++ b/projects/plugins/crm/tests/php/automation/class-automation-workflow-test.php @@ -184,7 +184,7 @@ public function test_workflow_execution_on_contact_created() { $automation->init_workflows(); // Fake event data - $contact = $this->automation_faker->contact( false ); + $contact = $this->automation_faker->contact(); // We expect the workflow to be executed on contact_created event with the contact data $workflow->expects( $this->once() ) diff --git a/projects/plugins/crm/tests/php/event-manager/class-event-manager-test.php b/projects/plugins/crm/tests/php/event-manager/class-event-manager-test.php index ed5d1295736f1..5de4cac264148 100644 --- a/projects/plugins/crm/tests/php/event-manager/class-event-manager-test.php +++ b/projects/plugins/crm/tests/php/event-manager/class-event-manager-test.php @@ -258,11 +258,9 @@ function ( $transaction_created ) use ( $transaction ) { */ public function test_notify_on_transaction_updated() { /** @var Transaction $transaction */ - $transaction = Automation_Faker::instance()->transaction(); - $previous_transaction = clone $transaction; + $transaction = Automation_Faker::instance()->transaction(); - $transaction_data = Transaction_Factory::tidy_data( $transaction ); - $previous_transaction_data = Transaction_Factory::tidy_data( $previous_transaction ); + $transaction_data = Transaction_Factory::tidy_data( $transaction ); add_action( 'jpcrm_transaction_updated', @@ -276,7 +274,7 @@ function ( $transaction_updated ) use ( $transaction ) { ); $transaction_event = new Transaction_Event(); - $transaction_event->updated( $transaction_data, $previous_transaction_data ); + $transaction_event->updated( $transaction_data ); } /** diff --git a/projects/plugins/debug-helper/modules/class-scan-helper.php b/projects/plugins/debug-helper/modules/class-scan-helper.php index 237eb6acc0333..722390ef419bc 100644 --- a/projects/plugins/debug-helper/modules/class-scan-helper.php +++ b/projects/plugins/debug-helper/modules/class-scan-helper.php @@ -431,7 +431,7 @@ private function infected_file_threat_exists() { */ private function generate_infected_file_threat() { $content = "echo <<write_file( $this->threats['infected_file'], $content ) ) { return new WP_Error( 'could-not-write', "Unable to write threat from {$this->threats['infected_file']}" ); } diff --git a/projects/plugins/inspect/app/REST_API/Permissions/Nonce.php b/projects/plugins/inspect/app/REST_API/Permissions/Nonce.php index e6885475adfeb..e62942675d5a2 100644 --- a/projects/plugins/inspect/app/REST_API/Permissions/Nonce.php +++ b/projects/plugins/inspect/app/REST_API/Permissions/Nonce.php @@ -7,7 +7,7 @@ /** * Nonces are tricky in REST. * - * `rest_api_init` action is only tirggered when visiting an URL that looks like a REST Endpoint. + * `rest_api_init` action is only triggered when visiting an URL that looks like a REST Endpoint. * This means that if nonces are generated there, they won't be available in regular * `init` or `admin_init` parts of the app. But that's exactly where we need them. * @@ -47,7 +47,7 @@ class Nonce implements Permission { public function __construct( $action, $request_key = 'nonce' ) { $this->action = $action; $this->request_key = $request_key; - $this->generate_nonce( $action ); + $this->generate_nonce(); } public function verify( $request ) { diff --git a/projects/plugins/jetpack/modules/widgets/gallery.php b/projects/plugins/jetpack/modules/widgets/gallery.php index dfa0acdb0a439..1d62bb73302f4 100644 --- a/projects/plugins/jetpack/modules/widgets/gallery.php +++ b/projects/plugins/jetpack/modules/widgets/gallery.php @@ -108,8 +108,7 @@ public function widget( $args, $instance ) { // of logic in that method that shouldn't be duplicated. $carousel = new Jetpack_Carousel(); - // First parameter is $output, which comes from filters, and causes bypass of the asset enqueuing. Passing null is correct. - $carousel->enqueue_assets( null ); + $carousel->enqueue_assets(); } } diff --git a/projects/plugins/jetpack/tests/php/modules/post-by-email/test-class.post-by-email-api.php b/projects/plugins/jetpack/tests/php/modules/post-by-email/test-class.post-by-email-api.php index d14983fed6b4e..6b122b3b15c0e 100644 --- a/projects/plugins/jetpack/tests/php/modules/post-by-email/test-class.post-by-email-api.php +++ b/projects/plugins/jetpack/tests/php/modules/post-by-email/test-class.post-by-email-api.php @@ -211,7 +211,7 @@ public function rest_pre_dispatch( $result, $server ) { if ( $user_id ) { wp_set_current_user( $user_id ); } - $auth = $server->check_authentication( null ); + $auth = $server->check_authentication(); if ( true === $auth ) { return $result; } diff --git a/projects/plugins/jetpack/tests/php/modules/sitemaps/test-class.sitemap-buffer.php b/projects/plugins/jetpack/tests/php/modules/sitemaps/test-class.sitemap-buffer.php index 1a46e5223ac27..27a52aacc6142 100644 --- a/projects/plugins/jetpack/tests/php/modules/sitemaps/test-class.sitemap-buffer.php +++ b/projects/plugins/jetpack/tests/php/modules/sitemaps/test-class.sitemap-buffer.php @@ -117,7 +117,7 @@ public function test_sitemap_buffer_add_item_at_byte_capacity() { * @since 4.7.0 */ public function test_sitemap_buffer_add_item_below_byte_capacity() { - $buffer = new Jetpack_Sitemap_Buffer_Dummy( 1, 48, '(', ')', '1970-01-01 00:00:00' ); + $buffer = new Jetpack_Sitemap_Buffer_Dummy( 1, 48, '1970-01-01 00:00:00' ); $buffer->append( 'foobarbazquux' ); $buffer->append( 'crunchly' ); $this->assertEquals( diff --git a/projects/plugins/jetpack/tests/php/sync/class-wp-test-jetpack-sync-queue-base-tests.php b/projects/plugins/jetpack/tests/php/sync/class-wp-test-jetpack-sync-queue-base-tests.php index dfa861b1077a7..097030115cfbb 100644 --- a/projects/plugins/jetpack/tests/php/sync/class-wp-test-jetpack-sync-queue-base-tests.php +++ b/projects/plugins/jetpack/tests/php/sync/class-wp-test-jetpack-sync-queue-base-tests.php @@ -164,7 +164,7 @@ public function test_checkout_of_item_larger_than_memory_fetches_it_solo() { } public function test_checkout_enforced_across_multiple_instances() { - $other_queue = new Queue( $this->queue->id, 2 ); + $other_queue = new Queue( $this->queue->id ); $this->queue->add_all( array( 1, 2, 3, 4, 5 ) ); diff --git a/projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-full.php b/projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-full.php index acf1cd60c9191..d6b15df3d5fb8 100644 --- a/projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-full.php +++ b/projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-full.php @@ -1603,7 +1603,7 @@ public function test_initial_sync_doesnt_sync_subscribers() { $this->sender->do_full_sync(); $this->assertEquals( 3, $this->server_replica_storage->user_count() ); // finally, let's make sure that the initial sync method actually invokes our initial sync user config - Actions::do_initial_sync( '4.2', '4.1' ); + Actions::do_initial_sync(); $current_user = wp_get_current_user(); $expected_sync_config = array( diff --git a/projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-modules-stats.php b/projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-modules-stats.php index 4a48303be6802..97d5dad753769 100644 --- a/projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-modules-stats.php +++ b/projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-modules-stats.php @@ -98,8 +98,8 @@ public function test_sends_stats_data_on_heartbeat_on_multisite() { $action = $this->server_event_storage->get_most_recent_event( 'jetpack_sync_heartbeat_stats' ); - \Jetpack_Options::delete_option( 'blog_token', 'asdasd.123123' ); - \Jetpack_Options::delete_option( 'id', 1234 ); + \Jetpack_Options::delete_option( 'blog_token' ); + \Jetpack_Options::delete_option( 'id' ); restore_current_blog(); $this->assertEquals( self::TEST_STAT_VALUE, $action->args[0][ self::TEST_STAT_NAME ] ); diff --git a/projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-queue.php b/projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-queue.php index 16324adb2d613..ef86d4f753f06 100644 --- a/projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-queue.php +++ b/projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-queue.php @@ -166,7 +166,7 @@ public function test_checkout_of_item_larger_than_memory_fetches_it_solo() { } public function test_checkout_enforced_across_multiple_instances() { - $other_queue = new Queue( $this->queue->id, 2 ); + $other_queue = new Queue( $this->queue->id ); $this->queue->add_all( array( 1, 2, 3, 4, 5 ) ); diff --git a/projects/plugins/vaultpress/class.vaultpress-hotfixes.php b/projects/plugins/vaultpress/class.vaultpress-hotfixes.php index 5b5e28a00f8c6..1d5c04812d8a3 100644 --- a/projects/plugins/vaultpress/class.vaultpress-hotfixes.php +++ b/projects/plugins/vaultpress/class.vaultpress-hotfixes.php @@ -30,7 +30,7 @@ function protect_youtube_embeds() { } wp_embed_unregister_handler( 'youtube_embed_url' ); - wp_embed_register_handler( 'youtube_embed_url', '#https?://(www.)?youtube\.com/(?:v|embed)/([^/]+)#i', array( $this, 'safe_embed_handler_youtube' ), 9, 4 ); + wp_embed_register_handler( 'youtube_embed_url', '#https?://(www.)?youtube\.com/(?:v|embed)/([^/]+)#i', array( $this, 'safe_embed_handler_youtube' ), 9 ); } function safe_embed_handler_youtube( $matches, $attr, $url, $rawattr ) { From 1343e64da2207bbfe0c2b741ed53e1ddcebd5ad9 Mon Sep 17 00:00:00 2001 From: tbradsha <32492176+tbradsha@users.noreply.github.com> Date: Wed, 22 Jan 2025 13:13:19 -0700 Subject: [PATCH 04/19] Another stray arg --- projects/plugins/crm/includes/ZeroBSCRM.GeneralFuncs.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/plugins/crm/includes/ZeroBSCRM.GeneralFuncs.php b/projects/plugins/crm/includes/ZeroBSCRM.GeneralFuncs.php index 6934b919ddd99..92afbb8547929 100644 --- a/projects/plugins/crm/includes/ZeroBSCRM.GeneralFuncs.php +++ b/projects/plugins/crm/includes/ZeroBSCRM.GeneralFuncs.php @@ -1707,7 +1707,7 @@ function jpcrm_get_mimetype( $file_path ) { $credentials = request_filesystem_credentials( site_url() ); wp_filesystem( $credentials ); } - $lines = $wp_filesystem->get_contents_array( $file_path, 8 ); + $lines = $wp_filesystem->get_contents_array( $file_path ); if ( $lines === false ) { return 'application/octet-stream'; } From 891409d04fa6cd2ad626d30b42dc9fdec6f4977b Mon Sep 17 00:00:00 2001 From: tbradsha <32492176+tbradsha@users.noreply.github.com> Date: Wed, 22 Jan 2025 13:16:52 -0700 Subject: [PATCH 05/19] Suppress things that confuse Phan --- .../boost-core/src/lib/class-boost-api.php | 2 ++ .../crm/includes/ZeroBSCRM.GeneralFuncs.php | 20 +++++++------------ ....wpcom-json-api-site-settings-endpoint.php | 2 ++ .../php/sync/test_class.jetpack-sync-meta.php | 6 ++++-- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/projects/packages/boost-core/src/lib/class-boost-api.php b/projects/packages/boost-core/src/lib/class-boost-api.php index 6fbc4930c944c..8a451b7b2da23 100644 --- a/projects/packages/boost-core/src/lib/class-boost-api.php +++ b/projects/packages/boost-core/src/lib/class-boost-api.php @@ -55,6 +55,7 @@ private static function get_api_client() { * @return array|\WP_Error */ public static function get( $path, $query = array(), $args = null ) { + // @phan-suppress-next-line PhanParamTooMany -- By default this is WPCOM_Boost_API_Client, which accepts an extra param. return self::get_api_client()->get( $path, $query, self::merge_args( $args ) ); } @@ -67,6 +68,7 @@ public static function get( $path, $query = array(), $args = null ) { * @return mixed */ public static function post( $path, $payload = array(), $args = null ) { + // @phan-suppress-next-line PhanParamTooMany -- By default this is WPCOM_Boost_API_Client, which accepts an extra param. return self::get_api_client()->post( $path, $payload, self::merge_args( $args ) ); } diff --git a/projects/plugins/crm/includes/ZeroBSCRM.GeneralFuncs.php b/projects/plugins/crm/includes/ZeroBSCRM.GeneralFuncs.php index 92afbb8547929..bf3b3ebe5b704 100644 --- a/projects/plugins/crm/includes/ZeroBSCRM.GeneralFuncs.php +++ b/projects/plugins/crm/includes/ZeroBSCRM.GeneralFuncs.php @@ -604,19 +604,13 @@ function zeroBSCRM_expandArchive($filepath,$expandTo){ if (file_exists($filepath) && file_exists($expandTo)){ - $archive = new PclZip($filepath); - - if ($archive->extract(PCLZIP_OPT_PATH, $expandTo) == 0) { - - return false; - - } else { - - return true; - - } - - + $archive = new PclZip( $filepath ); + // @phan-suppress-next-line PhanParamTooMany -- PclZip functions use func_get_args. + if ( $archive->extract( PCLZIP_OPT_PATH, $expandTo ) === 0 ) { // phpcs:ignore WordPress.NamingConventions.ValidVariableName.VariableNotSnakeCase + return false; + } else { + return true; + } } } catch (Exception $ex){ diff --git a/projects/plugins/jetpack/json-endpoints/class.wpcom-json-api-site-settings-endpoint.php b/projects/plugins/jetpack/json-endpoints/class.wpcom-json-api-site-settings-endpoint.php index 9852478a7c53d..b1737cfa10a21 100644 --- a/projects/plugins/jetpack/json-endpoints/class.wpcom-json-api-site-settings-endpoint.php +++ b/projects/plugins/jetpack/json-endpoints/class.wpcom-json-api-site-settings-endpoint.php @@ -689,6 +689,7 @@ public function update_settings() { if ( $value ) { Jetpack::activate_module( $blog_id, 'search' ); } else { + // @phan-suppress-next-line PhanParamTooMany -- Phan doesn't know about the WP.com variant of the Jetpack class. Jetpack::deactivate_module( $blog_id, 'search' ); } $updated[ $key ] = (bool) $value; @@ -705,6 +706,7 @@ public function update_settings() { if ( $value ) { Jetpack::activate_module( $blog_id, 'related-posts' ); } else { + // @phan-suppress-next-line PhanParamTooMany -- Phan doesn't know about the WP.com variant of the Jetpack class. Jetpack::deactivate_module( $blog_id, 'related-posts' ); } } diff --git a/projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-meta.php b/projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-meta.php index 4fa39a0b76221..b16f2296332af 100644 --- a/projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-meta.php +++ b/projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-meta.php @@ -343,7 +343,8 @@ public function test_get_object_by_id_size_limit_exceeded() { update_post_meta( $this->post_id, $this->whitelisted_post_meta, $meta_test_value ); $module = Modules::get_module( 'meta' ); - $metas = $module->get_object_by_id( 'post', $this->post_id, $this->whitelisted_post_meta ); + // @phan-suppress-next-line PhanParamTooMany -- Phan looks at the Module abstract class instead of the Meta class that extends it. + $metas = $module->get_object_by_id( 'post', $this->post_id, $this->whitelisted_post_meta ); $this->assertSame( '', $metas[0]['meta_value'] ); } @@ -355,7 +356,8 @@ public function test_get_object_by_id_size_limit_max() { update_post_meta( $this->post_id, $this->whitelisted_post_meta, $meta_test_value ); $module = Modules::get_module( 'meta' ); - $metas = $module->get_object_by_id( 'post', $this->post_id, $this->whitelisted_post_meta ); + // @phan-suppress-next-line PhanParamTooMany -- Phan looks at the Module abstract class instead of the Meta class that extends it. + $metas = $module->get_object_by_id( 'post', $this->post_id, $this->whitelisted_post_meta ); $this->assertEquals( $meta_test_value, $metas[0]['meta_value'] ); } From 878227bb1e027823c46634f6e7c1432d35405888 Mon Sep 17 00:00:00 2001 From: tbradsha <32492176+tbradsha@users.noreply.github.com> Date: Wed, 22 Jan 2025 13:17:35 -0700 Subject: [PATCH 06/19] Fix get_avatar_url calls --- .../packages/connection/src/class-rest-connector.php | 9 ++++++++- .../lib/admin-pages/class-jetpack-redux-state-helper.php | 9 ++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/projects/packages/connection/src/class-rest-connector.php b/projects/packages/connection/src/class-rest-connector.php index 475e320380953..1fc534a767c1a 100644 --- a/projects/packages/connection/src/class-rest-connector.php +++ b/projects/packages/connection/src/class-rest-connector.php @@ -623,7 +623,14 @@ public static function get_user_connection_data( $rest_response = true ) { 'id' => $current_user->ID, 'blogId' => $blog_id, 'wpcomUser' => $wpcom_user_data, - 'gravatar' => get_avatar_url( $current_user->ID, 64, 'mm', '', array( 'force_display' => true ) ), + 'gravatar' => get_avatar_url( + $current_user->ID, + array( + 'size' => 64, + 'default' => 'mm', + 'force_default' => true, + ) + ), 'permissions' => array( 'connect' => current_user_can( 'jetpack_connect' ), 'connect_user' => current_user_can( 'jetpack_connect_user' ), diff --git a/projects/plugins/jetpack/_inc/lib/admin-pages/class-jetpack-redux-state-helper.php b/projects/plugins/jetpack/_inc/lib/admin-pages/class-jetpack-redux-state-helper.php index 1d047e6d500dd..4c96905c6bdda 100644 --- a/projects/plugins/jetpack/_inc/lib/admin-pages/class-jetpack-redux-state-helper.php +++ b/projects/plugins/jetpack/_inc/lib/admin-pages/class-jetpack-redux-state-helper.php @@ -491,7 +491,14 @@ function jetpack_current_user_data() { 'email' => $current_user->user_email, 'id' => $current_user->ID, 'wpcomUser' => $dotcom_data, - 'gravatar' => get_avatar_url( $current_user->ID, 64, 'mm', '', array( 'force_display' => true ) ), + 'gravatar' => get_avatar_url( + $current_user->ID, + array( + 'size' => 64, + 'default' => 'mm', + 'force_default' => true, + ) + ), 'permissions' => array( 'admin_page' => current_user_can( 'jetpack_admin_page' ), 'connect' => current_user_can( 'jetpack_connect' ), From c1ce570693a31c5db057265e1322fa16487e52df Mon Sep 17 00:00:00 2001 From: tbradsha <32492176+tbradsha@users.noreply.github.com> Date: Wed, 22 Jan 2025 13:17:51 -0700 Subject: [PATCH 07/19] =?UTF-8?q?arrayHasKey=20=E2=86=92=20assertArrayHasK?= =?UTF-8?q?ey?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tests/php/test_Error_Handler.php | 80 +++++++++---------- 1 file changed, 40 insertions(+), 40 deletions(-) diff --git a/projects/packages/connection/tests/php/test_Error_Handler.php b/projects/packages/connection/tests/php/test_Error_Handler.php index 93180385dcadb..b3b1595e656f9 100644 --- a/projects/packages/connection/tests/php/test_Error_Handler.php +++ b/projects/packages/connection/tests/php/test_Error_Handler.php @@ -72,20 +72,20 @@ public function test_store_error() { $this->assertCount( 1, $stored_errors ); - $this->arrayHasKey( 'invalid_token', $stored_errors ); + $this->assertArrayHasKey( 'invalid_token', $stored_errors ); $this->assertCount( 1, $stored_errors['invalid_token'] ); - $this->arrayHasKey( '1', $stored_errors['invalid_token'] ); + $this->assertArrayHasKey( '1', $stored_errors['invalid_token'] ); - $this->arrayHasKey( 'nonce', $stored_errors['invalid_token']['1'] ); - $this->arrayHasKey( 'error_code', $stored_errors['invalid_token']['1'] ); - $this->arrayHasKey( 'user_id', $stored_errors['invalid_token']['1'] ); - $this->arrayHasKey( 'error_message', $stored_errors['invalid_token']['1'] ); - $this->arrayHasKey( 'error_data', $stored_errors['invalid_token']['1'] ); - $this->arrayHasKey( 'timestamp', $stored_errors['invalid_token']['1'] ); - $this->arrayHasKey( 'nonce', $stored_errors['invalid_token']['1'] ); - $this->arrayHasKey( 'error_type', $stored_errors['invalid_token']['1'] ); + $this->assertArrayHasKey( 'nonce', $stored_errors['invalid_token']['1'] ); + $this->assertArrayHasKey( 'error_code', $stored_errors['invalid_token']['1'] ); + $this->assertArrayHasKey( 'user_id', $stored_errors['invalid_token']['1'] ); + $this->assertArrayHasKey( 'error_message', $stored_errors['invalid_token']['1'] ); + $this->assertArrayHasKey( 'error_data', $stored_errors['invalid_token']['1'] ); + $this->assertArrayHasKey( 'timestamp', $stored_errors['invalid_token']['1'] ); + $this->assertArrayHasKey( 'nonce', $stored_errors['invalid_token']['1'] ); + $this->assertArrayHasKey( 'error_type', $stored_errors['invalid_token']['1'] ); $this->assertEquals( 'xmlrpc', $stored_errors['invalid_token']['1']['error_type'] ); } @@ -108,29 +108,29 @@ public function test_store_multiple_error_codes() { $this->assertCount( 3, $stored_errors ); - $this->arrayHasKey( 'invalid_token', $stored_errors ); + $this->assertArrayHasKey( 'invalid_token', $stored_errors ); $this->assertCount( 1, $stored_errors['invalid_token'] ); $this->assertCount( 1, $stored_errors['unknown_user'] ); $this->assertCount( 1, $stored_errors['invalid_connection_owner'] ); - $this->arrayHasKey( '1', $stored_errors['unknown_user'] ); + $this->assertArrayHasKey( '1', $stored_errors['unknown_user'] ); - $this->arrayHasKey( 'error_type', $stored_errors['invalid_token']['1'] ); + $this->assertArrayHasKey( 'error_type', $stored_errors['invalid_token']['1'] ); $this->assertEquals( 'xmlrpc', $stored_errors['invalid_token']['1']['error_type'] ); - $this->arrayHasKey( 'nonce', $stored_errors['unknown_user']['1'] ); - $this->arrayHasKey( 'error_code', $stored_errors['unknown_user']['1'] ); - $this->arrayHasKey( 'user_id', $stored_errors['unknown_user']['1'] ); - $this->arrayHasKey( 'error_message', $stored_errors['unknown_user']['1'] ); - $this->arrayHasKey( 'error_data', $stored_errors['unknown_user']['1'] ); - $this->arrayHasKey( 'timestamp', $stored_errors['unknown_user']['1'] ); - $this->arrayHasKey( 'nonce', $stored_errors['unknown_user']['1'] ); - $this->arrayHasKey( 'error_type', $stored_errors['unknown_user']['1'] ); + $this->assertArrayHasKey( 'nonce', $stored_errors['unknown_user']['1'] ); + $this->assertArrayHasKey( 'error_code', $stored_errors['unknown_user']['1'] ); + $this->assertArrayHasKey( 'user_id', $stored_errors['unknown_user']['1'] ); + $this->assertArrayHasKey( 'error_message', $stored_errors['unknown_user']['1'] ); + $this->assertArrayHasKey( 'error_data', $stored_errors['unknown_user']['1'] ); + $this->assertArrayHasKey( 'timestamp', $stored_errors['unknown_user']['1'] ); + $this->assertArrayHasKey( 'nonce', $stored_errors['unknown_user']['1'] ); + $this->assertArrayHasKey( 'error_type', $stored_errors['unknown_user']['1'] ); $this->assertEquals( 'rest', $stored_errors['unknown_user']['1']['error_type'] ); - $this->arrayHasKey( 'invalid', $stored_errors['invalid_connection_owner'] ); - $this->arrayHasKey( 'error_type', $stored_errors['invalid_connection_owner']['invalid'] ); + $this->assertArrayHasKey( 'invalid', $stored_errors['invalid_connection_owner'] ); + $this->assertArrayHasKey( 'error_type', $stored_errors['invalid_connection_owner']['invalid'] ); $this->assertEquals( 'connection', $stored_errors['invalid_connection_owner']['invalid']['error_type'] ); } @@ -153,21 +153,21 @@ public function test_store_multiple_error_codes_multiple_users() { $this->assertCount( 2, $stored_errors ); - $this->arrayHasKey( 'invalid_token', $stored_errors ); + $this->assertArrayHasKey( 'invalid_token', $stored_errors ); $this->assertCount( 1, $stored_errors['invalid_token'] ); $this->assertCount( 2, $stored_errors['unknown_user'] ); - $this->arrayHasKey( '2', $stored_errors['unknown_user'] ); + $this->assertArrayHasKey( '2', $stored_errors['unknown_user'] ); - $this->arrayHasKey( 'nonce', $stored_errors['unknown_user']['2'] ); - $this->arrayHasKey( 'error_code', $stored_errors['unknown_user']['2'] ); - $this->arrayHasKey( 'user_id', $stored_errors['unknown_user']['2'] ); - $this->arrayHasKey( 'error_message', $stored_errors['unknown_user']['2'] ); - $this->arrayHasKey( 'error_data', $stored_errors['unknown_user']['2'] ); - $this->arrayHasKey( 'timestamp', $stored_errors['unknown_user']['2'] ); - $this->arrayHasKey( 'nonce', $stored_errors['unknown_user']['2'] ); - $this->arrayHasKey( 'error_type', $stored_errors['unknown_user']['2'] ); + $this->assertArrayHasKey( 'nonce', $stored_errors['unknown_user']['2'] ); + $this->assertArrayHasKey( 'error_code', $stored_errors['unknown_user']['2'] ); + $this->assertArrayHasKey( 'user_id', $stored_errors['unknown_user']['2'] ); + $this->assertArrayHasKey( 'error_message', $stored_errors['unknown_user']['2'] ); + $this->assertArrayHasKey( 'error_data', $stored_errors['unknown_user']['2'] ); + $this->assertArrayHasKey( 'timestamp', $stored_errors['unknown_user']['2'] ); + $this->assertArrayHasKey( 'nonce', $stored_errors['unknown_user']['2'] ); + $this->assertArrayHasKey( 'error_type', $stored_errors['unknown_user']['2'] ); } /** @@ -363,18 +363,18 @@ public function test_check_api_response_for_errors() { $verified_errors = $this->error_handler->get_verified_errors(); $this->assertCount( 1, $stored_errors ); - $this->arrayHasKey( 'unknown_token', $stored_errors ); + $this->assertArrayHasKey( 'unknown_token', $stored_errors ); $this->assertCount( 1, $stored_errors['unknown_token'] ); - $this->arrayHasKey( '1', $stored_errors['unknown_token'] ); - $this->arrayHasKey( 'error_code', $stored_errors['unknown_token']['0'] ); - $this->arrayHasKey( 'error_type', $stored_errors['unknown_token']['0'] ); + $this->assertArrayHasKey( '1', $stored_errors['unknown_token'] ); + $this->assertArrayHasKey( 'error_code', $stored_errors['unknown_token']['0'] ); + $this->assertArrayHasKey( 'error_type', $stored_errors['unknown_token']['0'] ); $this->assertEquals( 'rest', $stored_errors['unknown_token']['0']['error_type'] ); $this->assertCount( 1, $verified_errors ); - $this->arrayHasKey( 'unknown_token', $verified_errors ); + $this->assertArrayHasKey( 'unknown_token', $verified_errors ); $this->assertCount( 1, $verified_errors['unknown_token'] ); - $this->arrayHasKey( '1', $verified_errors['unknown_token'] ); - $this->arrayHasKey( 'error_code', $verified_errors['unknown_token']['0'] ); + $this->assertArrayHasKey( '1', $verified_errors['unknown_token'] ); + $this->assertArrayHasKey( 'error_code', $verified_errors['unknown_token']['0'] ); $this->assertEquals( 'rest', $verified_errors['unknown_token']['0']['error_type'] ); } From c9971465cb782a0ae4cdaa9ca4a3c66f78bb18eb Mon Sep 17 00:00:00 2001 From: tbradsha <32492176+tbradsha@users.noreply.github.com> Date: Wed, 22 Jan 2025 13:18:33 -0700 Subject: [PATCH 08/19] Fix misplaced parentheses --- projects/plugins/crm/admin/settings/companies.page.php | 2 +- .../tests/php/sync/test_class.jetpack-sync-full-immediately.php | 2 +- .../jetpack/tests/php/sync/test_class.jetpack-sync-full.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/projects/plugins/crm/admin/settings/companies.page.php b/projects/plugins/crm/admin/settings/companies.page.php index c343cff9dfe28..482fcb5bc05ef 100644 --- a/projects/plugins/crm/admin/settings/companies.page.php +++ b/projects/plugins/crm/admin/settings/companies.page.php @@ -75,7 +75,7 @@ diff --git a/projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-full-immediately.php b/projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-full-immediately.php index 057957286b577..4a83a9127a939 100644 --- a/projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-full-immediately.php +++ b/projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-full-immediately.php @@ -690,7 +690,7 @@ public function test_full_sync_sends_all_post_terms() { // reset the storage, check value, and do full sync - storage should be set! $this->server_replica_storage->reset(); - $this->assertFalse( $this->server_replica_storage->get_the_terms( $post_id, 'post_tag', 'Not empty' ) ); + $this->assertFalse( $this->server_replica_storage->get_the_terms( $post_id, 'post_tag' ), 'Not empty' ); $this->full_sync->start(); $this->sender->do_full_sync(); diff --git a/projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-full.php b/projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-full.php index d6b15df3d5fb8..89466856556cd 100644 --- a/projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-full.php +++ b/projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-full.php @@ -855,7 +855,7 @@ public function test_full_sync_sends_all_post_terms() { // reset the storage, check value, and do full sync - storage should be set! $this->server_replica_storage->reset(); - $this->assertFalse( $this->server_replica_storage->get_the_terms( $post_id, 'post_tag', 'Not empty' ) ); + $this->assertFalse( $this->server_replica_storage->get_the_terms( $post_id, 'post_tag' ), 'Not empty' ); $this->full_sync->start(); $this->sender->do_full_sync(); From 5b26109990acdf3927d2ea23d109d201f5f7a975 Mon Sep 17 00:00:00 2001 From: tbradsha <32492176+tbradsha@users.noreply.github.com> Date: Wed, 22 Jan 2025 13:20:18 -0700 Subject: [PATCH 09/19] Tighten types We're using `WP_Option`, which allows an extra param in its `get()`. --- .../plugins/inspect/packages/Async_Option/Async_Option.php | 4 +--- .../inspect/packages/Async_Option/Async_Option_Template.php | 5 ++--- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/projects/plugins/inspect/packages/Async_Option/Async_Option.php b/projects/plugins/inspect/packages/Async_Option/Async_Option.php index ddf8d024fe491..6ab8502ae768b 100644 --- a/projects/plugins/inspect/packages/Async_Option/Async_Option.php +++ b/projects/plugins/inspect/packages/Async_Option/Async_Option.php @@ -2,8 +2,6 @@ namespace Automattic\Jetpack\Packages\Async_Option; -use Automattic\Jetpack\Packages\Async_Option\Storage\Storage; - class Async_Option { /** @@ -12,7 +10,7 @@ class Async_Option { private $key; /** - * @var Storage + * @var WP_Option */ protected $storage; diff --git a/projects/plugins/inspect/packages/Async_Option/Async_Option_Template.php b/projects/plugins/inspect/packages/Async_Option/Async_Option_Template.php index ec9edd85a80ce..c11cf9a43affb 100644 --- a/projects/plugins/inspect/packages/Async_Option/Async_Option_Template.php +++ b/projects/plugins/inspect/packages/Async_Option/Async_Option_Template.php @@ -2,7 +2,6 @@ namespace Automattic\Jetpack\Packages\Async_Option; -use Automattic\Jetpack\Packages\Async_Option\Storage\Storage; use Automattic\Jetpack\Packages\Async_Option\Storage\WP_Option; /** @@ -22,11 +21,11 @@ abstract class Async_Option_Template { private $errors = array(); /** - * Setup storage mechanism that subscribes to `Storage` contract + * Setup storage mechanism that subscribes to `WP_Option` contract * * @param $storage_namespace string * - * @return Storage + * @return WP_Option */ public function setup_storage( $storage_namespace ) { return new WP_Option( $storage_namespace ); From baf63ae604dbc7fa483144d0f6730be17bad4496 Mon Sep 17 00:00:00 2001 From: tbradsha <32492176+tbradsha@users.noreply.github.com> Date: Wed, 22 Jan 2025 13:20:37 -0700 Subject: [PATCH 10/19] Add missing sprintf --- projects/plugins/jetpack/class.jetpack-cli.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/plugins/jetpack/class.jetpack-cli.php b/projects/plugins/jetpack/class.jetpack-cli.php index 664ce0003e505..00b94981be5fc 100644 --- a/projects/plugins/jetpack/class.jetpack-cli.php +++ b/projects/plugins/jetpack/class.jetpack-cli.php @@ -1874,7 +1874,7 @@ public function publicize( $args, $named_args ) { WP_CLI::success( __( 'All Jetpack Social connections were successfully disconnected.', 'jetpack' ) ); } else { /* translators: %s is a lowercase string for a social network. */ - WP_CLI::success( __( 'All Jetpack Social connections to %s were successfully disconnected.', 'jetpack' ), $service ); + WP_CLI::success( sprintf( __( 'All Jetpack Social connections to %s were successfully disconnected.', 'jetpack' ), $service ) ); } } } elseif ( false !== $publicize->disconnect( false, $identifier ) ) { From 865f774096417cc84d123eb17f7d867c859d711e Mon Sep 17 00:00:00 2001 From: tbradsha <32492176+tbradsha@users.noreply.github.com> Date: Wed, 22 Jan 2025 13:23:47 -0700 Subject: [PATCH 11/19] Add unused param to allow dynamic method call --- projects/plugins/inspect/packages/Async_Option/Endpoint.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/projects/plugins/inspect/packages/Async_Option/Endpoint.php b/projects/plugins/inspect/packages/Async_Option/Endpoint.php index 21947f763e7d8..07a9151274bf8 100644 --- a/projects/plugins/inspect/packages/Async_Option/Endpoint.php +++ b/projects/plugins/inspect/packages/Async_Option/Endpoint.php @@ -70,8 +70,10 @@ public function handler( $request ) { /** * Handle GET Requests + * + * @param \WP_REST_Request $request Currently unused. */ - public function handle_get() { + public function handle_get( $request ) { // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable return $this->option->get(); } From 03a0d8af852aecf4fe6959bb95e1ab0b34d7c995 Mon Sep 17 00:00:00 2001 From: tbradsha <32492176+tbradsha@users.noreply.github.com> Date: Wed, 22 Jan 2025 13:25:55 -0700 Subject: [PATCH 12/19] Add changelogs --- .../packages/boost-core/changelog/fix-phan-PhanParamTooMany | 4 ++++ .../packages/connection/changelog/fix-phan-PhanParamTooMany | 4 ++++ projects/packages/forms/changelog/fix-phan-PhanParamTooMany | 4 ++++ .../packages/image-cdn/changelog/fix-phan-PhanParamTooMany | 4 ++++ .../jetpack-mu-wpcom/changelog/fix-phan-PhanParamTooMany | 4 ++++ .../packages/my-jetpack/changelog/fix-phan-PhanParamTooMany | 4 ++++ .../protect-status/changelog/fix-phan-PhanParamTooMany | 4 ++++ projects/packages/schema/changelog/fix-phan-PhanParamTooMany | 4 ++++ projects/packages/stats/changelog/fix-phan-PhanParamTooMany | 4 ++++ projects/packages/status/changelog/fix-phan-PhanParamTooMany | 4 ++++ projects/packages/sync/changelog/fix-phan-PhanParamTooMany | 4 ++++ .../packages/videopress/changelog/fix-phan-PhanParamTooMany | 4 ++++ projects/packages/waf/changelog/fix-phan-PhanParamTooMany | 4 ++++ projects/plugins/boost/changelog/fix-phan-PhanParamTooMany | 4 ++++ projects/plugins/crm/changelog/fix-phan-PhanParamTooMany | 4 ++++ .../plugins/debug-helper/changelog/fix-phan-PhanParamTooMany | 4 ++++ projects/plugins/inspect/changelog/fix-phan-PhanParamTooMany | 4 ++++ projects/plugins/jetpack/changelog/fix-phan-PhanParamTooMany | 4 ++++ projects/plugins/protect/changelog/fix-phan-PhanParamTooMany | 4 ++++ .../plugins/vaultpress/changelog/fix-phan-PhanParamTooMany | 4 ++++ 20 files changed, 80 insertions(+) create mode 100644 projects/packages/boost-core/changelog/fix-phan-PhanParamTooMany create mode 100644 projects/packages/connection/changelog/fix-phan-PhanParamTooMany create mode 100644 projects/packages/forms/changelog/fix-phan-PhanParamTooMany create mode 100644 projects/packages/image-cdn/changelog/fix-phan-PhanParamTooMany create mode 100644 projects/packages/jetpack-mu-wpcom/changelog/fix-phan-PhanParamTooMany create mode 100644 projects/packages/my-jetpack/changelog/fix-phan-PhanParamTooMany create mode 100644 projects/packages/protect-status/changelog/fix-phan-PhanParamTooMany create mode 100644 projects/packages/schema/changelog/fix-phan-PhanParamTooMany create mode 100644 projects/packages/stats/changelog/fix-phan-PhanParamTooMany create mode 100644 projects/packages/status/changelog/fix-phan-PhanParamTooMany create mode 100644 projects/packages/sync/changelog/fix-phan-PhanParamTooMany create mode 100644 projects/packages/videopress/changelog/fix-phan-PhanParamTooMany create mode 100644 projects/packages/waf/changelog/fix-phan-PhanParamTooMany create mode 100644 projects/plugins/boost/changelog/fix-phan-PhanParamTooMany create mode 100644 projects/plugins/crm/changelog/fix-phan-PhanParamTooMany create mode 100644 projects/plugins/debug-helper/changelog/fix-phan-PhanParamTooMany create mode 100644 projects/plugins/inspect/changelog/fix-phan-PhanParamTooMany create mode 100644 projects/plugins/jetpack/changelog/fix-phan-PhanParamTooMany create mode 100644 projects/plugins/protect/changelog/fix-phan-PhanParamTooMany create mode 100644 projects/plugins/vaultpress/changelog/fix-phan-PhanParamTooMany diff --git a/projects/packages/boost-core/changelog/fix-phan-PhanParamTooMany b/projects/packages/boost-core/changelog/fix-phan-PhanParamTooMany new file mode 100644 index 0000000000000..bceb16a46d5fe --- /dev/null +++ b/projects/packages/boost-core/changelog/fix-phan-PhanParamTooMany @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +Code: Remove extra params on function calls. diff --git a/projects/packages/connection/changelog/fix-phan-PhanParamTooMany b/projects/packages/connection/changelog/fix-phan-PhanParamTooMany new file mode 100644 index 0000000000000..bceb16a46d5fe --- /dev/null +++ b/projects/packages/connection/changelog/fix-phan-PhanParamTooMany @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +Code: Remove extra params on function calls. diff --git a/projects/packages/forms/changelog/fix-phan-PhanParamTooMany b/projects/packages/forms/changelog/fix-phan-PhanParamTooMany new file mode 100644 index 0000000000000..bceb16a46d5fe --- /dev/null +++ b/projects/packages/forms/changelog/fix-phan-PhanParamTooMany @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +Code: Remove extra params on function calls. diff --git a/projects/packages/image-cdn/changelog/fix-phan-PhanParamTooMany b/projects/packages/image-cdn/changelog/fix-phan-PhanParamTooMany new file mode 100644 index 0000000000000..bceb16a46d5fe --- /dev/null +++ b/projects/packages/image-cdn/changelog/fix-phan-PhanParamTooMany @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +Code: Remove extra params on function calls. diff --git a/projects/packages/jetpack-mu-wpcom/changelog/fix-phan-PhanParamTooMany b/projects/packages/jetpack-mu-wpcom/changelog/fix-phan-PhanParamTooMany new file mode 100644 index 0000000000000..bceb16a46d5fe --- /dev/null +++ b/projects/packages/jetpack-mu-wpcom/changelog/fix-phan-PhanParamTooMany @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +Code: Remove extra params on function calls. diff --git a/projects/packages/my-jetpack/changelog/fix-phan-PhanParamTooMany b/projects/packages/my-jetpack/changelog/fix-phan-PhanParamTooMany new file mode 100644 index 0000000000000..bceb16a46d5fe --- /dev/null +++ b/projects/packages/my-jetpack/changelog/fix-phan-PhanParamTooMany @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +Code: Remove extra params on function calls. diff --git a/projects/packages/protect-status/changelog/fix-phan-PhanParamTooMany b/projects/packages/protect-status/changelog/fix-phan-PhanParamTooMany new file mode 100644 index 0000000000000..bceb16a46d5fe --- /dev/null +++ b/projects/packages/protect-status/changelog/fix-phan-PhanParamTooMany @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +Code: Remove extra params on function calls. diff --git a/projects/packages/schema/changelog/fix-phan-PhanParamTooMany b/projects/packages/schema/changelog/fix-phan-PhanParamTooMany new file mode 100644 index 0000000000000..bceb16a46d5fe --- /dev/null +++ b/projects/packages/schema/changelog/fix-phan-PhanParamTooMany @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +Code: Remove extra params on function calls. diff --git a/projects/packages/stats/changelog/fix-phan-PhanParamTooMany b/projects/packages/stats/changelog/fix-phan-PhanParamTooMany new file mode 100644 index 0000000000000..bceb16a46d5fe --- /dev/null +++ b/projects/packages/stats/changelog/fix-phan-PhanParamTooMany @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +Code: Remove extra params on function calls. diff --git a/projects/packages/status/changelog/fix-phan-PhanParamTooMany b/projects/packages/status/changelog/fix-phan-PhanParamTooMany new file mode 100644 index 0000000000000..bceb16a46d5fe --- /dev/null +++ b/projects/packages/status/changelog/fix-phan-PhanParamTooMany @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +Code: Remove extra params on function calls. diff --git a/projects/packages/sync/changelog/fix-phan-PhanParamTooMany b/projects/packages/sync/changelog/fix-phan-PhanParamTooMany new file mode 100644 index 0000000000000..bceb16a46d5fe --- /dev/null +++ b/projects/packages/sync/changelog/fix-phan-PhanParamTooMany @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +Code: Remove extra params on function calls. diff --git a/projects/packages/videopress/changelog/fix-phan-PhanParamTooMany b/projects/packages/videopress/changelog/fix-phan-PhanParamTooMany new file mode 100644 index 0000000000000..bceb16a46d5fe --- /dev/null +++ b/projects/packages/videopress/changelog/fix-phan-PhanParamTooMany @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +Code: Remove extra params on function calls. diff --git a/projects/packages/waf/changelog/fix-phan-PhanParamTooMany b/projects/packages/waf/changelog/fix-phan-PhanParamTooMany new file mode 100644 index 0000000000000..bceb16a46d5fe --- /dev/null +++ b/projects/packages/waf/changelog/fix-phan-PhanParamTooMany @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +Code: Remove extra params on function calls. diff --git a/projects/plugins/boost/changelog/fix-phan-PhanParamTooMany b/projects/plugins/boost/changelog/fix-phan-PhanParamTooMany new file mode 100644 index 0000000000000..bceb16a46d5fe --- /dev/null +++ b/projects/plugins/boost/changelog/fix-phan-PhanParamTooMany @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +Code: Remove extra params on function calls. diff --git a/projects/plugins/crm/changelog/fix-phan-PhanParamTooMany b/projects/plugins/crm/changelog/fix-phan-PhanParamTooMany new file mode 100644 index 0000000000000..bceb16a46d5fe --- /dev/null +++ b/projects/plugins/crm/changelog/fix-phan-PhanParamTooMany @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +Code: Remove extra params on function calls. diff --git a/projects/plugins/debug-helper/changelog/fix-phan-PhanParamTooMany b/projects/plugins/debug-helper/changelog/fix-phan-PhanParamTooMany new file mode 100644 index 0000000000000..bceb16a46d5fe --- /dev/null +++ b/projects/plugins/debug-helper/changelog/fix-phan-PhanParamTooMany @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +Code: Remove extra params on function calls. diff --git a/projects/plugins/inspect/changelog/fix-phan-PhanParamTooMany b/projects/plugins/inspect/changelog/fix-phan-PhanParamTooMany new file mode 100644 index 0000000000000..bceb16a46d5fe --- /dev/null +++ b/projects/plugins/inspect/changelog/fix-phan-PhanParamTooMany @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +Code: Remove extra params on function calls. diff --git a/projects/plugins/jetpack/changelog/fix-phan-PhanParamTooMany b/projects/plugins/jetpack/changelog/fix-phan-PhanParamTooMany new file mode 100644 index 0000000000000..b7c5b86e8e3b1 --- /dev/null +++ b/projects/plugins/jetpack/changelog/fix-phan-PhanParamTooMany @@ -0,0 +1,4 @@ +Significance: patch +Type: other + +Code: Remove extra params on function calls. diff --git a/projects/plugins/protect/changelog/fix-phan-PhanParamTooMany b/projects/plugins/protect/changelog/fix-phan-PhanParamTooMany new file mode 100644 index 0000000000000..bceb16a46d5fe --- /dev/null +++ b/projects/plugins/protect/changelog/fix-phan-PhanParamTooMany @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +Code: Remove extra params on function calls. diff --git a/projects/plugins/vaultpress/changelog/fix-phan-PhanParamTooMany b/projects/plugins/vaultpress/changelog/fix-phan-PhanParamTooMany new file mode 100644 index 0000000000000..bceb16a46d5fe --- /dev/null +++ b/projects/plugins/vaultpress/changelog/fix-phan-PhanParamTooMany @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +Code: Remove extra params on function calls. From ee8948ca87ad19059a4e2d677629263398b99b59 Mon Sep 17 00:00:00 2001 From: tbradsha <32492176+tbradsha@users.noreply.github.com> Date: Wed, 22 Jan 2025 15:17:48 -0700 Subject: [PATCH 13/19] Use same behaviour as trunk --- .../packages/connection/src/class-rest-connector.php | 9 +-------- .../lib/admin-pages/class-jetpack-redux-state-helper.php | 9 +-------- 2 files changed, 2 insertions(+), 16 deletions(-) diff --git a/projects/packages/connection/src/class-rest-connector.php b/projects/packages/connection/src/class-rest-connector.php index 1fc534a767c1a..6a8134b47abb9 100644 --- a/projects/packages/connection/src/class-rest-connector.php +++ b/projects/packages/connection/src/class-rest-connector.php @@ -623,14 +623,7 @@ public static function get_user_connection_data( $rest_response = true ) { 'id' => $current_user->ID, 'blogId' => $blog_id, 'wpcomUser' => $wpcom_user_data, - 'gravatar' => get_avatar_url( - $current_user->ID, - array( - 'size' => 64, - 'default' => 'mm', - 'force_default' => true, - ) - ), + 'gravatar' => get_avatar_url( $current_user->ID ), 'permissions' => array( 'connect' => current_user_can( 'jetpack_connect' ), 'connect_user' => current_user_can( 'jetpack_connect_user' ), diff --git a/projects/plugins/jetpack/_inc/lib/admin-pages/class-jetpack-redux-state-helper.php b/projects/plugins/jetpack/_inc/lib/admin-pages/class-jetpack-redux-state-helper.php index 4c96905c6bdda..5933556739519 100644 --- a/projects/plugins/jetpack/_inc/lib/admin-pages/class-jetpack-redux-state-helper.php +++ b/projects/plugins/jetpack/_inc/lib/admin-pages/class-jetpack-redux-state-helper.php @@ -491,14 +491,7 @@ function jetpack_current_user_data() { 'email' => $current_user->user_email, 'id' => $current_user->ID, 'wpcomUser' => $dotcom_data, - 'gravatar' => get_avatar_url( - $current_user->ID, - array( - 'size' => 64, - 'default' => 'mm', - 'force_default' => true, - ) - ), + 'gravatar' => get_avatar_url( $current_user->ID ), 'permissions' => array( 'admin_page' => current_user_can( 'jetpack_admin_page' ), 'connect' => current_user_can( 'jetpack_connect' ), From a584a6a071b3cc27989de655bc113ff1b59baa83 Mon Sep 17 00:00:00 2001 From: tbradsha <32492176+tbradsha@users.noreply.github.com> Date: Wed, 22 Jan 2025 15:40:15 -0700 Subject: [PATCH 14/19] Fix assertion --- projects/packages/connection/tests/php/test_Error_Handler.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/packages/connection/tests/php/test_Error_Handler.php b/projects/packages/connection/tests/php/test_Error_Handler.php index b3b1595e656f9..7c549a0ddae14 100644 --- a/projects/packages/connection/tests/php/test_Error_Handler.php +++ b/projects/packages/connection/tests/php/test_Error_Handler.php @@ -365,7 +365,7 @@ public function test_check_api_response_for_errors() { $this->assertCount( 1, $stored_errors ); $this->assertArrayHasKey( 'unknown_token', $stored_errors ); $this->assertCount( 1, $stored_errors['unknown_token'] ); - $this->assertArrayHasKey( '1', $stored_errors['unknown_token'] ); + $this->assertArrayHasKey( 0, $stored_errors['unknown_token'] ); $this->assertArrayHasKey( 'error_code', $stored_errors['unknown_token']['0'] ); $this->assertArrayHasKey( 'error_type', $stored_errors['unknown_token']['0'] ); $this->assertEquals( 'rest', $stored_errors['unknown_token']['0']['error_type'] ); @@ -373,7 +373,7 @@ public function test_check_api_response_for_errors() { $this->assertCount( 1, $verified_errors ); $this->assertArrayHasKey( 'unknown_token', $verified_errors ); $this->assertCount( 1, $verified_errors['unknown_token'] ); - $this->assertArrayHasKey( '1', $verified_errors['unknown_token'] ); + $this->assertArrayHasKey( 0, $verified_errors['unknown_token'] ); $this->assertArrayHasKey( 'error_code', $verified_errors['unknown_token']['0'] ); $this->assertEquals( 'rest', $verified_errors['unknown_token']['0']['error_type'] ); } From 1ea067bf62791788cc42124708c38c0f6387a777 Mon Sep 17 00:00:00 2001 From: tbradsha <32492176+tbradsha@users.noreply.github.com> Date: Fri, 31 Jan 2025 09:46:09 -0700 Subject: [PATCH 15/19] Add param to Storage::get and use that type as before --- .../plugins/inspect/packages/Async_Option/Async_Option.php | 4 +++- .../inspect/packages/Async_Option/Async_Option_Template.php | 5 +++-- .../inspect/packages/Async_Option/Storage/Storage.php | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/projects/plugins/inspect/packages/Async_Option/Async_Option.php b/projects/plugins/inspect/packages/Async_Option/Async_Option.php index 6ab8502ae768b..ddf8d024fe491 100644 --- a/projects/plugins/inspect/packages/Async_Option/Async_Option.php +++ b/projects/plugins/inspect/packages/Async_Option/Async_Option.php @@ -2,6 +2,8 @@ namespace Automattic\Jetpack\Packages\Async_Option; +use Automattic\Jetpack\Packages\Async_Option\Storage\Storage; + class Async_Option { /** @@ -10,7 +12,7 @@ class Async_Option { private $key; /** - * @var WP_Option + * @var Storage */ protected $storage; diff --git a/projects/plugins/inspect/packages/Async_Option/Async_Option_Template.php b/projects/plugins/inspect/packages/Async_Option/Async_Option_Template.php index c11cf9a43affb..ec9edd85a80ce 100644 --- a/projects/plugins/inspect/packages/Async_Option/Async_Option_Template.php +++ b/projects/plugins/inspect/packages/Async_Option/Async_Option_Template.php @@ -2,6 +2,7 @@ namespace Automattic\Jetpack\Packages\Async_Option; +use Automattic\Jetpack\Packages\Async_Option\Storage\Storage; use Automattic\Jetpack\Packages\Async_Option\Storage\WP_Option; /** @@ -21,11 +22,11 @@ abstract class Async_Option_Template { private $errors = array(); /** - * Setup storage mechanism that subscribes to `WP_Option` contract + * Setup storage mechanism that subscribes to `Storage` contract * * @param $storage_namespace string * - * @return WP_Option + * @return Storage */ public function setup_storage( $storage_namespace ) { return new WP_Option( $storage_namespace ); diff --git a/projects/plugins/inspect/packages/Async_Option/Storage/Storage.php b/projects/plugins/inspect/packages/Async_Option/Storage/Storage.php index ce6a4ffb34cf9..798da9d1f38ea 100644 --- a/projects/plugins/inspect/packages/Async_Option/Storage/Storage.php +++ b/projects/plugins/inspect/packages/Async_Option/Storage/Storage.php @@ -4,7 +4,7 @@ interface Storage { - public function get( $key ); + public function get( $key, $default ); public function set( $key, $value ); From 6906f662bcc91cd1cefcbc68e42afb9f684ef0d2 Mon Sep 17 00:00:00 2001 From: tbradsha <32492176+tbradsha@users.noreply.github.com> Date: Fri, 31 Jan 2025 09:55:41 -0700 Subject: [PATCH 16/19] Inform Phan of type rather than suppressing error --- .../jetpack/tests/php/sync/test_class.jetpack-sync-meta.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-meta.php b/projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-meta.php index b16f2296332af..eaa68b6d052e6 100644 --- a/projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-meta.php +++ b/projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-meta.php @@ -343,7 +343,7 @@ public function test_get_object_by_id_size_limit_exceeded() { update_post_meta( $this->post_id, $this->whitelisted_post_meta, $meta_test_value ); $module = Modules::get_module( 'meta' ); - // @phan-suppress-next-line PhanParamTooMany -- Phan looks at the Module abstract class instead of the Meta class that extends it. + '@phan-var \Automattic\Jetpack\Sync\Modules\Meta $module'; $metas = $module->get_object_by_id( 'post', $this->post_id, $this->whitelisted_post_meta ); $this->assertSame( '', $metas[0]['meta_value'] ); } @@ -356,7 +356,7 @@ public function test_get_object_by_id_size_limit_max() { update_post_meta( $this->post_id, $this->whitelisted_post_meta, $meta_test_value ); $module = Modules::get_module( 'meta' ); - // @phan-suppress-next-line PhanParamTooMany -- Phan looks at the Module abstract class instead of the Meta class that extends it. + '@phan-var \Automattic\Jetpack\Sync\Modules\Meta $module'; $metas = $module->get_object_by_id( 'post', $this->post_id, $this->whitelisted_post_meta ); $this->assertEquals( $meta_test_value, $metas[0]['meta_value'] ); } From ea69a4e11cad4d6ff88f287e28f2296b415f7c87 Mon Sep 17 00:00:00 2001 From: tbradsha <32492176+tbradsha@users.noreply.github.com> Date: Fri, 31 Jan 2025 09:59:50 -0700 Subject: [PATCH 17/19] Update errant types --- projects/packages/sync/src/modules/class-meta.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/projects/packages/sync/src/modules/class-meta.php b/projects/packages/sync/src/modules/class-meta.php index d92ab518d024c..ed6674d5b3074 100644 --- a/projects/packages/sync/src/modules/class-meta.php +++ b/projects/packages/sync/src/modules/class-meta.php @@ -94,9 +94,9 @@ public function get_objects_by_id( $object_type, $config ) { /** * Get a single Meta Result. * - * @param string $object_type post, comment, term, user. - * @param null $id Object ID. - * @param null $meta_key Meta Key. + * @param string $object_type post, comment, term, user. + * @param int|null $id Object ID. + * @param string|null $meta_key Meta Key. * * @return mixed|null */ From df1351061ec1e8aeb1d0187d30fd87acb2893b56 Mon Sep 17 00:00:00 2001 From: tbradsha <32492176+tbradsha@users.noreply.github.com> Date: Fri, 31 Jan 2025 10:15:26 -0700 Subject: [PATCH 18/19] Update Phan baselines --- .../packages/boost-core/.phan/baseline.php | 2 - .../packages/connection/.phan/baseline.php | 12 ++--- projects/packages/forms/.phan/baseline.php | 5 +- .../packages/image-cdn/.phan/baseline.php | 7 ++- .../jetpack-mu-wpcom/.phan/baseline.php | 3 +- .../packages/masterbar/.phan/baseline.php | 2 +- .../packages/my-jetpack/.phan/baseline.php | 6 +-- .../protect-status/.phan/baseline.php | 2 - .../packages/publicize/.phan/baseline.php | 2 +- projects/packages/schema/.phan/baseline.php | 2 - .../packages/stats-admin/.phan/baseline.php | 2 +- projects/packages/stats/.phan/baseline.php | 5 +- projects/packages/status/.phan/baseline.php | 2 - projects/packages/sync/.phan/baseline.php | 8 ++-- .../packages/videopress/.phan/baseline.php | 3 -- projects/packages/waf/.phan/baseline.php | 2 - projects/plugins/boost/.phan/baseline.php | 4 +- projects/plugins/crm/.phan/baseline.php | 17 ++++--- .../plugins/debug-helper/.phan/baseline.php | 5 +- projects/plugins/inspect/.phan/baseline.php | 4 -- projects/plugins/jetpack/.phan/baseline.php | 48 ++++++++----------- projects/plugins/protect/.phan/baseline.php | 2 - .../plugins/vaultpress/.phan/baseline.php | 3 +- 23 files changed, 53 insertions(+), 95 deletions(-) diff --git a/projects/packages/boost-core/.phan/baseline.php b/projects/packages/boost-core/.phan/baseline.php index 65423713e6dde..f0979d9893c75 100644 --- a/projects/packages/boost-core/.phan/baseline.php +++ b/projects/packages/boost-core/.phan/baseline.php @@ -10,12 +10,10 @@ return [ // # Issue statistics: // PhanAbstractStaticMethodCallInStatic : 3 occurrences - // PhanParamTooMany : 2 occurrences // PhanTypeMismatchArgumentInternal : 2 occurrences // Currently, file_suppressions and directory_suppressions are the only supported suppressions 'file_suppressions' => [ - 'src/lib/class-boost-api.php' => ['PhanParamTooMany'], 'src/lib/class-cacheable.php' => ['PhanAbstractStaticMethodCallInStatic'], 'src/lib/class-utils.php' => ['PhanTypeMismatchArgumentInternal'], ], diff --git a/projects/packages/connection/.phan/baseline.php b/projects/packages/connection/.phan/baseline.php index fd61210a7bcf7..afc07f5c28eb3 100644 --- a/projects/packages/connection/.phan/baseline.php +++ b/projects/packages/connection/.phan/baseline.php @@ -9,13 +9,12 @@ */ return [ // # Issue statistics: - // PhanParamTooMany : 40+ occurrences // PhanTypeMismatchArgument : 40+ occurrences // PhanPluginDuplicateConditionalNullCoalescing : 15+ occurrences // PhanTypeMismatchReturn : 15+ occurrences - // PhanTypeMismatchArgumentProbablyReal : 9 occurrences // PhanTypeMismatchPropertyProbablyReal : 9 occurrences // PhanNoopNew : 8 occurrences + // PhanTypeMismatchArgumentProbablyReal : 8 occurrences // PhanTypeMismatchReturnProbablyReal : 8 occurrences // PhanRedundantCondition : 6 occurrences // PhanTypeArraySuspiciousNullable : 5 occurrences @@ -42,7 +41,7 @@ 'file_suppressions' => [ 'legacy/class-jetpack-options.php' => ['PhanTypeMismatchArgumentNullable', 'PhanTypeMismatchArgumentProbablyReal'], 'legacy/class-jetpack-signature.php' => ['PhanPluginDuplicateConditionalNullCoalescing', 'PhanTypeMismatchArgumentInternal'], - 'legacy/class-jetpack-tracks-client.php' => ['PhanNonClassMethodCall', 'PhanParamTooMany', 'PhanPluginDuplicateConditionalNullCoalescing', 'PhanTypeMismatchArgument', 'PhanTypeMismatchPropertyProbablyReal'], + 'legacy/class-jetpack-tracks-client.php' => ['PhanNonClassMethodCall', 'PhanPluginDuplicateConditionalNullCoalescing', 'PhanTypeMismatchArgument', 'PhanTypeMismatchPropertyProbablyReal'], 'legacy/class-jetpack-xmlrpc-server.php' => ['PhanAccessMethodInternal', 'PhanPluginDuplicateConditionalNullCoalescing', 'PhanRedundantCondition', 'PhanTypeMismatchArgumentNullable', 'PhanTypeMismatchDefault', 'PhanTypeMismatchReturn'], 'src/class-error-handler.php' => ['PhanTypeMismatchReturnProbablyReal'], 'src/class-heartbeat.php' => ['PhanTypeMismatchPropertyDefault'], @@ -51,7 +50,7 @@ 'src/class-partner-coupon.php' => ['PhanPluginDuplicateConditionalNullCoalescing'], 'src/class-partner.php' => ['PhanTypeMismatchPropertyProbablyReal'], 'src/class-rest-authentication.php' => ['PhanTypeMismatchPropertyDefault', 'PhanTypeMismatchPropertyProbablyReal'], - 'src/class-rest-connector.php' => ['PhanParamTooMany', 'PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchReturnProbablyReal'], + 'src/class-rest-connector.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchReturnProbablyReal'], 'src/class-secrets.php' => ['PhanNonClassMethodCall', 'PhanTypeMismatchArgument'], 'src/class-server-sandbox.php' => ['PhanPluginDuplicateConditionalNullCoalescing', 'PhanTypeMismatchArgument'], 'src/class-tokens.php' => ['PhanImpossibleTypeComparison', 'PhanTypeMismatchArgumentInternal', 'PhanTypeMismatchReturn', 'PhanTypeMismatchReturnProbablyReal'], @@ -61,9 +60,8 @@ 'src/webhooks/class-authorize-redirect.php' => ['PhanUndeclaredClassMethod'], 'tests/php/test-class-nonce-handler.php' => ['PhanPluginDuplicateAdjacentStatement', 'PhanTypeMismatchArgument'], 'tests/php/test-rest-endpoints.php' => ['PhanNoopNew', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchReturn', 'PhanTypeMismatchReturnProbablyReal'], - 'tests/php/test_Error_Handler.php' => ['PhanParamTooMany', 'PhanTypeMismatchArgument'], - 'tests/php/test_Manager_integration.php' => ['PhanParamTooMany'], - 'tests/php/test_Manager_unit.php' => ['PhanDeprecatedFunction', 'PhanParamTooMany', 'PhanTypeArraySuspiciousNullable', 'PhanTypeObjectUnsetDeclaredProperty'], + 'tests/php/test_Error_Handler.php' => ['PhanTypeMismatchArgument'], + 'tests/php/test_Manager_unit.php' => ['PhanDeprecatedFunction', 'PhanTypeArraySuspiciousNullable', 'PhanTypeObjectUnsetDeclaredProperty'], 'tests/php/test_Rest_Authentication.php' => ['PhanTypeMismatchArgument'], 'tests/php/test_Server_Sandbox.php' => ['PhanTypeArraySuspiciousNullable'], 'tests/php/test_Signature.php' => ['PhanTypeMismatchArgumentProbablyReal'], diff --git a/projects/packages/forms/.phan/baseline.php b/projects/packages/forms/.phan/baseline.php index 514b43e8b8b76..3a68f46ad7c2c 100644 --- a/projects/packages/forms/.phan/baseline.php +++ b/projects/packages/forms/.phan/baseline.php @@ -11,7 +11,7 @@ // # Issue statistics: // PhanTypeMismatchArgument : 20+ occurrences // PhanPluginDuplicateConditionalNullCoalescing : 10+ occurrences - // PhanTypeMismatchReturnProbablyReal : 9 occurrences + // PhanTypeMismatchReturnProbablyReal : 10+ occurrences // PhanTypeMismatchArgumentInternal : 6 occurrences // PhanTypeMismatchArgumentProbablyReal : 6 occurrences // PhanRedundantCondition : 4 occurrences @@ -20,7 +20,6 @@ // PhanTypeConversionFromArray : 2 occurrences // PhanTypeMismatchArgumentNullableInternal : 2 occurrences // PhanTypeMismatchReturn : 2 occurrences - // PhanParamTooMany : 1 occurrence // PhanPluginDuplicateAdjacentStatement : 1 occurrence // PhanPluginMixedKeyNoKey : 1 occurrence // PhanPossiblyNullTypeMismatchProperty : 1 occurrence @@ -33,7 +32,7 @@ 'file_suppressions' => [ 'src/class-wpcom-rest-api-v2-endpoint-forms.php' => ['PhanTypePossiblyInvalidDimOffset'], 'src/contact-form/class-admin.php' => ['PhanPluginDuplicateConditionalNullCoalescing', 'PhanRedundantCondition', 'PhanTypeArraySuspiciousNullable', 'PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentInternal', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchReturn'], - 'src/contact-form/class-contact-form-field.php' => ['PhanParamTooMany', 'PhanPluginDuplicateConditionalNullCoalescing', 'PhanPossiblyNullTypeMismatchProperty', 'PhanTypeConversionFromArray', 'PhanTypeMismatchArgument', 'PhanTypeMismatchReturnProbablyReal', 'PhanUndeclaredProperty'], + 'src/contact-form/class-contact-form-field.php' => ['PhanPluginDuplicateConditionalNullCoalescing', 'PhanPossiblyNullTypeMismatchProperty', 'PhanTypeConversionFromArray', 'PhanTypeMismatchArgument', 'PhanTypeMismatchReturnProbablyReal', 'PhanUndeclaredProperty'], 'src/contact-form/class-contact-form-plugin.php' => ['PhanPluginDuplicateAdjacentStatement', 'PhanPluginDuplicateConditionalNullCoalescing', 'PhanPluginRedundantAssignment', 'PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentInternal', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchReturnProbablyReal'], 'src/contact-form/class-contact-form-shortcode.php' => ['PhanPluginDuplicateConditionalNullCoalescing', 'PhanTypeMismatchReturnProbablyReal'], 'src/contact-form/class-contact-form.php' => ['PhanPluginDuplicateConditionalNullCoalescing', 'PhanPluginRedundantAssignment', 'PhanRedundantCondition', 'PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMismatchReturnNullable', 'PhanTypeMismatchReturnProbablyReal'], diff --git a/projects/packages/image-cdn/.phan/baseline.php b/projects/packages/image-cdn/.phan/baseline.php index 2c2feb19b8c48..bbe603a59f92b 100644 --- a/projects/packages/image-cdn/.phan/baseline.php +++ b/projects/packages/image-cdn/.phan/baseline.php @@ -11,9 +11,8 @@ // # Issue statistics: // PhanTypePossiblyInvalidDimOffset : 10+ occurrences // PhanPluginSimplifyExpressionBool : 6 occurrences - // PhanParamTooMany : 5 occurrences // PhanPluginDuplicateConditionalNullCoalescing : 4 occurrences - // PhanPossiblyUndeclaredVariable : 3 occurrences + // PhanPossiblyUndeclaredVariable : 2 occurrences // PhanTypeMismatchArgumentProbablyReal : 2 occurrences // PhanTypeMismatchPropertyProbablyReal : 2 occurrences // PhanTypeMismatchReturn : 2 occurrences @@ -32,8 +31,8 @@ 'src/class-image-cdn-core.php' => ['PhanTypeMismatchReturn'], 'src/class-image-cdn-image-sizes.php' => ['PhanPluginSimplifyExpressionBool'], 'src/class-image-cdn.php' => ['PhanNonClassMethodCall', 'PhanPluginDuplicateConditionalNullCoalescing', 'PhanPluginSimplifyExpressionBool', 'PhanPossiblyUndeclaredVariable', 'PhanTypeArraySuspicious', 'PhanTypeMismatchArgumentInternal', 'PhanTypeMismatchPropertyProbablyReal', 'PhanTypeMismatchReturn', 'PhanTypeMismatchReturnProbablyReal', 'PhanTypePossiblyInvalidDimOffset'], - 'src/compatibility/photon.php' => ['PhanParamTooMany', 'PhanTypeMismatchArgumentNullableInternal'], - 'tests/php/test_class.image_cdn.php' => ['PhanParamTooMany', 'PhanPluginDuplicateConditionalNullCoalescing', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentNullable', 'PhanTypeMismatchPropertyProbablyReal', 'PhanUndeclaredMethod', 'PhanUndeclaredStaticMethod'], + 'src/compatibility/photon.php' => ['PhanTypeMismatchArgumentNullableInternal'], + 'tests/php/test_class.image_cdn.php' => ['PhanPluginDuplicateConditionalNullCoalescing', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentNullable', 'PhanTypeMismatchPropertyProbablyReal', 'PhanUndeclaredMethod', 'PhanUndeclaredStaticMethod'], 'tests/php/test_class.image_cdn_core.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanTypeObjectUnsetDeclaredProperty'], ], // 'directory_suppressions' => ['src/directory_name' => ['PhanIssueName1', 'PhanIssueName2']] can be manually added if needed. diff --git a/projects/packages/jetpack-mu-wpcom/.phan/baseline.php b/projects/packages/jetpack-mu-wpcom/.phan/baseline.php index 6865fcfd0af51..fcdd7c5cb23fe 100644 --- a/projects/packages/jetpack-mu-wpcom/.phan/baseline.php +++ b/projects/packages/jetpack-mu-wpcom/.phan/baseline.php @@ -19,7 +19,6 @@ // PhanTypeMismatchReturnProbablyReal : 4 occurrences // PhanTypePossiblyInvalidDimOffset : 3 occurrences // PhanEmptyFQSENInCallable : 2 occurrences - // PhanParamTooMany : 2 occurrences // PhanTypeArraySuspicious : 2 occurrences // PhanTypeArraySuspiciousNullable : 2 occurrences // PhanTypeMismatchDefault : 2 occurrences @@ -53,7 +52,7 @@ 'src/features/launchpad/launchpad.php' => ['PhanTypeArraySuspiciousNullable', 'PhanTypeMismatchArgument', 'PhanTypeMismatchReturn', 'PhanTypeMismatchReturnProbablyReal'], 'src/features/marketplace-products-updater/class-marketplace-products-updater.php' => ['PhanTypeMismatchDimFetch', 'PhanTypeMismatchReturn'], 'src/features/media/heif-support.php' => ['PhanPluginSimplifyExpressionBool'], - 'src/features/verbum-comments/class-verbum-comments.php' => ['PhanImpossibleTypeComparison', 'PhanNoopNew', 'PhanParamTooMany', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredFunction'], + 'src/features/verbum-comments/class-verbum-comments.php' => ['PhanImpossibleTypeComparison', 'PhanNoopNew', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredFunction'], 'src/features/wpcom-endpoints/class-wpcom-rest-api-v2-endpoint-launchpad.php' => ['PhanPluginDuplicateConditionalNullCoalescing'], 'src/features/wpcom-endpoints/class-wpcom-rest-api-v2-endpoint-site-migration-migrate-guru-key.php' => ['PhanUndeclaredClassMethod'], 'src/features/wpcom-endpoints/class-wpcom-rest-api-v2-endpoint-site-migration-wpcom-migration-key.php' => ['PhanUndeclaredClassMethod'], diff --git a/projects/packages/masterbar/.phan/baseline.php b/projects/packages/masterbar/.phan/baseline.php index a5d99171df831..ecce106ea85db 100644 --- a/projects/packages/masterbar/.phan/baseline.php +++ b/projects/packages/masterbar/.phan/baseline.php @@ -9,7 +9,7 @@ */ return [ // # Issue statistics: - // PhanNoopNew : 5 occurrences + // PhanNoopNew : 4 occurrences // Currently, file_suppressions and directory_suppressions are the only supported suppressions 'file_suppressions' => [ diff --git a/projects/packages/my-jetpack/.phan/baseline.php b/projects/packages/my-jetpack/.phan/baseline.php index 89d682178484a..cc1f6bf874d12 100644 --- a/projects/packages/my-jetpack/.phan/baseline.php +++ b/projects/packages/my-jetpack/.phan/baseline.php @@ -11,7 +11,6 @@ // # Issue statistics: // PhanTypeMismatchArgumentNullable : 60+ occurrences // PhanTypeMismatchPropertyDefault : 15+ occurrences - // PhanParamTooMany : 9 occurrences // PhanAbstractStaticMethodCallInStatic : 8 occurrences // PhanTypeMismatchReturnProbablyReal : 8 occurrences // PhanNoopNew : 7 occurrences @@ -33,9 +32,8 @@ 'src/class-initializer.php' => ['PhanImpossibleCondition', 'PhanNoopNew', 'PhanRedundantCondition', 'PhanTypeMismatchReturn', 'PhanTypeMismatchReturnNullable', 'PhanUndeclaredClassMethod'], 'src/class-jetpack-manage.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'src/class-products.php' => ['PhanNonClassMethodCall'], - 'src/class-rest-products.php' => ['PhanParamTooMany', 'PhanPluginMixedKeyNoKey', 'PhanTypeMismatchReturn'], - 'src/class-rest-purchases.php' => ['PhanParamTooMany', 'PhanTypeMismatchReturn', 'PhanTypeMismatchReturnProbablyReal'], - 'src/class-rest-zendesk-chat.php' => ['PhanParamTooMany'], + 'src/class-rest-products.php' => ['PhanPluginMixedKeyNoKey', 'PhanTypeMismatchReturn'], + 'src/class-rest-purchases.php' => ['PhanTypeMismatchReturn', 'PhanTypeMismatchReturnProbablyReal'], 'src/class-wpcom-products.php' => ['PhanTypeMismatchReturnProbablyReal'], 'src/products/class-anti-spam.php' => ['PhanTypeMismatchArgumentNullable', 'PhanTypeMismatchPropertyDefault'], 'src/products/class-backup.php' => ['PhanTypeMismatchArgumentNullable', 'PhanTypeMismatchPropertyDefault', 'PhanTypeSuspiciousNonTraversableForeach'], diff --git a/projects/packages/protect-status/.phan/baseline.php b/projects/packages/protect-status/.phan/baseline.php index 86d346ec79007..de8bae0b4a4dd 100644 --- a/projects/packages/protect-status/.phan/baseline.php +++ b/projects/packages/protect-status/.phan/baseline.php @@ -11,7 +11,6 @@ // # Issue statistics: // PhanPluginDuplicateConditionalNullCoalescing : 25+ occurrences // PhanTypeMismatchArgument : 3 occurrences - // PhanParamTooMany : 2 occurrences // PhanPluginSimplifyExpressionBool : 1 occurrence // PhanRedundantCondition : 1 occurrence // PhanTypeMismatchReturnProbablyReal : 1 occurrence @@ -20,7 +19,6 @@ 'file_suppressions' => [ 'src/class-plan.php' => ['PhanTypeMismatchReturnProbablyReal'], 'src/class-protect-status.php' => ['PhanPluginDuplicateConditionalNullCoalescing'], - 'src/class-rest-controller.php' => ['PhanParamTooMany'], 'src/class-scan-status.php' => ['PhanPluginDuplicateConditionalNullCoalescing', 'PhanRedundantCondition'], 'src/class-status.php' => ['PhanPluginSimplifyExpressionBool', 'PhanTypeMismatchArgument'], 'tests/php/test-scan-status.php' => ['PhanTypeMismatchArgument'], diff --git a/projects/packages/publicize/.phan/baseline.php b/projects/packages/publicize/.phan/baseline.php index b819017a9a146..6cb6dc65c76c4 100644 --- a/projects/packages/publicize/.phan/baseline.php +++ b/projects/packages/publicize/.phan/baseline.php @@ -11,6 +11,7 @@ // # Issue statistics: // PhanPluginDuplicateConditionalNullCoalescing : 6 occurrences // PhanTypeMismatchArgument : 6 occurrences + // PhanNoopNew : 3 occurrences // PhanPluginMixedKeyNoKey : 3 occurrences // PhanTypeMismatchArgumentNullable : 3 occurrences // PhanUndeclaredClassMethod : 3 occurrences @@ -19,7 +20,6 @@ // PhanTypeMismatchReturnProbablyReal : 2 occurrences // PhanTypeMissingReturn : 2 occurrences // PhanImpossibleCondition : 1 occurrence - // PhanNoopNew : 1 occurrence // PhanParamSignatureMismatch : 1 occurrence // PhanPluginDuplicateExpressionAssignmentOperation : 1 occurrence // PhanPluginSimplifyExpressionBool : 1 occurrence diff --git a/projects/packages/schema/.phan/baseline.php b/projects/packages/schema/.phan/baseline.php index 512768d303724..29659b9080639 100644 --- a/projects/packages/schema/.phan/baseline.php +++ b/projects/packages/schema/.phan/baseline.php @@ -13,13 +13,11 @@ // PhanParamTooFew : 5 occurrences // PhanTypeMismatchArgumentProbablyReal : 2 occurrences // PhanImpossibleTypeComparison : 1 occurrence - // PhanParamTooMany : 1 occurrence // PhanTypeMismatchArgumentNullable : 1 occurrence // PhanTypeMismatchReturn : 1 occurrence // Currently, file_suppressions and directory_suppressions are the only supported suppressions 'file_suppressions' => [ - 'src/class-schema.php' => ['PhanParamTooMany'], 'src/types/class-type-assoc-array.php' => ['PhanTypeMismatchArgumentNullable', 'PhanTypeMismatchReturn'], 'src/types/class-type-string.php' => ['PhanImpossibleTypeComparison'], 'tests/php/integration/test-integration-fallback-values.php' => ['PhanNonClassMethodCall'], diff --git a/projects/packages/stats-admin/.phan/baseline.php b/projects/packages/stats-admin/.phan/baseline.php index dcd197fe3706f..631837fd24c1c 100644 --- a/projects/packages/stats-admin/.phan/baseline.php +++ b/projects/packages/stats-admin/.phan/baseline.php @@ -9,8 +9,8 @@ */ return [ // # Issue statistics: + // PhanTypeMismatchArgumentProbablyReal : 8 occurrences // PhanTypeMismatchReturn : 8 occurrences - // PhanTypeMismatchArgumentProbablyReal : 7 occurrences // PhanPluginDuplicateConditionalNullCoalescing : 4 occurrences // PhanTypeMismatchReturnProbablyReal : 2 occurrences // PhanTypeMismatchReturnNullable : 1 occurrence diff --git a/projects/packages/stats/.phan/baseline.php b/projects/packages/stats/.phan/baseline.php index 20e29a09c4233..5caf37dcbc75c 100644 --- a/projects/packages/stats/.phan/baseline.php +++ b/projects/packages/stats/.phan/baseline.php @@ -9,7 +9,6 @@ */ return [ // # Issue statistics: - // PhanParamTooMany : 7 occurrences // PhanTypeVoidAssignment : 4 occurrences // PhanPluginDuplicateConditionalNullCoalescing : 2 occurrences // PhanTypeMismatchReturn : 1 occurrence @@ -18,9 +17,9 @@ 'file_suppressions' => [ 'src/class-tracking-pixel.php' => ['PhanPluginDuplicateConditionalNullCoalescing'], 'src/class-wpcom-stats.php' => ['PhanTypeMismatchReturn'], - 'tests/php/test-main.php' => ['PhanParamTooMany', 'PhanTypeVoidAssignment'], + 'tests/php/test-main.php' => ['PhanTypeVoidAssignment'], 'tests/php/test-options.php' => ['PhanTypeVoidAssignment'], - 'tests/php/test-xmlrpc-provider.php' => ['PhanParamTooMany', 'PhanTypeVoidAssignment'], + 'tests/php/test-xmlrpc-provider.php' => ['PhanTypeVoidAssignment'], ], // 'directory_suppressions' => ['src/directory_name' => ['PhanIssueName1', 'PhanIssueName2']] can be manually added if needed. // (directory_suppressions will currently be ignored by subsequent calls to --save-baseline, but may be preserved in future Phan releases) diff --git a/projects/packages/status/.phan/baseline.php b/projects/packages/status/.phan/baseline.php index 4d814abb8a776..66282ccc8eb97 100644 --- a/projects/packages/status/.phan/baseline.php +++ b/projects/packages/status/.phan/baseline.php @@ -14,7 +14,6 @@ // PhanPluginDuplicateConditionalNullCoalescing : 2 occurrences // PhanPluginSimplifyExpressionBool : 2 occurrences // PhanRedefineFunction : 2 occurrences - // PhanParamTooMany : 1 occurrence // PhanPluginRedundantAssignment : 1 occurrence // PhanRedundantCondition : 1 occurrence // PhanTypeArraySuspicious : 1 occurrence @@ -32,7 +31,6 @@ 'src/class-modules.php' => ['PhanPluginSimplifyExpressionBool', 'PhanTypeArraySuspicious', 'PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentProbablyReal'], 'src/class-status.php' => ['PhanRedundantCondition', 'PhanUndeclaredFunction'], 'tests/php/bootstrap.php' => ['PhanRedefineFunction', 'PhanTypeMismatchReturnProbablyReal'], - 'tests/php/test-host.php' => ['PhanParamTooMany'], 'tests/php/test-status.php' => ['PhanTypeMismatchArgumentInternal'], ], // 'directory_suppressions' => ['src/directory_name' => ['PhanIssueName1', 'PhanIssueName2']] can be manually added if needed. diff --git a/projects/packages/sync/.phan/baseline.php b/projects/packages/sync/.phan/baseline.php index a3955bc005b47..4074beb38c4d7 100644 --- a/projects/packages/sync/.phan/baseline.php +++ b/projects/packages/sync/.phan/baseline.php @@ -23,11 +23,10 @@ // PhanRedundantCondition : 4 occurrences // PhanTypeExpectedObjectPropAccess : 4 occurrences // PhanTypeMismatchArgumentInternal : 4 occurrences - // PhanTypeArraySuspicious : 2 occurrences // PhanTypeArraySuspiciousNullable : 3 occurrences // PhanAccessMethodInternal : 2 occurrences // PhanImpossibleCondition : 2 occurrences - // PhanParamTooMany : 2 occurrences + // PhanTypeArraySuspicious : 2 occurrences // PhanTypeMismatchArgumentNullable : 2 occurrences // PhanTypeMismatchPropertyDefault : 2 occurrences // PhanTypeMismatchReturnNullable : 2 occurrences @@ -54,19 +53,18 @@ 'src/class-lock.php' => ['PhanTypeMismatchReturn'], 'src/class-queue.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentNullableInternal'], 'src/class-replicastore.php' => ['PhanAccessMethodInternal', 'PhanParamSignatureMismatch', 'PhanPluginDuplicateSwitchCaseLooseEquality', 'PhanTypeArraySuspiciousNullable', 'PhanTypeMismatchArgument', 'PhanTypeMismatchReturn', 'PhanTypeMismatchReturnNullable', 'PhanTypeSuspiciousStringExpression'], - 'src/class-rest-endpoints.php' => ['PhanParamTooMany', 'PhanParamTooManyCallable', 'PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentNullable', 'PhanTypeMismatchReturn', 'PhanTypeMismatchReturnProbablyReal', 'PhanTypePossiblyInvalidDimOffset'], + 'src/class-rest-endpoints.php' => ['PhanParamTooManyCallable', 'PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentNullable', 'PhanTypeMismatchReturn', 'PhanTypeMismatchReturnProbablyReal', 'PhanTypePossiblyInvalidDimOffset'], 'src/class-rest-sender.php' => ['PhanPluginDuplicateConditionalNullCoalescing', 'PhanTypeMismatchArgumentProbablyReal'], 'src/class-sender.php' => ['PhanNonClassMethodCall', 'PhanPluginDuplicateConditionalNullCoalescing', 'PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty', 'PhanTypeMismatchReturnProbablyReal'], 'src/class-server.php' => ['PhanTypeMismatchDeclaredParam', 'PhanTypeMismatchReturnProbablyReal'], 'src/class-settings.php' => ['PhanNonClassMethodCall', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'src/class-utils.php' => ['PhanTypeExpectedObjectPropAccess'], - 'src/modules/class-callables.php' => ['PhanParamSignatureMismatch', 'PhanParamTooMany', 'PhanTypeArraySuspicious', 'PhanTypeMismatchArgument', 'PhanTypeMismatchReturnProbablyReal'], + 'src/modules/class-callables.php' => ['PhanParamSignatureMismatch', 'PhanTypeArraySuspicious', 'PhanTypeMismatchArgument', 'PhanTypeMismatchReturnProbablyReal'], 'src/modules/class-comments.php' => ['PhanParamSignatureMismatch', 'PhanTypeMismatchReturn', 'PhanTypeMismatchReturnProbablyReal'], 'src/modules/class-constants.php' => ['PhanParamSignatureMismatch', 'PhanTypeMismatchReturnProbablyReal', 'PhanUndeclaredProperty'], 'src/modules/class-full-sync-immediately.php' => ['PhanPluginSimplifyExpressionBool', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchReturn'], 'src/modules/class-full-sync.php' => ['PhanPluginDuplicateConditionalNullCoalescing', 'PhanPluginSimplifyExpressionBool', 'PhanPossiblyUndeclaredVariable', 'PhanTypeComparisonFromArray'], 'src/modules/class-import.php' => ['PhanTypeMismatchArgumentInternal'], - 'src/modules/class-meta.php' => ['PhanParamSignatureMismatch'], 'src/modules/class-module.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchReturnProbablyReal'], 'src/modules/class-network-options.php' => ['PhanParamSignatureMismatch', 'PhanTypeMismatchReturnProbablyReal'], 'src/modules/class-options.php' => ['PhanParamSignatureMismatch', 'PhanTypeMismatchReturnProbablyReal'], diff --git a/projects/packages/videopress/.phan/baseline.php b/projects/packages/videopress/.phan/baseline.php index b0b96b05ab734..4293758e30be3 100644 --- a/projects/packages/videopress/.phan/baseline.php +++ b/projects/packages/videopress/.phan/baseline.php @@ -21,7 +21,6 @@ // PhanTypeArraySuspiciousNullable : 4 occurrences // PhanTypeMismatchArgument : 4 occurrences // PhanNoopNew : 3 occurrences - // PhanParamTooMany : 3 occurrences // PhanPossiblyUndeclaredVariable : 2 occurrences // PhanTypeInvalidDimOffset : 2 occurrences // PhanUndeclaredExtendedClass : 2 occurrences @@ -48,14 +47,12 @@ 'src/class-jwt-token-bridge.php' => ['PhanTypeMismatchReturn'], 'src/class-plan.php' => ['PhanTypeMismatchReturnProbablyReal'], 'src/class-stats.php' => ['PhanTypeArraySuspiciousNullable'], - 'src/class-uploader-rest-endpoints.php' => ['PhanParamTooMany'], 'src/class-uploader.php' => ['PhanTypeMismatchArgument'], 'src/class-utils.php' => ['PhanTypeMismatchReturnProbablyReal'], 'src/class-videopresstoken.php' => ['PhanTypeMismatchReturn'], 'src/class-wpcom-rest-api-v2-attachment-field-videopress.php' => ['PhanTypeMismatchReturn', 'PhanTypeMismatchReturnProbablyReal'], 'src/class-wpcom-rest-api-v2-endpoint-videopress.php' => ['PhanAccessMethodInternal', 'PhanTypeInvalidDimOffset', 'PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentProbablyReal'], 'src/class-xmlrpc.php' => ['PhanPluginDuplicateConditionalNullCoalescing'], - 'src/tus/class-transient-store.php' => ['PhanParamTooMany'], 'src/tus/class-tus-abstract-cache.php' => ['PhanTypeMismatchArgumentInternal'], 'src/tus/class-tus-client.php' => ['PhanNonClassMethodCall', 'PhanTypeMismatchArgument'], 'src/tus/class-tus-file.php' => ['PhanPluginSimplifyExpressionBool', 'PhanTypeArraySuspiciousNullable', 'PhanUndeclaredClassMethod', 'PhanUndeclaredTypeThrowsType'], diff --git a/projects/packages/waf/.phan/baseline.php b/projects/packages/waf/.phan/baseline.php index 327b501c60128..037a4896531b9 100644 --- a/projects/packages/waf/.phan/baseline.php +++ b/projects/packages/waf/.phan/baseline.php @@ -18,7 +18,6 @@ // PhanRedefineFunction : 4 occurrences // PhanTypeMismatchArgumentInternal : 4 occurrences // PhanTypeMismatchArgumentProbablyReal : 4 occurrences - // PhanParamTooMany : 2 occurrences // PhanPluginRedundantAssignment : 2 occurrences // PhanStaticCallToNonStatic : 2 occurrences // PhanTypeArraySuspiciousNullable : 2 occurrences @@ -45,7 +44,6 @@ 'src/class-waf-rules-manager.php' => ['PhanTypeMismatchArgument'], 'src/class-waf-runtime.php' => ['PhanPluginDuplicateConditionalNullCoalescing', 'PhanTypeArraySuspiciousNullable'], 'src/class-waf-transforms.php' => ['PhanPluginInvalidPregRegex', 'PhanTypeInvalidDimOffset'], - 'tests/php/integration/test-waf-compatibility.php' => ['PhanParamTooMany'], 'tests/php/unit/functions-wordpress.php' => ['PhanRedefineFunction'], 'tests/php/unit/test-waf-operators.php' => ['PhanTypeMismatchArgumentInternal'], 'tests/php/unit/test-waf-runtime-targets.php' => ['PhanPluginRedundantAssignment'], diff --git a/projects/plugins/boost/.phan/baseline.php b/projects/plugins/boost/.phan/baseline.php index c009f71b48236..1f84a5f5191f2 100644 --- a/projects/plugins/boost/.phan/baseline.php +++ b/projects/plugins/boost/.phan/baseline.php @@ -13,7 +13,6 @@ // PhanPluginDuplicateConditionalNullCoalescing : 10+ occurrences // PhanTypeArraySuspicious : 9 occurrences // PhanTypeMismatchArgument : 8 occurrences - // PhanParamTooMany : 6 occurrences // PhanPossiblyUndeclaredVariable : 5 occurrences // PhanTypeMismatchReturnProbablyReal : 5 occurrences // PhanUndeclaredConstant : 5 occurrences @@ -30,6 +29,7 @@ // PhanTypeMismatchReturnNullable : 2 occurrences // PhanCoalescingNeverNull : 1 occurrence // PhanImpossibleTypeComparisonInGlobalScope : 1 occurrence + // PhanParamTooMany : 1 occurrence // PhanRedefineFunction : 1 occurrence // PhanRedundantCondition : 1 occurrence // PhanTypeInvalidUnaryOperandIncOrDec : 1 occurrence @@ -65,9 +65,7 @@ 'app/modules/optimizations/page-cache/pre-wordpress/Request.php' => ['PhanPluginDuplicateConditionalNullCoalescing', 'PhanTypeMismatchPropertyDefault'], 'app/modules/optimizations/page-cache/pre-wordpress/storage/File_Storage.php' => ['PhanTypeMismatchArgument'], 'app/modules/optimizations/render-blocking-js/class-render-blocking-js.php' => ['PhanTypeMismatchProperty', 'PhanTypeMismatchPropertyDefault'], - 'app/rest-api/permissions/Nonce.php' => ['PhanParamTooMany'], 'compatibility/elementor.php' => ['PhanUndeclaredClassConstant'], - 'compatibility/lib/class-sync-jetpack-module-status.php' => ['PhanParamTooMany'], 'compatibility/page-optimize.php' => ['PhanUndeclaredFunction', 'PhanUndeclaredFunctionInCallable'], 'compatibility/score-prompt.php' => ['PhanImpossibleTypeComparisonInGlobalScope', 'PhanTypeComparisonToArray'], 'compatibility/web-stories.php' => ['PhanUndeclaredClassConstant'], diff --git a/projects/plugins/crm/.phan/baseline.php b/projects/plugins/crm/.phan/baseline.php index 514e9af179200..7c8415e0e6466 100644 --- a/projects/plugins/crm/.phan/baseline.php +++ b/projects/plugins/crm/.phan/baseline.php @@ -65,7 +65,6 @@ // PhanUndeclaredGlobalVariable : 15+ occurrences // PhanUndeclaredProperty : 15+ occurrences // PhanUndeclaredTypeProperty : 15+ occurrences - // PhanParamTooMany : 10+ occurrences // PhanPluginDuplicateIfCondition : 10+ occurrences // PhanTypeMismatchDimFetchNullable : 10+ occurrences // PhanTypeMismatchPropertyDefault : 10+ occurrences @@ -103,6 +102,7 @@ // PhanUnextractableAnnotation : 2 occurrences // PhanImpossibleTypeComparisonInLoop : 1 occurrence // PhanNoopVariable : 1 occurrence + // PhanParamTooMany : 1 occurrence // PhanPluginDuplicateArrayKey : 1 occurrence // PhanPluginDuplicateCatchStatementBody : 1 occurrence // PhanPluginUseReturnValueInternalKnown : 1 occurrence @@ -139,7 +139,6 @@ 'admin/export/main.page.php' => ['PhanTypeMismatchArgument'], 'admin/settings/business-info.page.php' => ['PhanRedundantConditionInGlobalScope'], 'admin/settings/client-portal.page.php' => ['PhanRedundantConditionInGlobalScope', 'PhanUndeclaredVariableDim'], - 'admin/settings/companies.page.php' => ['PhanParamTooMany'], 'admin/settings/custom-fields.page.php' => ['PhanPluginDuplicateConditionalNullCoalescing', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanRedundantConditionInGlobalScope', 'PhanTypeMismatchDimFetch'], 'admin/settings/field-options.page.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanRedundantConditionInGlobalScope', 'PhanTypeInvalidDimOffset'], 'admin/settings/field-sorts.page.php' => ['PhanPluginDuplicateConditionalNullCoalescing', 'PhanRedundantConditionInGlobalScope', 'PhanTypeArraySuspiciousNullable'], @@ -170,7 +169,7 @@ 'api/create_transaction.php' => ['PhanImpossibleTypeComparisonInGlobalScope', 'PhanPossiblyUndeclaredGlobalVariable'], 'api/customers.php' => ['PhanPluginSimplifyExpressionBool'], 'api/status.php' => ['PhanTypePossiblyInvalidDimOffset'], - 'includes/ZeroBSCRM.AJAX.php' => ['PhanDeprecatedFunction', 'PhanImpossibleCondition', 'PhanParamTooMany', 'PhanPluginDuplicateAdjacentStatement', 'PhanPluginDuplicateExpressionAssignment', 'PhanPluginNeverReturnFunction', 'PhanPluginRedundantAssignment', 'PhanPluginSimplifyExpressionBool', 'PhanPluginUnreachableCode', 'PhanPossiblyUndeclaredVariable', 'PhanRedundantCondition', 'PhanTypeArraySuspicious', 'PhanTypeArraySuspiciousNullable', 'PhanTypeInvalidDimOffset', 'PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentInternal', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMismatchDimFetch', 'PhanTypePossiblyInvalidDimOffset', 'PhanTypeVoidAssignment', 'PhanUndeclaredConstant', 'PhanUndeclaredVariableDim'], + 'includes/ZeroBSCRM.AJAX.php' => ['PhanDeprecatedFunction', 'PhanImpossibleCondition', 'PhanPluginDuplicateAdjacentStatement', 'PhanPluginDuplicateExpressionAssignment', 'PhanPluginNeverReturnFunction', 'PhanPluginRedundantAssignment', 'PhanPluginSimplifyExpressionBool', 'PhanPluginUnreachableCode', 'PhanPossiblyUndeclaredVariable', 'PhanRedundantCondition', 'PhanTypeArraySuspicious', 'PhanTypeArraySuspiciousNullable', 'PhanTypeInvalidDimOffset', 'PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentInternal', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMismatchDimFetch', 'PhanTypePossiblyInvalidDimOffset', 'PhanTypeVoidAssignment', 'PhanUndeclaredConstant', 'PhanUndeclaredVariableDim'], 'includes/ZeroBSCRM.API.php' => ['PhanCommentParamWithoutRealParam', 'PhanRedefineFunctionInternal', 'PhanRedundantCondition', 'PhanTypeArraySuspicious', 'PhanTypeMismatchArgumentInternal'], 'includes/ZeroBSCRM.AdminPages.Checks.php' => ['PhanPluginUnreachableCode'], 'includes/ZeroBSCRM.AdminPages.php' => ['PhanDeprecatedFunction', 'PhanImpossibleCondition', 'PhanPluginDuplicateAdjacentStatement', 'PhanPluginRedundantAssignment', 'PhanPossiblyUndeclaredVariable', 'PhanTypeExpectedObjectPropAccess', 'PhanTypeMismatchArgument', 'PhanTypeSuspiciousEcho', 'PhanUndeclaredVariableDim'], @@ -189,7 +188,7 @@ 'includes/ZeroBSCRM.DAL3.Helpers.php' => ['PhanDeprecatedFunction', 'PhanImpossibleCondition', 'PhanImpossibleTypeComparison', 'PhanPluginDuplicateConditionalNullCoalescing', 'PhanPluginRedundantAssignment', 'PhanPluginUnreachableCode', 'PhanPossiblyUndeclaredVariable', 'PhanRedundantCondition', 'PhanTypeArraySuspiciousNullable', 'PhanTypeConversionFromArray', 'PhanTypeExpectedObjectPropAccess', 'PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentNullable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchDefault', 'PhanTypeMismatchReturn', 'PhanTypeMismatchReturnProbablyReal', 'PhanTypePossiblyInvalidDimOffset', 'PhanTypeSuspiciousStringExpression', 'PhanUndeclaredVariable', 'PhanUnextractableAnnotationElementName'], 'includes/ZeroBSCRM.DAL3.Obj.Addresses.php' => ['PhanEmptyForeach'], 'includes/ZeroBSCRM.DAL3.Obj.Companies.php' => ['PhanCommentParamWithoutRealParam', 'PhanEmptyForeach', 'PhanImpossibleCondition', 'PhanImpossibleTypeComparison', 'PhanNoopBinaryOperator', 'PhanPluginDuplicateConditionalNullCoalescing', 'PhanPluginDuplicateExpressionAssignmentOperation', 'PhanPluginDuplicateIfCondition', 'PhanPluginRedundantAssignment', 'PhanPluginUnreachableCode', 'PhanPossiblyUndeclaredVariable', 'PhanRedundantCondition', 'PhanSuspiciousValueComparison', 'PhanSuspiciousWeakTypeComparison', 'PhanTypeArraySuspicious', 'PhanTypeArraySuspiciousNull', 'PhanTypeArraySuspiciousNullable', 'PhanTypeComparisonFromArray', 'PhanTypeExpectedObjectPropAccess', 'PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentInternalReal', 'PhanTypeMismatchArgumentNullable', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchDefault', 'PhanTypeMismatchDimAssignment', 'PhanTypeMismatchDimFetchNullable', 'PhanTypeMismatchForeach', 'PhanTypeMismatchReturn', 'PhanTypeMismatchReturnNullable', 'PhanTypeMismatchReturnProbablyReal', 'PhanTypePossiblyInvalidDimOffset', 'PhanUndeclaredFunction', 'PhanUndeclaredTypeReturnType', 'PhanUndeclaredVariable', 'PhanUndeclaredVariableDim', 'PhanUnextractableAnnotationElementName'], - 'includes/ZeroBSCRM.DAL3.Obj.Contacts.php' => ['PhanCommentParamWithoutRealParam', 'PhanEmptyForeach', 'PhanImpossibleCondition', 'PhanImpossibleTypeComparison', 'PhanNoopBinaryOperator', 'PhanParamTooMany', 'PhanPluginDuplicateConditionalNullCoalescing', 'PhanPluginDuplicateExpressionAssignmentOperation', 'PhanPluginDuplicateIfCondition', 'PhanPluginRedundantAssignment', 'PhanPluginUnreachableCode', 'PhanPossiblyUndeclaredVariable', 'PhanRedundantCondition', 'PhanSuspiciousValueComparison', 'PhanSuspiciousWeakTypeComparison', 'PhanTypeArraySuspicious', 'PhanTypeArraySuspiciousNull', 'PhanTypeArraySuspiciousNullable', 'PhanTypeComparisonFromArray', 'PhanTypeExpectedObjectPropAccess', 'PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentInternal', 'PhanTypeMismatchArgumentInternalReal', 'PhanTypeMismatchArgumentNullable', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchArgumentReal', 'PhanTypeMismatchDefault', 'PhanTypeMismatchDimFetchNullable', 'PhanTypeMismatchForeach', 'PhanTypeMismatchReturn', 'PhanTypeMismatchReturnNullable', 'PhanTypeMismatchReturnProbablyReal', 'PhanTypePossiblyInvalidDimOffset', 'PhanTypeSuspiciousStringExpression', 'PhanUndeclaredTypeParameter', 'PhanUndeclaredTypeReturnType', 'PhanUndeclaredVariable', 'PhanUndeclaredVariableDim', 'PhanUnextractableAnnotationElementName'], + 'includes/ZeroBSCRM.DAL3.Obj.Contacts.php' => ['PhanCommentParamWithoutRealParam', 'PhanEmptyForeach', 'PhanImpossibleCondition', 'PhanImpossibleTypeComparison', 'PhanNoopBinaryOperator', 'PhanPluginDuplicateConditionalNullCoalescing', 'PhanPluginDuplicateExpressionAssignmentOperation', 'PhanPluginDuplicateIfCondition', 'PhanPluginRedundantAssignment', 'PhanPluginUnreachableCode', 'PhanPossiblyUndeclaredVariable', 'PhanRedundantCondition', 'PhanSuspiciousValueComparison', 'PhanSuspiciousWeakTypeComparison', 'PhanTypeArraySuspicious', 'PhanTypeArraySuspiciousNull', 'PhanTypeArraySuspiciousNullable', 'PhanTypeComparisonFromArray', 'PhanTypeExpectedObjectPropAccess', 'PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentInternal', 'PhanTypeMismatchArgumentInternalReal', 'PhanTypeMismatchArgumentNullable', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchArgumentReal', 'PhanTypeMismatchDefault', 'PhanTypeMismatchDimFetchNullable', 'PhanTypeMismatchForeach', 'PhanTypeMismatchReturn', 'PhanTypeMismatchReturnNullable', 'PhanTypeMismatchReturnProbablyReal', 'PhanTypePossiblyInvalidDimOffset', 'PhanTypeSuspiciousStringExpression', 'PhanUndeclaredTypeParameter', 'PhanUndeclaredTypeReturnType', 'PhanUndeclaredVariable', 'PhanUndeclaredVariableDim', 'PhanUnextractableAnnotationElementName'], 'includes/ZeroBSCRM.DAL3.Obj.EventReminders.php' => ['PhanEmptyForeach', 'PhanImpossibleCondition', 'PhanImpossibleTypeComparison', 'PhanPluginDuplicateExpressionAssignmentOperation', 'PhanPluginRedundantAssignment', 'PhanPluginUnreachableCode', 'PhanPossiblyUndeclaredVariable', 'PhanRedundantCondition', 'PhanSuspiciousValueComparison', 'PhanSuspiciousWeakTypeComparison', 'PhanTypeArraySuspiciousNullable', 'PhanTypeComparisonFromArray', 'PhanTypeExpectedObjectPropAccess', 'PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentInternal', 'PhanTypeMismatchArgumentInternalReal', 'PhanTypeMismatchArgumentNullable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchDefault', 'PhanTypeMismatchReturn', 'PhanTypeMismatchReturnNullable', 'PhanTypeMismatchReturnProbablyReal', 'PhanUndeclaredVariable', 'PhanUnextractableAnnotationElementName'], 'includes/ZeroBSCRM.DAL3.Obj.Events.php' => ['PhanCommentParamWithoutRealParam', 'PhanEmptyForeach', 'PhanImpossibleCondition', 'PhanImpossibleTypeComparison', 'PhanNoopBinaryOperator', 'PhanPluginDuplicateConditionalNullCoalescing', 'PhanPluginDuplicateExpressionAssignmentOperation', 'PhanPluginRedundantAssignment', 'PhanPluginUnreachableCode', 'PhanPossiblyUndeclaredVariable', 'PhanRedundantCondition', 'PhanSuspiciousValueComparison', 'PhanSuspiciousWeakTypeComparison', 'PhanTypeArraySuspiciousNull', 'PhanTypeArraySuspiciousNullable', 'PhanTypeComparisonFromArray', 'PhanTypeExpectedObjectPropAccess', 'PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentInternalReal', 'PhanTypeMismatchArgumentNullable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchDefault', 'PhanTypeMismatchForeach', 'PhanTypeMismatchReturn', 'PhanTypeMismatchReturnNullable', 'PhanTypeMismatchReturnProbablyReal', 'PhanTypePossiblyInvalidDimOffset', 'PhanUndeclaredVariable', 'PhanUndeclaredVariableDim', 'PhanUnextractableAnnotationElementName'], 'includes/ZeroBSCRM.DAL3.Obj.Forms.php' => ['PhanCommentParamWithoutRealParam', 'PhanEmptyForeach', 'PhanImpossibleCondition', 'PhanImpossibleTypeComparison', 'PhanNoopBinaryOperator', 'PhanPluginDuplicateExpressionAssignmentOperation', 'PhanPluginRedundantAssignment', 'PhanPluginUnreachableCode', 'PhanPossiblyUndeclaredVariable', 'PhanRedundantCondition', 'PhanSuspiciousValueComparison', 'PhanSuspiciousWeakTypeComparison', 'PhanTypeArraySuspiciousNull', 'PhanTypeArraySuspiciousNullable', 'PhanTypeComparisonFromArray', 'PhanTypeExpectedObjectPropAccess', 'PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentInternal', 'PhanTypeMismatchArgumentInternalReal', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchDefault', 'PhanTypeMismatchDimAssignment', 'PhanTypeMismatchDimFetchNullable', 'PhanTypeMismatchForeach', 'PhanTypeMismatchReturn', 'PhanTypeMismatchReturnNullable', 'PhanTypeMismatchReturnProbablyReal', 'PhanUndeclaredVariable', 'PhanUndeclaredVariableDim', 'PhanUnextractableAnnotationElementName'], @@ -211,7 +210,7 @@ 'includes/ZeroBSCRM.FileUploads.php' => ['PhanTypeComparisonFromArray', 'PhanTypeMismatchDimFetch'], 'includes/ZeroBSCRM.FormatHelpers.php' => ['PhanImpossibleCondition', 'PhanNoopVariable', 'PhanPluginRedundantAssignment', 'PhanPluginUnreachableCode', 'PhanPossiblyUndeclaredVariable', 'PhanRedundantCondition', 'PhanTypeArraySuspiciousNullable', 'PhanTypeInvalidLeftOperandOfAdd', 'PhanTypeMismatchArgument', 'PhanTypeMismatchDefault', 'PhanTypeMismatchReturnProbablyReal', 'PhanTypeSuspiciousStringExpression', 'PhanUndeclaredTypeParameter', 'PhanUndeclaredTypeReturnType'], 'includes/ZeroBSCRM.Forms.php' => ['PhanPluginSimplifyExpressionBool', 'PhanTypeMissingReturn', 'PhanTypeNonVarPassByRef', 'PhanTypeSuspiciousEcho', 'PhanTypeSuspiciousStringExpression', 'PhanUndeclaredVariable'], - 'includes/ZeroBSCRM.GeneralFuncs.php' => ['PhanCommentParamWithoutRealParam', 'PhanImpossibleCondition', 'PhanImpossibleTypeComparison', 'PhanMisspelledAnnotation', 'PhanParamTooMany', 'PhanParamTooManyInternal', 'PhanPluginNeverReturnFunction', 'PhanPluginSimplifyExpressionBool', 'PhanPluginUnreachableCode', 'PhanRedundantCondition', 'PhanSuspiciousValueComparison', 'PhanTypeInvalidLeftOperandOfNumericOp', 'PhanTypeMismatchArgumentInternal', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMismatchDimFetch', 'PhanUndeclaredConstant', 'PhanUndeclaredFunction', 'PhanUndeclaredVariableDim'], + 'includes/ZeroBSCRM.GeneralFuncs.php' => ['PhanCommentParamWithoutRealParam', 'PhanImpossibleCondition', 'PhanImpossibleTypeComparison', 'PhanMisspelledAnnotation', 'PhanParamTooManyInternal', 'PhanPluginNeverReturnFunction', 'PhanPluginSimplifyExpressionBool', 'PhanPluginUnreachableCode', 'PhanRedundantCondition', 'PhanSuspiciousValueComparison', 'PhanTypeInvalidLeftOperandOfNumericOp', 'PhanTypeMismatchArgumentInternal', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMismatchDimFetch', 'PhanUndeclaredConstant', 'PhanUndeclaredFunction', 'PhanUndeclaredVariableDim'], 'includes/ZeroBSCRM.IntegrationFuncs.php' => ['PhanPluginRedundantAssignment', 'PhanPluginUnreachableCode', 'PhanRedundantCondition'], 'includes/ZeroBSCRM.InternalAutomatorRecipes.php' => ['PhanPluginRedundantAssignment', 'PhanRedundantCondition', 'PhanSuspiciousValueComparison', 'PhanTypeMismatchDefault', 'PhanTypePossiblyInvalidDimOffset', 'PhanUndeclaredTypeParameter'], 'includes/ZeroBSCRM.InvoiceBuilder.php' => ['PhanPluginDuplicateAdjacentStatement', 'PhanPluginDuplicateExpressionAssignmentOperation', 'PhanPluginDuplicateExpressionBinaryOp', 'PhanPluginRedundantAssignment', 'PhanPossiblyUndeclaredVariable', 'PhanTypeExpectedObjectPropAccess', 'PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentInternal', 'PhanTypeMismatchArgumentNullable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchReturn', 'PhanTypeMismatchReturnProbablyReal', 'PhanTypePossiblyInvalidDimOffset', 'PhanTypeSuspiciousStringExpression', 'PhanUndeclaredTypeReturnType', 'PhanUndeclaredVariable'], @@ -232,7 +231,7 @@ 'includes/ZeroBSCRM.MetaBoxes3.QuoteTemplates.php' => ['PhanUndeclaredFunctionInCallable'], 'includes/ZeroBSCRM.MetaBoxes3.Quotes.php' => ['PhanImpossibleCondition', 'PhanRedundantCondition', 'PhanTypeMismatchArgument', 'PhanUndeclaredFunctionInCallable'], 'includes/ZeroBSCRM.MetaBoxes3.Tags.php' => ['PhanDeprecatedFunction', 'PhanNoopBinaryOperator', 'PhanTypeSuspiciousStringExpression'], - 'includes/ZeroBSCRM.MetaBoxes3.Tasks.php' => ['PhanParamTooMany', 'PhanRedundantCondition', 'PhanTypeMismatchArgument', 'PhanTypeMismatchDefault', 'PhanTypeVoidAssignment', 'PhanUndeclaredTypeParameter'], + 'includes/ZeroBSCRM.MetaBoxes3.Tasks.php' => ['PhanRedundantCondition', 'PhanTypeMismatchArgument', 'PhanTypeMismatchDefault', 'PhanTypeVoidAssignment', 'PhanUndeclaredTypeParameter'], 'includes/ZeroBSCRM.MetaBoxes3.Transactions.php' => ['PhanImpossibleCondition', 'PhanPluginDuplicateConditionalNullCoalescing', 'PhanTypeArraySuspiciousNullable', 'PhanTypeMismatchArgument'], 'includes/ZeroBSCRM.Migrations.php' => ['PhanPluginRedundantAssignment'], 'includes/ZeroBSCRM.NotifyMe.php' => ['PhanNoopBinaryOperator', 'PhanPluginDuplicateAdjacentStatement', 'PhanPluginNeverReturnFunction', 'PhanTypeMismatchArgumentInternal', 'PhanTypeSuspiciousStringExpression', 'PhanUndeclaredVariableDim'], @@ -287,7 +286,7 @@ 'modules/woo-sync/includes/class-woo-sync-background-sync.php' => ['PhanUndeclaredTypeParameter', 'PhanUnextractableAnnotationElementName'], 'modules/woo-sync/includes/class-woo-sync-my-account-integration.php' => ['PhanPluginDuplicateConditionalNullCoalescing', 'PhanRedundantCondition', 'PhanTypeArraySuspicious', 'PhanTypeMismatchArgument', 'PhanTypePossiblyInvalidDimOffset'], 'modules/woo-sync/includes/class-woo-sync-woo-admin-integration.php' => ['PhanUndeclaredClassMethod', 'PhanUndeclaredClassProperty', 'PhanUndeclaredTypeParameter'], - 'modules/woo-sync/includes/class-woo-sync.php' => ['PhanImpossibleTypeComparison', 'PhanParamTooFew', 'PhanParamTooMany', 'PhanPluginDuplicateConditionalNullCoalescing', 'PhanPluginDuplicateExpressionAssignmentOperation', 'PhanPluginNeverReturnMethod', 'PhanPluginUnreachableCode', 'PhanPossiblyUndeclaredVariable', 'PhanRedundantCondition', 'PhanTypeArraySuspicious', 'PhanTypeArraySuspiciousNullable', 'PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentInternal', 'PhanTypeMismatchPropertyDefault', 'PhanTypeMismatchReturn', 'PhanUndeclaredClassMethod', 'PhanUndeclaredFunctionInCallable', 'PhanUndeclaredTypeParameter', 'PhanUndeclaredTypeReturnType', 'PhanUndeclaredVariable', 'PhanUnextractableAnnotationElementName', 'PhanUnextractableAnnotationSuffix'], + 'modules/woo-sync/includes/class-woo-sync.php' => ['PhanImpossibleTypeComparison', 'PhanParamTooFew', 'PhanPluginDuplicateConditionalNullCoalescing', 'PhanPluginDuplicateExpressionAssignmentOperation', 'PhanPluginNeverReturnMethod', 'PhanPluginUnreachableCode', 'PhanPossiblyUndeclaredVariable', 'PhanRedundantCondition', 'PhanTypeArraySuspicious', 'PhanTypeArraySuspiciousNullable', 'PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentInternal', 'PhanTypeMismatchPropertyDefault', 'PhanTypeMismatchReturn', 'PhanUndeclaredClassMethod', 'PhanUndeclaredFunctionInCallable', 'PhanUndeclaredTypeParameter', 'PhanUndeclaredTypeReturnType', 'PhanUndeclaredVariable', 'PhanUnextractableAnnotationElementName', 'PhanUnextractableAnnotationSuffix'], 'modules/woo-sync/includes/jpcrm-woo-sync-contact-tabs.php' => ['PhanUndeclaredFunction', 'PhanUndeclaredMethod'], 'modules/woo-sync/includes/segment-conditions/class-segment-condition-woo-customer.php' => ['PhanTypeArraySuspiciousNullable'], 'modules/woo-sync/includes/segment-conditions/class-segment-condition-woo-order-count.php' => ['PhanTypeArraySuspiciousNullable'], @@ -332,7 +331,7 @@ 'tests/codeception/_support/Module/WordPress.php' => ['PhanIncompatibleRealPropertyType', 'PhanParamSignatureMismatch', 'PhanTypeMismatchDeclaredParamNullable', 'PhanUndeclaredClassInstanceof', 'PhanUndeclaredClassMethod', 'PhanUndeclaredFunction', 'PhanUndeclaredMethod', 'PhanUndeclaredTypeParameter', 'PhanUndeclaredTypeProperty', 'PhanUndeclaredTypeReturnType'], 'tests/codeception/_support/UnitTester.php' => ['PhanParamSignatureMismatch', 'PhanParamSignaturePHPDocMismatchReturnType', 'PhanParamSignaturePHPDocMismatchTooFewParameters', 'PhanUndeclaredTrait'], 'tests/php/automation/class-automation-engine-test.php' => ['PhanPluginDuplicateAdjacentStatement', 'PhanRedundantCondition'], - 'tests/php/automation/class-automation-workflow-test.php' => ['PhanParamTooMany', 'PhanUnreferencedUseNormal'], + 'tests/php/automation/class-automation-workflow-test.php' => ['PhanUnreferencedUseNormal'], 'tests/php/automation/companies/class-company-trigger-test.php' => ['PhanUnreferencedUseNormal'], 'tests/php/automation/contacts/actions/class-delete-contact-test.php' => ['PhanUnreferencedUseNormal'], 'tests/php/automation/contacts/class-contact-condition-test.php' => ['PhanUnreferencedUseNormal'], @@ -350,7 +349,7 @@ 'tests/php/automation/transactions/class-transaction-trigger-test.php' => ['PhanUnreferencedUseNormal'], 'tests/php/bootstrap.php' => ['PhanUndeclaredConstant'], 'tests/php/event-manager/class-event-manager-faker.php' => ['PhanUndeclaredTypeReturnType'], - 'tests/php/event-manager/class-event-manager-test.php' => ['PhanCommentVarInsteadOfParam', 'PhanParamTooMany'], + 'tests/php/event-manager/class-event-manager-test.php' => ['PhanCommentVarInsteadOfParam'], 'tests/php/rest-api/v4/class-rest-authentication-test.php' => ['PhanTypeMismatchReturn'], 'tests/php/rest-api/v4/class-rest-contacts-controller-test.php' => ['PhanPluginNeverReturnFunction'], ], diff --git a/projects/plugins/debug-helper/.phan/baseline.php b/projects/plugins/debug-helper/.phan/baseline.php index 0435052416793..b7c093aa21e3b 100644 --- a/projects/plugins/debug-helper/.phan/baseline.php +++ b/projects/plugins/debug-helper/.phan/baseline.php @@ -13,9 +13,9 @@ // PhanNoopNew : 15+ occurrences // PhanPluginSimplifyExpressionBool : 9 occurrences // PhanPluginDuplicateConditionalNullCoalescing : 4 occurrences - // PhanUndeclaredClassConstant : 4 occurrences // PhanUndeclaredClassStaticProperty : 4 occurrences // PhanTypeMismatchArgument : 3 occurrences + // PhanUndeclaredClassConstant : 3 occurrences // PhanUndeclaredConstantOfClass : 3 occurrences // PhanUndeclaredMethod : 3 occurrences // PhanTypeMismatchReturnProbablyReal : 2 occurrences @@ -23,7 +23,6 @@ // PhanUndeclaredProperty : 2 occurrences // PhanEmptyForeach : 1 occurrence // PhanNonClassMethodCall : 1 occurrence - // PhanParamTooMany : 1 occurrence // PhanSuspiciousValueComparison : 1 occurrence // PhanTypeConversionFromArray : 1 occurrence // PhanTypePossiblyInvalidDimOffset : 1 occurrence @@ -43,7 +42,7 @@ 'modules/class-modules-helper.php' => ['PhanNoopNew', 'PhanUndeclaredClassMethod'], 'modules/class-protect-helper.php' => ['PhanNoopNew', 'PhanPluginSimplifyExpressionBool', 'PhanUndeclaredClassMethod', 'PhanUndeclaredClassStaticProperty', 'PhanUndeclaredProperty'], 'modules/class-rest-api-tester.php' => ['PhanNoopNew'], - 'modules/class-scan-helper.php' => ['PhanNoopNew', 'PhanParamTooMany', 'PhanSuspiciousValueComparison', 'PhanTypeConversionFromArray', 'PhanTypeMismatchReturnProbablyReal'], + 'modules/class-scan-helper.php' => ['PhanNoopNew', 'PhanSuspiciousValueComparison', 'PhanTypeConversionFromArray', 'PhanTypeMismatchReturnProbablyReal'], 'modules/class-sync-data-settings-tester.php' => ['PhanNoopNew', 'PhanTypePossiblyInvalidDimOffset', 'PhanUndeclaredClass'], 'modules/class-waf-helper.php' => ['PhanNoopNew', 'PhanPluginSimplifyExpressionBool', 'PhanTypeMismatchReturnProbablyReal', 'PhanUndeclaredClassConstant', 'PhanUndeclaredClassMethod'], 'modules/class-wpcom-api-request-tracker-module.php' => ['PhanNoopNew', 'PhanTypeMismatchArgument'], diff --git a/projects/plugins/inspect/.phan/baseline.php b/projects/plugins/inspect/.phan/baseline.php index 7e751d129c29e..83e0a80e72b1f 100644 --- a/projects/plugins/inspect/.phan/baseline.php +++ b/projects/plugins/inspect/.phan/baseline.php @@ -9,7 +9,6 @@ */ return [ // # Issue statistics: - // PhanParamTooMany : 3 occurrences // PhanTypeMismatchArgumentInternal : 2 occurrences // PhanAccessMethodInternal : 1 occurrence // PhanTypeMismatchReturn : 1 occurrence @@ -21,10 +20,7 @@ 'app/Options/Monitor_Status.php' => ['PhanTypeMismatchReturn'], 'app/Options/Observer_Settings.php' => ['PhanTypeMismatchArgumentInternal'], 'app/REST_API/Endpoints/Send_Request.php' => ['PhanTypeMismatchArgumentInternal'], - 'app/REST_API/Permissions/Nonce.php' => ['PhanParamTooMany'], 'functions.php' => ['PhanAccessMethodInternal'], - 'packages/Async_Option/Async_Option.php' => ['PhanParamTooMany'], - 'packages/Async_Option/Endpoint.php' => ['PhanParamTooMany'], ], // 'directory_suppressions' => ['src/directory_name' => ['PhanIssueName1', 'PhanIssueName2']] can be manually added if needed. // (directory_suppressions will currently be ignored by subsequent calls to --save-baseline, but may be preserved in future Phan releases) diff --git a/projects/plugins/jetpack/.phan/baseline.php b/projects/plugins/jetpack/.phan/baseline.php index a079c84fdd775..728f09a4fcf41 100644 --- a/projects/plugins/jetpack/.phan/baseline.php +++ b/projects/plugins/jetpack/.phan/baseline.php @@ -19,10 +19,9 @@ // PhanRedundantCondition : 70+ occurrences // PhanDeprecatedFunction : 65+ occurrences // PhanPossiblyUndeclaredVariable : 60+ occurrences + // PhanTypeArraySuspiciousNullable : 55+ occurrences // PhanRedefineFunction : 50+ occurrences - // PhanTypeArraySuspiciousNullable : 50+ occurrences // PhanTypeMismatchArgumentNullable : 50+ occurrences - // PhanParamTooMany : 40+ occurrences // PhanPluginDuplicateAdjacentStatement : 40+ occurrences // PhanTypeMismatchArgumentInternal : 40+ occurrences // PhanTypeExpectedObjectPropAccess : 35+ occurrences @@ -74,6 +73,7 @@ // PhanTypeObjectUnsetDeclaredProperty : 3 occurrences // PhanUndeclaredMethodInCallable : 3 occurrences // PhanImpossibleConditionInLoop : 2 occurrences + // PhanParamTooMany : 2 occurrences // PhanParamTooManyCallable : 2 occurrences // PhanPluginDuplicateSwitchCaseLooseEquality : 2 occurrences // PhanStaticCallToNonStatic : 2 occurrences @@ -96,16 +96,15 @@ '3rd-party/bbpress.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredFunction'], '3rd-party/class-domain-mapping.php' => ['PhanUndeclaredClassInCallable', 'PhanUndeclaredClassMethod', 'PhanUndeclaredFunctionInCallable', 'PhanUndeclaredTypeReturnType'], '3rd-party/class-jetpack-bbpress-rest-api.php' => ['PhanUndeclaredFunction'], - '3rd-party/class.jetpack-amp-support.php' => ['PhanDeprecatedFunction', 'PhanParamTooMany'], + '3rd-party/class.jetpack-amp-support.php' => ['PhanDeprecatedFunction'], '3rd-party/debug-bar/class-jetpack-search-debug-bar.php' => ['PhanUndeclaredExtendedClass', 'PhanUndeclaredMethod'], '3rd-party/qtranslate-x.php' => ['PhanTypeMismatchReturn'], - '3rd-party/woocommerce.php' => ['PhanParamTooMany'], '3rd-party/wpml.php' => ['PhanUndeclaredFunction'], '_inc/blogging-prompts.php' => ['PhanPluginDuplicateConditionalNullCoalescing', 'PhanTypeArraySuspicious', 'PhanTypeMismatchArgumentInternal'], '_inc/class.jetpack-provision.php' => ['PhanAccessMethodInternal', 'PhanTypeMismatchArgument', 'PhanTypeMismatchReturnNullable'], '_inc/genericons.php' => ['PhanTypeMismatchArgumentProbablyReal'], '_inc/lib/admin-pages/class-jetpack-about-page.php' => ['PhanTypeMismatchArgument'], - '_inc/lib/admin-pages/class-jetpack-redux-state-helper.php' => ['PhanParamTooMany', 'PhanPluginDuplicateConditionalNullCoalescing', 'PhanRedundantCondition', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchDimAssignment'], + '_inc/lib/admin-pages/class-jetpack-redux-state-helper.php' => ['PhanPluginDuplicateConditionalNullCoalescing', 'PhanRedundantCondition', 'PhanTypeMismatchDimAssignment'], '_inc/lib/admin-pages/class.jetpack-admin-page.php' => ['PhanTypeMismatchReturnProbablyReal', 'PhanUndeclaredProperty'], '_inc/lib/class-jetpack-ai-helper.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchPropertyDefault'], '_inc/lib/class-jetpack-instagram-gallery-helper.php' => ['PhanTypeMismatchArgument'], @@ -157,10 +156,9 @@ 'class-jetpack-gallery-settings.php' => ['PhanNoopNew'], 'class-jetpack-pre-connection-jitms.php' => ['PhanTypeMismatchArgument'], 'class-jetpack-xmlrpc-methods.php' => ['PhanPluginDuplicateConditionalNullCoalescing', 'PhanRedundantCondition'], - 'class.frame-nonce-preview.php' => ['PhanParamTooMany'], 'class.jetpack-admin.php' => ['PhanPluginMixedKeyNoKey', 'PhanTypeMismatchArgumentProbablyReal'], 'class.jetpack-autoupdate.php' => ['PhanTypeMismatchArgument'], - 'class.jetpack-cli.php' => ['PhanAccessMethodInternal', 'PhanParamTooMany', 'PhanParamTooManyCallable', 'PhanPluginDuplicateConditionalNullCoalescing', 'PhanRedundantCondition', 'PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentInternal', 'PhanTypeMismatchArgumentNullable', 'PhanTypeMismatchDefault', 'PhanTypeMismatchReturn'], + 'class.jetpack-cli.php' => ['PhanAccessMethodInternal', 'PhanParamTooManyCallable', 'PhanPluginDuplicateConditionalNullCoalescing', 'PhanRedundantCondition', 'PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentInternal', 'PhanTypeMismatchArgumentNullable', 'PhanTypeMismatchDefault', 'PhanTypeMismatchReturn'], 'class.jetpack-gutenberg.php' => ['PhanPluginDuplicateConditionalNullCoalescing', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMismatchPropertyProbablyReal', 'PhanTypeMismatchReturn', 'PhanTypeSuspiciousStringExpression'], 'class.jetpack-heartbeat.php' => ['PhanTypeMismatchPropertyDefault'], 'class.jetpack-modules-list-table.php' => ['PhanCommentAbstractOnInheritedMethod'], @@ -259,7 +257,7 @@ 'json-endpoints/class.wpcom-json-api-render-endpoint.php' => ['PhanPluginSimplifyExpressionBool', 'PhanTypeMismatchArgument'], 'json-endpoints/class.wpcom-json-api-render-shortcode-endpoint.php' => ['PhanNoopNew', 'PhanTypeMismatchReturn'], 'json-endpoints/class.wpcom-json-api-sharing-buttons-endpoint.php' => ['PhanNoopNew', 'PhanPluginDuplicateConditionalNullCoalescing', 'PhanTypeMismatchArgument', 'PhanTypeMismatchReturn', 'PhanTypePossiblyInvalidDimOffset'], - 'json-endpoints/class.wpcom-json-api-site-settings-endpoint.php' => ['PhanDeprecatedFunction', 'PhanNoopNew', 'PhanParamTooMany', 'PhanRedundantCondition', 'PhanRedundantConditionInLoop', 'PhanTypeMismatchArgument', 'PhanTypeMismatchReturn', 'PhanTypePossiblyInvalidDimOffset'], + 'json-endpoints/class.wpcom-json-api-site-settings-endpoint.php' => ['PhanDeprecatedFunction', 'PhanNoopNew', 'PhanRedundantCondition', 'PhanRedundantConditionInLoop', 'PhanTypeMismatchArgument', 'PhanTypeMismatchReturn', 'PhanTypePossiblyInvalidDimOffset'], 'json-endpoints/class.wpcom-json-api-site-settings-v1-2-endpoint.php' => ['PhanNoopNew'], 'json-endpoints/class.wpcom-json-api-site-settings-v1-3-endpoint.php' => ['PhanNoopNew'], 'json-endpoints/class.wpcom-json-api-site-settings-v1-4-endpoint.php' => ['PhanNoopNew'], @@ -268,9 +266,9 @@ 'json-endpoints/class.wpcom-json-api-update-customcss.php' => ['PhanNoopNew', 'PhanTypeMismatchReturn'], 'json-endpoints/class.wpcom-json-api-update-media-endpoint.php' => ['PhanNoopNew', 'PhanTypeMismatchReturn'], 'json-endpoints/class.wpcom-json-api-update-media-v1-1-endpoint.php' => ['PhanNoopNew', 'PhanPluginDuplicateConditionalNullCoalescing', 'PhanTypeMismatchArgument', 'PhanTypeMismatchReturn'], - 'json-endpoints/class.wpcom-json-api-update-post-endpoint.php' => ['PhanNoopNew', 'PhanParamTooMany', 'PhanPluginDuplicateConditionalNullCoalescing', 'PhanPluginSimplifyExpressionBool', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentNullable', 'PhanTypeMismatchReturn', 'PhanTypePossiblyInvalidDimOffset'], - 'json-endpoints/class.wpcom-json-api-update-post-v1-1-endpoint.php' => ['PhanNoopNew', 'PhanParamTooMany', 'PhanPluginDuplicateConditionalNullCoalescing', 'PhanPluginSimplifyExpressionBool', 'PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentNullable', 'PhanTypeMismatchReturn', 'PhanTypePossiblyInvalidDimOffset'], - 'json-endpoints/class.wpcom-json-api-update-post-v1-2-endpoint.php' => ['PhanNoopNew', 'PhanParamTooMany', 'PhanPluginDuplicateConditionalNullCoalescing', 'PhanPluginSimplifyExpressionBool', 'PhanPossiblyUndeclaredVariable', 'PhanTypeArraySuspiciousNullable', 'PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentNullable', 'PhanTypePossiblyInvalidDimOffset'], + 'json-endpoints/class.wpcom-json-api-update-post-endpoint.php' => ['PhanNoopNew', 'PhanPluginDuplicateConditionalNullCoalescing', 'PhanPluginSimplifyExpressionBool', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentNullable', 'PhanTypeMismatchReturn', 'PhanTypePossiblyInvalidDimOffset'], + 'json-endpoints/class.wpcom-json-api-update-post-v1-1-endpoint.php' => ['PhanNoopNew', 'PhanPluginDuplicateConditionalNullCoalescing', 'PhanPluginSimplifyExpressionBool', 'PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentNullable', 'PhanTypeMismatchReturn', 'PhanTypePossiblyInvalidDimOffset'], + 'json-endpoints/class.wpcom-json-api-update-post-v1-2-endpoint.php' => ['PhanNoopNew', 'PhanPluginDuplicateConditionalNullCoalescing', 'PhanPluginSimplifyExpressionBool', 'PhanPossiblyUndeclaredVariable', 'PhanTypeArraySuspiciousNullable', 'PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentNullable', 'PhanTypePossiblyInvalidDimOffset'], 'json-endpoints/class.wpcom-json-api-update-site-homepage-endpoint.php' => ['PhanNoopNew', 'PhanTypeMismatchReturn'], 'json-endpoints/class.wpcom-json-api-update-site-logo-endpoint.php' => ['PhanNoopNew', 'PhanTypeMismatchReturn'], 'json-endpoints/class.wpcom-json-api-update-taxonomy-endpoint.php' => ['PhanNoopNew', 'PhanTypeMismatchArgument', 'PhanTypeMismatchReturn'], @@ -323,12 +321,12 @@ 'modules/google-fonts/current/load-google-fonts.php' => ['PhanNoopNew', 'PhanTypeArraySuspicious', 'PhanTypeMismatchArgumentInternal', 'PhanTypeMismatchReturnProbablyReal'], 'modules/gravatar-hovercards.php' => ['PhanPluginDuplicateConditionalNullCoalescing', 'PhanTypeMismatchArgumentProbablyReal'], 'modules/infinite-scroll.php' => ['PhanUndeclaredClassMethod'], - 'modules/infinite-scroll/infinity.php' => ['PhanNoopNew', 'PhanParamTooMany', 'PhanPluginDuplicateConditionalNullCoalescing', 'PhanPluginSimplifyExpressionBool', 'PhanRedundantCondition', 'PhanTypeComparisonToArray', 'PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchReturn', 'PhanTypeMismatchReturnProbablyReal', 'PhanTypeMissingReturn'], + 'modules/infinite-scroll/infinity.php' => ['PhanNoopNew', 'PhanPluginDuplicateConditionalNullCoalescing', 'PhanPluginSimplifyExpressionBool', 'PhanRedundantCondition', 'PhanTypeComparisonToArray', 'PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchReturn', 'PhanTypeMismatchReturnProbablyReal', 'PhanTypeMissingReturn'], 'modules/latex.php' => ['PhanPluginDuplicateConditionalNullCoalescing'], 'modules/likes.php' => ['PhanPluginRedundantAssignment', 'PhanUndeclaredFunction'], 'modules/likes/jetpack-likes-master-iframe.php' => ['PhanPluginDuplicateConditionalNullCoalescing'], 'modules/likes/jetpack-likes-settings.php' => ['PhanDeprecatedFunction', 'PhanRedundantCondition'], - 'modules/markdown/easy-markdown.php' => ['PhanParamTooMany', 'PhanPluginDuplicateConditionalNullCoalescing', 'PhanTypeArraySuspiciousNullable', 'PhanTypeMismatchArgument', 'PhanUndeclaredProperty'], + 'modules/markdown/easy-markdown.php' => ['PhanPluginDuplicateConditionalNullCoalescing', 'PhanTypeArraySuspiciousNullable', 'PhanTypeMismatchArgument', 'PhanUndeclaredProperty'], 'modules/memberships/class-jetpack-memberships.php' => ['PhanPluginDuplicateConditionalNullCoalescing', 'PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredMethod'], 'modules/module-headings.php' => ['PhanPluginDuplicateConditionalNullCoalescing', 'PhanTypeMismatchReturnProbablyReal'], 'modules/monitor.php' => ['PhanNoopNew', 'PhanTypeMismatchReturnProbablyReal'], @@ -401,8 +399,6 @@ 'modules/subscriptions/views.php' => ['PhanPluginDuplicateConditionalNullCoalescing', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentNullable', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMissingReturn', 'PhanTypePossiblyInvalidDimOffset'], 'modules/theme-tools/compat/twentyfourteen.php' => ['PhanRedefineFunction'], 'modules/theme-tools/compat/twentynineteen.php' => ['PhanRedefineFunction'], - 'modules/theme-tools/compat/twentysixteen.php' => ['PhanParamTooMany'], - 'modules/theme-tools/compat/twentytwenty.php' => ['PhanParamTooMany'], 'modules/theme-tools/content-options.php' => ['PhanRedefineFunction'], 'modules/theme-tools/content-options/author-bio.php' => ['PhanRedefineFunction', 'PhanTypeMismatchArgument'], 'modules/theme-tools/content-options/blog-display.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanRedefineFunction'], @@ -444,7 +440,7 @@ 'modules/widgets/flickr.php' => ['PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentNullable', 'PhanTypeMissingReturn'], 'modules/widgets/flickr/form.php' => ['PhanTypeMismatchArgument'], 'modules/widgets/follow-button.php' => ['PhanPluginUseReturnValueInternalKnown', 'PhanTypeMissingReturn'], - 'modules/widgets/gallery.php' => ['PhanParamTooMany', 'PhanPluginDuplicateConditionalNullCoalescing', 'PhanTypeMismatchReturnProbablyReal', 'PhanTypeMissingReturn'], + 'modules/widgets/gallery.php' => ['PhanPluginDuplicateConditionalNullCoalescing', 'PhanTypeMismatchReturnProbablyReal', 'PhanTypeMissingReturn'], 'modules/widgets/goodreads.php' => ['PhanPluginDuplicateConditionalNullCoalescing', 'PhanTypeMismatchArgumentInternal', 'PhanTypeMissingReturn'], 'modules/widgets/google-translate.php' => ['PhanPluginDuplicateConditionalNullCoalescing', 'PhanRedundantCondition', 'PhanTypeMissingReturn'], 'modules/widgets/gravatar-profile.php' => ['PhanPluginDuplicateConditionalNullCoalescing', 'PhanTypeMissingReturn'], @@ -481,8 +477,8 @@ 'src/class-jetpack-modules-overrides.php' => ['PhanRedundantCondition'], 'tests/php/3rd-party/test_class.jetpack-amp-support.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'tests/php/_inc/lib/test-class-jetpack-blogging-prompts.php' => ['PhanTypeMismatchArgumentNullable'], - 'tests/php/_inc/lib/test_class.rest-api-authentication.php' => ['PhanParamTooMany', 'PhanPluginDuplicateConditionalNullCoalescing'], - 'tests/php/_inc/lib/test_class.rest-api-endpoints.php' => ['PhanParamTooMany', 'PhanPluginDuplicateConditionalNullCoalescing', 'PhanTypeInvalidLeftOperandOfAdd', 'PhanTypeMismatchReturn', 'PhanTypeMismatchReturnProbablyReal'], + 'tests/php/_inc/lib/test_class.rest-api-authentication.php' => ['PhanPluginDuplicateConditionalNullCoalescing'], + 'tests/php/_inc/lib/test_class.rest-api-endpoints.php' => ['PhanPluginDuplicateConditionalNullCoalescing', 'PhanTypeInvalidLeftOperandOfAdd', 'PhanTypeMismatchReturn', 'PhanTypeMismatchReturnProbablyReal'], 'tests/php/core-api/test_class-wpcom-rest-field-controller.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentProbablyReal'], 'tests/php/core-api/wpcom-endpoints/test-class-wpcom-rest-api-v2-endpoint-admin-menu.php' => ['PhanPluginMixedKeyNoKey', 'PhanTypeArraySuspiciousNullable', 'PhanTypeMismatchReturn'], 'tests/php/core-api/wpcom-endpoints/test-class-wpcom-rest-api-v2-endpoint-external-media.php' => ['PhanTypeExpectedObjectPropAccess', 'PhanTypeMismatchArgument'], @@ -503,26 +499,23 @@ 'tests/php/media/test-class.jetpack-media-extractor.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentProbablyReal'], 'tests/php/media/test-class.jetpack-post-images.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'tests/php/modules/photon/test_class.jetpack-photon-static-asset-cdn.php' => ['PhanTypeMismatchProperty'], - 'tests/php/modules/post-by-email/test-class.post-by-email-api.php' => ['PhanParamTooMany'], 'tests/php/modules/publicize/test_class.publicize.php' => ['PhanPluginDuplicateConditionalNullCoalescing'], 'tests/php/modules/sharedaddy/test-class.recaptcha.php' => ['PhanDeprecatedClass'], 'tests/php/modules/shortcodes/test-class.archives.php' => ['PhanPluginDuplicateAdjacentStatement'], 'tests/php/modules/shortcodes/test-class.getty.php' => ['PhanPluginInvalidPregRegex'], - 'tests/php/modules/shortcodes/test-class.gravatar.php' => ['PhanParamTooMany'], 'tests/php/modules/shortcodes/test-class.instagram.php' => ['PhanTypeMismatchArgument'], - 'tests/php/modules/shortcodes/test-class.mixcloud.php' => ['PhanParamTooMany'], 'tests/php/modules/shortcodes/test-class.slideshow.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'tests/php/modules/shortcodes/test-class.ted.php' => ['PhanTypeMismatchArgument'], 'tests/php/modules/shortcodes/test-class.tweet.php' => ['PhanTypeMismatchArgument'], 'tests/php/modules/shortcodes/test-class.vimeo.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'tests/php/modules/shortcodes/test-oembed-pocketcasts.php' => ['PhanTypeMismatchArgument'], - 'tests/php/modules/sitemaps/test-class.sitemap-buffer.php' => ['PhanParamTooMany', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchPropertyProbablyReal'], + 'tests/php/modules/sitemaps/test-class.sitemap-buffer.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchPropertyProbablyReal'], 'tests/php/modules/sitemaps/test-class.sitemap-librarian.php' => ['PhanTypeMismatchArgument'], 'tests/php/modules/subscriptions/test_class.jetpack-subscriptions.php' => ['PhanDeprecatedProperty', 'PhanPluginDuplicateConditionalNullCoalescing', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentProbablyReal'], 'tests/php/modules/widgets/test_contact-info-widget.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'tests/php/modules/widgets/test_wordpress-post-widget.php' => ['PhanDeprecatedFunction', 'PhanTypeMismatchArgumentProbablyReal'], 'tests/php/sync/class-test-jetpack-sync-search.php' => ['PhanStaticCallToNonStatic', 'PhanTypeMismatchArgumentInternal'], - 'tests/php/sync/class-wp-test-jetpack-sync-queue-base-tests.php' => ['PhanParamTooMany', 'PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentProbablyReal'], + 'tests/php/sync/class-wp-test-jetpack-sync-queue-base-tests.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentProbablyReal'], 'tests/php/sync/server/class.jetpack-sync-server-eventstore.php' => ['PhanPluginDuplicateConditionalNullCoalescing'], 'tests/php/sync/server/class.jetpack-sync-test-object-factory.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'tests/php/sync/server/class.jetpack-sync-test-replicastore.php' => ['PhanPluginDuplicateConditionalNullCoalescing', 'PhanTypeInvalidLeftOperandOfAdd'], @@ -531,17 +524,16 @@ 'tests/php/sync/test_class.jetpack-sync-base.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchReturn'], 'tests/php/sync/test_class.jetpack-sync-callables.php' => ['PhanNoopNew', 'PhanPluginDuplicateConditionalNullCoalescing', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMissingReturn'], 'tests/php/sync/test_class.jetpack-sync-comments.php' => ['PhanTypeMismatchArgument'], - 'tests/php/sync/test_class.jetpack-sync-full-immediately.php' => ['PhanParamTooMany', 'PhanPluginDuplicateAdjacentStatement', 'PhanPossiblyUndeclaredVariable', 'PhanTypeArraySuspiciousNullable', 'PhanTypeMismatchArgumentNullable', 'PhanTypeMismatchArgumentProbablyReal'], - 'tests/php/sync/test_class.jetpack-sync-full.php' => ['PhanParamTooMany', 'PhanPluginDuplicateAdjacentStatement', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentNullable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchArgumentReal', 'PhanUndeclaredProperty'], + 'tests/php/sync/test_class.jetpack-sync-full-immediately.php' => ['PhanPluginDuplicateAdjacentStatement', 'PhanPossiblyUndeclaredVariable', 'PhanTypeArraySuspiciousNullable', 'PhanTypeMismatchArgumentNullable', 'PhanTypeMismatchArgumentProbablyReal'], + 'tests/php/sync/test_class.jetpack-sync-full.php' => ['PhanPluginDuplicateAdjacentStatement', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentNullable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchArgumentReal', 'PhanUndeclaredProperty'], 'tests/php/sync/test_class.jetpack-sync-import.php' => ['PhanRedefineClass'], 'tests/php/sync/test_class.jetpack-sync-integration.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchPropertyProbablyReal'], 'tests/php/sync/test_class.jetpack-sync-menus.php' => ['PhanTypeMismatchArgumentProbablyReal'], - 'tests/php/sync/test_class.jetpack-sync-meta.php' => ['PhanParamTooMany', 'PhanTypeMismatchArgument'], - 'tests/php/sync/test_class.jetpack-sync-modules-stats.php' => ['PhanParamTooMany'], + 'tests/php/sync/test_class.jetpack-sync-meta.php' => ['PhanParamTooMany', 'PhanTypeArraySuspiciousNullable', 'PhanTypeMismatchArgument'], 'tests/php/sync/test_class.jetpack-sync-posts.php' => ['PhanNoopNew', 'PhanPluginDuplicateConditionalNullCoalescing', 'PhanTypeExpectedObjectPropAccess', 'PhanTypeMismatchArgumentProbablyReal'], 'tests/php/sync/test_class.jetpack-sync-queue-custom-table.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'tests/php/sync/test_class.jetpack-sync-queue-options-table.php' => ['PhanTypeMismatchArgumentProbablyReal'], - 'tests/php/sync/test_class.jetpack-sync-queue.php' => ['PhanParamTooMany', 'PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentProbablyReal'], + 'tests/php/sync/test_class.jetpack-sync-queue.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentProbablyReal'], 'tests/php/sync/test_class.jetpack-sync-sender.php' => ['PhanPluginDuplicateAdjacentStatement', 'PhanTypeMismatchArgumentProbablyReal'], 'tests/php/sync/test_class.jetpack-sync-term-relationships.php' => ['PhanPluginUnreachableCode'], 'tests/php/sync/test_class.jetpack-sync-themes.php' => ['PhanPluginDuplicateAdjacentStatement'], diff --git a/projects/plugins/protect/.phan/baseline.php b/projects/plugins/protect/.phan/baseline.php index fba380eb870a7..1ae49ee4826f0 100644 --- a/projects/plugins/protect/.phan/baseline.php +++ b/projects/plugins/protect/.phan/baseline.php @@ -9,7 +9,6 @@ */ return [ // # Issue statistics: - // PhanParamTooMany : 3 occurrences // PhanNoopNew : 1 occurrence // PhanPluginDuplicateConditionalNullCoalescing : 1 occurrence // PhanTypeMismatchReturnProbablyReal : 1 occurrence @@ -18,7 +17,6 @@ 'file_suppressions' => [ 'jetpack-protect.php' => ['PhanNoopNew'], 'src/class-credentials.php' => ['PhanPluginDuplicateConditionalNullCoalescing', 'PhanTypeMismatchReturnProbablyReal'], - 'src/class-rest-controller.php' => ['PhanParamTooMany'], ], // 'directory_suppressions' => ['src/directory_name' => ['PhanIssueName1', 'PhanIssueName2']] can be manually added if needed. // (directory_suppressions will currently be ignored by subsequent calls to --save-baseline, but may be preserved in future Phan releases) diff --git a/projects/plugins/vaultpress/.phan/baseline.php b/projects/plugins/vaultpress/.phan/baseline.php index d3ee7abd52ef4..5a7d7308a8485 100644 --- a/projects/plugins/vaultpress/.phan/baseline.php +++ b/projects/plugins/vaultpress/.phan/baseline.php @@ -36,7 +36,6 @@ // PhanUndeclaredVariable : 2 occurrences // PhanAccessMethodProtected : 1 occurrence // PhanParamSpecial1 : 1 occurrence - // PhanParamTooMany : 1 occurrence // PhanPluginDuplicateExpressionAssignment : 1 occurrence // PhanRedundantCondition : 1 occurrence // PhanTypeInvalidDimOffset : 1 occurrence @@ -50,7 +49,7 @@ 'class.vaultpress-cli.php' => ['PhanUndeclaredFunctionInCallable'], 'class.vaultpress-database.php' => ['PhanParamSpecial1', 'PhanPluginDuplicateConditionalNullCoalescing', 'PhanPossiblyUndeclaredVariable', 'PhanTypeArraySuspiciousNullable', 'PhanTypeMismatchArgumentInternal', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeNonVarPassByRef', 'PhanTypeObjectUnsetDeclaredProperty', 'PhanUndeclaredConstant', 'PhanUndeclaredProperty', 'PhanUndeclaredVariableDim'], 'class.vaultpress-filesystem.php' => ['PhanPluginNeverReturnMethod', 'PhanPluginSimplifyExpressionBool', 'PhanPluginUnreachableCode', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeNonVarPassByRef', 'PhanTypeSuspiciousStringExpression', 'PhanUndeclaredVariable'], - 'class.vaultpress-hotfixes.php' => ['PhanDeprecatedFunction', 'PhanParamTooMany', 'PhanPluginSimplifyExpressionBool', 'PhanRedefineFunction', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypePossiblyInvalidDimOffset'], + 'class.vaultpress-hotfixes.php' => ['PhanDeprecatedFunction', 'PhanPluginSimplifyExpressionBool', 'PhanRedefineFunction', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypePossiblyInvalidDimOffset'], 'cron-tasks.php' => ['PhanRedefineFunction'], 'vaultpress.php' => ['PhanAccessMethodProtected', 'PhanDeprecatedFunction', 'PhanPluginDuplicateConditionalNullCoalescing', 'PhanPluginDuplicateExpressionAssignment', 'PhanPluginNeverReturnMethod', 'PhanPluginSimplifyExpressionBool', 'PhanPluginUnreachableCode', 'PhanPossiblyUndeclaredVariable', 'PhanRedundantCondition', 'PhanTypeArraySuspiciousNullable', 'PhanTypeExpectedObjectPropAccessButGotNull', 'PhanTypeInvalidRightOperandOfNumericOp', 'PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentInternal', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchDimFetch', 'PhanTypePossiblyInvalidDimOffset', 'PhanTypeSuspiciousStringExpression', 'PhanUndeclaredClassMethod', 'PhanUndeclaredClassReference', 'PhanUndeclaredConstant', 'PhanUndeclaredFunction', 'PhanUndeclaredMethod', 'PhanUndeclaredProperty', 'PhanUndeclaredVariable'], 'vp-scanner.php' => ['PhanCommentParamWithoutRealParam', 'PhanPossiblyUndeclaredVariable', 'PhanTypeInvalidDimOffset', 'PhanTypeMismatchArgumentInternal', 'PhanTypeMismatchArgumentNullableInternal', 'PhanUndeclaredFunction'], From 8aab7bf1ff0d1eef44741685658e0e422e521b76 Mon Sep 17 00:00:00 2001 From: tbradsha <32492176+tbradsha@users.noreply.github.com> Date: Fri, 31 Jan 2025 10:17:05 -0700 Subject: [PATCH 19/19] More changelogs --- .../packages/masterbar/changelog/fix-phan-PhanParamTooMany | 4 ++++ .../packages/publicize/changelog/fix-phan-PhanParamTooMany | 4 ++++ .../packages/stats-admin/changelog/fix-phan-PhanParamTooMany | 4 ++++ 3 files changed, 12 insertions(+) create mode 100644 projects/packages/masterbar/changelog/fix-phan-PhanParamTooMany create mode 100644 projects/packages/publicize/changelog/fix-phan-PhanParamTooMany create mode 100644 projects/packages/stats-admin/changelog/fix-phan-PhanParamTooMany diff --git a/projects/packages/masterbar/changelog/fix-phan-PhanParamTooMany b/projects/packages/masterbar/changelog/fix-phan-PhanParamTooMany new file mode 100644 index 0000000000000..c1192e2ed90c3 --- /dev/null +++ b/projects/packages/masterbar/changelog/fix-phan-PhanParamTooMany @@ -0,0 +1,4 @@ +Significance: patch +Type: changed + +Phan: Update baselines. diff --git a/projects/packages/publicize/changelog/fix-phan-PhanParamTooMany b/projects/packages/publicize/changelog/fix-phan-PhanParamTooMany new file mode 100644 index 0000000000000..c1192e2ed90c3 --- /dev/null +++ b/projects/packages/publicize/changelog/fix-phan-PhanParamTooMany @@ -0,0 +1,4 @@ +Significance: patch +Type: changed + +Phan: Update baselines. diff --git a/projects/packages/stats-admin/changelog/fix-phan-PhanParamTooMany b/projects/packages/stats-admin/changelog/fix-phan-PhanParamTooMany new file mode 100644 index 0000000000000..c1192e2ed90c3 --- /dev/null +++ b/projects/packages/stats-admin/changelog/fix-phan-PhanParamTooMany @@ -0,0 +1,4 @@ +Significance: patch +Type: changed + +Phan: Update baselines.