Type::getType()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
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