diff --git a/CHANGELOG.md b/CHANGELOG.md index a5c14de..b6d1433 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +## 4.0.1 - 2022-05-06 + +### Fixed +- Fixed an issue where `$value` was not allowed to be `null` + ## 4.0.0 - 2022-05-03 ### Changed diff --git a/composer.json b/composer.json index 680d085..221988b 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "percipiolondon/craft-colour-swatches", "description": "Let clients choose from a predefined set of colours and utilise associated colour codes and class names in your templates.", "type": "craft-plugin", - "version": "4.0.0", + "version": "4.0.1", "keywords": [ "craft", "cms", diff --git a/src/models/ColourSwatches.php b/src/models/ColourSwatches.php index e170188..328522d 100644 --- a/src/models/ColourSwatches.php +++ b/src/models/ColourSwatches.php @@ -26,9 +26,9 @@ class ColourSwatches extends Model /** * ColourSwatches constructor. * - * @param string $value + * @param string|null $value */ - public function __construct(string $value) + public function __construct(?string $value) { if ($this->validateJson($value)) { $colorData = Json::decode($value); @@ -42,10 +42,10 @@ public function __construct(string $value) // making sure we have json data, returns boolean(true) if this is the case /** - * @param string $value + * @param string|null $value * @return bool */ - public function validateJson(string $value): bool + public function validateJson(?string $value): bool { $json = Json::decode($value); return $json && $value != $json;