1 | <?php |
||
2 | |||
3 | namespace Tests\TestModel\Instance; |
||
4 | |||
5 | use Xml\ModelBuilder; |
||
6 | use Xml\Impl\Instance\ModelTypeInstanceContext; |
||
7 | use Xml\Type\ModelTypeInstanceProviderInterface; |
||
8 | use Tests\TestModel\TestModelConstants; |
||
9 | |||
10 | class Guardian extends AnimalReference |
||
11 | { |
||
12 | public function __construct(ModelTypeInstanceContext $instanceContext) |
||
13 | { |
||
14 | parent::__construct($instanceContext); |
||
15 | } |
||
16 | |||
17 | public static function registerType(ModelBuilder $modelBuilder): void |
||
18 | { |
||
19 | $typeBuilder = $modelBuilder->defineType( |
||
20 | Guardian::class, |
||
21 | TestModelConstants::ELEMENT_NAME_GUARDIAN |
||
22 | ) |
||
23 | ->namespaceUri(TestModelConstants::MODEL_NAMESPACE) |
||
24 | ->extendsType(AnimalReference::class) |
||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||
25 | ->instanceProvider( |
||
26 | new class implements ModelTypeInstanceProviderInterface |
||
27 | { |
||
28 | public function newInstance(ModelTypeInstanceContext $instanceContext): Guardian |
||
29 | { |
||
30 | return new Guardian($instanceContext); |
||
31 | } |
||
32 | } |
||
33 | ); |
||
34 | |||
35 | $typeBuilder->build(); |
||
36 | } |
||
37 | } |
||
38 |