1 | <?php |
||
2 | |||
3 | declare(strict_types=1); |
||
4 | |||
5 | namespace Cycle\Annotated; |
||
6 | |||
7 | use Doctrine\Common\Annotations\Reader as DoctrineReader; |
||
8 | use Spiral\Attributes\AnnotationReader; |
||
9 | use Spiral\Attributes\AttributeReader; |
||
10 | use Spiral\Attributes\Composite\SelectiveReader; |
||
11 | use Spiral\Attributes\ReaderInterface; |
||
12 | |||
13 | final class ReaderFactory |
||
14 | { |
||
15 | 1062 | public static function create(DoctrineReader|ReaderInterface $reader = null): ReaderInterface |
|
16 | { |
||
17 | return match (true) { |
||
18 | 1062 | $reader instanceof ReaderInterface => $reader, |
|
19 | 20 | $reader instanceof DoctrineReader => new AnnotationReader($reader), |
|
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||
20 | 10 | $reader === null => new SelectiveReader([ |
|
21 | 10 | new AttributeReader(), |
|
22 | 1062 | new AnnotationReader(), |
|
23 | ]), |
||
24 | }; |
||
25 | } |
||
26 | } |
||
27 |