Completed
Push — master ( 3e29f4...a0257c )
by Gytis
03:40 queued 11s
created

ParamTypeSubject::fromParam()   A

Complexity

Conditions 3
Paths 1

Size

Total Lines 10
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 9
CRAP Score 3

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 3
eloc 8
nc 1
nop 3
dl 0
loc 10
ccs 9
cts 9
cp 1
crap 3
rs 10
c 1
b 0
f 0
1
<?php
2
3
namespace Gskema\TypeSniff\Inspection\Subject;
4
5
use Gskema\TypeSniff\Core\DocBlock\DocBlock;
6
use Gskema\TypeSniff\Core\DocBlock\Tag\ParamTag;
7
use Gskema\TypeSniff\Core\Func\FunctionParam;
8
9
class ParamTypeSubject extends AbstractTypeSubject
10
{
11
    /**
12
     * @param FunctionParam $param
13
     * @param ParamTag|null $tag
14
     * @param DocBlock      $docBlock
15
     *
16
     * @return static
17
     */
18 4
    public static function fromParam(FunctionParam $param, ?ParamTag $tag, DocBlock $docBlock)
19
    {
20 4
        return new static(
21 4
            $tag ? $tag->getType() : null,
22 4
            $param->getType(),
23 4
            $param->getValueType(),
24 4
            $tag ? $tag->getLine() : $param->getLine(),
25 4
            $param->getLine(),
26 4
            sprintf('parameter $%s', $param->getName()),
27 4
            $docBlock
28
        );
29
    }
30
}
31