| @@ -30,15 +30,8 @@ | ||
| 30 | 30 | * @var bool |
| 31 | 31 | */ |
| 32 | 32 | public $is_verified; |
| 33 | 33 | /** |
| 34 | - * @author Leo Fajardo (@leorw) | |
| 35 | - * @since 2.3.0 | |
| 36 | - * | |
| 37 | - * @var bool | |
| 38 | - */ | |
| 39 | - public $is_beta; | |
| 40 | - /** | |
| 41 | 34 | * @var string|null |
| 42 | 35 | */ |
| 43 | 36 | public $customer_id; |
| 44 | 37 | /** |
| @@ -54,8 +47,21 @@ | ||
| 54 | 47 | function __construct( $user = false ) { |
| 55 | 48 | parent::__construct( $user ); |
| 56 | 49 | } |
| 57 | 50 | |
| 51 | + /** | |
| 52 | + * This method removes the deprecated 'is_beta' property from the serialized data. | |
| 53 | + * Should clean up the serialized data to avoid PHP 8.2 warning on next execution. | |
| 54 | + * | |
| 55 | + * @return void | |
| 56 | + */ | |
| 57 | + function __wakeup() { | |
| 58 | + if ( property_exists( $this, 'is_beta' ) ) { | |
| 59 | + // If we enter here, and we are running PHP 8.2, we already had the warning. But we sanitize data for next execution. | |
| 60 | + unset( $this->is_beta ); | |
| 61 | + } | |
| 62 | + } | |
| 63 | + | |
| 58 | 64 | function get_name() { |
| 59 | 65 | return trim( ucfirst( trim( is_string( $this->first ) ? $this->first : '' ) ) . ' ' . ucfirst( trim( is_string( $this->last ) ? $this->last : '' ) ) ); |
| 60 | 66 | } |
| 61 | 67 | |
| @@ -64,16 +70,17 @@ | ||
| 64 | 70 | } |
| 65 | 71 | |
| 66 | 72 | /** |
| 67 | 73 | * @author Leo Fajardo (@leorw) |
| 68 | - * @since 2.3.0 | |
| 74 | + * @since 2.4.2 | |
| 69 | 75 | * |
| 70 | 76 | * @return bool |
| 71 | 77 | */ |
| 72 | - function is_beta() { | |
| 73 | - return ( isset( $this->is_beta ) && true === $this->is_beta ); | |
| 74 | - } | |
| 78 | + function is_beta() { | |
| 79 | + // Return `false` since this is just for backward compatibility. | |
| 80 | + return false; | |
| 81 | + } | |
| 75 | 82 | |
| 76 | - static function get_type() { | |
| 83 | + static function get_type() { | |
| 77 | 84 | return 'user'; |
| 78 | 85 | } |
| 79 | 86 | } |