Skip to content

Commit

Permalink
feat: allow un/serialize for currency
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris8934 committed Jan 26, 2024
1 parent a829bd4 commit 51b70fe
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/Currency.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,17 @@ public function jsonSerialize(): string
{
return $this->code;
}

/**
* @return array<string, string>
*/
public function __serialize(): array
{
return ['code' => $this->code];
}

public function __unserialize(array $data): void
{
$this->code = (string) $data['code'];

Check failure on line 71 in src/Currency.php

View workflow job for this annotation

GitHub Actions / Build lowest version

PropertyTypeCoercion

src/Currency.php:71:23: PropertyTypeCoercion: $this->code expects 'non-empty-string', parent type 'string' provided (see https://psalm.dev/198)

Check failure on line 71 in src/Currency.php

View workflow job for this annotation

GitHub Actions / Build (8.1)

PropertyTypeCoercion

src/Currency.php:71:23: PropertyTypeCoercion: $this->code expects 'non-empty-string', parent type 'string' provided (see https://psalm.dev/198)

Check failure on line 71 in src/Currency.php

View workflow job for this annotation

GitHub Actions / Psalm

PropertyTypeCoercion

src/Currency.php:71:23: PropertyTypeCoercion: $this->code expects 'non-empty-string', parent type 'string' provided (see https://psalm.dev/198)

Check failure on line 71 in src/Currency.php

View workflow job for this annotation

GitHub Actions / Build (8.2)

PropertyTypeCoercion

src/Currency.php:71:23: PropertyTypeCoercion: $this->code expects 'non-empty-string', parent type 'string' provided (see https://psalm.dev/198)

Check failure on line 71 in src/Currency.php

View workflow job for this annotation

GitHub Actions / Build (8.3)

PropertyTypeCoercion

src/Currency.php:71:23: PropertyTypeCoercion: $this->code expects 'non-empty-string', parent type 'string' provided (see https://psalm.dev/198)
}
}

0 comments on commit 51b70fe

Please sign in to comment.