Completed
Push — develop ( 8eb671...133594 )
by Mike
19:30 queued 09:24
created

GenericTagAssembler::create()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
cc 2
nc 2
nop 1
dl 0
loc 10
rs 9.9332
c 0
b 0
f 0
ccs 0
cts 8
cp 0
crap 6
1
<?php
2
declare(strict_types=1);
3
4
/**
5
 * This file is part of phpDocumentor.
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 *
10
 * @author    Mike van Riel <[email protected]>
11
 * @copyright 2010-2018 Mike van Riel / Naenius (http://www.naenius.com)
12
 * @license   http://www.opensource.org/licenses/mit-license.php MIT
13
 * @link      http://phpdoc.org
14
 */
15
16
namespace phpDocumentor\Descriptor\Builder\Reflector\Tags;
17
18
use phpDocumentor\Descriptor\Builder\Reflector\AssemblerAbstract;
19
use phpDocumentor\Descriptor\TagDescriptor;
20
use phpDocumentor\Reflection\DocBlock\Tag;
21
use phpDocumentor\Reflection\DocBlock\Tags\BaseTag;
22
23
class GenericTagAssembler extends AssemblerAbstract
24
{
25
    /**
26
     * Creates a new Descriptor from the given Reflector.
27
     *
28
     * @param Tag $data
29
     *
30
     * @return TagDescriptor
31
     */
32
    public function create($data)
33
    {
34
        $descriptor = new TagDescriptor($data->getName());
35
36
        if ($data instanceof BaseTag) {
37
            $descriptor->setDescription($data->getDescription());
0 ignored issues
show
Bug introduced by
It seems like $data->getDescription() targeting phpDocumentor\Reflection...seTag::getDescription() can also be of type null or object<phpDocumentor\Ref...n\DocBlock\Description>; however, phpDocumentor\Descriptor...iptor::setDescription() does only seem to accept string, maybe add an additional type check?

This check looks at variables that are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
38
        }
39
40
        return $descriptor;
41
    }
42
}
43