Skip to content

Commit

Permalink
Merge branch 'v4-develop' into v4
Browse files Browse the repository at this point in the history
  • Loading branch information
michtio committed May 6, 2022
2 parents 2359673 + 49e801a commit 51d947a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
8 changes: 4 additions & 4 deletions src/models/ColourSwatches.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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;
Expand Down

0 comments on commit 51d947a

Please sign in to comment.