Skip to content

Commit

Permalink
Update phpTypecast for bool type (#291)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tigrov committed Jul 19, 2023
1 parent aa42990 commit 7c402ef
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -7,6 +7,7 @@
- Bug #287: Fix `bit` type (@Tigrov)
- Enh #289: Array parser refactoring (@Tigrov)
- Chg #288: Typecast refactoring (@Tigrov)
- Chg #291: Update phpTypecast for bool type (@Tigrov)

## 1.0.0 April 12, 2023

Expand Down
7 changes: 1 addition & 6 deletions src/ColumnSchema.php
Expand Up @@ -140,12 +140,7 @@ protected function phpTypecastValue(mixed $value): mixed
return match ($this->getType()) {
Schema::TYPE_BIT => is_string($value) ? bindec($value) : $value,

SchemaInterface::TYPE_BOOLEAN
=> match ($value) {
't' => true,
'f' => false,
default => (bool) $value,
},
SchemaInterface::TYPE_BOOLEAN => $value && $value !== 'f',

SchemaInterface::TYPE_JSON
=> json_decode((string) $value, true, 512, JSON_THROW_ON_ERROR),
Expand Down

0 comments on commit 7c402ef

Please sign in to comment.