Skip to content

Commit

Permalink
Add description to codec interfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
alcaeus committed Jul 7, 2023
1 parent cf08982 commit 8fa0518
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Codec/Codec.php
Original file line number Diff line number Diff line change
Expand Up @@ -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<BSONType, NativeType>
Expand Down
3 changes: 3 additions & 0 deletions src/Codec/DocumentCodec.php
Original file line number Diff line number Diff line change
Expand Up @@ -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<Document, ObjectType>
*/
Expand Down
5 changes: 5 additions & 0 deletions src/Codec/KnowsCodecLibrary.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 8fa0518

Please sign in to comment.