From 8fa051843a2ebb46399597f18c8f7c5ff685c69a Mon Sep 17 00:00:00 2001 From: Andreas Braun Date: Fri, 7 Jul 2023 14:21:52 +0200 Subject: [PATCH] Add description to codec interfaces --- src/Codec/Codec.php | 3 +++ src/Codec/DocumentCodec.php | 3 +++ src/Codec/KnowsCodecLibrary.php | 5 +++++ 3 files changed, 11 insertions(+) diff --git a/src/Codec/Codec.php b/src/Codec/Codec.php index e5a498b20..a21df53e9 100644 --- a/src/Codec/Codec.php +++ b/src/Codec/Codec.php @@ -3,6 +3,9 @@ namespace MongoDB\Codec; /** + * The Codec interface allows decoding BSON data to native PHP types and back + * to BSON. + * * @psalm-template BSONType * @psalm-template NativeType * @template-extends Decoder diff --git a/src/Codec/DocumentCodec.php b/src/Codec/DocumentCodec.php index b90b661c2..7a5ab278e 100644 --- a/src/Codec/DocumentCodec.php +++ b/src/Codec/DocumentCodec.php @@ -5,6 +5,9 @@ use MongoDB\BSON\Document; /** + * The DocumentCodec interface allows decoding BSON document data to native PHP + * objects and back to BSON documents. + * * @psalm-template ObjectType of object * @template-extends Codec */ diff --git a/src/Codec/KnowsCodecLibrary.php b/src/Codec/KnowsCodecLibrary.php index 008abd96d..c03b7a6a6 100644 --- a/src/Codec/KnowsCodecLibrary.php +++ b/src/Codec/KnowsCodecLibrary.php @@ -2,6 +2,11 @@ namespace MongoDB\Codec; +/** + * This interface is used to indicate that a class is aware of the CodecLibrary + * it was added to. The library will be injected when the codec is added to the + * library. This allows codecs to recursively encode its nested values. + */ interface KnowsCodecLibrary { public function attachLibrary(CodecLibrary $library): void;