Skip to content

Commit 2c7ffb4

Browse files
committed
Add psalm template annotations for codec examples
We still exclude psalm from these examples to avoid littering the code with assertions and annotations
1 parent f9b9141 commit 2c7ffb4

File tree

6 files changed

+16
-1
lines changed

6 files changed

+16
-1
lines changed

docs/examples/codecs/handling-data-types/DateTimeCodec.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
use MongoDB\Codec\EncodeIfSupported;
88
use MongoDB\Exception\UnsupportedValueException;
99

10+
/**
11+
* @template-implements Codec<Document, DateTimeImmutable>
12+
*/
1013
final class DateTimeCodec implements Codec
1114
{
1215
use DecodeIfSupported;

docs/examples/codecs/handling-data-types/PersonCodec.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
use MongoDB\Codec\EncodeIfSupported;
77
use MongoDB\Exception\UnsupportedValueException;
88

9+
/**
10+
* @template-implements DocumentCodec<Person>
11+
*/
912
final class PersonCodec implements DocumentCodec
1013
{
1114
use DecodeIfSupported;

docs/examples/codecs/handling-documents/PersonCodec.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
use MongoDB\Codec\EncodeIfSupported;
77
use MongoDB\Exception\UnsupportedValueException;
88

9+
/**
10+
* @template-implements DocumentCodec<Person>
11+
*/
912
final class PersonCodec implements DocumentCodec
1013
{
1114
// These traits define commonly used functionality to avoid duplication

docs/examples/codecs/handling-embedded-documents/AddressCodec.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
use MongoDB\Codec\EncodeIfSupported;
77
use MongoDB\Exception\UnsupportedValueException;
88

9+
/**
10+
* @template-implements DocumentCodec<Address>
11+
*/
912
final class AddressCodec implements DocumentCodec
1013
{
1114
use DecodeIfSupported;

docs/examples/codecs/handling-embedded-documents/PersonCodec.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
use MongoDB\Codec\EncodeIfSupported;
77
use MongoDB\Exception\UnsupportedValueException;
88

9+
/**
10+
* @template-implements DocumentCodec<Person>
11+
*/
912
final class PersonCodec implements DocumentCodec
1013
{
1114
use DecodeIfSupported;

psalm.xml.dist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
>
1212
<projectFiles>
1313
<directory name="src" />
14-
<directory name="docs/examples" />
14+
<directory name="docs/examples/encryption" />
1515
<directory name="examples" />
1616
<ignoreFiles>
1717
<directory name="vendor" />

0 commit comments

Comments
 (0)