Skip to content

Commit 3375be0

Browse files
tbradshamatticbot
authored andcommitted
Phan: Fix errant extra params in function calls (#41263)
* Remove extra param on remove_filter/remove_action There's no arg count when removing. * 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. * Remove other stray args In most cases, these appear to be due to refactors. * Another stray arg * Suppress things that confuse Phan * Fix get_avatar_url calls * arrayHasKey → assertArrayHasKey * Fix misplaced parentheses * Tighten types We're using `WP_Option`, which allows an extra param in its `get()`. * Add missing sprintf * Add unused param to allow dynamic method call * Add changelogs * Use same behaviour as trunk * Fix assertion * Add param to Storage::get and use that type as before * Inform Phan of type rather than suppressing error * Update errant types * Update Phan baselines * More changelogs Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/13079055733 Upstream-Ref: Automattic/jetpack@4b2a4a9
1 parent de8c194 commit 3375be0

7 files changed

+18
-23
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ This is an alpha version! The changes listed here are not final.
1414
- Updated package dependencies.
1515

1616
### Fixed
17+
- Code: Remove extra params on function calls.
1718
- Small fix to welcome wizard
1819

1920
## [6.5.1] - 2025-01-22

admin/settings/companies.page.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
<?php
7676
if ( isset( $sbupdated ) ) {
7777
if ( $sbupdated ) {
78-
echo zeroBSCRM_UI2_messageHTML( 'success', __( 'Settings Updated', 'zero-bs-crm', '' ) );
78+
echo zeroBSCRM_UI2_messageHTML( 'success', __( 'Settings Updated', 'zero-bs-crm' ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
7979
}
8080
}
8181
?>

includes/ZeroBSCRM.AJAX.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -1108,7 +1108,7 @@ function ZeroBSCRM_accept_quote() {
11081108
) {
11091109
zeroBSCRM_sendJSONError( array( 'access' => 1 ), 403 );
11101110
}
1111-
} elseif ( ! zeroBSCRM_quotes_getFromHash( $quoteHash, -1 )['success'] ) {
1111+
} elseif ( ! zeroBSCRM_quotes_getFromHash( $quoteHash )['success'] ) { // phpcs:ignore WordPress.NamingConventions.ValidVariableName.VariableNotSnakeCase
11121112
zeroBSCRM_sendJSONError( array( 'hash' => 1 ), 403 );
11131113
}
11141114

@@ -4013,7 +4013,7 @@ function zeroBSCRM_AJAX_enactListViewBulkAction() {
40134013
foreach ( $legitIDs as $id ) {
40144014

40154015
// } Update quote as unaccepted (should verify this worked...)
4016-
zeroBS_markQuoteUnAccepted( $id, zeroBS_getCurrentUserUsername() );
4016+
zeroBS_markQuoteUnAccepted( $id );
40174017

40184018
++$unaccepted;
40194019

includes/ZeroBSCRM.DAL3.Obj.Contacts.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -3571,11 +3571,11 @@ public function deleteContact($args=array()){
35713571
)
35723572
);
35733573

3574-
} unset($trans);
3574+
} unset( $trans );
35753575

3576-
// delete events
3577-
$events = zeroBS_getEventsByCustomerID($id,false,1000000,0,false);
3578-
foreach ($events as $event){
3576+
// delete events
3577+
$events = zeroBS_getEventsByCustomerID( $id, false, 1000000, 0 );
3578+
foreach ( $events as $event ) {
35793579

35803580
// delete post
35813581
$zbs->DAL->events->deleteEvent( // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase

includes/ZeroBSCRM.GeneralFuncs.php

+8-14
Original file line numberDiff line numberDiff line change
@@ -604,19 +604,13 @@ function zeroBSCRM_expandArchive($filepath,$expandTo){
604604

605605
if (file_exists($filepath) && file_exists($expandTo)){
606606

607-
$archive = new PclZip($filepath);
608-
609-
if ($archive->extract(PCLZIP_OPT_PATH, $expandTo) == 0) {
610-
611-
return false;
612-
613-
} else {
614-
615-
return true;
616-
617-
}
618-
619-
607+
$archive = new PclZip( $filepath );
608+
// @phan-suppress-next-line PhanParamTooMany -- PclZip functions use func_get_args.
609+
if ( $archive->extract( PCLZIP_OPT_PATH, $expandTo ) === 0 ) { // phpcs:ignore WordPress.NamingConventions.ValidVariableName.VariableNotSnakeCase
610+
return false;
611+
} else {
612+
return true;
613+
}
620614
}
621615

622616
} catch (Exception $ex){
@@ -1707,7 +1701,7 @@ function jpcrm_get_mimetype( $file_path ) {
17071701
$credentials = request_filesystem_credentials( site_url() );
17081702
wp_filesystem( $credentials );
17091703
}
1710-
$lines = $wp_filesystem->get_contents_array( $file_path, 8 );
1704+
$lines = $wp_filesystem->get_contents_array( $file_path );
17111705
if ( $lines === false ) {
17121706
return 'application/octet-stream';
17131707
}

includes/ZeroBSCRM.MetaBoxes3.Tasks.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,7 @@ function zeroBSCRM_task_addEdit( $taskID = -1 ) {
533533

534534
$html .= zeroBSCRM_task_ui_clear();
535535

536-
$html .= zeroBSCRM_task_ui_for( $taskObject, $taskID );
536+
$html .= zeroBSCRM_task_ui_for( $taskObject ); // phpcs:ignore WordPress.NamingConventions.ValidVariableName.VariableNotSnakeCase
537537

538538
$html .= zeroBSCRM_task_ui_clear();
539539

modules/woo-sync/includes/class-woo-sync.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -2226,7 +2226,7 @@ private function migrate_52(){
22262226
$new_sync_site = $this->add_sync_site( $data );
22272227

22282228
// verify
2229-
if ( is_array( $new_sync_site ) && !empty( $new_sync_site['site_key'] ) && $this->get_active_sync_site( $new_sync_site['site_key'], true ) ){
2229+
if ( is_array( $new_sync_site ) && !empty( $new_sync_site['site_key'] ) && $this->get_active_sync_site( $new_sync_site['site_key'] ) ){
22302230

22312231
// backup and remove old settings
22322232
update_option( 'jpcrm_woosync_52_mig_backup', $settings, false );

0 commit comments

Comments
 (0)