From 898be743929dbeb17d6c030f0d2a320f9127f0e2 Mon Sep 17 00:00:00 2001 From: Darin Kotter Date: Fri, 19 Mar 2021 13:51:10 -0600 Subject: [PATCH 1/2] Make sure the log_sync function we extend has the same type hints as the abstract function, otherwise older versions of PHP will throw errors --- includes/classes/ExternalConnection.php | 2 +- includes/classes/InternalConnections/NetworkSiteConnection.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/classes/ExternalConnection.php b/includes/classes/ExternalConnection.php index f6cb5494d..2acddf68a 100644 --- a/includes/classes/ExternalConnection.php +++ b/includes/classes/ExternalConnection.php @@ -74,7 +74,7 @@ public function __construct( $name, $base_url, $id, Authentication $auth_handler * @param boolean $overwrite Whether to overwrite the sync log for this connection. Default false. * @since 0.8 */ - public function log_sync( array $item_id_mappings, $connection_id = 0, $overwrite = false ) { + public function log_sync( array $item_id_mappings, $connection_id = 0, bool $overwrite = false ) { $connection_id = 0 === $connection_id ? $this->id : $connection_id; $sync_log = $this->get_sync_log( $connection_id ); diff --git a/includes/classes/InternalConnections/NetworkSiteConnection.php b/includes/classes/InternalConnections/NetworkSiteConnection.php index d80f90123..1e1bd69e9 100644 --- a/includes/classes/InternalConnections/NetworkSiteConnection.php +++ b/includes/classes/InternalConnections/NetworkSiteConnection.php @@ -343,7 +343,7 @@ public function pull( $items ) { * @param boolean $overwrite Whether to overwrite the sync log for this site. Default false. * @since 0.8 */ - public function log_sync( array $item_id_mappings, $blog_id = 0, $overwrite = false ) { + public function log_sync( array $item_id_mappings, $blog_id = 0, bool $overwrite = false ) { $blog_id = 0 === $blog_id ? $this->site->blog_id : $blog_id; $current_site_log = []; From 0e711441afac656ee06cc48bae6f707fa88de6f7 Mon Sep 17 00:00:00 2001 From: Darin Kotter Date: Mon, 22 Mar 2021 15:45:54 -0600 Subject: [PATCH 2/2] Remove the boolean type declaration, as this isn't supported on PHP 5.6 --- includes/classes/Connection.php | 2 +- includes/classes/ExternalConnection.php | 2 +- includes/classes/InternalConnections/NetworkSiteConnection.php | 2 +- tests/php/includes/common.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/includes/classes/Connection.php b/includes/classes/Connection.php index ee06ced51..9e22f5441 100644 --- a/includes/classes/Connection.php +++ b/includes/classes/Connection.php @@ -48,7 +48,7 @@ abstract public function remote_get( $args ); * @param boolean $overwrite Whether to overwrite the sync log. Optional. * @since 0.8 */ - abstract public function log_sync( array $item_id_mappings, $id, bool $overwrite ); + abstract public function log_sync( array $item_id_mappings, $id, $overwrite ); /** * Get the sync log diff --git a/includes/classes/ExternalConnection.php b/includes/classes/ExternalConnection.php index 2acddf68a..f6cb5494d 100644 --- a/includes/classes/ExternalConnection.php +++ b/includes/classes/ExternalConnection.php @@ -74,7 +74,7 @@ public function __construct( $name, $base_url, $id, Authentication $auth_handler * @param boolean $overwrite Whether to overwrite the sync log for this connection. Default false. * @since 0.8 */ - public function log_sync( array $item_id_mappings, $connection_id = 0, bool $overwrite = false ) { + public function log_sync( array $item_id_mappings, $connection_id = 0, $overwrite = false ) { $connection_id = 0 === $connection_id ? $this->id : $connection_id; $sync_log = $this->get_sync_log( $connection_id ); diff --git a/includes/classes/InternalConnections/NetworkSiteConnection.php b/includes/classes/InternalConnections/NetworkSiteConnection.php index 1e1bd69e9..d80f90123 100644 --- a/includes/classes/InternalConnections/NetworkSiteConnection.php +++ b/includes/classes/InternalConnections/NetworkSiteConnection.php @@ -343,7 +343,7 @@ public function pull( $items ) { * @param boolean $overwrite Whether to overwrite the sync log for this site. Default false. * @since 0.8 */ - public function log_sync( array $item_id_mappings, $blog_id = 0, bool $overwrite = false ) { + public function log_sync( array $item_id_mappings, $blog_id = 0, $overwrite = false ) { $blog_id = 0 === $blog_id ? $this->site->blog_id : $blog_id; $current_site_log = []; diff --git a/tests/php/includes/common.php b/tests/php/includes/common.php index 9c3978bba..fc019af73 100644 --- a/tests/php/includes/common.php +++ b/tests/php/includes/common.php @@ -284,7 +284,7 @@ public function pull( $items ) { } public function remote_get( $args ) { } - public function log_sync( array $item_id_mappings, $id, bool $overwrite ) {} + public function log_sync( array $item_id_mappings, $id, $overwrite ) {} public function get_sync_log( $id ) {}