From b9faed6e1778f30fb748a7e78f57b7e354afb372 Mon Sep 17 00:00:00 2001 From: Brandon Date: Mon, 4 Nov 2024 22:22:00 -0600 Subject: [PATCH] =?UTF-8?q?=F0=9F=A9=B9=20Change=20`match`=20statement=20t?= =?UTF-8?q?o=20conditional=20for=20PHP=207.x=20(Fixes=20#90)=20(#91)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugin.php | 2 +- src/PhoneNumberField.php | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/plugin.php b/plugin.php index 0995070..e298a47 100644 --- a/plugin.php +++ b/plugin.php @@ -4,7 +4,7 @@ * Plugin Name: Advanced Custom Fields: Phone Number * Plugin URI: https://github.com/log1x/acf-phone-number * Description: A real ACF phone number field. - * Version: 1.3.0 + * Version: 1.3.1 * Author: Brandon Nifong * Author URI: https://github.com/log1x */ diff --git a/src/PhoneNumberField.php b/src/PhoneNumberField.php index 252fdf5..f79855e 100644 --- a/src/PhoneNumberField.php +++ b/src/PhoneNumberField.php @@ -160,11 +160,13 @@ public function input_admin_enqueue_scripts() public function format_value($value, $post_id, $field) { $number = new PhoneNumber($value); + $format = $field['return_format'] ?? $this->defaults['return_format']; - return match ($field['return_format'] ?? $this->defaults['return_format']) { - 'array' => $number->toArray(), - default => $number, - }; + if ($format === 'array') { + return $number->toArray(); + } + + return $number; } /**