Skip to content

Commit 8287094

Browse files
committed
Remove PHP 7.4+ type declarations for broader compatibility
- Remove typed properties from class properties ($table_name, $db_version) - Remove return type declarations from all methods - Remove parameter type declarations from all methods - Maintains PHP 7.4+ compatibility while supporting older PHP versions
1 parent bf308e8 commit 8287094

1 file changed

Lines changed: 13 additions & 13 deletions

File tree

includes/class-database.php

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,15 @@ class Database {
2727
* @since 1.0.0
2828
* @var string
2929
*/
30-
private string $table_name;
30+
private $table_name;
3131

3232
/**
3333
* Database version.
3434
*
3535
* @since 1.0.0
3636
* @var string
3737
*/
38-
private string $db_version = '1.0.0';
38+
private $db_version = '1.0.0';
3939

4040
/**
4141
* Constructor.
@@ -55,7 +55,7 @@ public function __construct() {
5555
*
5656
* @return bool|\WP_Error True if table created successfully, \WP_Error on failure.
5757
*/
58-
public function create_table(): bool|\WP_Error {
58+
public function create_table() {
5959
global $wpdb;
6060

6161
$charset_collate = $wpdb->get_charset_collate();
@@ -103,7 +103,7 @@ public function create_table(): bool|\WP_Error {
103103
*
104104
* @return bool True if update is required, false otherwise.
105105
*/
106-
public function needs_update(): bool {
106+
public function needs_update() {
107107
$current_version = get_option( 'glue_link_db_version', '0' );
108108
return version_compare( $current_version, $this->db_version, '<' );
109109
}
@@ -115,7 +115,7 @@ public function needs_update(): bool {
115115
*
116116
* @return string Table name.
117117
*/
118-
public function get_table_name(): string {
118+
public function get_table_name() {
119119
return $this->table_name;
120120
}
121121

@@ -126,7 +126,7 @@ public function get_table_name(): string {
126126
*
127127
* @param int|string $identifier Subscriber ID or email.
128128
*/
129-
public function clear_subscriber_cache( $identifier ): void {
129+
public function clear_subscriber_cache( $identifier ) {
130130
if ( is_int( $identifier ) ) {
131131
wp_cache_delete( 'glue_link_subscriber_' . $identifier, 'glue_link' );
132132
} elseif ( is_string( $identifier ) ) {
@@ -142,7 +142,7 @@ public function clear_subscriber_cache( $identifier ): void {
142142
* @param int $id Subscriber ID.
143143
* @return Subscriber|\WP_Error Subscriber object or \WP_Error on failure.
144144
*/
145-
public function get_subscriber( int $id ): Subscriber|\WP_Error {
145+
public function get_subscriber( $id ) {
146146
global $wpdb;
147147

148148
$cache_key = 'glue_link_subscriber_' . $id;
@@ -179,7 +179,7 @@ public function get_subscriber( int $id ): Subscriber|\WP_Error {
179179
* @param string $email Subscriber email.
180180
* @return Subscriber|\WP_Error Subscriber object or \WP_Error on failure.
181181
*/
182-
public function get_subscriber_by_email( string $email ): Subscriber|\WP_Error {
182+
public function get_subscriber_by_email( $email ) {
183183
global $wpdb;
184184

185185
$cache_key = 'glue_link_subscriber_email_' . md5( $email );
@@ -444,7 +444,7 @@ private function merge_subscriber_data( $existing_subscriber, $new_subscriber )
444444
* @param int $id Subscriber ID.
445445
* @return bool|\WP_Error True on success, \WP_Error on failure.
446446
*/
447-
public function delete_subscriber( int $id ): bool|\WP_Error {
447+
public function delete_subscriber( $id ) {
448448
global $wpdb;
449449

450450
$subscriber = $this->get_subscriber( $id );
@@ -501,7 +501,7 @@ public function delete_subscriber( int $id ): bool|\WP_Error {
501501
* }
502502
* @return Subscriber[] Array of Subscriber objects.
503503
*/
504-
public function get_subscribers( array $args = array() ): array {
504+
public function get_subscribers( $args = array() ) {
505505
global $wpdb;
506506

507507
$defaults = array(
@@ -582,7 +582,7 @@ public function get_subscribers( array $args = array() ): array {
582582
*
583583
* @return array|\WP_Error Array of counts by status or \WP_Error on failure.
584584
*/
585-
public function get_subscriber_counts(): array|\WP_Error {
585+
public function get_subscriber_counts() {
586586
global $wpdb;
587587

588588
$cache_key = 'glue_link_subscriber_counts';
@@ -624,7 +624,7 @@ public function get_subscriber_counts(): array|\WP_Error {
624624
* @param array $ids Array of subscriber IDs.
625625
* @return bool|\WP_Error True on success, \WP_Error on failure.
626626
*/
627-
public function delete_subscribers( array $ids ): bool|\WP_Error {
627+
public function delete_subscribers( $ids ) {
628628
global $wpdb;
629629

630630
if ( empty( $ids ) ) {
@@ -676,7 +676,7 @@ public function delete_subscribers( array $ids ): bool|\WP_Error {
676676
* }
677677
* @return int Total number of subscribers matching the criteria.
678678
*/
679-
public function get_subscriber_count( array $args = array() ): int {
679+
public function get_subscriber_count( $args = array() ) {
680680
global $wpdb;
681681

682682
$defaults = array(

0 commit comments

Comments
 (0)