diff --git a/src/fields/ListField.php b/src/fields/ListField.php index bf62888..cecc898 100644 --- a/src/fields/ListField.php +++ b/src/fields/ListField.php @@ -47,7 +47,7 @@ public function getInputHtml(mixed $value, ?ElementInterface $element = null): s public function normalizeValue(mixed $value, ?ElementInterface $element = null): mixed { if ($value) { - $o = json_decode($value); + $o = json_decode((string) $value); if ($o) { $value = $o->id; } diff --git a/src/fields/ListsField.php b/src/fields/ListsField.php index 7cecc2d..715df70 100644 --- a/src/fields/ListsField.php +++ b/src/fields/ListsField.php @@ -62,7 +62,7 @@ public function getInputHtml(mixed $value, ?ElementInterface $element = null): s public function normalizeValue(mixed $value, ?ElementInterface $element = null): mixed { if ($value && ! is_array($value)) { - $o = json_decode($value, false, 512, JSON_THROW_ON_ERROR); + $o = json_decode((string) $value, false, 512, JSON_THROW_ON_ERROR); $newValues = []; if (is_array($o)) { foreach ($o as $val) { diff --git a/src/services/Base.php b/src/services/Base.php index 5c97a49..7edb003 100644 --- a/src/services/Base.php +++ b/src/services/Base.php @@ -13,7 +13,7 @@ abstract class Base extends Component protected function getSetting(string $name): mixed { - if ($this->settings === null) { + if (! $this->settings instanceof Settings) { /** @var Settings $settings */ $settings = Plugin::getInstance()->getSettings(); $this->settings = $settings; diff --git a/src/utilities/KCUtilities.php b/src/utilities/KCUtilities.php index c060455..e156fb8 100644 --- a/src/utilities/KCUtilities.php +++ b/src/utilities/KCUtilities.php @@ -41,7 +41,7 @@ public static function id(): string * @version v1.0.0 Monday, May 23rd, 2022. * @access public static */ - public static function iconPath(): string + public static function icon(): string { return Craft::getAlias('@fostercommerce/klaviyoconnect/icon-mask.svg'); } diff --git a/src/variables/Variable.php b/src/variables/Variable.php index fa6ebf1..fd4b462 100644 --- a/src/variables/Variable.php +++ b/src/variables/Variable.php @@ -30,7 +30,7 @@ public function lists(): mixed } catch (RequestException $e) { try { $response = json_decode( - $e->getResponse()?->getBody()->getContents(), + (string) $e->getResponse()?->getBody()->getContents(), false, 512, // default JSON_THROW_ON_ERROR