Skip to content

Commit 3bd49f2

Browse files
committed
chore: add type guard
1 parent 91ee091 commit 3bd49f2

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

marshal.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ import (
44
"github.com/trim21/go-phpserialize/internal/encoder"
55
)
66

7+
// make sure they are equal
8+
var _ Marshaler = encoder.Marshaler(nil)
9+
var _ encoder.Marshaler = Marshaler(nil)
10+
711
// Marshaler allow users to implement its own encoder.
812
// **it's return value will not be validated**, please make sure you return valid encoded bytes.
913
type Marshaler interface {

unmarshal.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ import (
1010
"github.com/trim21/go-phpserialize/internal/errors"
1111
)
1212

13+
// make sure they are equal
14+
var _ Unmarshaler = decoder.Unmarshaler(nil)
15+
var _ decoder.Unmarshaler = Unmarshaler(nil)
16+
1317
type Unmarshaler interface {
1418
UnmarshalPHP([]byte) error
1519
}

0 commit comments

Comments
 (0)