Type   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 10
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
c 1
b 0
f 0
dl 0
loc 10
ccs 2
cts 2
cp 1
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A getType() 0 3 1
1
<?php
2
/*
3
 * Copyright (c) Nate Brunette.
4
 * Distributed under the MIT License (http://opensource.org/licenses/MIT)
5
 */
6
7
declare(strict_types=1);
8
9
namespace Tebru\Gson\Annotation;
10
11
use Tebru\AnnotationReader\AbstractAnnotation;
12
use Tebru\PhpType\TypeToken;
13
14
/**
15
 * Class Type
16
 *
17
 * Used to define an explicit type for a property.  Generally a type will tried to
18
 * be inferred using the value, type, type hints, return types, or default values; otherwise,
19
 * the type will be assumed to be primitive.  This annotation lets you explicitly define
20
 * a type or create a custom type that can be used by a TypeAdapter.
21
 *
22
 * @author Nate Brunette <[email protected]>
23
 *
24
 * @Annotation
25
 * @Target({"PROPERTY", "METHOD"})
26
 */
27
class Type extends AbstractAnnotation
28
{
29
    /**
30
     * Returns the php type
31
     *
32
     * @return TypeToken
33
     */
34 1
    public function getType(): TypeToken
35
    {
36 1
        return TypeToken::create($this->getValue());
37
    }
38
}
39